diff options
author | Volker Lendecke <vlendec@samba.org> | 2005-08-24 13:15:01 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:34:32 -0500 |
commit | 11f4803d002bf5a4bba24103d6c472ea638e196e (patch) | |
tree | c3516a362d4e07aa6c155483cab7009bb2d6d78e /source4/torture/torture.c | |
parent | ca71549d5af608a280645f69016749ae9da89747 (diff) | |
download | samba-11f4803d002bf5a4bba24103d6c472ea638e196e.tar.gz samba-11f4803d002bf5a4bba24103d6c472ea638e196e.tar.bz2 samba-11f4803d002bf5a4bba24103d6c472ea638e196e.zip |
r9584: Fix a race condition in Samba 3. If two files are opened simultaneously with
NTCREATEX_DISP_CREATE (create if not exists, else fail) they might end up with
two or more times NT_STATUS_OK as EEXIST is not correctly handled.
Jeremy, please look closely at this. You can easily verify this by adding a
smb_msleep(100) to the top of open_file_ntcreate and run the new samba4
torture test. It does also happen without the msleep, but not as reliably.
Thanks,
Volker
(This used to be commit c803d4c9a588e39a90ddfe900be9b9de1a861f82)
Diffstat (limited to 'source4/torture/torture.c')
-rw-r--r-- | source4/torture/torture.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/source4/torture/torture.c b/source4/torture/torture.c index 436c7281bd..dde3c7bd5b 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -76,16 +76,17 @@ failed: return NULL; } -BOOL torture_open_connection_share(struct smbcli_state **c, +BOOL torture_open_connection_share(TALLOC_CTX *mem_ctx, + struct smbcli_state **c, const char *hostname, - const char *sharename) + const char *sharename, + struct event_context *ev) { NTSTATUS status; - status = smbcli_full_connection(NULL, - c, hostname, + status = smbcli_full_connection(mem_ctx, c, hostname, sharename, NULL, - cmdline_credentials, NULL); + cmdline_credentials, ev); if (!NT_STATUS_IS_OK(status)) { printf("Failed to open connection - %s\n", nt_errstr(status)); return False; @@ -102,7 +103,7 @@ BOOL torture_open_connection(struct smbcli_state **c) const char *host = lp_parm_string(-1, "torture", "host"); const char *share = lp_parm_string(-1, "torture", "share"); - return torture_open_connection_share(c, host, share); + return torture_open_connection_share(NULL, c, host, share, NULL); } @@ -2107,9 +2108,11 @@ double torture_create_procs(BOOL (*fn)(struct smbcli_state *, int), BOOL *result while (1) { if (hostname) { - if (torture_open_connection_share(¤t_cli, + if (torture_open_connection_share(NULL, + ¤t_cli, hostname, - sharename)) { + sharename, + NULL)) { break; } } else if (torture_open_connection(¤t_cli)) { |