Ignore:
Timestamp:
Nov 25, 2016, 8:04:54 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.7

File:
1 edited

Legend:

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

    r988 r989  
    106106        static char *savedun;
    107107        static char *savedpw;
    108         char tmp[128];
    109108
    110109        if (hasasked) {
     
    116115        hasasked = true;
    117116
    118         if (!opt.nonprompt && !opt.username_specified) {
    119                 printf("Username for %s at %s [guest] ", shr, srv);
    120                 if (fgets(tmp, sizeof(tmp), stdin) == NULL) {
    121                         return;
    122                 }
    123                 if ((strlen(tmp) > 0) && (tmp[strlen(tmp) - 1] == '\n')) {
    124                         tmp[strlen(tmp) - 1] = '\0';
    125                 }
    126                 strncpy(un, tmp, unlen - 1);
    127         } else if (opt.username != NULL) {
     117        /*
     118         * If no user has been specified un is initialized with the current
     119         * username of the user who started smbget.
     120         */
     121        if (opt.username_specified) {
    128122                strncpy(un, opt.username, unlen - 1);
    129123        }
    130124
    131         if (!opt.nonprompt && !opt.password_specified) {
     125        if (!opt.nonprompt && !opt.password_specified && pw[0] == '\0') {
    132126                char *prompt;
    133                 if (asprintf(&prompt, "Password for %s at %s: ", shr, srv) ==
    134                     -1) {
     127                int rc;
     128
     129                rc = asprintf(&prompt,
     130                              "Password for [%s] connecting to //%s/%s: ",
     131                              un, shr, srv);
     132                if (rc == -1) {
    135133                        return;
    136134                }
Note: See TracChangeset for help on using the changeset viewer.