The branch, v4-0-test has been updated via 07d6347 Fix bug in old create temp SMB request. Only use VFS functions. via 389face Bug 9807 - wbinfo: fix segfault in wbinfo_pam_logon via 376c36b wafsamba: display the default value in help for SAMBA3_ADD_OPTION via 35000ea s3:wscript: change --with-dmapi to default=auto to match the autoconf build from 9bfcb9f Ensure we test the dirsort module in make test.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test - Log ----------------------------------------------------------------- commit 07d6347ee3ad546842c7a8704bc79710f84be41a Author: Jeremy Allison <j...@samba.org> Date: Wed Apr 17 14:42:20 2013 -0700 Fix bug in old create temp SMB request. Only use VFS functions. Signed-off-by: Jeremy Allison <j...@samba.org> Fix bug #9811 - Old DOS SMB CTEMP request uses a non-VFS function to access the filesystem. Autobuild-User(v4-0-test): Karolin Seeger <ksee...@samba.org> Autobuild-Date(v4-0-test): Mon Apr 22 11:28:04 CEST 2013 on sn-devel-104 commit 389faceaa365d314ec49c9629b835d0418e6d222 Author: David Disseldorp <dd...@samba.org> Date: Wed Apr 17 10:39:12 2013 -0700 Bug 9807 - wbinfo: fix segfault in wbinfo_pam_logon wbinfo_pam_logon() incorrectly assumes that wbcLogonUser() always returns an allocated wbcAuthErrorInfo struct on failure. Signed-off-by: David Disseldorp <dd...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Wed Apr 17 21:29:29 CEST 2013 on sn-devel-104 commit 376c36b61d2984b52cd7aaa5ef1513fe5464bb32 Author: Stefan Metzmacher <me...@samba.org> Date: Fri Mar 22 09:37:09 2013 +0100 wafsamba: display the default value in help for SAMBA3_ADD_OPTION Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Volker Lendecke <v...@samba.org> (cherry picked from commit 81cc940c994424d351ac282383df4d1a57d6b614) Fix bug #9804 - wafsamba: display the default value in help for SAMBA3_ADD_OPTION. commit 35000eabcd6dd170ad6ac0ddb7424979b4cfc76a Author: Stefan Metzmacher <me...@samba.org> Date: Fri Mar 22 09:39:42 2013 +0100 s3:wscript: change --with-dmapi to default=auto to match the autoconf build Signed-off-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Volker Lendecke <v...@samba.org> Autobuild-User(master): Volker Lendecke <v...@samba.org> Autobuild-Date(master): Wed Apr 3 11:45:12 CEST 2013 on sn-devel-104 (cherry picked from commit 79038397aa8786c92401312973185c7b14e8fa66) Fix bug #9803 - change --with-dmapi to default=auto to match the autoconf build. ----------------------------------------------------------------------- Summary of changes: buildtools/wafsamba/samba3.py | 11 ++++- nsswitch/wbinfo.c | 7 +-- source3/smbd/reply.c | 117 ++++++++++++++++++++++------------------ source3/wscript | 2 +- 4 files changed, 78 insertions(+), 59 deletions(-) Changeset truncated at 500 lines: diff --git a/buildtools/wafsamba/samba3.py b/buildtools/wafsamba/samba3.py index 476d8fc..fd063ad 100644 --- a/buildtools/wafsamba/samba3.py +++ b/buildtools/wafsamba/samba3.py @@ -8,8 +8,17 @@ from samba_autoconf import library_flags def SAMBA3_ADD_OPTION(opt, option, help=(), dest=None, default=True, with_name="with", without_name="without"): + if default is None: + default_str="auto" + elif default == True: + default_str="yes" + elif default == False: + default_str="no" + else: + default_str=str(default) + if help == (): - help = ("Build with %s support" % option) + help = ("Build with %s support (default=%s)" % (option, default_str)) if dest is None: dest = "with_%s" % option.replace('-', '_') diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c index aee4004..762382c 100644 --- a/nsswitch/wbinfo.c +++ b/nsswitch/wbinfo.c @@ -1736,7 +1736,7 @@ static bool wbinfo_pam_logon(char *username) { wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE; struct wbcLogonUserParams params; - struct wbcAuthErrorInfo *error; + struct wbcAuthErrorInfo *error = NULL; char *s = NULL; char *p = NULL; TALLOC_CTX *frame = talloc_tos(); @@ -1787,16 +1787,15 @@ static bool wbinfo_pam_logon(char *username) d_printf("plaintext password authentication %s\n", WBC_ERROR_IS_OK(wbc_status) ? "succeeded" : "failed"); - if (!WBC_ERROR_IS_OK(wbc_status)) { + if (!WBC_ERROR_IS_OK(wbc_status) && (error != NULL)) { d_fprintf(stderr, "error code was %s (0x%x)\nerror message was: %s\n", error->nt_string, (int)error->nt_status, error->display_string); wbcFreeMemory(error); - return false; } - return true; + return WBC_ERROR_IS_OK(wbc_status); } /* Save creds with winbind */ diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index c815a5a..3b2a493 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -2421,13 +2421,14 @@ void reply_ctemp(struct smb_request *req) { connection_struct *conn = req->conn; struct smb_filename *smb_fname = NULL; + char *wire_name = NULL; char *fname = NULL; uint32 fattr; files_struct *fsp; int oplock_request; - int tmpfd; char *s; NTSTATUS status; + int i; TALLOC_CTX *ctx = talloc_tos(); START_PROFILE(SMBctemp); @@ -2440,77 +2441,86 @@ void reply_ctemp(struct smb_request *req) fattr = SVAL(req->vwv+0, 0); oplock_request = CORE_OPLOCK_REQUEST(req->inbuf); - srvstr_get_path_req(ctx, req, &fname, (const char *)req->buf+1, + srvstr_get_path_req(ctx, req, &wire_name, (const char *)req->buf+1, STR_TERMINATE, &status); if (!NT_STATUS_IS_OK(status)) { reply_nterror(req, status); goto out; } - if (*fname) { - fname = talloc_asprintf(ctx, - "%s/TMXXXXXX", - fname); - } else { - fname = talloc_strdup(ctx, "TMXXXXXX"); - } - if (!fname) { - reply_nterror(req, NT_STATUS_NO_MEMORY); - goto out; - } + for (i = 0; i < 10; i++) { + if (*wire_name) { + fname = talloc_asprintf(ctx, + "%s/TMP%s", + wire_name, + generate_random_str_list(ctx, 5, "0123456789")); + } else { + fname = talloc_asprintf(ctx, + "TMP%s", + generate_random_str_list(ctx, 5, "0123456789")); + } - status = filename_convert(ctx, conn, + if (!fname) { + reply_nterror(req, NT_STATUS_NO_MEMORY); + goto out; + } + + status = filename_convert(ctx, conn, req->flags2 & FLAGS2_DFS_PATHNAMES, fname, 0, NULL, &smb_fname); - if (!NT_STATUS_IS_OK(status)) { - if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) { - reply_botherror(req, NT_STATUS_PATH_NOT_COVERED, + if (!NT_STATUS_IS_OK(status)) { + if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) { + reply_botherror(req, NT_STATUS_PATH_NOT_COVERED, ERRSRV, ERRbadpath); + goto out; + } + reply_nterror(req, status); goto out; } - reply_nterror(req, status); - goto out; - } - - tmpfd = mkstemp(smb_fname->base_name); - if (tmpfd == -1) { - reply_nterror(req, map_nt_error_from_unix(errno)); - goto out; - } - SMB_VFS_STAT(conn, smb_fname); - - /* We should fail if file does not exist. */ - status = SMB_VFS_CREATE_FILE( - conn, /* conn */ - req, /* req */ - 0, /* root_dir_fid */ - smb_fname, /* fname */ - FILE_GENERIC_READ | FILE_GENERIC_WRITE, /* access_mask */ - FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */ - FILE_OPEN, /* create_disposition*/ - 0, /* create_options */ - fattr, /* file_attributes */ - oplock_request, /* oplock_request */ - 0, /* allocation_size */ - 0, /* private_flags */ - NULL, /* sd */ - NULL, /* ea_list */ - &fsp, /* result */ - NULL); /* pinfo */ - - /* close fd from mkstemp() */ - close(tmpfd); + /* Create the file. */ + status = SMB_VFS_CREATE_FILE( + conn, /* conn */ + req, /* req */ + 0, /* root_dir_fid */ + smb_fname, /* fname */ + FILE_GENERIC_READ | FILE_GENERIC_WRITE, /* access_mask */ + FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */ + FILE_CREATE, /* create_disposition*/ + 0, /* create_options */ + fattr, /* file_attributes */ + oplock_request, /* oplock_request */ + 0, /* allocation_size */ + 0, /* private_flags */ + NULL, /* sd */ + NULL, /* ea_list */ + &fsp, /* result */ + NULL); /* pinfo */ + + if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) { + TALLOC_FREE(fname); + TALLOC_FREE(smb_fname); + continue; + } - if (!NT_STATUS_IS_OK(status)) { - if (open_was_deferred(req->sconn, req->mid)) { - /* We have re-scheduled this call. */ + if (!NT_STATUS_IS_OK(status)) { + if (open_was_deferred(req->sconn, req->mid)) { + /* We have re-scheduled this call. */ + goto out; + } + reply_openerror(req, status); goto out; } - reply_openerror(req, status); + + break; + } + + if (i == 10) { + /* Collision after 10 times... */ + reply_nterror(req, status); goto out; } @@ -2551,6 +2561,7 @@ void reply_ctemp(struct smb_request *req) fsp->fh->fd, (unsigned int)smb_fname->st.st_ex_mode)); out: TALLOC_FREE(smb_fname); + TALLOC_FREE(wire_name); END_PROFILE(SMBctemp); return; } diff --git a/source3/wscript b/source3/wscript index 7f83fef..e1672e0 100644 --- a/source3/wscript +++ b/source3/wscript @@ -41,7 +41,7 @@ def set_options(opt): opt.SAMBA3_ADD_OPTION('syslog') opt.SAMBA3_ADD_OPTION('automount') opt.SAMBA3_ADD_OPTION('aio-support') - opt.SAMBA3_ADD_OPTION('dmapi', default=False, help="build with DMAPI support") + opt.SAMBA3_ADD_OPTION('dmapi', default=None) # None means autodetection opt.SAMBA3_ADD_OPTION('fam', default=None) # None means autodetection opt.SAMBA3_ADD_OPTION('profiling-data', default=False) -- Samba Shared Repository