Changeset 740 for vendor/current/source3/nmbd/nmbd.c
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/nmbd/nmbd.c
r594 r740 5 5 Copyright (C) Jeremy Allison 1997-2002 6 6 Copyright (C) Jelmer Vernooij 2002,2003 (Conversion to popt) 7 7 8 8 This program is free software; you can redistribute it and/or modify 9 9 it under the terms of the GNU General Public License as published by 10 10 the Free Software Foundation; either version 3 of the License, or 11 11 (at your option) any later version. 12 12 13 13 This program is distributed in the hope that it will be useful, 14 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 16 GNU General Public License for more details. 17 17 18 18 You should have received a copy of the GNU General Public License 19 19 along with this program. If not, see <http://www.gnu.org/licenses/>. 20 21 20 */ 22 21 23 22 #include "includes.h" 23 #include "system/filesys.h" 24 #include "popt_common.h" 25 #include "nmbd/nmbd.h" 26 #include "serverid.h" 27 #include "messages.h" 24 28 25 29 int ClientNMB = -1; … … 41 45 struct event_context *nmbd_event_context(void) 42 46 { 43 static struct event_context *ctx; 44 45 if (!ctx && !(ctx = event_context_init(NULL))) { 46 smb_panic("Could not init nmbd event context"); 47 } 48 return ctx; 47 return server_event_context(); 49 48 } 50 49 51 50 struct messaging_context *nmbd_messaging_context(void) 52 51 { 53 static struct messaging_context *ctx; 54 55 if (ctx == NULL) { 56 ctx = messaging_init(NULL, server_id_self(), 57 nmbd_event_context()); 58 } 59 if (ctx == NULL) { 60 DEBUG(0, ("Could not init nmbd messaging context.\n")); 61 } 62 return ctx; 52 struct messaging_context *msg_ctx = server_messaging_context(); 53 if (likely(msg_ctx != NULL)) { 54 return msg_ctx; 55 } 56 smb_panic("Could not init nmbd's messaging context.\n"); 57 return NULL; 63 58 } 64 59 … … 84 79 85 80 gencache_stabilize(); 81 serverid_deregister(procid_self()); 86 82 87 83 pidfile_unlink(); … … 254 250 } 255 251 256 ip = ((struct sockaddr_in *)&iface->ip)->sin_addr; 257 nmask = ((struct sockaddr_in *)&iface->netmask)->sin_addr; 252 ip = ((struct sockaddr_in *)(void *)&iface->ip)->sin_addr; 253 nmask = ((struct sockaddr_in *)(void *) 254 &iface->netmask)->sin_addr; 258 255 259 256 /* … … 263 260 */ 264 261 265 if (is_loopback_addr((struct sockaddr *) &iface->ip)) {262 if (is_loopback_addr((struct sockaddr *)(void *)&iface->ip)) { 266 263 DEBUG(2,("reload_interfaces: Ignoring loopback " 267 264 "interface %s\n", … … 302 299 continue; 303 300 } 304 ip = ((struct sockaddr_in *)&iface->ip)->sin_addr; 305 nmask = ((struct sockaddr_in *)&iface->netmask)->sin_addr; 301 ip = ((struct sockaddr_in *)(void *) 302 &iface->ip)->sin_addr; 303 nmask = ((struct sockaddr_in *)(void *) 304 &iface->netmask)->sin_addr; 306 305 if (ip_equal_v4(ip, subrec->myip) && 307 306 ip_equal_v4(nmask, subrec->mask_ip)) { … … 338 337 * cause us to exit. 339 338 */ 340 saved_handler = CatchSignal( SIGTERM, SIGNAL_CAST SIG_DFL);339 saved_handler = CatchSignal(SIGTERM, SIG_DFL); 341 340 342 341 /* We only count IPv4, non-loopback interfaces here. */ … … 346 345 } 347 346 348 CatchSignal( SIGTERM, SIGNAL_CAST saved_handler);347 CatchSignal(SIGTERM, saved_handler); 349 348 350 349 /* … … 433 432 434 433 in_addr_to_sockaddr_storage(&ss, p->ip); 435 pss = iface_ip((struct sockaddr *) &ss);434 pss = iface_ip((struct sockaddr *)(void *)&ss); 436 435 437 436 if (pss == NULL) { … … 658 657 if (lp_enhanced_browsing()) 659 658 sync_all_dmbs(t); 660 661 /*662 * clear the unexpected packet queue663 */664 665 clear_unexpected(t);666 659 667 660 /* check for new network interfaces */ … … 774 767 { NULL } 775 768 }; 776 TALLOC_CTX *frame = talloc_stackframe(); /* Setup tos. */ 769 TALLOC_CTX *frame; 770 NTSTATUS status; 771 772 /* 773 * Do this before any other talloc operation 774 */ 775 talloc_enable_null_tracking(); 776 frame = talloc_stackframe(); 777 777 778 778 load_case_tables(); … … 850 850 exit(1); 851 851 } 852 853 setup_logging( argv[0], log_stdout ); 852 if (log_stdout) { 853 setup_logging( argv[0], DEBUG_STDOUT); 854 } else { 855 setup_logging( argv[0], DEBUG_FILE); 856 } 854 857 855 858 reopen_logs(); … … 889 892 if (is_daemon && !opt_interactive) { 890 893 DEBUG( 2, ( "Becoming a daemon.\n" ) ); 891 become_daemon(Fork, no_process_group );894 become_daemon(Fork, no_process_group, log_stdout); 892 895 } 893 896 … … 919 922 pidfile_create("nmbd"); 920 923 921 if (!NT_STATUS_IS_OK(reinit_after_fork(nmbd_messaging_context(), 922 nmbd_event_context(), false))) { 924 status = reinit_after_fork(nmbd_messaging_context(), 925 nmbd_event_context(), 926 procid_self(), false); 927 928 if (!NT_STATUS_IS_OK(status)) { 923 929 DEBUG(0,("reinit_after_fork() failed\n")); 924 930 exit(1); … … 931 937 932 938 /* get broadcast messages */ 933 claim_connection(NULL,"",FLAG_MSG_GENERAL|FLAG_MSG_DBWRAP); 939 940 if (!serverid_register(procid_self(), 941 FLAG_MSG_GENERAL|FLAG_MSG_DBWRAP)) { 942 DEBUG(1, ("Could not register myself in serverid.tdb\n")); 943 exit(1); 944 } 934 945 935 946 messaging_register(nmbd_messaging_context(), NULL, … … 1000 1011 } 1001 1012 1013 if (!nmbd_init_packet_server()) { 1014 kill_async_dns_child(); 1015 exit(1); 1016 } 1017 1002 1018 TALLOC_FREE(frame); 1003 1019 process(); 1004 1020 1005 if (dbf)1006 x_fclose(dbf);1007 1021 kill_async_dns_child(); 1008 1022 return(0);
Note:
See TracChangeset
for help on using the changeset viewer.