svn commit: samba r24389 - in branches/SAMBA_3_2_0: examples/libsmbclient source/libsmb

derrell at samba.org derrell at samba.org
Tue Aug 14 03:02:53 GMT 2007


Author: derrell
Date: 2007-08-14 03:02:52 +0000 (Tue, 14 Aug 2007)
New Revision: 24389

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24389

Log:
- ACL retrieval provided incomplete information because the buffer pointer was
 incremented too far in some circumstances.  In these cases, only the first
 of multiple concatenated strings would be seen.

- Working on bug 4649 pertaining to delete an ACL, this fixes the reported
 crash.  It appears to have been an incomplete switchover from malloc to
 talloc, as the memory was still being freed with SAFE_FREE.

 Deleting ACLs still doesn't work.  Although a valid request is sent to the
 server and a SUCCESS response is returned, the method that's used in
 libsmbclient for deleting ACLs seems to be incorrect.  In looking at the
 samba4 torture tests, it appears that we should be turning on the INHERIT
 flag if we want to delete the ACL.  (I could use some assistance on the
 proper flags to send, from anyone familiar with this stuff.)

- Apply patch from SATOH Fumiyasu to fix bug 4750.  smbc_telldir_ctx() was not
  returning a value useful to smbc_lseekdir_ctx().

Derrell

Modified:
   branches/SAMBA_3_2_0/examples/libsmbclient/Makefile
   branches/SAMBA_3_2_0/source/libsmb/libsmbclient.c


Changeset:
Modified: branches/SAMBA_3_2_0/examples/libsmbclient/Makefile
===================================================================
--- branches/SAMBA_3_2_0/examples/libsmbclient/Makefile	2007-08-14 03:02:34 UTC (rev 24388)
+++ branches/SAMBA_3_2_0/examples/libsmbclient/Makefile	2007-08-14 03:02:52 UTC (rev 24389)
@@ -10,12 +10,12 @@
 DEFS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 CFLAGS = -O0 -g -I$(SAMBA_INCL) $(EXTLIB_INCL) $(DEFS)
 
-LDFLAGS = -L/usr/local/samba/lib
+LDFLAGS = -L/usr/local/samba/lib \
+	  -lldap -lkrb5 -lgssapi_krb5
 #LIBSMBCLIENT = /usr/local/samba/lib/libsmbclient.so
 LIBSMBCLIENT = ../../source/bin/libsmbclient.a -ldl -lresolv
 
 TESTS=	testsmbc \
-	tree \
 	testacl \
 	testacl2 \
 	testbrowse \
@@ -26,6 +26,8 @@
 	testutime \
 	testread
 
+#	tree \
+
 all:	$(TESTS) smbsh
 
 testsmbc: testsmbc.o 
@@ -38,11 +40,11 @@
 
 testacl: testacl.o
 	@echo Linking testacl
-	$(CC) `gtk-config --cflags` $(CFLAGS) $(LDFLAGS) -o $@ $< `gtk-config --libs` $(LIBSMBCLIENT) -lpopt
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBSMBCLIENT) -lpopt
 
 testacl2: testacl2.o
 	@echo Linking testacl2
-	$(CC) `gtk-config --cflags` $(CFLAGS) $(LDFLAGS) -o $@ $< `gtk-config --libs` $(LIBSMBCLIENT) -lpopt
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBSMBCLIENT) -lpopt
 
 testbrowse: testbrowse.o
 	@echo Linking testbrowse

Modified: branches/SAMBA_3_2_0/source/libsmb/libsmbclient.c
===================================================================
--- branches/SAMBA_3_2_0/source/libsmb/libsmbclient.c	2007-08-14 03:02:34 UTC (rev 24388)
+++ branches/SAMBA_3_2_0/source/libsmb/libsmbclient.c	2007-08-14 03:02:52 UTC (rev 24389)
@@ -3444,8 +3444,6 @@
 smbc_telldir_ctx(SMBCCTX *context,
                  SMBCFILE *dir)
 {
-	off_t ret_val; /* Squash warnings about cast */
-
 	if (!context || !context->internal ||
 	    !context->internal->_initialized) {
 
@@ -3468,12 +3466,16 @@
 
 	}
 
+        /* See if we're already at the end. */
+        if (dir->dir_next == NULL) {
+                /* We are. */
+                return -1;
+        }
+
 	/*
 	 * We return the pointer here as the offset
 	 */
-	ret_val = (off_t)(long)dir->dir_next;
-	return ret_val;
-
+        return (off_t)(long)dir->dir_next->dirent;
 }
 
 /*
@@ -4536,6 +4538,7 @@
                         buf += n;
                         n_used += n;
                         bufsize -= n;
+                        n = 0;
                 }
 
                 if (! exclude_nt_owner) {
@@ -4583,6 +4586,7 @@
                         buf += n;
                         n_used += n;
                         bufsize -= n;
+                        n = 0;
                 }
 
                 if (! exclude_nt_group) {
@@ -4628,6 +4632,7 @@
                         buf += n;
                         n_used += n;
                         bufsize -= n;
+                        n = 0;
                 }
 
                 if (! exclude_nt_acl) {
@@ -4718,6 +4723,7 @@
                                 buf += n;
                                 n_used += n;
                                 bufsize -= n;
+                                n = 0;
                         }
                 }
 
@@ -4792,6 +4798,7 @@
                         buf += n;
                         n_used += n;
                         bufsize -= n;
+                        n = 0;
                 }
 
                 if (! exclude_dos_size) {
@@ -4836,6 +4843,7 @@
                         buf += n;
                         n_used += n;
                         bufsize -= n;
+                        n = 0;
                 }
 
                 if (! exclude_dos_create_time &&
@@ -4878,6 +4886,7 @@
                         buf += n;
                         n_used += n;
                         bufsize -= n;
+                        n = 0;
                 }
 
                 if (! exclude_dos_access_time) {
@@ -4919,6 +4928,7 @@
                         buf += n;
                         n_used += n;
                         bufsize -= n;
+                        n = 0;
                 }
 
                 if (! exclude_dos_write_time) {
@@ -4960,6 +4970,7 @@
                         buf += n;
                         n_used += n;
                         bufsize -= n;
+                        n = 0;
                 }
 
                 if (! exclude_dos_change_time) {
@@ -5001,6 +5012,7 @@
                         buf += n;
                         n_used += n;
                         bufsize -= n;
+                        n = 0;
                 }
 
                 if (! exclude_dos_inode) {
@@ -5045,6 +5057,7 @@
                         buf += n;
                         n_used += n;
                         bufsize -= n;
+                        n = 0;
                 }
 
                 /* Restore name pointer to its original value */
@@ -5139,8 +5152,8 @@
 	switch (mode) {
 	case SMBC_XATTR_MODE_REMOVE_ALL:
                 old->dacl->num_aces = 0;
-                SAFE_FREE(old->dacl->aces);
-                SAFE_FREE(old->dacl);
+                prs_mem_free(old->dacl->aces);
+                prs_mem_free(&old->dacl);
                 old->dacl = NULL;
                 dacl = old->dacl;
                 break;
@@ -5159,8 +5172,8 @@
 					}
 					old->dacl->num_aces--;
 					if (old->dacl->num_aces == 0) {
-						SAFE_FREE(old->dacl->aces);
-						SAFE_FREE(old->dacl);
+                                                prs_mem_free(&old->dacl->aces);
+                                                prs_mem_free(&old->dacl);
 						old->dacl = NULL;
 					}
 					found = True;



More information about the samba-cvs mailing list