Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/utils/net.c

    r740 r988  
    106106
    107107                trust_pw = get_pass(_("Enter machine password: "), c->opt_stdin);
     108                if (trust_pw == NULL) {
     109                            d_fprintf(stderr,
     110                                      _("Error in reading machine password\n"));
     111                            return 1;
     112                }
    108113
    109114                if (!secrets_store_machine_password(trust_pw, lp_workgroup(), sec_channel_type)) {
     
    244249        }
    245250        else {
    246                 name = global_myname();
     251                name = lp_netbios_name();
    247252        }
    248253
    249254        if(!initialize_password_db(false, NULL)) {
    250                 DEBUG(0, ("WARNING: Could not open passdb - local sid may not reflect passdb\n"
    251                           "backend knowledge (such as the sid stored in LDAP)\n"));
     255                d_fprintf(stderr, _("WARNING: Could not open passdb\n"));
     256                return 1;
    252257        }
    253258
     
    287292        }
    288293
    289         if (!secrets_store_domain_sid(global_myname(), &sid)) {
     294        if (!secrets_store_domain_sid(lp_netbios_name(), &sid)) {
    290295                DEBUG(0,("Can't store domain SID as a pdc/bdc.\n"));
    291296                return 1;
     
    328333
    329334        if(!initialize_password_db(false, NULL)) {
    330                 DEBUG(0, ("WARNING: Could not open passdb - domain SID may "
    331                           "not reflect passdb\n"
    332                           "backend knowledge (such as the SID stored in "
    333                           "LDAP)\n"));
     335                d_fprintf(stderr, _("WARNING: Could not open passdb\n"));
     336                return 1;
    334337        }
    335338
     
    347350        get_global_sam_sid();
    348351
    349         if (!secrets_fetch_domain_sid(global_myname(), &domain_sid)) {
    350                 d_fprintf(stderr, _("Could not fetch local SID\n"));
    351                 return 1;
    352         }
    353         sid_to_fstring(sid_str, &domain_sid);
    354         d_printf(_("SID for local machine %s is: %s\n"),
    355                  global_myname(), sid_str);
    356 
     352        if (!IS_DC) {
     353                if (!secrets_fetch_domain_sid(lp_netbios_name(), &domain_sid)) {
     354                        d_fprintf(stderr, _("Could not fetch local SID\n"));
     355                        return 1;
     356                }
     357                sid_to_fstring(sid_str, &domain_sid);
     358                d_printf(_("SID for local machine %s is: %s\n"),
     359                         lp_netbios_name(), sid_str);
     360        }
    357361        if (!secrets_fetch_domain_sid(c->opt_workgroup, &domain_sid)) {
    358362                d_fprintf(stderr, _("Could not fetch domain SID\n"));
     
    367371
    368372static bool search_maxrid(struct pdb_search *search, const char *type,
    369                           uint32 *max_rid)
     373                          uint32_t *max_rid)
    370374{
    371375        struct samr_displayentry *entries;
    372         uint32 i, num_entries;
     376        uint32_t i, num_entries;
    373377
    374378        if (search == NULL) {
     
    384388}
    385389
    386 static uint32 get_maxrid(void)
    387 {
    388         uint32 max_rid = 0;
     390static uint32_t get_maxrid(void)
     391{
     392        uint32_t max_rid = 0;
    389393
    390394        if (!search_maxrid(pdb_search_users(talloc_tos(), 0), "users", &max_rid))
     
    404408static int net_maxrid(struct net_context *c, int argc, const char **argv)
    405409{
    406         uint32 rid;
     410        uint32_t rid;
    407411
    408412        if (argc != 0) {
     
    740744        },
    741745
     746        {       "notify",
     747                net_notify,
     748                NET_TRANSPORT_LOCAL,
     749                N_("notifyd client code"),
     750                N_("  Use 'net help notify' to get more information about "
     751                   "'net notify' commands.")
     752        },
     753
    742754#ifdef WITH_FAKE_KASERVER
    743755        {       "afs",
     
    764776  main program
    765777****************************************************************************/
    766  int main(int argc, const char **argv)
     778 int main(int argc, char **argv)
    767779{
    768780        int opt,i;
     
    771783        int argc_new = 0;
    772784        const char ** argv_new;
     785        const char **argv_const = discard_const_p(const char *, argv);
    773786        poptContext pc;
    774787        TALLOC_CTX *frame = talloc_stackframe();
     
    783796                {"myname",      'n', POPT_ARG_STRING, &c->opt_requester_name},
    784797                {"server",      'S', POPT_ARG_STRING, &c->opt_host},
    785                 {"encrypt",     'e', POPT_ARG_NONE,   NULL, 'e', N_("Encrypt SMB transport (UNIX extended servers only)") },
     798                {"encrypt",     'e', POPT_ARG_NONE,   NULL, 'e', N_("Encrypt SMB transport") },
    786799                {"container",   'c', POPT_ARG_STRING, &c->opt_container},
    787800                {"comment",     'C', POPT_ARG_STRING, &c->opt_comment},
     
    821834                {"auto", 'a', POPT_ARG_NONE,   &c->opt_auto},
    822835                {"repair", 0, POPT_ARG_NONE,   &c->opt_repair},
     836                /* Options for 'net registry check'*/
     837                {"reg-version", 0, POPT_ARG_INT, &c->opt_reg_version},
     838                {"output", 'o', POPT_ARG_STRING, &c->opt_output},
     839                {"wipe", 0, POPT_ARG_NONE, &c->opt_wipe},
     840                /* Options for 'net registry import' */
     841                {"precheck", 0, POPT_ARG_STRING, &c->opt_precheck},
     842                /* Options for 'net ads join' */
     843                {"no-dns-updates", 0, POPT_ARG_NONE, &c->opt_no_dns_updates},
    823844                POPT_COMMON_SAMBA
    824845                { 0, 0, 0, 0}
     
    829850        setup_logging(argv[0], DEBUG_STDERR);
    830851
    831         load_case_tables();
     852        smb_init_locale();
    832853
    833854        setlocale(LC_ALL, "");
     
    843864        c->private_data = net_func;
    844865
    845         pc = poptGetContext(NULL, argc, (const char **) argv, long_options,
     866        pc = poptGetContext(NULL, argc, argv_const, long_options,
    846867                            POPT_CONTEXT_KEEP_FIRST);
    847868
     
    864885                case 'U':
    865886                        c->opt_user_specified = true;
    866                         c->opt_user_name = SMB_STRDUP(c->opt_user_name);
     887                        c->opt_user_name = talloc_strdup(c, c->opt_user_name);
    867888                        p = strchr(c->opt_user_name,'%');
    868889                        if (p) {
     
    874895                        d_fprintf(stderr, _("\nInvalid option %s: %s\n"),
    875896                                 poptBadOption(pc, 0), poptStrerror(opt));
    876                         net_help(c, argc, argv);
     897                        net_help(c, argc, argv_const);
    877898                        exit(1);
    878899                }
    879900        }
    880901
    881         lp_load(get_dyn_CONFIGFILE(), true, false, false, true);
     902        if (!lp_load_initial_only(get_dyn_CONFIGFILE())) {
     903                d_fprintf(stderr, "Can't load %s - run testparm to debug it\n",
     904                          get_dyn_CONFIGFILE());
     905                exit(1);
     906        }
     907
     908        /*
     909         * Failing to init the msg_ctx isn't a fatal error. Only root-level
     910         * things (joining/leaving domains etc.) will be denied.
     911         */
     912        c->msg_ctx = messaging_init(c, samba_tevent_context_init(c));
     913
     914        if (!lp_load_global(get_dyn_CONFIGFILE())) {
     915                d_fprintf(stderr, "Can't load %s - run testparm to debug it\n",
     916                          get_dyn_CONFIGFILE());
     917                exit(1);
     918        }
     919
     920#if defined(HAVE_BIND_TEXTDOMAIN_CODESET)
     921        /* Bind our gettext results to 'unix charset'
     922           
     923           This ensures that the translations and any embedded strings are in the
     924           same charset.  It won't be the one from the user's locale (we no
     925           longer auto-detect that), but it will be self-consistent.
     926        */
     927        bind_textdomain_codeset(MODULE_NAME, lp_unix_charset());
     928#endif
    882929
    883930        argv_new = (const char **)poptGetArgs(pc);
     
    896943
    897944        if (c->opt_requester_name) {
    898                 set_global_myname(c->opt_requester_name);
     945                lp_set_cmdline("netbios name", c->opt_requester_name);
    899946        }
    900947
     
    904951
    905952        if (!c->opt_workgroup) {
    906                 c->opt_workgroup = smb_xstrdup(lp_workgroup());
     953                c->opt_workgroup = talloc_strdup(c, lp_workgroup());
    907954        }
    908955
    909956        if (!c->opt_target_workgroup) {
    910                 c->opt_target_workgroup = smb_xstrdup(lp_workgroup());
     957                c->opt_target_workgroup = talloc_strdup(c, lp_workgroup());
    911958        }
    912959
     
    931978        }
    932979
    933         /* Failing to init the msg_ctx isn't a fatal error. Only
    934            root-level things (joining/leaving domains etc.) will be denied. */
    935 
    936         c->msg_ctx = messaging_init(c, procid_self(),
    937                                     event_context_init(c));
     980        popt_burn_cmdline_password(argc, argv);
    938981
    939982        rc = net_run_function(c, argc_new-1, argv_new+1, "net", net_func);
Note: See TracChangeset for help on using the changeset viewer.