Changeset 988 for vendor/current/source3/utils/net.c
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/utils/net.c
r740 r988 106 106 107 107 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 } 108 113 109 114 if (!secrets_store_machine_password(trust_pw, lp_workgroup(), sec_channel_type)) { … … 244 249 } 245 250 else { 246 name = global_myname();251 name = lp_netbios_name(); 247 252 } 248 253 249 254 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; 252 257 } 253 258 … … 287 292 } 288 293 289 if (!secrets_store_domain_sid( global_myname(), &sid)) {294 if (!secrets_store_domain_sid(lp_netbios_name(), &sid)) { 290 295 DEBUG(0,("Can't store domain SID as a pdc/bdc.\n")); 291 296 return 1; … … 328 333 329 334 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; 334 337 } 335 338 … … 347 350 get_global_sam_sid(); 348 351 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 } 357 361 if (!secrets_fetch_domain_sid(c->opt_workgroup, &domain_sid)) { 358 362 d_fprintf(stderr, _("Could not fetch domain SID\n")); … … 367 371 368 372 static bool search_maxrid(struct pdb_search *search, const char *type, 369 uint32 *max_rid)373 uint32_t *max_rid) 370 374 { 371 375 struct samr_displayentry *entries; 372 uint32 i, num_entries;376 uint32_t i, num_entries; 373 377 374 378 if (search == NULL) { … … 384 388 } 385 389 386 static uint32 get_maxrid(void)387 { 388 uint32 max_rid = 0;390 static uint32_t get_maxrid(void) 391 { 392 uint32_t max_rid = 0; 389 393 390 394 if (!search_maxrid(pdb_search_users(talloc_tos(), 0), "users", &max_rid)) … … 404 408 static int net_maxrid(struct net_context *c, int argc, const char **argv) 405 409 { 406 uint32 rid;410 uint32_t rid; 407 411 408 412 if (argc != 0) { … … 740 744 }, 741 745 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 742 754 #ifdef WITH_FAKE_KASERVER 743 755 { "afs", … … 764 776 main program 765 777 ****************************************************************************/ 766 int main(int argc, c onst char **argv)778 int main(int argc, char **argv) 767 779 { 768 780 int opt,i; … … 771 783 int argc_new = 0; 772 784 const char ** argv_new; 785 const char **argv_const = discard_const_p(const char *, argv); 773 786 poptContext pc; 774 787 TALLOC_CTX *frame = talloc_stackframe(); … … 783 796 {"myname", 'n', POPT_ARG_STRING, &c->opt_requester_name}, 784 797 {"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") }, 786 799 {"container", 'c', POPT_ARG_STRING, &c->opt_container}, 787 800 {"comment", 'C', POPT_ARG_STRING, &c->opt_comment}, … … 821 834 {"auto", 'a', POPT_ARG_NONE, &c->opt_auto}, 822 835 {"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}, 823 844 POPT_COMMON_SAMBA 824 845 { 0, 0, 0, 0} … … 829 850 setup_logging(argv[0], DEBUG_STDERR); 830 851 831 load_case_tables();852 smb_init_locale(); 832 853 833 854 setlocale(LC_ALL, ""); … … 843 864 c->private_data = net_func; 844 865 845 pc = poptGetContext(NULL, argc, (const char **) argv, long_options,866 pc = poptGetContext(NULL, argc, argv_const, long_options, 846 867 POPT_CONTEXT_KEEP_FIRST); 847 868 … … 864 885 case 'U': 865 886 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); 867 888 p = strchr(c->opt_user_name,'%'); 868 889 if (p) { … … 874 895 d_fprintf(stderr, _("\nInvalid option %s: %s\n"), 875 896 poptBadOption(pc, 0), poptStrerror(opt)); 876 net_help(c, argc, argv );897 net_help(c, argc, argv_const); 877 898 exit(1); 878 899 } 879 900 } 880 901 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 882 929 883 930 argv_new = (const char **)poptGetArgs(pc); … … 896 943 897 944 if (c->opt_requester_name) { 898 set_global_myname(c->opt_requester_name);945 lp_set_cmdline("netbios name", c->opt_requester_name); 899 946 } 900 947 … … 904 951 905 952 if (!c->opt_workgroup) { 906 c->opt_workgroup = smb_xstrdup(lp_workgroup());953 c->opt_workgroup = talloc_strdup(c, lp_workgroup()); 907 954 } 908 955 909 956 if (!c->opt_target_workgroup) { 910 c->opt_target_workgroup = smb_xstrdup(lp_workgroup());957 c->opt_target_workgroup = talloc_strdup(c, lp_workgroup()); 911 958 } 912 959 … … 931 978 } 932 979 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); 938 981 939 982 rc = net_run_function(c, argc_new-1, argv_new+1, "net", net_func);
Note:
See TracChangeset
for help on using the changeset viewer.