Changeset 745 for trunk/server/source3/smbd/server.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source3/smbd/server.c
r668 r745 23 23 24 24 #include "includes.h" 25 #include "system/filesys.h" 26 #include "popt_common.h" 27 #include "smbd/smbd.h" 25 28 #include "smbd/globals.h" 26 27 static_decl_rpc; 29 #include "registry/reg_init_full.h" 30 #include "libcli/auth/schannel.h" 31 #include "secrets.h" 32 #include "memcache.h" 33 #include "ctdbd_conn.h" 34 #include "printing/printer_list.h" 35 #include "rpc_server/rpc_ep_setup.h" 36 #include "printing/pcap.h" 37 #include "printing.h" 38 #include "serverid.h" 39 #include "passdb.h" 40 #include "auth.h" 41 #include "messages.h" 42 #include "smbprofile.h" 43 44 extern void start_epmd(struct tevent_context *ev_ctx, 45 struct messaging_context *msg_ctx); 46 47 extern void start_spoolssd(struct event_context *ev_ctx, 48 struct messaging_context *msg_ctx); 28 49 29 50 #ifdef WITH_DFS … … 31 52 #endif /* WITH_DFS */ 32 53 33 int smbd_server_fd(void)34 {35 return server_fd;36 }37 38 54 static void smbd_set_server_fd(int fd) 39 55 { 40 server_fd = fd; 41 } 42 43 int get_client_fd(void) 44 { 45 return server_fd; 56 struct smbd_server_connection *sconn = smbd_server_conn; 57 char addr[INET6_ADDRSTRLEN]; 58 const char *name; 59 60 sconn->sock = fd; 61 62 /* 63 * Initialize sconn->client_id: If we can't find the client's 64 * name, default to its address. 65 */ 66 67 client_addr(fd, sconn->client_id.addr, sizeof(sconn->client_id.addr)); 68 69 name = client_name(sconn->sock); 70 if (strcmp(name, "UNKNOWN") != 0) { 71 name = talloc_strdup(sconn, name); 72 } else { 73 name = NULL; 74 } 75 sconn->client_id.name = 76 (name != NULL) ? name : sconn->client_id.addr; 77 78 sub_set_socket_ids(sconn->client_id.addr, sconn->client_id.name, 79 client_socket_addr(sconn->sock, addr, 80 sizeof(addr))); 46 81 } 47 82 48 83 struct event_context *smbd_event_context(void) 49 84 { 50 if (!smbd_event_ctx) { 51 smbd_event_ctx = event_context_init(talloc_autofree_context()); 52 } 53 if (!smbd_event_ctx) { 54 smb_panic("Could not init smbd event context"); 55 } 56 return smbd_event_ctx; 57 } 58 59 struct messaging_context *smbd_messaging_context(void) 60 { 61 if (smbd_msg_ctx == NULL) { 62 smbd_msg_ctx = messaging_init(talloc_autofree_context(), 63 server_id_self(), 64 smbd_event_context()); 65 } 66 if (smbd_msg_ctx == NULL) { 67 DEBUG(0, ("Could not init smbd messaging context.\n")); 68 } 69 return smbd_msg_ctx; 70 } 71 72 struct memcache *smbd_memcache(void) 73 { 74 if (!smbd_memcache_ctx) { 75 smbd_memcache_ctx = memcache_init(talloc_autofree_context(), 76 lp_max_stat_cache_size()*1024); 77 } 78 if (!smbd_memcache_ctx) { 79 smb_panic("Could not init smbd memcache"); 80 } 81 82 return smbd_memcache_ctx; 85 return server_event_context(); 83 86 } 84 87 … … 93 96 DATA_BLOB *data) 94 97 { 98 struct tevent_context *ev_ctx = 99 talloc_get_type_abort(private_data, struct tevent_context); 100 95 101 DEBUG(10,("smb_conf_updated: Got message saying smb.conf was " 96 102 "updated. Reloading.\n")); 97 103 change_to_root_user(); 98 reload_services(False); 99 } 100 104 reload_services(msg, smbd_server_conn->sock, False); 105 if (am_parent) { 106 pcap_cache_reload(ev_ctx, msg, 107 &reload_pcap_change_notify); 108 } 109 } 110 111 /******************************************************************* 112 What to do when printcap is updated. 113 ********************************************************************/ 114 115 static void smb_pcap_updated(struct messaging_context *msg, 116 void *private_data, 117 uint32_t msg_type, 118 struct server_id server_id, 119 DATA_BLOB *data) 120 { 121 struct tevent_context *ev_ctx = 122 talloc_get_type_abort(private_data, struct tevent_context); 123 124 DEBUG(10,("Got message saying pcap was updated. Reloading.\n")); 125 change_to_root_user(); 126 reload_printers(ev_ctx, msg); 127 } 101 128 102 129 /******************************************************************* … … 158 185 159 186 if (data->length != sizeof(sig)) { 160 161 187 DEBUG(0, ("Process %s sent bogus signal injection request\n", 162 188 procid_str_static(&src))); … … 240 266 DEBUG(1,("Cleaning up brl and lock database after unclean shutdown\n")); 241 267 message_send_all(smbd_messaging_context(), MSG_SMB_UNLOCK, NULL, 0, NULL); 242 messaging_send_buf(smbd_messaging_context(), procid_self(), 268 messaging_send_buf(smbd_messaging_context(), procid_self(), 243 269 MSG_SMB_BRL_VALIDATE, NULL, 0); 244 270 /* mark the cleanup as having been done */ … … 250 276 struct child_pid *child; 251 277 static struct timed_event *cleanup_te; 278 struct server_id child_id; 252 279 253 280 if (unclean_shutdown) { … … 256 283 pending locks 257 284 */ 258 DEBUG(3,(__location__ " Unclean shutdown of pid %u\n", 285 DEBUG(3,(__location__ " Unclean shutdown of pid %u\n", 259 286 (unsigned int)pid)); 260 287 if (!cleanup_te) { … … 263 290 cleanup_te = event_add_timed(smbd_event_context(), NULL, 264 291 timeval_current_ofs(cleanup_time, 0), 265 cleanup_timeout_fn, 292 cleanup_timeout_fn, 266 293 &cleanup_te); 267 294 DEBUG(1,("Scheduled cleanup of brl and lock database after unclean shutdown\n")); 268 295 } 296 } 297 298 child_id = procid_self(); /* Just initialize pid and potentially vnn */ 299 child_id.pid = pid; 300 301 if (!serverid_deregister(child_id)) { 302 DEBUG(1, ("Could not remove pid %d from serverid.tdb\n", 303 (int)pid)); 269 304 } 270 305 … … 375 410 struct sockaddr_storage addr; 376 411 socklen_t in_addrlen = sizeof(addr); 412 int fd; 377 413 pid_t pid = 0; 378 379 smbd_set_server_fd(accept(s->fd,(struct sockaddr *)&addr,&in_addrlen)); 380 381 if (smbd_server_fd() == -1 && errno == EINTR) 414 uint64_t unique_id; 415 416 fd = accept(s->fd, (struct sockaddr *)(void *)&addr,&in_addrlen); 417 smbd_set_server_fd(fd); 418 419 if (fd == -1 && errno == EINTR) 382 420 return; 383 421 384 if ( smbd_server_fd()== -1) {422 if (fd == -1) { 385 423 DEBUG(0,("open_sockets_smbd: accept: %s\n", 386 424 strerror(errno))); … … 389 427 390 428 if (s->parent->interactive) { 391 smbd_process( );429 smbd_process(smbd_server_conn); 392 430 exit_server_cleanly("end of interactive mode"); 393 431 return; … … 395 433 396 434 if (!allowable_number_of_smbd_processes()) { 397 close( smbd_server_fd());435 close(fd); 398 436 smbd_set_server_fd(-1); 399 437 return; 400 438 } 439 440 /* 441 * Generate a unique id in the parent process so that we use 442 * the global random state in the parent. 443 */ 444 generate_random_buffer((uint8_t *)&unique_id, sizeof(unique_id)); 401 445 402 446 pid = sys_fork(); 403 447 if (pid == 0) { 404 448 NTSTATUS status = NT_STATUS_OK; 449 405 450 /* Child code ... */ 406 451 am_parent = 0; 452 453 set_my_unique_id(unique_id); 407 454 408 455 /* Stop zombies, the parent explicitly handles … … 422 469 423 470 status = reinit_after_fork(smbd_messaging_context(), 424 smbd_event_context(), true); 471 smbd_event_context(), procid_self(), 472 true); 425 473 if (!NT_STATUS_IS_OK(status)) { 426 474 if (NT_STATUS_EQUAL(status, … … 430 478 goto exit; 431 479 } 480 if (lp_clustering() && 481 NT_STATUS_EQUAL(status, 482 NT_STATUS_INTERNAL_DB_ERROR)) { 483 DEBUG(1,("child process cannot initialize " 484 "because connection to CTDB " 485 "has failed\n")); 486 goto exit; 487 } 488 432 489 DEBUG(0,("reinit_after_fork() failed\n")); 433 490 smb_panic("reinit_after_fork() failed"); … … 435 492 436 493 smbd_setup_sig_term_handler(); 437 smbd_setup_sig_hup_handler(); 438 439 smbd_process(); 494 smbd_setup_sig_hup_handler(server_event_context(), 495 server_messaging_context()); 496 497 if (!serverid_register(procid_self(), 498 FLAG_MSG_GENERAL|FLAG_MSG_SMBD 499 |FLAG_MSG_DBWRAP 500 |FLAG_MSG_PRINT_GENERAL)) { 501 exit_server_cleanly("Could not register myself in " 502 "serverid.tdb"); 503 } 504 505 smbd_process(smbd_server_conn); 440 506 exit: 441 507 exit_server_cleanly("end of child"); 442 508 return; 443 } else if (pid < 0) { 509 } 510 511 if (pid < 0) { 444 512 DEBUG(0,("smbd_accept_connection: sys_fork() failed: %s\n", 445 513 strerror(errno))); … … 447 515 448 516 /* The parent doesn't need this socket */ 449 close( smbd_server_fd());517 close(fd); 450 518 451 519 /* Sun May 6 18:56:14 2001 ackley@cs.unm.edu: … … 543 611 } 544 612 545 static bool parent_housekeeping_fn(const struct timeval *now, void *private_data) 546 { 547 DEBUG(5, ("houskeeping\n")); 548 /* check if we need to reload services */ 549 check_reload(time(NULL)); 613 static bool smbd_parent_housekeeping(const struct timeval *now, void *private_data) 614 { 615 time_t printcap_cache_time = (time_t)lp_printcap_cache_time(); 616 time_t t = time_mono(NULL); 617 618 DEBUG(5, ("parent housekeeping\n")); 619 620 /* if periodic printcap rescan is enabled, see if it's time to reload */ 621 if ((printcap_cache_time != 0) 622 && (t >= (last_printer_reload_time + printcap_cache_time))) { 623 DEBUG( 3,( "Printcap cache time expired.\n")); 624 pcap_cache_reload(server_event_context(), 625 smbd_messaging_context(), 626 &reload_pcap_change_notify); 627 last_printer_reload_time = t; 628 } 629 550 630 return true; 551 631 } … … 556 636 557 637 static bool open_sockets_smbd(struct smbd_parent_context *parent, 638 struct messaging_context *msg_ctx, 558 639 const char *smb_ports) 559 640 { … … 682 763 operations until it has gone thru a full startup, which 683 764 includes checking to see that smbd is listening. */ 684 claim_connection(NULL,"", 685 FLAG_MSG_GENERAL|FLAG_MSG_SMBD|FLAG_MSG_DBWRAP); 765 766 if (!serverid_register(procid_self(), 767 FLAG_MSG_GENERAL|FLAG_MSG_SMBD 768 |FLAG_MSG_DBWRAP)) { 769 DEBUG(0, ("open_sockets_smbd: Failed to register " 770 "myself in serverid.tdb\n")); 771 return false; 772 } 686 773 687 774 if (!(event_add_idle(smbd_event_context(), NULL, 688 775 timeval_set(SMBD_HOUSEKEEPING_INTERVAL, 0), 689 "parent_housekeeping", parent_housekeeping_fn,690 parent))) {691 DEBUG(0, ("Could not add housekeeping event\n"));692 exit(1);776 "parent_housekeeping", smbd_parent_housekeeping, 777 NULL))) { 778 DEBUG(0, ("Could not add parent_housekeeping event\n")); 779 return false; 693 780 } 694 781 695 782 /* Listen to messages */ 696 783 697 messaging_register(smbd_messaging_context(), NULL, 698 MSG_SMB_SAM_SYNC, msg_sam_sync); 699 messaging_register(smbd_messaging_context(), NULL, 700 MSG_SHUTDOWN, msg_exit_server); 701 messaging_register(smbd_messaging_context(), NULL, 702 MSG_SMB_FILE_RENAME, msg_file_was_renamed); 703 messaging_register(smbd_messaging_context(), NULL, 704 MSG_SMB_CONF_UPDATED, smb_conf_updated); 705 messaging_register(smbd_messaging_context(), NULL, 706 MSG_SMB_STAT_CACHE_DELETE, smb_stat_cache_delete); 707 messaging_register(smbd_messaging_context(), NULL, 708 MSG_DEBUG, smbd_msg_debug); 709 brl_register_msgs(smbd_messaging_context()); 784 messaging_register(msg_ctx, NULL, MSG_SMB_SAM_SYNC, msg_sam_sync); 785 messaging_register(msg_ctx, NULL, MSG_SHUTDOWN, msg_exit_server); 786 messaging_register(msg_ctx, NULL, MSG_SMB_FILE_RENAME, 787 msg_file_was_renamed); 788 messaging_register(msg_ctx, server_event_context(), MSG_SMB_CONF_UPDATED, 789 smb_conf_updated); 790 messaging_register(msg_ctx, NULL, MSG_SMB_STAT_CACHE_DELETE, 791 smb_stat_cache_delete); 792 messaging_register(msg_ctx, NULL, MSG_DEBUG, smbd_msg_debug); 793 messaging_register(msg_ctx, server_event_context(), MSG_PRINTER_PCAP, 794 smb_pcap_updated); 795 brl_register_msgs(msg_ctx); 796 797 msg_idmap_register_msgs(msg_ctx); 710 798 711 799 #ifdef CLUSTER_SUPPORT … … 716 804 717 805 #ifdef DEVELOPER 718 messaging_register( smbd_messaging_context(), NULL,719 MSG_SMB_INJECT_FAULT,msg_inject_fault);720 #endif 721 722 if ( dns_port != 0) {806 messaging_register(msg_ctx, NULL, MSG_SMB_INJECT_FAULT, 807 msg_inject_fault); 808 #endif 809 810 if (lp_multicast_dns_register() && (dns_port != 0)) { 723 811 #ifdef WITH_DNSSD_SUPPORT 724 812 smbd_setup_mdns_registration(smbd_event_context(), … … 747 835 int ret; 748 836 TALLOC_CTX *frame = talloc_stackframe(); 837 749 838 ret = tevent_loop_once(smbd_event_context()); 750 839 if (ret != 0) { … … 758 847 } 759 848 760 /***************************************************************************761 purge stale printers and reload from pre-populated pcap cache762 ***************************************************************************/763 void reload_printers(void)764 {765 int snum;766 int n_services = lp_numservices();767 int pnum = lp_servicenumber(PRINTERS_NAME);768 const char *pname;769 770 DEBUG(10, ("reloading printer services from pcap cache\n"));771 for (snum = 0; snum < n_services; snum++) {772 /* avoid removing PRINTERS_NAME or non-autoloaded printers */773 if (snum == pnum || !(lp_snum_ok(snum) && lp_print_ok(snum) &&774 lp_autoloaded(snum)))775 continue;776 777 pname = lp_printername(snum);778 if (!pcap_printername_ok(pname)) {779 DEBUG(3, ("removing stale printer %s\n", pname));780 781 if (is_printer_published(NULL, snum, NULL))782 nt_printer_publish(NULL, snum, DSPRINT_UNPUBLISH);783 del_a_printer(pname);784 lp_killservice(snum);785 }786 }787 788 load_printers();789 }790 791 /****************************************************************************792 Reload the services file.793 **************************************************************************/794 795 bool reload_services(bool test)796 {797 bool ret;798 799 if (lp_loaded()) {800 char *fname = lp_configfile();801 if (file_exist(fname) &&802 !strcsequal(fname, get_dyn_CONFIGFILE())) {803 set_dyn_CONFIGFILE(fname);804 test = False;805 }806 }807 808 reopen_logs();809 810 if (test && !lp_file_list_changed())811 return(True);812 813 lp_killunused(conn_snum_used);814 815 ret = lp_load(get_dyn_CONFIGFILE(), False, False, True, True);816 817 pcap_cache_reload(&reload_printers);818 819 /* perhaps the config filename is now set */820 if (!test)821 reload_services(True);822 823 reopen_logs();824 825 load_interfaces();826 827 if (smbd_server_fd() != -1) {828 set_socket_options(smbd_server_fd(),"SO_KEEPALIVE");829 set_socket_options(smbd_server_fd(), lp_socket_options());830 }831 832 mangle_reset_cache();833 reset_stat_cache();834 835 /* this forces service parameters to be flushed */836 set_current_service(NULL,0,True);837 838 return(ret);839 }840 841 /****************************************************************************842 Exit the server.843 ****************************************************************************/844 845 /* Reasons for shutting down a server process. */846 enum server_exit_reason { SERVER_EXIT_NORMAL, SERVER_EXIT_ABNORMAL };847 848 static void exit_server_common(enum server_exit_reason how,849 const char *const reason) _NORETURN_;850 851 static void exit_server_common(enum server_exit_reason how,852 const char *const reason)853 {854 bool had_open_conn = false;855 struct smbd_server_connection *sconn = smbd_server_conn;856 857 if (!exit_firsttime)858 exit(0);859 exit_firsttime = false;860 861 change_to_root_user();862 863 if (sconn && sconn->smb1.negprot.auth_context) {864 struct auth_context *a = sconn->smb1.negprot.auth_context;865 a->free(&sconn->smb1.negprot.auth_context);866 }867 868 if (sconn) {869 had_open_conn = conn_close_all(sconn);870 invalidate_all_vuids(sconn);871 }872 873 /* 3 second timeout. */874 print_notify_send_messages(smbd_messaging_context(), 3);875 876 /* delete our entry in the connections database. */877 yield_connection(NULL,"");878 879 #ifdef WITH_DFS880 if (dcelogin_atmost_once) {881 dfs_unlogin();882 }883 #endif884 885 #ifdef USE_DMAPI886 /* Destroy Samba DMAPI session only if we are master smbd process */887 if (am_parent) {888 if (!dmapi_destroy_session()) {889 DEBUG(0,("Unable to close Samba DMAPI session\n"));890 }891 }892 #endif893 894 locking_end();895 printing_end();896 897 /*898 * we need to force the order of freeing the following,899 * because smbd_msg_ctx is not a talloc child of smbd_server_conn.900 */901 sconn = NULL;902 TALLOC_FREE(smbd_server_conn);903 TALLOC_FREE(smbd_msg_ctx);904 TALLOC_FREE(smbd_event_ctx);905 906 if (how != SERVER_EXIT_NORMAL) {907 int oldlevel = DEBUGLEVEL;908 909 DEBUGLEVEL = 10;910 911 DEBUGSEP(0);912 DEBUG(0,("Abnormal server exit: %s\n",913 reason ? reason : "no explanation provided"));914 DEBUGSEP(0);915 916 log_stack_trace();917 918 DEBUGLEVEL = oldlevel;919 dump_core();920 921 } else {922 DEBUG(3,("Server exit (%s)\n",923 (reason ? reason : "normal exit")));924 if (am_parent) {925 pidfile_unlink();926 }927 gencache_stabilize();928 }929 930 /* if we had any open SMB connections when we exited then we931 need to tell the parent smbd so that it can trigger a retry932 of any locks we may have been holding or open files we were933 blocking */934 if (had_open_conn) {935 exit(1);936 } else {937 exit(0);938 }939 }940 941 void exit_server(const char *const explanation)942 {943 exit_server_common(SERVER_EXIT_ABNORMAL, explanation);944 }945 946 void exit_server_cleanly(const char *const explanation)947 {948 exit_server_common(SERVER_EXIT_NORMAL, explanation);949 }950 951 void exit_server_fault(void)952 {953 exit_server("critical server fault");954 }955 849 956 850 /**************************************************************************** … … 967 861 if (!init_names()) 968 862 return False; 969 970 file_init();971 863 972 864 if (!secrets_init()) … … 1021 913 }; 1022 914 struct smbd_parent_context *parent = NULL; 1023 TALLOC_CTX *frame = talloc_stackframe(); /* Setup tos. */ 915 TALLOC_CTX *frame; 916 NTSTATUS status; 917 uint64_t unique_id; 918 919 /* 920 * Do this before any other talloc operation 921 */ 922 talloc_enable_null_tracking(); 923 frame = talloc_stackframe(); 924 925 load_case_tables(); 926 927 /* Initialize the event context, it will panic on error */ 928 smbd_event_context(); 1024 929 1025 930 smbd_init_globals(); … … 1066 971 } 1067 972 1068 setup_logging(argv[0],log_stdout); 973 if (log_stdout) { 974 setup_logging(argv[0], DEBUG_STDOUT); 975 } else { 976 setup_logging(argv[0], DEBUG_FILE); 977 } 1069 978 1070 979 if (print_build_options) { … … 1073 982 } 1074 983 1075 load_case_tables();1076 1077 984 #ifdef HAVE_SETLUID 1078 985 /* needed for SecureWare on SCO */ … … 1080 987 #endif 1081 988 1082 sec_init();1083 1084 989 set_remote_machine_name("smbd", False); 1085 990 … … 1097 1002 generate_random_buffer(NULL, 0); 1098 1003 1004 /* get initial effective uid and gid */ 1005 sec_init(); 1006 1099 1007 /* make absolutely sure we run as root - to handle cases where people 1100 1008 are crazy enough to have it setuid */ 1101 1102 1009 gain_root_privilege(); 1103 1010 gain_root_group_privilege(); … … 1133 1040 so set our umask to 0 */ 1134 1041 umask(0); 1135 1136 init_sec_ctx();1137 1042 1138 1043 reopen_logs(); … … 1168 1073 } 1169 1074 1075 /* Init the security context and global current_user */ 1076 init_sec_ctx(); 1077 1170 1078 if (smbd_messaging_context() == NULL) 1171 1079 exit(1); 1172 1080 1173 if (!reload_services(False)) 1174 return(-1); 1081 /* 1082 * Reloading of the printers will not work here as we don't have a 1083 * server info and rpc services set up. It will be called later. 1084 */ 1085 if (!reload_services(smbd_messaging_context(), -1, False)) { 1086 exit(1); 1087 } 1088 1089 /* ...NOTE... Log files are working from this point! */ 1090 1091 DEBUG(3,("loaded services\n")); 1175 1092 1176 1093 init_structs(); … … 1191 1108 #endif 1192 1109 1193 DEBUG(3,( "loaded services\n"));1194 1195 1110 if (!is_daemon && !is_a_socket(0)) { 1196 1111 if (!interactive) … … 1207 1122 if (is_daemon && !interactive) { 1208 1123 DEBUG( 3, ( "Becoming a daemon.\n" ) ); 1209 become_daemon(Fork, no_process_group); 1210 } 1124 become_daemon(Fork, no_process_group, log_stdout); 1125 } 1126 1127 generate_random_buffer((uint8_t *)&unique_id, sizeof(unique_id)); 1128 set_my_unique_id(unique_id); 1211 1129 1212 1130 #if HAVE_SETPGID … … 1225 1143 pidfile_create("smbd"); 1226 1144 1227 if (!NT_STATUS_IS_OK(reinit_after_fork(smbd_messaging_context(), 1228 smbd_event_context(), false))) { 1145 status = reinit_after_fork(smbd_messaging_context(), 1146 smbd_event_context(), 1147 procid_self(), false); 1148 if (!NT_STATUS_IS_OK(status)) { 1229 1149 DEBUG(0,("reinit_after_fork() failed\n")); 1230 1150 exit(1); 1231 1151 } 1232 1152 1153 smbd_server_conn->msg_ctx = smbd_messaging_context(); 1154 1233 1155 smbd_setup_sig_term_handler(); 1234 smbd_setup_sig_hup_handler(); 1156 smbd_setup_sig_hup_handler(smbd_event_context(), 1157 smbd_server_conn->msg_ctx); 1235 1158 1236 1159 /* Setup all the TDB's - including CLEAR_IF_FIRST tdb's. */ … … 1253 1176 } 1254 1177 1178 if (lp_server_role() == ROLE_DOMAIN_BDC || lp_server_role() == ROLE_DOMAIN_PDC) { 1179 if (!open_schannel_session_store(NULL, lp_private_dir())) { 1180 DEBUG(0,("ERROR: Samba cannot open schannel store for secured NETLOGON operations.\n")); 1181 exit(1); 1182 } 1183 } 1184 1255 1185 if(!get_global_sam_sid()) { 1256 1186 DEBUG(0,("ERROR: Samba cannot create a SAM SID.\n")); … … 1258 1188 } 1259 1189 1260 if (!session_init()) 1261 exit(1); 1190 if (!sessionid_init()) { 1191 exit(1); 1192 } 1262 1193 1263 1194 if (!connections_init(True)) … … 1267 1198 exit(1); 1268 1199 1269 namecache_enable(); 1200 if (!messaging_tdb_parent_init(smbd_event_context())) { 1201 exit(1); 1202 } 1203 1204 if (!notify_internal_parent_init(smbd_event_context())) { 1205 exit(1); 1206 } 1207 1208 if (!serverid_parent_init(smbd_event_context())) { 1209 exit(1); 1210 } 1211 1212 if (!printer_list_parent_init()) { 1213 exit(1); 1214 } 1270 1215 1271 1216 if (!W_ERROR_IS_OK(registry_init_full())) 1272 1217 exit(1); 1273 1218 1274 #if 01275 if (!init_svcctl_db())1276 exit(1);1277 #endif1278 1279 1219 if (!print_backend_init(smbd_messaging_context())) 1280 1220 exit(1); 1281 1282 if (!init_guest_info()) {1283 DEBUG(0,("ERROR: failed to setup guest info.\n"));1284 return -1;1285 }1286 1221 1287 1222 /* Open the share_info.tdb here, so we don't have to open … … 1294 1229 } 1295 1230 1231 status = init_system_info(); 1232 if (!NT_STATUS_IS_OK(status)) { 1233 DEBUG(1, ("ERROR: failed to setup system user info: %s.\n", 1234 nt_errstr(status))); 1235 return -1; 1236 } 1237 1238 if (!init_guest_info()) { 1239 DEBUG(0,("ERROR: failed to setup guest info.\n")); 1240 return -1; 1241 } 1242 1243 if (!file_init(smbd_server_conn)) { 1244 DEBUG(0, ("ERROR: file_init failed\n")); 1245 return -1; 1246 } 1247 1248 if (is_daemon && !interactive) { 1249 const char *rpcsrv_type; 1250 1251 rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM, 1252 "rpc_server", "epmapper", 1253 "none"); 1254 if (StrCaseCmp(rpcsrv_type, "daemon") == 0) { 1255 start_epmd(smbd_event_context(), 1256 smbd_server_conn->msg_ctx); 1257 } 1258 } 1259 1260 if (!dcesrv_ep_setup(smbd_event_context(), smbd_server_conn->msg_ctx)) { 1261 exit(1); 1262 } 1263 1264 /* Publish nt printers, this requires a working winreg pipe */ 1265 pcap_cache_reload(server_event_context(), smbd_messaging_context(), 1266 &reload_printers); 1267 1296 1268 /* only start the background queue daemon if we are 1297 1269 running as a daemon -- bad things will happen if … … 1301 1273 if (is_daemon && !interactive 1302 1274 && lp_parm_bool(-1, "smbd", "backgroundqueue", true)) { 1303 start_background_queue(); 1275 start_background_queue(smbd_event_context(), 1276 smbd_messaging_context()); 1277 } 1278 1279 if (is_daemon && !_lp_disable_spoolss()) { 1280 const char *rpcsrv_type; 1281 1282 /* start spoolss daemon */ 1283 /* start as a separate daemon only if enabled */ 1284 rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM, 1285 "rpc_server", "spoolss", 1286 "embedded"); 1287 if (StrCaseCmp(rpcsrv_type, "daemon") == 0) { 1288 start_spoolssd(smbd_event_context(), 1289 smbd_messaging_context()); 1290 } 1304 1291 } 1305 1292 … … 1323 1310 smbd_setup_sig_chld_handler(); 1324 1311 1325 smbd_process( );1312 smbd_process(smbd_server_conn); 1326 1313 1327 1314 exit_server_cleanly(NULL); … … 1335 1322 parent->interactive = interactive; 1336 1323 1337 if (!open_sockets_smbd(parent, ports))1324 if (!open_sockets_smbd(parent, smbd_messaging_context(), ports)) 1338 1325 exit_server("open_sockets_smbd() failed"); 1339 1326
Note:
See TracChangeset
for help on using the changeset viewer.