Ignore:
Timestamp:
Jul 11, 2008, 1:13:42 AM (17 years ago)
Author:
Paul Smedley
Message:

Update branch to 3.0.31 release

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.0/source/utils/net.c

    r134 r140  
    182182                                        opt_password, 0, Undefined, NULL);
    183183
    184         if (NT_STATUS_IS_OK(nt_status)) {
     184        if (NT_STATUS_IS_OK(nt_status) ||
     185            NT_STATUS_EQUAL(nt_status, NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT) ||
     186            NT_STATUS_EQUAL(nt_status, NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT) ||
     187            NT_STATUS_EQUAL(nt_status, NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT)) {
    185188                return nt_status;
    186         } else {
    187                 d_fprintf(stderr, "Could not connect to server %s\n", server_name);
    188 
    189                 /* Display a nicer message depending on the result */
    190 
    191                 if (NT_STATUS_V(nt_status) ==
    192                     NT_STATUS_V(NT_STATUS_LOGON_FAILURE))
    193                         d_fprintf(stderr, "The username or password was not correct.\n");
    194 
    195                 if (NT_STATUS_V(nt_status) ==
    196                     NT_STATUS_V(NT_STATUS_ACCOUNT_LOCKED_OUT))
    197                         d_fprintf(stderr, "The account was locked out.\n");
    198 
    199                 if (NT_STATUS_V(nt_status) ==
    200                     NT_STATUS_V(NT_STATUS_ACCOUNT_DISABLED))
    201                         d_fprintf(stderr, "The account was disabled.\n");
    202 
    203                 return nt_status;
    204         }
     189        }
     190
     191        d_fprintf(stderr, "Could not connect to server %s\n", server_name);
     192
     193        /* Display a nicer message depending on the result */
     194
     195        if (NT_STATUS_V(nt_status) ==
     196            NT_STATUS_V(NT_STATUS_LOGON_FAILURE))
     197                d_fprintf(stderr, "The username or password was not correct.\n");
     198
     199        if (NT_STATUS_V(nt_status) ==
     200            NT_STATUS_V(NT_STATUS_ACCOUNT_LOCKED_OUT))
     201                d_fprintf(stderr, "The account was locked out.\n");
     202
     203        if (NT_STATUS_V(nt_status) ==
     204            NT_STATUS_V(NT_STATUS_ACCOUNT_DISABLED))
     205                d_fprintf(stderr, "The account was disabled.\n");
     206
     207        return nt_status;
    205208}
    206209
     
    482485        struct in_addr server_ip;
    483486        struct cli_state *cli = NULL;
    484         NTSTATUS nt_status;
     487        NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
    485488
    486489        if ( !server || !ip ) {
     
    494497        }
    495498
     499        if (opt_user_name && opt_password) {
     500                nt_status = connect_to_ipc(&cli, &server_ip, server_name);
     501                if (NT_STATUS_IS_OK(nt_status)) {
     502                        goto connected;
     503                }
     504        }
    496505        if (flags & NET_FLAGS_ANONYMOUS) {
    497506                nt_status = connect_to_ipc_anonymous(&cli, &server_ip, server_name);
    498         } else {
    499                 nt_status = connect_to_ipc(&cli, &server_ip, server_name);
    500         }
    501 
     507                if (NT_STATUS_IS_OK(nt_status)) {
     508                        goto connected;
     509                }
     510        }
     511
     512        SAFE_FREE(server_name);
     513        d_fprintf(stderr, "Connection failed: %s\n",
     514                  nt_errstr(nt_status));
     515        return NULL;
     516
     517 connected:
    502518        /* store the server in the affinity cache if it was a PDC */
    503519
     
    505521                saf_store( cli->server_domain, cli->desthost );
    506522
    507         SAFE_FREE(server_name);
    508         if (NT_STATUS_IS_OK(nt_status)) {
    509                 return cli;
    510         } else {
    511                 d_fprintf(stderr, "Connection failed: %s\n",
    512                           nt_errstr(nt_status));
    513                 return NULL;
    514         }
     523        return cli;
    515524}
    516525
Note: See TracChangeset for help on using the changeset viewer.