[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-1397-g4ff2101

Derrell Lipman derrell.lipman at unwireduniverse.com
Wed Jan 16 02:31:58 GMT 2008


The branch, v3-2-test has been updated
       via  4ff2101c69a0cfcfdc5f775493cb6e88c57e4bbe (commit)
       via  f963d57096184dd9381fcc5f175150d27460ea7a (commit)
       via  3a61e663e51fe620225691bc8673bf8800a36f47 (commit)
       via  913c335d21c503d32b35bf65da7b2bddf0473875 (commit)
       via  2f432842442859f98ecd263464ce02821ab10fca (commit)
      from  874425c8f680fb2f737b46a3177b239e69302af5 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 4ff2101c69a0cfcfdc5f775493cb6e88c57e4bbe
Merge: f963d57096184dd9381fcc5f175150d27460ea7a 874425c8f680fb2f737b46a3177b239e69302af5
Author: Derrell Lipman <derrell.lipman at unwireduniverse.com>
Date:   Wed Jan 16 02:30:21 2008 +0000

    Merge branch 'v3-2-test' of git://git.samba.org/samba into v3-2-test

commit f963d57096184dd9381fcc5f175150d27460ea7a
Merge: 3a61e663e51fe620225691bc8673bf8800a36f47 5467db388355a4769e48fed7eb80920d1820f727
Author: Derrell Lipman <derrell.lipman at unwireduniverse.com>
Date:   Wed Jan 16 00:45:06 2008 +0000

    Merge branch 'v3-2-test' of git://git.samba.org/samba into v3-2-test

commit 3a61e663e51fe620225691bc8673bf8800a36f47
Merge: 913c335d21c503d32b35bf65da7b2bddf0473875 9a4b6fd3e21f54a0ff83f1fd0d0d5331a2cfdd0a
Author: Derrell Lipman <derrell.lipman at unwireduniverse.com>
Date:   Tue Jan 15 13:58:47 2008 +0000

    Merge branch 'v3-2-test' of git://git.samba.org/samba into v3-2-test

commit 913c335d21c503d32b35bf65da7b2bddf0473875
Author: Derrell Lipman <derrell.lipman at unwireduniverse.com>
Date:   Sun Jan 13 17:10:06 2008 -0500

    Fix smbc_listxattr() and friends (bug #5189)
    
    When the capability of using full names for DOS attributes was added, a bug
    was introduced which caused the wrong number of bytes to be returned.  This
    patch to smbc_listxattr_ctx() fixes the problem.
    
    Thanks to Jack Schmidt for this patch.
    
    Derrell

commit 2f432842442859f98ecd263464ce02821ab10fca
Author: Derrell Lipman <derrell.lipman at unwireduniverse.com>
Date:   Sun Jan 13 12:07:18 2008 -0500

    Fix compile and linking errors since last this code was tested

-----------------------------------------------------------------------

Summary of changes:
 examples/libsmbclient/Makefile             |    2 +-
 examples/libsmbclient/smbwrapper/Makefile  |    2 +-
 examples/libsmbclient/smbwrapper/wrapper.c |    1 +
 examples/libsmbclient/testacl.c            |   27 ++++++++++++++++++++++++++-
 source/include/libsmbclient.h              |    2 +-
 source/libsmb/libsmbclient.c               |   11 +++++++----
 6 files changed, 37 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/examples/libsmbclient/Makefile b/examples/libsmbclient/Makefile
index 6500707..26b8057 100644
--- a/examples/libsmbclient/Makefile
+++ b/examples/libsmbclient/Makefile
@@ -13,7 +13,7 @@ CFLAGS = -O0 -g -I$(SAMBA_INCL) $(EXTLIB_INCL) $(DEFS)
 LDFLAGS = -L/usr/local/samba/lib \
 	  -lldap -lkrb5 -lgssapi_krb5
 #LIBSMBCLIENT = /usr/local/samba/lib/libsmbclient.so
-LIBSMBCLIENT = -lsmbclient -ldl -lresolv
+LIBSMBCLIENT = -lwbclient -lsmbclient -ldl -lresolv
 
 TESTS=	testsmbc \
 	testacl \
diff --git a/examples/libsmbclient/smbwrapper/Makefile b/examples/libsmbclient/smbwrapper/Makefile
index c94ef8f..7264353 100644
--- a/examples/libsmbclient/smbwrapper/Makefile
+++ b/examples/libsmbclient/smbwrapper/Makefile
@@ -1,4 +1,4 @@
-LIBS = -lsmbclient -ldl
+LIBS = -lwbclient -lsmbclient -ldl
 DEFS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 
 CFLAGS = -I$(SAMBA_INCL) $(EXTLIB_INCL)
diff --git a/examples/libsmbclient/smbwrapper/wrapper.c b/examples/libsmbclient/smbwrapper/wrapper.c
index 30f9037..958e006 100644
--- a/examples/libsmbclient/smbwrapper/wrapper.c
+++ b/examples/libsmbclient/smbwrapper/wrapper.c
@@ -61,6 +61,7 @@
 #include <dirent.h>
 #include <signal.h>
 #include <stdarg.h>
+#include <string.h>
 #ifdef __USE_GNU
 # define SMBW_USE_GNU
 #endif
diff --git a/examples/libsmbclient/testacl.c b/examples/libsmbclient/testacl.c
index 4d327b3..51cc90f 100644
--- a/examples/libsmbclient/testacl.c
+++ b/examples/libsmbclient/testacl.c
@@ -7,6 +7,7 @@
 
 enum acl_mode
 {
+    SMB_ACL_LIST,
     SMB_ACL_GET,
     SMB_ACL_SET,
     SMB_ACL_DELETE,
@@ -24,7 +25,7 @@ int main(int argc, const char *argv[])
     int debug = 0;
     int numeric = 0;
     int full_time_names = 0;
-    enum acl_mode mode = SMB_ACL_GET;
+    enum acl_mode mode = SMB_ACL_LIST;
     static char *the_acl = NULL;
     int ret;
     char *p;
@@ -149,6 +150,30 @@ int main(int argc, const char *argv[])
     
     switch(mode)
     {
+    case SMB_ACL_LIST:
+        ret = smbc_listxattr(path, value, sizeof(value)-2);
+        if (ret < 0)
+        {
+            printf("Could not get attribute list for [%s] %d: %s\n",
+                   path, errno, strerror(errno));
+            return 1;
+        }
+
+        /*
+         * The list of attributes has a series of null-terminated strings.
+         * The list of strings terminates with an extra null byte, thus two in
+         * a row.  Ensure that our buffer, which is conceivably shorter than
+         * the list of attributes, actually ends with two null bytes in a row.
+         */
+        value[sizeof(value) - 2] = '\0';
+        value[sizeof(value) - 1] = '\0';
+        printf("Supported attributes:\n");
+        for (p = value; *p; p += strlen(p) + 1)
+        {
+            printf("\t%s\n", p);
+        }
+        break;
+
     case SMB_ACL_GET:
         if (the_acl == NULL)
         {
diff --git a/source/include/libsmbclient.h b/source/include/libsmbclient.h
index 9175b33..07242f7 100644
--- a/source/include/libsmbclient.h
+++ b/source/include/libsmbclient.h
@@ -1961,7 +1961,7 @@ int smbc_fremovexattr(int fd,
  *                            extended attributes
  *
  * @note            This function always returns all attribute names supported
- *                  by NT file systems, regardless of wether the referenced
+ *                  by NT file systems, regardless of whether the referenced
  *                  file system supports extended attributes (e.g. a Windows
  *                  2000 machine supports extended attributes if NTFS is used,
  *                  but not if FAT is used, and Windows 98 doesn't support
diff --git a/source/libsmb/libsmbclient.c b/source/libsmb/libsmbclient.c
index f266c16..fb04d14 100644
--- a/source/libsmb/libsmbclient.c
+++ b/source/libsmb/libsmbclient.c
@@ -6279,6 +6279,7 @@ smbc_listxattr_ctx(SMBCCTX *context,
          * the complete set of attribute names, always, rather than only those
          * attribute names which actually exist for a file.  Hmmm...
          */
+        size_t retsize;
         const char supported_old[] =
                 "system.*\0"
                 "system.*+\0"
@@ -6322,22 +6323,24 @@ smbc_listxattr_ctx(SMBCCTX *context,
 
         if (context->internal->_full_time_names) {
                 supported = supported_new;
+                retsize = sizeof(supported_new);
         } else {
                 supported = supported_old;
+                retsize = sizeof(supported_old);
         }
 
         if (size == 0) {
-                return sizeof(supported);
+                return retsize;
         }
 
-        if (sizeof(supported) > size) {
+        if (retsize > size) {
                 errno = ERANGE;
                 return -1;
         }
 
         /* this can't be strcpy() because there are embedded null characters */
-        memcpy(list, supported, sizeof(supported));
-        return sizeof(supported);
+        memcpy(list, supported, retsize);
+        return retsize;
 }
 
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list