Changeset 745 for trunk/server/source3/nmbd/nmbd.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/nmbd/nmbd.c
r596 r745 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; … … 45 49 struct event_context *nmbd_event_context(void) 46 50 { 47 static struct event_context *ctx; 48 49 if (!ctx && !(ctx = event_context_init(NULL))) { 50 smb_panic("Could not init nmbd event context"); 51 } 52 return ctx; 51 return server_event_context(); 53 52 } 54 53 55 54 struct messaging_context *nmbd_messaging_context(void) 56 55 { 57 static struct messaging_context *ctx; 58 59 if (ctx == NULL) { 60 ctx = messaging_init(NULL, server_id_self(), 61 nmbd_event_context()); 62 } 63 if (ctx == NULL) { 64 DEBUG(0, ("Could not init nmbd messaging context.\n")); 65 } 66 return ctx; 56 struct messaging_context *msg_ctx = server_messaging_context(); 57 if (likely(msg_ctx != NULL)) { 58 return msg_ctx; 59 } 60 smb_panic("Could not init nmbd's messaging context.\n"); 61 return NULL; 67 62 } 68 63 … … 88 83 89 84 gencache_stabilize(); 85 serverid_deregister(procid_self()); 90 86 91 87 pidfile_unlink(); … … 258 254 } 259 255 260 ip = ((struct sockaddr_in *)&iface->ip)->sin_addr; 261 nmask = ((struct sockaddr_in *)&iface->netmask)->sin_addr; 256 ip = ((struct sockaddr_in *)(void *)&iface->ip)->sin_addr; 257 nmask = ((struct sockaddr_in *)(void *) 258 &iface->netmask)->sin_addr; 262 259 263 260 /* … … 267 264 */ 268 265 269 if (is_loopback_addr((struct sockaddr *) &iface->ip)) {266 if (is_loopback_addr((struct sockaddr *)(void *)&iface->ip)) { 270 267 DEBUG(2,("reload_interfaces: Ignoring loopback " 271 268 "interface %s\n", … … 306 303 continue; 307 304 } 308 ip = ((struct sockaddr_in *)&iface->ip)->sin_addr; 309 nmask = ((struct sockaddr_in *)&iface->netmask)->sin_addr; 305 ip = ((struct sockaddr_in *)(void *) 306 &iface->ip)->sin_addr; 307 nmask = ((struct sockaddr_in *)(void *) 308 &iface->netmask)->sin_addr; 310 309 if (ip_equal_v4(ip, subrec->myip) && 311 310 ip_equal_v4(nmask, subrec->mask_ip)) { … … 342 341 * cause us to exit. 343 342 */ 344 saved_handler = CatchSignal( SIGTERM, SIGNAL_CAST SIG_DFL);343 saved_handler = CatchSignal(SIGTERM, SIG_DFL); 345 344 346 345 /* We only count IPv4, non-loopback interfaces here. */ … … 350 349 } 351 350 352 CatchSignal( SIGTERM, SIGNAL_CAST saved_handler);351 CatchSignal(SIGTERM, saved_handler); 353 352 354 353 /* … … 447 446 448 447 in_addr_to_sockaddr_storage(&ss, p->ip); 449 pss = iface_ip((struct sockaddr *) &ss);448 pss = iface_ip((struct sockaddr *)(void *)&ss); 450 449 451 450 if (pss == NULL) { … … 672 671 if (lp_enhanced_browsing()) 673 672 sync_all_dmbs(t); 674 675 /*676 * clear the unexpected packet queue677 */678 679 clear_unexpected(t);680 673 681 674 /* check for new network interfaces */ … … 788 781 { NULL } 789 782 }; 790 TALLOC_CTX *frame = talloc_stackframe(); /* Setup tos. */ 783 TALLOC_CTX *frame; 784 NTSTATUS status; 785 786 /* 787 * Do this before any other talloc operation 788 */ 789 talloc_enable_null_tracking(); 790 frame = talloc_stackframe(); 791 791 792 792 #ifdef __OS2__ … … 868 868 exit(1); 869 869 } 870 871 setup_logging( argv[0], log_stdout ); 870 if (log_stdout) { 871 setup_logging( argv[0], DEBUG_STDOUT); 872 } else { 873 setup_logging( argv[0], DEBUG_FILE); 874 } 872 875 873 876 reopen_logs(); … … 907 910 if (is_daemon && !opt_interactive) { 908 911 DEBUG( 2, ( "Becoming a daemon.\n" ) ); 909 become_daemon(Fork, no_process_group );912 become_daemon(Fork, no_process_group, log_stdout); 910 913 } 911 914 … … 937 940 pidfile_create("nmbd"); 938 941 939 if (!NT_STATUS_IS_OK(reinit_after_fork(nmbd_messaging_context(), 940 nmbd_event_context(), false))) { 942 status = reinit_after_fork(nmbd_messaging_context(), 943 nmbd_event_context(), 944 procid_self(), false); 945 946 if (!NT_STATUS_IS_OK(status)) { 941 947 DEBUG(0,("reinit_after_fork() failed\n")); 942 948 exit(1); … … 949 955 950 956 /* get broadcast messages */ 951 claim_connection(NULL,"",FLAG_MSG_GENERAL|FLAG_MSG_DBWRAP); 957 958 if (!serverid_register(procid_self(), 959 FLAG_MSG_GENERAL|FLAG_MSG_DBWRAP)) { 960 DEBUG(1, ("Could not register myself in serverid.tdb\n")); 961 exit(1); 962 } 952 963 953 964 messaging_register(nmbd_messaging_context(), NULL, … … 1018 1029 } 1019 1030 1031 if (!nmbd_init_packet_server()) { 1032 kill_async_dns_child(); 1033 exit(1); 1034 } 1035 1020 1036 TALLOC_FREE(frame); 1021 1037 process(); 1022 1038 1023 if (dbf)1024 x_fclose(dbf);1025 1039 kill_async_dns_child(); 1026 1040 return(0);
Note:
See TracChangeset
for help on using the changeset viewer.