s3:smbd: move pending_auth_data list to struct smbd_server_connection
[kai/samba.git] / source3 / smbd / server.c
index d27f98281b388c527638eef087137a9be55f7731..685b26fa1ae981427b699149d5b8bb72da65097a 100644 (file)
@@ -356,6 +356,7 @@ static void smbd_accept_connection(struct tevent_context *ev,
 
        pid = sys_fork();
        if (pid == 0) {
+               NTSTATUS status = NT_STATUS_OK;
                /* Child code ... */
                am_parent = 0;
 
@@ -374,10 +375,15 @@ static void smbd_accept_connection(struct tevent_context *ev,
                talloc_free(s->parent);
                s = NULL;
 
-               if (!reinit_after_fork(
-                           smbd_messaging_context(),
-                           smbd_event_context(),
-                           true)) {
+               status = reinit_after_fork(smbd_messaging_context(),
+                                          smbd_event_context(), true);
+               if (!NT_STATUS_IS_OK(status)) {
+                       if (NT_STATUS_EQUAL(status,
+                                           NT_STATUS_TOO_MANY_OPENED_FILES)) {
+                               DEBUG(0,("child process cannot initialize "
+                                        "because too many files are open\n"));
+                               goto exit;
+                       }
                        DEBUG(0,("reinit_after_fork() failed\n"));
                        smb_panic("reinit_after_fork() failed");
                }
@@ -386,6 +392,7 @@ static void smbd_accept_connection(struct tevent_context *ev,
                smbd_setup_sig_hup_handler();
 
                smbd_process();
+        exit:
                exit_server_cleanly("end of child");
                return;
        } else if (pid < 0) {
@@ -643,8 +650,19 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent,
 #endif
 
        if (dns_port != 0) {
+#ifdef WITH_DNSSD_SUPPORT
                smbd_setup_mdns_registration(smbd_event_context(),
                                             parent, dns_port);
+#endif
+#ifdef WITH_AVAHI_SUPPORT
+               void *avahi_conn;
+
+               avahi_conn = avahi_start_register(
+                       smbd_event_context(), smbd_event_context(), dns_port);
+               if (avahi_conn == NULL) {
+                       DEBUG(10, ("avahi_start_register failed\n"));
+               }
+#endif
        }
 
        return true;
@@ -1111,8 +1129,8 @@ extern void build_options(bool screen);
        if (is_daemon)
                pidfile_create("smbd");
 
-       if (!reinit_after_fork(smbd_messaging_context(),
-                              smbd_event_context(), false)) {
+       if (!NT_STATUS_IS_OK(reinit_after_fork(smbd_messaging_context(),
+                            smbd_event_context(), false))) {
                DEBUG(0,("reinit_after_fork() failed\n"));
                exit(1);
        }