diff options
author | Andrew Bartlett <abartlet@samba.org> | 2008-02-04 17:51:38 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2008-02-04 17:51:38 +1100 |
commit | 77f71c1b65358723771354fd9ff1dc418b227ccc (patch) | |
tree | 2b1b96d1f3dcd55997fd6d48e75085ff506fb0a2 /source4/smbd | |
parent | 23d681caf9c1186999ac676d70a1eb0e8a43e358 (diff) | |
download | samba-77f71c1b65358723771354fd9ff1dc418b227ccc.tar.gz samba-77f71c1b65358723771354fd9ff1dc418b227ccc.tar.bz2 samba-77f71c1b65358723771354fd9ff1dc418b227ccc.zip |
Rework cluster_id() to take an additional argument, as we need
<node>.<pid>.<fd> to be unique in a prefork process environment.
Andrew Bartlett and David Disseldorp
(This used to be commit 931994a7f185bbc98924823e9e8cef1011dd0957)
Diffstat (limited to 'source4/smbd')
-rw-r--r-- | source4/smbd/service_stream.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/source4/smbd/service_stream.c b/source4/smbd/service_stream.c index 0d6f1b7281..7e1f6493ee 100644 --- a/source4/smbd/service_stream.c +++ b/source4/smbd/service_stream.c @@ -136,7 +136,7 @@ NTSTATUS stream_new_connection_merge(struct event_context *ev, srv_conn->private = private_data; srv_conn->model_ops = model_ops; srv_conn->socket = sock; - srv_conn->server_id = cluster_id(0); + srv_conn->server_id = cluster_id(0, 0); srv_conn->ops = stream_ops; srv_conn->msg_ctx = msg_ctx; srv_conn->event.ctx = ev; @@ -274,8 +274,11 @@ NTSTATUS stream_setup_socket(struct event_context *event_context, NT_STATUS_NOT_OK_RETURN(status); } - /* TODO: set socket ACL's here when they're implemented */ + /* TODO: set socket ACL's (host allow etc) here when they're + * implemented */ + /* Some sockets don't have a port, or are just described from + * the string. We are indicating this by having port == NULL */ if (!port) { socket_address = socket_address_from_strings(stream_socket, stream_socket->sock->backend_name, @@ -314,9 +317,16 @@ NTSTATUS stream_setup_socket(struct event_context *event_context, return status; } - /* we will close the socket using the events system */ + /* By specifying EVENT_FD_AUTOCLOSE below, we indicate that we + * will close the socket using the events system. This avoids + * nasty interactions with waiting for talloc to close the socket. */ + socket_set_flags(stream_socket->sock, SOCKET_FLAG_NOCLOSE); + /* Add the FD from the newly created socket into the event + * subsystem. it will call the accept handler whenever we get + * new connections */ + event_add_fd(event_context, stream_socket->sock, socket_get_fd(stream_socket->sock), EVENT_FD_READ|EVENT_FD_AUTOCLOSE, |