diff options
author | Andrew Bartlett <abartlet@samba.org> | 2013-01-25 13:15:51 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2013-01-25 12:00:04 +0100 |
commit | c5db4eb9104f1a95220273ee2b0290d157053922 (patch) | |
tree | cb58b99ca03bbd7d35f0a591fac7a7e1f2d1a5b0 /source4 | |
parent | da35cd7bd230b2299f9566f4775bd98fda3024f8 (diff) | |
download | samba-c5db4eb9104f1a95220273ee2b0290d157053922.tar.gz samba-c5db4eb9104f1a95220273ee2b0290d157053922.tar.bz2 samba-c5db4eb9104f1a95220273ee2b0290d157053922.zip |
bug9598: s4-process_single: Use pid,fd as cluster_id in process_single just like process_prefork
This avoids two different process single servers (say LDAP and the RPC server) sharing the same
server id.
Fix-bug: https://bugzilla.samba.org/show_bug.cgi?id=9598
Reported-by: Matthieu Patou <mat@matws.net>
Reviewed-by: Matthieu Patou <mat@matws.net>
Signed-off-by: Andrew Bartlett <abartlett@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Jan 25 12:00:04 CET 2013 on sn-devel-104
Diffstat (limited to 'source4')
-rw-r--r-- | source4/smbd/process_single.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source4/smbd/process_single.c b/source4/smbd/process_single.c index 742eac1824..ff67750034 100644 --- a/source4/smbd/process_single.c +++ b/source4/smbd/process_single.c @@ -49,6 +49,7 @@ static void single_accept_connection(struct tevent_context *ev, { NTSTATUS status; struct socket_context *connected_socket; + pid_t pid = getpid(); /* accept an incoming connection. */ status = socket_accept(listen_socket, &connected_socket); @@ -71,10 +72,14 @@ static void single_accept_connection(struct tevent_context *ev, talloc_steal(private_data, connected_socket); - /* The cluster_id(0, fd) cannot collide with the incrementing - * task below, as the first component is 0, not 1 */ + /* + * We use the PID so we cannot collide in with cluster ids + * generated in other single mode tasks, and, and won't + * collide with PIDs from process model standard because a the + * combination of pid/fd should be unique system-wide + */ new_conn(ev, lp_ctx, connected_socket, - cluster_id(0, socket_get_fd(connected_socket)), private_data); + cluster_id(pid, socket_get_fd(connected_socket)), private_data); } /* |