Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source3/rpc_client/cli_netlogon.c

    r596 r745  
    2222
    2323#include "includes.h"
     24
    2425#include "../libcli/auth/libcli_auth.h"
    25 #include "../librpc/gen_ndr/cli_netlogon.h"
     26#include "../librpc/gen_ndr/ndr_netlogon_c.h"
     27#include "rpc_client/cli_netlogon.h"
     28#include "rpc_client/init_netlogon.h"
     29#include "rpc_client/util_netlogon.h"
     30#include "../libcli/security/security.h"
    2631
    2732/****************************************************************************
     
    4045                                     uint32_t *neg_flags_inout)
    4146{
     47
    4248        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
    4349        struct netr_Credential clnt_chal_send;
     
    4753        fstring mach_acct;
    4854        uint32_t neg_flags = *neg_flags_inout;
     55
    4956
    5057        if (!ndr_syntax_id_equal(&cli->abstract_syntax,
     
    6572
    6673        /* Get the server challenge. */
    67         result = rpccli_netr_ServerReqChallenge(cli, talloc_tos(),
     74        , talloc_tos(),
    6875                                                cli->srv_name_slash,
    6976                                                clnt_name,
    7077                                                &clnt_chal_send,
    71                                                 &srv_chal_recv);
     78                                                &srv_chal_recv,
     79                                                &result);
     80        if (!NT_STATUS_IS_OK(status)) {
     81                return status;
     82        }
    7283        if (!NT_STATUS_IS_OK(result)) {
    7384                return result;
     
    7586
    7687        /* Calculate the session key and client credentials */
    77        
     88
    7889        cli->dc = netlogon_creds_client_init(cli,
    7990                                    mach_acct,
     
    93104         */
    94105
    95         result = rpccli_netr_ServerAuthenticate2(cli, talloc_tos(),
     106        , talloc_tos(),
    96107                                                 cli->srv_name_slash,
    97108                                                 cli->dc->account_name,
     
    100111                                                 &clnt_chal_send, /* input. */
    101112                                                 &srv_chal_recv, /* output. */
    102                                                  &neg_flags);
    103 
     113                                                 &neg_flags,
     114                                                 &result);
     115        if (!NT_STATUS_IS_OK(status)) {
     116                return status;
     117        }
    104118        /* we might be talking to NT4, so let's downgrade in that case and retry
    105119         * with the returned neg_flags - gd */
     
    149163                                   const char *password,
    150164                                   const char *workstation,
     165
    151166                                   int logon_type)
    152167{
    153168        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
     169
    154170        struct netr_Authenticator clnt_creds;
    155171        struct netr_Authenticator ret_creds;
     
    157173        union netr_Validation validation;
    158174        uint8_t authoritative;
    159         int validation_level = 3;
    160175        fstring clnt_name_slash;
    161         uint8 zeros[16];
     176        ;
    162177
    163178        ZERO_STRUCT(ret_creds);
    164         ZERO_STRUCT(zeros);
    165179
    166180        logon = TALLOC_ZERO_P(mem_ctx, union netr_LogonLevel);
     
    264278        }
    265279
    266         result = rpccli_netr_LogonSamLogon(cli, mem_ctx,
     280        , mem_ctx,
    267281                                           cli->srv_name_slash,
    268282                                           global_myname(),
     
    273287                                           validation_level,
    274288                                           &validation,
    275                                            &authoritative);
     289                                           &authoritative,
     290                                           &result);
     291        if (!NT_STATUS_IS_OK(status)) {
     292                return status;
     293        }
    276294
    277295        /* Always check returned credentials */
     
    282300
    283301        return result;
    284 }
    285 
    286 #define COPY_LSA_STRING(mem_ctx, in, out, name) do { \
    287         if (in->name.string) { \
    288                 out->name.string = talloc_strdup(mem_ctx, in->name.string); \
    289                 NT_STATUS_HAVE_NO_MEMORY(out->name.string); \
    290         } \
    291 } while (0)
    292 
    293 static NTSTATUS copy_netr_SamBaseInfo(TALLOC_CTX *mem_ctx,
    294                                       const struct netr_SamBaseInfo *in,
    295                                       struct netr_SamBaseInfo *out)
    296 {
    297         /* first copy all, then realloc pointers */
    298         *out = *in;
    299 
    300         COPY_LSA_STRING(mem_ctx, in, out, account_name);
    301         COPY_LSA_STRING(mem_ctx, in, out, full_name);
    302         COPY_LSA_STRING(mem_ctx, in, out, logon_script);
    303         COPY_LSA_STRING(mem_ctx, in, out, profile_path);
    304         COPY_LSA_STRING(mem_ctx, in, out, home_directory);
    305         COPY_LSA_STRING(mem_ctx, in, out, home_drive);
    306 
    307         if (in->groups.count) {
    308                 out->groups.rids = (struct samr_RidWithAttribute *)
    309                         talloc_memdup(mem_ctx, in->groups.rids,
    310                                 (sizeof(struct samr_RidWithAttribute) *
    311                                         in->groups.count));
    312                 NT_STATUS_HAVE_NO_MEMORY(out->groups.rids);
    313         }
    314 
    315         COPY_LSA_STRING(mem_ctx, in, out, logon_server);
    316         COPY_LSA_STRING(mem_ctx, in, out, domain);
    317 
    318         if (in->domain_sid) {
    319                 out->domain_sid = sid_dup_talloc(mem_ctx, in->domain_sid);
    320                 NT_STATUS_HAVE_NO_MEMORY(out->domain_sid);
    321         }
    322 
    323         return NT_STATUS_OK;
    324302}
    325303
     
    391369{
    392370        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
     371
    393372        const char *workstation_name_slash;
    394373        const char *server_name_slash;
    395         uint8 zeros[16];
    396374        struct netr_Authenticator clnt_creds;
    397375        struct netr_Authenticator ret_creds;
     
    402380        struct netr_ChallengeResponse lm;
    403381        struct netr_ChallengeResponse nt;
     382
    404383
    405384        *info3 = NULL;
    406385
    407         ZERO_STRUCT(zeros);
    408386        ZERO_STRUCT(ret_creds);
    409387
     
    462440        /* Marshall data and send request */
    463441
    464         result = rpccli_netr_LogonSamLogon(cli, mem_ctx,
     442        , mem_ctx,
    465443                                           server_name_slash,
    466444                                           global_myname(),
     
    471449                                           validation_level,
    472450                                           &validation,
    473                                            &authoritative);
    474         if (!NT_STATUS_IS_OK(result)) {
    475                 return result;
     451                                           &authoritative,
     452                                           &result);
     453        if (!NT_STATUS_IS_OK(status)) {
     454                return status;
    476455        }
    477456
     
    480459                DEBUG(0,("rpccli_netlogon_sam_network_logon: credentials chain check failed\n"));
    481460                return NT_STATUS_ACCESS_DENIED;
     461
     462
     463
     464
    482465        }
    483466
     
    506489{
    507490        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
     491
    508492        const char *workstation_name_slash;
    509493        const char *server_name_slash;
    510         uint8 zeros[16];
    511494        union netr_LogonLevel *logon = NULL;
    512495        struct netr_NetworkInfo *network_info;
     
    516499        struct netr_ChallengeResponse nt;
    517500        uint32_t flags = 0;
     501
    518502
    519503        *info3 = NULL;
    520 
    521         ZERO_STRUCT(zeros);
    522504
    523505        ZERO_STRUCT(lm);
     
    573555        /* Marshall data and send request */
    574556
    575         result = rpccli_netr_LogonSamLogonEx(cli, mem_ctx,
     557        , mem_ctx,
    576558                                             server_name_slash,
    577559                                             global_myname(),
     
    581563                                             &validation,
    582564                                             &authoritative,
    583                                              &flags);
     565                                             &flags,
     566                                             &result);
     567        if (!NT_STATUS_IS_OK(status)) {
     568                return status;
     569        }
     570
    584571        if (!NT_STATUS_IS_OK(result)) {
    585572                return result;
     
    613600                                            enum netr_SchannelType sec_channel_type)
    614601{
    615         NTSTATUS result;
     602        NTSTATUS result;
    616603        struct netr_Authenticator clnt_creds, srv_cred;
     604
    617605
    618606        if (!cli->dc) {
     
    643631                                        &new_password);
    644632
    645                 result = rpccli_netr_ServerPasswordSet2(cli, mem_ctx,
     633                , mem_ctx,
    646634                                                        cli->srv_name_slash,
    647635                                                        cli->dc->account_name,
     
    650638                                                        &clnt_creds,
    651639                                                        &srv_cred,
    652                                                         &new_password);
    653                 if (!NT_STATUS_IS_OK(result)) {
    654                         DEBUG(0,("rpccli_netr_ServerPasswordSet2 failed: %s\n",
    655                                 nt_errstr(result)));
    656                         return result;
     640                                                        &new_password,
     641                                                        &result);
     642                if (!NT_STATUS_IS_OK(status)) {
     643                        DEBUG(0,("dcerpc_netr_ServerPasswordSet2 failed: %s\n",
     644                                nt_errstr(status)));
     645                        return status;
    657646                }
    658647        } else {
     
    662651                netlogon_creds_des_encrypt(cli->dc, &new_password);
    663652
    664                 result = rpccli_netr_ServerPasswordSet(cli, mem_ctx,
     653                , mem_ctx,
    665654                                                       cli->srv_name_slash,
    666655                                                       cli->dc->account_name,
     
    669658                                                       &clnt_creds,
    670659                                                       &srv_cred,
    671                                                        &new_password);
    672                 if (!NT_STATUS_IS_OK(result)) {
    673                         DEBUG(0,("rpccli_netr_ServerPasswordSet failed: %s\n",
    674                                 nt_errstr(result)));
    675                         return result;
     660                                                       &new_password,
     661                                                       &result);
     662                if (!NT_STATUS_IS_OK(status)) {
     663                        DEBUG(0,("dcerpc_netr_ServerPasswordSet failed: %s\n",
     664                                nt_errstr(status)));
     665                        return status;
    676666                }
    677667        }
     
    683673        }
    684674
     675
     676
     677
     678
     679
     680
    685681        return result;
    686682}
Note: See TracChangeset for help on using the changeset viewer.