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/source4/smbd/server.c

    r414 r740  
    3232#include "ntptr/ntptr.h"
    3333#include "auth/gensec/gensec.h"
     34#include "libcli/auth/schannel.h"
    3435#include "smbd/process_model.h"
    3536#include "param/secrets.h"
     
    4142#include "librpc/gen_ndr/ndr_irpc.h"
    4243#include "cluster/cluster.h"
     44#include "dynconfig/dynconfig.h"
    4345
    4446/*
     
    116118#endif
    117119        DEBUG(0,("Exiting pid %d on SIGTERM\n", (int)getpid()));
    118         exit(0);
     120        exit(127);
    119121}
    120122
     
    141143
    142144        /* POSIX demands that signals are inherited. If the invoking process has
    143          * these signals masked, we will have problems, as we won't recieve them. */
     145         * these signals masked, we will have problems, as we won't receive them. */
    144146        BlockSignals(false, SIGHUP);
    145147        BlockSignals(false, SIGTERM);
     
    177179{
    178180        const char *binary_name = (const char *)private_data;
    179         DEBUG(0,("%s: maximum runtime exceeded - terminating\n", binary_name));
     181        struct timeval tv;
     182        struct timezone tz;
     183        if (gettimeofday(&tv, &tz) == 0) {
     184                DEBUG(0,("%s: maximum runtime exceeded - terminating, current ts: %d\n", binary_name, (int)tv.tv_sec));
     185        } else {
     186                DEBUG(0,("%s: maximum runtime exceeded - terminating\n", binary_name));
     187        }
    180188        exit(0);
    181189}
    182190
    183191/*
    184   pre-open the sam ldb to ensure the schema has been loaded. This
    185   saves a lot of time in child processes 
     192  pre-open the key databases. This saves a lot of time in child
     193  processes
    186194 */
    187 static void prime_samdb_schema(struct tevent_context *event_ctx)
    188 {
    189         TALLOC_CTX *samdb_context;
    190         samdb_context = talloc_new(event_ctx);
    191         samdb_connect(samdb_context, event_ctx, cmdline_lp_ctx, system_session(samdb_context, cmdline_lp_ctx));
    192         talloc_free(samdb_context);
     195static void prime_ldb_databases(struct tevent_context *event_ctx)
     196{
     197        TALLOC_CTX *db_context;
     198        db_context = talloc_new(event_ctx);
     199
     200        samdb_connect(db_context, event_ctx, cmdline_lp_ctx, system_session(cmdline_lp_ctx), 0);
     201        privilege_connect(db_context, cmdline_lp_ctx);
     202
     203        /* we deliberately leave these open, which allows them to be
     204         * re-used in ldb_wrap_connect() */
    193205}
    194206
     
    214226
    215227        msg = messaging_init(talloc_autofree_context(),
    216                              lp_messaging_path(event_ctx, lp_ctx),
    217                              cluster_id(0, SAMBA_PARENT_TASKID),
    218                              lp_iconv_convenience(lp_ctx),
    219                              event_ctx);
     228                             lpcfg_messaging_path(event_ctx, lp_ctx),
     229                             cluster_id(0, SAMBA_PARENT_TASKID), event_ctx);
    220230        NT_STATUS_HAVE_NO_MEMORY(msg);
    221231
     
    229239
    230240
     241/*
     242  show build info
     243 */
     244static void show_build(void)
     245{
     246#define CONFIG_OPTION(n) { #n, dyn_ ## n }
     247        struct {
     248                const char *name;
     249                const char *value;
     250        } config_options[] = {
     251                CONFIG_OPTION(BINDIR),
     252                CONFIG_OPTION(SBINDIR),
     253                CONFIG_OPTION(CONFIGFILE),
     254                CONFIG_OPTION(NCALRPCDIR),
     255                CONFIG_OPTION(LOGFILEBASE),
     256                CONFIG_OPTION(LMHOSTSFILE),
     257                CONFIG_OPTION(DATADIR),
     258                CONFIG_OPTION(MODULESDIR),
     259                CONFIG_OPTION(LOCKDIR),
     260                CONFIG_OPTION(PIDDIR),
     261                CONFIG_OPTION(PRIVATE_DIR),
     262                CONFIG_OPTION(SWATDIR),
     263                CONFIG_OPTION(CODEPAGEDIR),
     264                CONFIG_OPTION(SETUPDIR),
     265                CONFIG_OPTION(WINBINDD_SOCKET_DIR),
     266                CONFIG_OPTION(WINBINDD_PRIVILEGED_SOCKET_DIR),
     267                CONFIG_OPTION(NTP_SIGND_SOCKET_DIR),
     268                { NULL, NULL}
     269        };
     270        int i;
     271
     272        printf("Samba version: %s\n", SAMBA_VERSION_STRING);
     273        printf("Build environment:\n");
     274#ifdef BUILD_SYSTEM
     275        printf("   Build host:  %s\n", BUILD_SYSTEM);
     276#endif
     277
     278        printf("Paths:\n");
     279        for (i=0; config_options[i].name; i++) {
     280                printf("   %s: %s\n", config_options[i].name, config_options[i].value);
     281        }
     282
     283        exit(0);
     284}
    231285
    232286/*
     
    239293        int opt;
    240294        poptContext pc;
    241         extern NTSTATUS server_service_wrepl_init(void);
    242         extern NTSTATUS server_service_kdc_init(void);
    243         extern NTSTATUS server_service_ldap_init(void);
    244         extern NTSTATUS server_service_web_init(void);
    245         extern NTSTATUS server_service_ldap_init(void);
    246         extern NTSTATUS server_service_winbind_init(void);
    247         extern NTSTATUS server_service_nbtd_init(void);
    248         extern NTSTATUS server_service_auth_init(void);
    249         extern NTSTATUS server_service_cldapd_init(void);
    250         extern NTSTATUS server_service_smb_init(void);
    251         extern NTSTATUS server_service_drepl_init(void);
    252         extern NTSTATUS server_service_kcc_init(void);
    253         extern NTSTATUS server_service_rpc_init(void);
    254         extern NTSTATUS server_service_ntp_signd_init(void);
    255         extern NTSTATUS server_service_samba3_smb_init(void);
     295#define _MODULE_PROTO(init) extern NTSTATUS init(void);
     296        STATIC_service_MODULES_PROTO;
    256297        init_module_fn static_init[] = { STATIC_service_MODULES };
    257298        init_module_fn *shared_init;
     
    264305                OPT_DAEMON = 1000,
    265306                OPT_INTERACTIVE,
    266                 OPT_PROCESS_MODEL
     307                OPT_PROCESS_MODEL,
     308                OPT_SHOW_BUILD
    267309        };
    268310        struct poptOption long_options[] = {
     
    276318                {"maximum-runtime",0, POPT_ARG_INT, &max_runtime, 0,
    277319                 "set maximum runtime of the server process, till autotermination", "seconds"},
     320                {"show-build", 'b', POPT_ARG_NONE, NULL, OPT_SHOW_BUILD, "show build info", NULL },
    278321                POPT_COMMON_SAMBA
    279322                POPT_COMMON_VERSION
     
    293336                        model = poptGetOptArg(pc);
    294337                        break;
     338                case OPT_SHOW_BUILD:
     339                        show_build();
     340                        break;
    295341                default:
    296342                        fprintf(stderr, "\nInvalid option %s: %s\n\n",
    297343                                  poptBadOption(pc, 0), poptStrerror(opt));
    298344                        poptPrintUsage(pc, stderr, 0);
    299                         exit(1);
     345                        return 1;
    300346                }
    301347        }
     
    305351                          "Option -i|--interactive is not allowed together with -D|--daemon\n\n");
    306352                poptPrintUsage(pc, stderr, 0);
    307                 exit(1);
     353                return 1;
    308354        } else if (!opt_interactive) {
    309355                /* default is --daemon */
     
    321367
    322368        DEBUG(0,("%s version %s started.\n", binary_name, SAMBA_VERSION_STRING));
    323         DEBUGADD(0,("Copyright Andrew Tridgell and the Samba Team 1992-2009\n"));
     369        DEBUGADD(0,("Copyright Andrew Tridgell and the Samba Team 1992-2011\n"));
    324370
    325371        if (sizeof(uint16_t) < 2 || sizeof(uint32_t) < 4 || sizeof(uint64_t) < 8) {
     
    327373                DEBUGADD(0,("sizeof(uint16_t) = %u, sizeof(uint32_t) %u, sizeof(uint64_t) = %u\n",
    328374                            (unsigned int)sizeof(uint16_t), (unsigned int)sizeof(uint32_t), (unsigned int)sizeof(uint64_t)));
    329                 exit(1);
     375                return 1;
    330376        }
    331377
    332378        if (opt_daemon) {
    333379                DEBUG(3,("Becoming a daemon.\n"));
    334                 become_daemon(true, false);
     380                become_daemon(true, false, false);
    335381        }
    336382
    337383        cleanup_tmp_files(cmdline_lp_ctx);
    338384
    339         if (!directory_exist(lp_lockdir(cmdline_lp_ctx))) {
    340                 mkdir(lp_lockdir(cmdline_lp_ctx), 0755);
    341         }
    342 
    343         pidfile_create(lp_piddir(cmdline_lp_ctx), binary_name);
     385        if (!directory_exist(lpcfg_lockdir(cmdline_lp_ctx))) {
     386                mkdir(lpcfg_lockdir(cmdline_lp_ctx), 0755);
     387        }
     388
     389        pidfile_create(lpcfg_piddir(cmdline_lp_ctx), binary_name);
    344390
    345391        /* Do *not* remove this, until you have removed
     
    347393        /* Setup the SECRETS subsystem */
    348394        if (secrets_init(talloc_autofree_context(), cmdline_lp_ctx) == NULL) {
    349                 exit(1);
     395                return 1;
     396        }
     397
     398        if (lpcfg_server_role(cmdline_lp_ctx) == ROLE_DOMAIN_CONTROLLER) {
     399                if (!open_schannel_session_store(talloc_autofree_context(), lpcfg_private_dir(cmdline_lp_ctx))) {
     400                        DEBUG(0,("ERROR: Samba cannot open schannel store for secured NETLOGON operations.\n"));
     401                        exit(1);
     402                }
    350403        }
    351404
     
    393446
    394447        if (max_runtime) {
     448                struct timeval tv;
     449                struct timezone tz;
     450
     451                if (gettimeofday(&tv, &tz) == 0) {
     452                        DEBUG(0,("Called with maxruntime %d - current ts %d\n", max_runtime, (int)tv.tv_sec));
     453                } else {
     454                        DEBUG(0,("Called with maxruntime %d\n", max_runtime));
     455                }
    395456                tevent_add_timer(event_ctx, event_ctx,
    396457                                 timeval_current_ofs(max_runtime, 0),
     
    399460        }
    400461
    401         prime_samdb_schema(event_ctx);
     462        prime_ldb_databases(event_ctx);
    402463
    403464        status = setup_parent_messaging(event_ctx, cmdline_lp_ctx);
     
    410471
    411472        status = server_service_startup(event_ctx, cmdline_lp_ctx, model,
    412                                         lp_server_services(cmdline_lp_ctx));
     473                                        lpcfg_server_services(cmdline_lp_ctx));
    413474        if (!NT_STATUS_IS_OK(status)) {
    414475                DEBUG(0,("Starting Services failed - %s\n", nt_errstr(status)));
Note: See TracChangeset for help on using the changeset viewer.