summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorDerrell Lipman <derrell.lipman@unwireduniverse.com>2008-01-13 17:10:06 -0500
committerDerrell Lipman <derrell.lipman@unwireduniverse.com>2008-01-13 17:10:06 -0500
commit011e89c85868ec8f16e475a560a0e5bd41995920 (patch)
treeaf09d7ba6e11444a2536fab25a7be082ab6b66f9 /source3
parentd49ba81210970e44cc1c7179a959f74351684fdf (diff)
downloadsamba-011e89c85868ec8f16e475a560a0e5bd41995920.tar.gz
samba-011e89c85868ec8f16e475a560a0e5bd41995920.tar.bz2
samba-011e89c85868ec8f16e475a560a0e5bd41995920.zip
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 (This used to be commit 913c335d21c503d32b35bf65da7b2bddf0473875)
Diffstat (limited to 'source3')
-rw-r--r--source3/include/libsmbclient.h2
-rw-r--r--source3/libsmb/libsmbclient.c11
2 files changed, 8 insertions, 5 deletions
diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h
index 9175b33d60..07242f7956 100644
--- a/source3/include/libsmbclient.h
+++ b/source3/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/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c
index da8f1e332b..179f6eba5d 100644
--- a/source3/libsmb/libsmbclient.c
+++ b/source3/libsmb/libsmbclient.c
@@ -6241,6 +6241,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"
@@ -6284,22 +6285,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;
}