Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/nmbd/nmbd.c

    r594 r740  
    55   Copyright (C) Jeremy Allison 1997-2002
    66   Copyright (C) Jelmer Vernooij 2002,2003 (Conversion to popt)
    7    
     7
    88   This program is free software; you can redistribute it and/or modify
    99   it under the terms of the GNU General Public License as published by
    1010   the Free Software Foundation; either version 3 of the License, or
    1111   (at your option) any later version.
    12    
     12
    1313   This program is distributed in the hope that it will be useful,
    1414   but WITHOUT ANY WARRANTY; without even the implied warranty of
    1515   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1616   GNU General Public License for more details.
    17    
     17
    1818   You should have received a copy of the GNU General Public License
    1919   along with this program.  If not, see <http://www.gnu.org/licenses/>.
    20    
    2120*/
    2221
    2322#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"
    2428
    2529int ClientNMB       = -1;
     
    4145struct event_context *nmbd_event_context(void)
    4246{
    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();
    4948}
    5049
    5150struct messaging_context *nmbd_messaging_context(void)
    5251{
    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;
    6358}
    6459
     
    8479
    8580        gencache_stabilize();
     81        serverid_deregister(procid_self());
    8682
    8783        pidfile_unlink();
     
    254250                }
    255251
    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;
    258255
    259256                /*
     
    263260                 */
    264261
    265                 if (is_loopback_addr((struct sockaddr *)&iface->ip)) {
     262                if (is_loopback_addr((struct sockaddr *)(void *)&iface->ip)) {
    266263                        DEBUG(2,("reload_interfaces: Ignoring loopback "
    267264                                "interface %s\n",
     
    302299                                continue;
    303300                        }
    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;
    306305                        if (ip_equal_v4(ip, subrec->myip) &&
    307306                            ip_equal_v4(nmask, subrec->mask_ip)) {
     
    338337                 * cause us to exit.
    339338                 */
    340                 saved_handler = CatchSignal( SIGTERM, SIGNAL_CAST SIG_DFL );
     339                saved_handler = CatchSignal(SIGTERM, SIG_DFL);
    341340
    342341                /* We only count IPv4, non-loopback interfaces here. */
     
    346345                }
    347346
    348                 CatchSignal( SIGTERM, SIGNAL_CAST saved_handler );
     347                CatchSignal(SIGTERM, saved_handler);
    349348
    350349                /*
     
    433432
    434433        in_addr_to_sockaddr_storage(&ss, p->ip);
    435         pss = iface_ip((struct sockaddr *)&ss);
     434        pss = iface_ip((struct sockaddr *)(void *)&ss);
    436435
    437436        if (pss == NULL) {
     
    658657                if (lp_enhanced_browsing())
    659658                        sync_all_dmbs(t);
    660 
    661                 /*
    662                  * clear the unexpected packet queue
    663                  */
    664 
    665                 clear_unexpected(t);
    666659
    667660                /* check for new network interfaces */
     
    774767        { NULL }
    775768        };
    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();
    777777
    778778        load_case_tables();
     
    850850                exit(1);
    851851        }
    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        }
    854857
    855858        reopen_logs();
     
    889892        if (is_daemon && !opt_interactive) {
    890893                DEBUG( 2, ( "Becoming a daemon.\n" ) );
    891                 become_daemon(Fork, no_process_group);
     894                become_daemon(Fork, no_process_group, log_stdout);
    892895        }
    893896
     
    919922        pidfile_create("nmbd");
    920923
    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)) {
    923929                DEBUG(0,("reinit_after_fork() failed\n"));
    924930                exit(1);
     
    931937
    932938        /* 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        }
    934945
    935946        messaging_register(nmbd_messaging_context(), NULL,
     
    10001011        }
    10011012
     1013        if (!nmbd_init_packet_server()) {
     1014                kill_async_dns_child();
     1015                exit(1);
     1016        }
     1017
    10021018        TALLOC_FREE(frame);
    10031019        process();
    10041020
    1005         if (dbf)
    1006                 x_fclose(dbf);
    10071021        kill_async_dns_child();
    10081022        return(0);
Note: See TracChangeset for help on using the changeset viewer.