The branch, v3-5-test has been updated via abcbca1... s3: Simplify the code a bit: Catch (len==0) early via 6e478ce... Fix bug 7081 - vfs_expand_msdfs doesn't work correctly (with fix identified) from da2297f... s3/vfs_scannedonly: AIX doesn't have MSG_DONTWAIT (cherry picked from commit e95e3270d1f3fece7292359d276ce45913a699ac)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test - Log ----------------------------------------------------------------- commit abcbca12316fadea0db1fa8bc1522789926e8dba Author: Volker Lendecke <v...@samba.org> Date: Wed Feb 3 07:37:29 2010 +0100 s3: Simplify the code a bit: Catch (len==0) early Part of a fix for bug #7081. commit 6e478ce2483a4376566693d16869d88f0d429951 Author: Jeremy Allison <j...@samba.org> Date: Tue Feb 2 16:43:41 2010 -0800 Fix bug 7081 - vfs_expand_msdfs doesn't work correctly (with fix identified) Fix inspired by idea from Eric Horst <er...@cac.washington.edu>. Jeremy. (cherry picked from commit de24209f0a745ada4220a1751c4ed88ae6eea575) ----------------------------------------------------------------------- Summary of changes: source3/modules/vfs_expand_msdfs.c | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/modules/vfs_expand_msdfs.c b/source3/modules/vfs_expand_msdfs.c index 9edd0f6..0772215 100644 --- a/source3/modules/vfs_expand_msdfs.c +++ b/source3/modules/vfs_expand_msdfs.c @@ -173,20 +173,26 @@ static int expand_msdfs_readlink(struct vfs_handle_struct *handle, TALLOC_CTX *ctx = talloc_tos(); int result; char *target = TALLOC_ARRAY(ctx, char, PATH_MAX+1); + size_t len; if (!target) { errno = ENOMEM; return -1; } + if (bufsiz == 0) { + errno = EINVAL; + return -1; + } + result = SMB_VFS_NEXT_READLINK(handle, path, target, PATH_MAX); - if (result < 0) + if (result <= 0) return result; target[result] = '\0'; - if ((strncmp(target, "msdfs:", strlen("msdfs:")) == 0) && + if ((strncmp(target, "msdfs:", 6) == 0) && (strchr_m(target, '@') != NULL)) { target = expand_msdfs_target(ctx, handle->conn, target); if (!target) { @@ -195,8 +201,12 @@ static int expand_msdfs_readlink(struct vfs_handle_struct *handle, } } - safe_strcpy(buf, target, bufsiz-1); - return strlen(buf); + len = MIN(bufsiz, strlen(target)); + + memcpy(buf, target, len); + + TALLOC_FREE(target); + return len; } static struct vfs_fn_pointers vfs_expand_msdfs_fns = { -- Samba Shared Repository