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/smbpasswd.c

    r740 r988  
    9898                switch(ch) {
    9999                case 'L':
    100 #if !defined(NSS_WRAPPER)
    101100                        if (getuid() != 0) {
    102101                                fprintf(stderr, "smbpasswd -L can only be used by root.\n");
    103102                                exit(1);
    104103                        }
    105 #endif
    106104                        local_flags |= LOCAL_AM_ROOT;
    107105                        break;
    108106                case 'c':
    109107                        configfile = optarg;
     108                        set_dyn_CONFIGFILE(optarg);
    110109                        break;
    111110                case 'a':
     
    137136                        local_flags |= LOCAL_SET_NO_PASSWORD;
    138137                        local_flags &= ~LOCAL_SET_PASSWORD;
     138                        SAFE_FREE(new_passwd);
    139139                        new_passwd = smb_xstrdup("NO PASSWORD");
    140140                        break;
     
    153153                        break;
    154154                case 'R':
    155                         lp_set_name_resolve_order(optarg);
     155                        lp_set_cmdline("name resolve order", optarg);
    156156                        break;
    157157                case 'D':
     
    196196        }
    197197
    198         if (!lp_load(configfile,True,False,False,True)) {
     198        if (!lp_load_global(configfile)) {
    199199                fprintf(stderr, "Can't load %s - run testparm to debug it\n",
    200200                        configfile);
     
    216216
    217217        p = get_pass("New SMB password:", stdin_get);
     218        if (p == NULL) {
     219                return NULL;
     220        }
    218221
    219222        fstrcpy(new_pw, p);
     
    221224
    222225        p = get_pass("Retype new SMB password:", stdin_get);
     226        if (p == NULL) {
     227                return NULL;
     228        }
    223229
    224230        if (strcmp(p, new_pw)) {
     
    286292                return False;
    287293
    288         return secrets_store_ldap_pw(lp_ldap_admin_dn(), pw);
     294        return secrets_store_ldap_pw(lp_ldap_admin_dn(talloc_tos()), pw);
    289295}
    290296
     
    301307
    302308        if (local_flags & LOCAL_SET_LDAP_ADMIN_PW) {
    303                 char *ldap_admin_dn = lp_ldap_admin_dn();
     309                char *ldap_admin_dn = lp_ldap_admin_dn(talloc_tos());
    304310                if ( ! *ldap_admin_dn ) {
    305311                        DEBUG(0,("ERROR: 'ldap admin dn' not defined! Please check your smb.conf\n"));
     
    310316                if ( ! *ldap_secret ) {
    311317                        new_passwd = prompt_for_new_password(stdin_passwd_get);
     318                        if (new_passwd == NULL) {
     319                                fprintf(stderr, "Failed to read new password!\n");
     320                                exit(1);
     321                        }
    312322                        fstrcpy(ldap_secret, new_passwd);
    313323                }
     
    370380                        SAFE_FREE(new_passwd);
    371381                        new_passwd = smb_xstrdup(user_name);
    372                         strlower_m(new_passwd);
     382                        if (!strlower_m(new_passwd)) {
     383                                fprintf(stderr, "strlower_m %s failed\n",
     384                                        new_passwd);
     385                                exit(1);
     386                        }
    373387                }
    374388
     
    379393
    380394                slprintf(buf, sizeof(buf)-1, "%s$", user_name);
    381                 fstrcpy(user_name, buf);
     395                strlcpy(user_name, buf, sizeof(user_name));
    382396        } else if (local_flags & LOCAL_INTERDOM_ACCOUNT) {
    383397                static fstring buf;
     
    396410                /* prepare uppercased and '$' terminated username */
    397411                slprintf(buf, sizeof(buf) - 1, "%s$", user_name);
    398                 fstrcpy(user_name, buf);
     412                strlcpy(user_name, buf, sizeof(user_name));
    399413
    400414        } else {
     
    533547        if (remote_machine != NULL) {
    534548                old_pw = get_pass("Old SMB password:",stdin_passwd_get);
     549                if (old_pw == NULL) {
     550                        fprintf(stderr, "Unable to get old password.\n");
     551                        exit(1);
     552                }
    535553        }
    536554
     
    580598        }
    581599
    582         load_case_tables();
     600        smb_init_locale();
    583601
    584602        local_flags = process_options(argc, argv, local_flags);
     
    601619
    602620        if (local_flags & LOCAL_AM_ROOT) {
    603                 secrets_init();
    604                 return process_root(local_flags);
    605         }
    606 
    607         ret = process_nonroot(local_flags);
     621                bool ok;
     622
     623                ok = secrets_init();
     624                if (!ok) {
     625                        return 1;
     626                }
     627                ret = process_root(local_flags);
     628        } else {
     629                ret = process_nonroot(local_flags);
     630        }
    608631        TALLOC_FREE(frame);
    609632        return ret;
Note: See TracChangeset for help on using the changeset viewer.