summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-01-23 13:08:22 +0100
committerStefan Metzmacher <metze@samba.org>2009-01-27 15:28:11 +0100
commite11e82318c92fdfdc231eb48abb2fb6faac3dcf0 (patch)
treedb7903e81b76c5c9bfee998283fb881b6d9c61f6
parent52f6a4436f9da439fc687894b329898833af7ff8 (diff)
downloadsamba-e11e82318c92fdfdc231eb48abb2fb6faac3dcf0.tar.gz
samba-e11e82318c92fdfdc231eb48abb2fb6faac3dcf0.tar.bz2
samba-e11e82318c92fdfdc231eb48abb2fb6faac3dcf0.zip
s3:smbd: make inetd code path more clear
metze
-rw-r--r--source3/smbd/server.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 7bc96ff5fb..f95fa874ff 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -136,24 +136,6 @@ static void msg_sam_sync(struct messaging_context *msg,
DEBUG(10, ("** sam sync message received, ignoring\n"));
}
-
-/****************************************************************************
- Open the socket communication - inetd.
-****************************************************************************/
-
-static bool open_sockets_inetd(void)
-{
- /* Started from inetd. fd 0 is the socket. */
- /* We will abort gracefully when the client or remote system
- goes away */
- smbd_set_server_fd(dup(0));
-
- /* close our standard file descriptors */
- close_low_fds(False); /* Don't close stderr */
-
- return True;
-}
-
static void msg_exit_server(struct messaging_context *msg,
void *private_data,
uint32_t msg_type,
@@ -317,7 +299,7 @@ static void smbd_setup_sig_chld_handler(void)
Open the socket communication.
****************************************************************************/
-static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_ports)
+static bool open_sockets_smbd(bool interactive, const char *smb_ports)
{
int num_interfaces = iface_count();
int num_sockets = 0;
@@ -330,10 +312,6 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_
struct dns_reg_state * dns_reg = NULL;
unsigned dns_port = 0;
- if (!is_daemon) {
- return open_sockets_inetd();
- }
-
#ifdef HAVE_ATEXIT
atexit(killkids);
#endif
@@ -1224,7 +1202,25 @@ extern void build_options(bool screen);
start_background_queue();
}
- if (!open_sockets_smbd(is_daemon, interactive, ports))
+ if (!is_daemon) {
+ /* inetd mode */
+ TALLOC_FREE(frame);
+
+ /* Started from inetd. fd 0 is the socket. */
+ /* We will abort gracefully when the client or remote system
+ goes away */
+ smbd_set_server_fd(dup(0));
+
+ /* close our standard file descriptors */
+ close_low_fds(False); /* Don't close stderr */
+
+ smbd_process();
+
+ exit_server_cleanly(NULL);
+ return(0);
+ }
+
+ if (!open_sockets_smbd(interactive, ports))
exit(1);
TALLOC_FREE(frame);