And finally IDMAP in 3_0
[tprouty/samba.git] / source3 / smbd / server.c
index ba03a9b9de665f2a8aaf2a99b76fb689b662fc3a..edc7b57ba3988f32c84fc2fe2dc3648af00ae488 100644 (file)
@@ -3,7 +3,7 @@
    Main SMB server routines
    Copyright (C) Andrew Tridgell               1992-1998
    Copyright (C) Martin Pool                   2002
-   Copyright (C) Jelmer Vernooij               2002
+   Copyright (C) Jelmer Vernooij               2002-2003
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -398,7 +398,7 @@ static BOOL open_sockets_smbd(BOOL is_daemon, BOOL interactive, const char *smb_
                                
                                /* this is needed so that we get decent entries
                                   in smbstatus for port 445 connects */
-                               set_remote_machine_name(get_socket_addr(smbd_server_fd()));
+                               set_remote_machine_name(get_socket_addr(smbd_server_fd()), False);
                                
                                /* Reset global variables in util.c so
                                   that client substitutions will be
@@ -411,10 +411,6 @@ static BOOL open_sockets_smbd(BOOL is_daemon, BOOL interactive, const char *smb_
                                        return False;
                                }
 
-                               /* Load DSO's */
-                               if(lp_modules()) 
-                                       smb_load_modules(lp_modules());
-
                                return True; 
                        }
                        /* The parent doesn't need this socket */
@@ -505,25 +501,6 @@ BOOL reload_services(BOOL test)
        return(ret);
 }
 
-/*******************************************************************
- Print out all talloc memory info.
-********************************************************************/
-
-void return_all_talloc_info(int msg_type, pid_t src_pid, void *buf, size_t len)
-{
-       TALLOC_CTX *ctx = talloc_init("info context");
-       char *info = NULL;
-
-       if (!ctx)
-               return;
-
-       info = talloc_describe_all(ctx);
-       if (info)
-               DEBUG(10,(info));
-       message_send_pid(src_pid, MSG_TALLOC_USAGE, info, info ? strlen(info) + 1 : 0, True);
-       talloc_destroy(ctx);
-}
-
 #if DUMP_CORE
 /*******************************************************************
 prepare to dump a core file - carefully!
@@ -590,6 +567,9 @@ void exit_server(const char *reason)
 
        print_notify_send_messages(3); /* 3 second timeout. */
 
+       /* run all registered exit events */
+       smb_run_exit_events();
+
        /* delete our entry in the connections database. */
        yield_connection(NULL,"");
 
@@ -673,11 +653,7 @@ static BOOL init_structs(void )
        {"log-stdout", 'S', POPT_ARG_VAL, &log_stdout, True, "Log to stdout" },
        {"build-options", 'b', POPT_ARG_NONE, NULL, 'b', "Print build options" },
        {"port", 'p', POPT_ARG_STRING, &ports, 0, "Listen on the specified ports"},
-       {NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug},
-       {NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_configfile},
-       {NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_socket_options},
-       {NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_log_base},
-       {NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_version},
+       POPT_COMMON_SAMBA
        { NULL }
        };
 
@@ -707,7 +683,7 @@ static BOOL init_structs(void )
 
        load_case_tables();
 
-       set_remote_machine_name("smbd");
+       set_remote_machine_name("smbd", False);
 
        if (interactive) {
                Fork = False;
@@ -763,7 +739,7 @@ static BOOL init_structs(void )
        reopen_logs();
 
        DEBUG(0,( "smbd version %s started.\n", VERSION));
-       DEBUGADD(0,( "Copyright Andrew Tridgell and the Samba Team 1992-2002\n"));
+       DEBUGADD(0,( "Copyright Andrew Tridgell and the Samba Team 1992-2003\n"));
 
        DEBUG(2,("uid=%d gid=%d euid=%d egid=%d\n",
                 (int)getuid(),(int)getgid(),(int)geteuid(),(int)getegid()));
@@ -829,10 +805,6 @@ static BOOL init_structs(void )
        if (!message_init())
                exit(1);
 
-       register_msg_pool_usage();
-       register_dmalloc_msgs();
-       message_register(MSG_REQ_TALLOC_USAGE, return_all_talloc_info);
-
        if (!print_backend_init())
                exit(1);
 
@@ -867,6 +839,16 @@ static BOOL init_structs(void )
        if(!initialize_password_db(False))
                exit(1);
 
+       if (!idmap_init())
+               exit(1);
+
+       if (!idmap_init_wellknown_sids())
+               exit(1);
+
+       static_init_rpc;
+
+       init_modules();
+
        uni_group_cache_init(); /* Non-critical */
        
        /* possibly reload the services file. */