diff options
author | Stefan Metzmacher <metze@samba.org> | 2009-01-22 10:13:45 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2009-01-27 15:28:07 +0100 |
commit | 6a2b7f98151ef0b5b434e1ed522a47770e2151ea (patch) | |
tree | d3cf3d521de3825e36748edb8fa2fe0fb01cbc5e /source3/smbd | |
parent | 7d93d3d4b8db230ceb51a81f18650b8114528f1f (diff) | |
download | samba-6a2b7f98151ef0b5b434e1ed522a47770e2151ea.tar.gz samba-6a2b7f98151ef0b5b434e1ed522a47770e2151ea.tar.bz2 samba-6a2b7f98151ef0b5b434e1ed522a47770e2151ea.zip |
s3:smbd: we should setup the client socket in the same way in all code pathes
We should behave the same in inetd, interactive and deamon modes.
metze
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/server.c | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 65fb0a84d1..794e9d2ac6 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -199,9 +199,6 @@ static bool open_sockets_inetd(void) /* close our standard file descriptors */ close_low_fds(False); /* Don't close stderr */ - - set_socket_options(smbd_server_fd(),"SO_KEEPALIVE"); - set_socket_options(smbd_server_fd(), lp_socket_options()); return True; } @@ -690,17 +687,11 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_ continue; } - /* Ensure child is set to blocking mode */ - set_blocking(smbd_server_fd(),True); - - if (smbd_server_fd() != -1 && interactive) + if (interactive) return True; if (allowable_number_of_smbd_processes() && - smbd_server_fd() != -1 && ((child = sys_fork())==0)) { - char remaddr[INET6_ADDRSTRLEN]; - /* Child code ... */ /* Stop zombies, the parent explicitly handles @@ -719,17 +710,6 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_ close_low_fds(False); am_parent = 0; - set_socket_options(smbd_server_fd(),"SO_KEEPALIVE"); - set_socket_options(smbd_server_fd(), - lp_socket_options()); - - /* this is needed so that we get decent entries - in smbstatus for port 445 connects */ - set_remote_machine_name(get_peer_addr(smbd_server_fd(), - remaddr, - sizeof(remaddr)), - false); - if (!reinit_after_fork( smbd_messaging_context(), smbd_event_context(), @@ -1114,6 +1094,7 @@ extern void build_options(bool screen); POPT_COMMON_DYNCONFIG POPT_TABLEEND }; + char remaddr[INET6_ADDRSTRLEN]; TALLOC_CTX *frame = talloc_stackframe(); /* Setup tos. */ smbd_init_globals(); @@ -1379,6 +1360,19 @@ extern void build_options(bool screen); * everything after this point is run after the fork() */ + /* Ensure child is set to blocking mode */ + set_blocking(smbd_server_fd(),True); + + set_socket_options(smbd_server_fd(),"SO_KEEPALIVE"); + set_socket_options(smbd_server_fd(), lp_socket_options()); + + /* this is needed so that we get decent entries + in smbstatus for port 445 connects */ + set_remote_machine_name(get_peer_addr(smbd_server_fd(), + remaddr, + sizeof(remaddr)), + false); + static_init_rpc; init_modules(); |