[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Wed Oct 27 16:03:01 MDT 2010
The branch, master has been updated
via c6d7e6a Fix for bug 7755 - SMBC_getdents_ctx() ignores struct alignment rules
from 6486733 ndr: Make sure ndr_dns.c has no lines wider than 80 chars
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit c6d7e6ad08a94709264d05b9cc8f266f07bc6851
Author: Jeremy Allison <jra at samba.org>
Date: Wed Oct 27 14:17:46 2010 -0700
Fix for bug 7755 - SMBC_getdents_ctx() ignores struct alignment rules
Based on a fix from Sven Neumann <s.neumann at raumfeld.com>.
Autobuild-User: Jeremy Allison <jra at samba.org>
Autobuild-Date: Wed Oct 27 22:02:11 UTC 2010 on sn-devel-104
-----------------------------------------------------------------------
Summary of changes:
source3/libsmb/libsmb_dir.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c
index 7661ecf..9398f92 100644
--- a/source3/libsmb/libsmb_dir.c
+++ b/source3/libsmb/libsmb_dir.c
@@ -1050,6 +1050,7 @@ SMBC_getdents_ctx(SMBCCTX *context,
while ((dirlist = dir->dir_next)) {
struct smbc_dirent *dirent;
+ struct smbc_dirent *currentEntry = (struct smbc_dirent *)ndir;
if (!dirlist->dirent) {
@@ -1086,17 +1087,23 @@ SMBC_getdents_ctx(SMBCCTX *context,
}
- memcpy(ndir, dirent, reqd); /* Copy the data in ... */
+ memcpy(currentEntry, dirent, reqd); /* Copy the data in ... */
- ((struct smbc_dirent *)ndir)->comment =
- (char *)(&((struct smbc_dirent *)ndir)->name +
- dirent->namelen +
- 1);
+ currentEntry->comment = ¤tEntry->name[0] +
+ dirent->namelen + 1;
ndir += reqd;
-
rem -= reqd;
+ /* Try and align the struct for the next entry
+ on a valid pointer boundary by appending zeros */
+ while((rem > 0) && ((unsigned long long)ndir & (sizeof(void*) - 1))) {
+ *ndir = '\0';
+ rem--;
+ ndir++;
+ currentEntry->dirlen++;
+ }
+
dir->dir_next = dirlist = dirlist -> next;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list