Ignore:
Timestamp:
Oct 30, 2009, 9:39:05 AM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update 3.3 to 3.3.9

Location:
branches/samba-3.3.x/source/rpc_client
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.3.x/source/rpc_client/cli_lsarpc.c

    r206 r342  
    127127                                               char **domains,
    128128                                               char **names,
    129                                                enum lsa_SidType *types)
     129                                               enum lsa_SidType *types,
     130                                               bool use_lookupsids3)
    130131{
    131132        NTSTATUS result = NT_STATUS_OK;
     
    160161        }
    161162
    162         result = rpccli_lsa_LookupSids(cli, mem_ctx,
    163                                        pol,
    164                                        &sid_array,
    165                                        &ref_domains,
    166                                        &lsa_names,
    167                                        level,
    168                                        &count);
     163        if (use_lookupsids3) {
     164                struct lsa_TransNameArray2 lsa_names2;
     165                uint32_t n;
     166
     167                ZERO_STRUCT(lsa_names2);
     168
     169                result = rpccli_lsa_LookupSids3(cli, mem_ctx,
     170                                                &sid_array,
     171                                                &ref_domains,
     172                                                &lsa_names2,
     173                                                level,
     174                                                &count,
     175                                                0,
     176                                                0);
     177
     178                if (!NT_STATUS_IS_ERR(result)) {
     179                        lsa_names.count = lsa_names2.count;
     180                        lsa_names.names = talloc_array(mem_ctx, struct lsa_TranslatedName, lsa_names.count);
     181                        if (!lsa_names.names) {
     182                                return NT_STATUS_NO_MEMORY;
     183                        }
     184                        for (n=0; n < lsa_names.count; n++) {
     185                                lsa_names.names[n].sid_type     = lsa_names2.names[n].sid_type;
     186                                lsa_names.names[n].name         = lsa_names2.names[n].name;
     187                                lsa_names.names[n].sid_index    = lsa_names2.names[n].sid_index;
     188                        }
     189                }
     190
     191        } else {
     192                result = rpccli_lsa_LookupSids(cli, mem_ctx,
     193                                               pol,
     194                                               &sid_array,
     195                                               &ref_domains,
     196                                               &lsa_names,
     197                                               level,
     198                                               &count);
     199        }
    169200
    170201        DEBUG(10, ("LSA_LOOKUPSIDS returned '%s', mapped count = %d'\n",
     
    246277#define LOOKUP_SIDS_HUNK_SIZE 1000
    247278
    248 NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli,
    249                                 TALLOC_CTX *mem_ctx,
    250                                 POLICY_HND *pol,
    251                                 int num_sids,
    252                                 const DOM_SID *sids,
    253                                 char ***pdomains,
    254                                 char ***pnames,
    255                                 enum lsa_SidType **ptypes)
     279static NTSTATUS rpccli_lsa_lookup_sids_generic(struct rpc_pipe_client *cli,
     280                                               TALLOC_CTX *mem_ctx,
     281                                               struct policy_handle *pol,
     282                                               int num_sids,
     283                                               const DOM_SID *sids,
     284                                               char ***pdomains,
     285                                               char ***pnames,
     286                                               enum lsa_SidType **ptypes,
     287                                               bool use_lookupsids3)
    256288{
    257289        NTSTATUS result = NT_STATUS_OK;
     
    312344                                                             hunk_domains,
    313345                                                             hunk_names,
    314                                                              hunk_types);
     346                                                             hunk_types,
     347                                                             use_lookupsids3);
    315348
    316349                if (!NT_STATUS_IS_OK(hunk_result) &&
     
    353386}
    354387
     388NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli,
     389                                TALLOC_CTX *mem_ctx,
     390                                struct policy_handle *pol,
     391                                int num_sids,
     392                                const DOM_SID *sids,
     393                                char ***pdomains,
     394                                char ***pnames,
     395                                enum lsa_SidType **ptypes)
     396{
     397        return rpccli_lsa_lookup_sids_generic(cli, mem_ctx, pol, num_sids, sids,
     398                                              pdomains, pnames, ptypes, false);
     399}
     400
     401NTSTATUS rpccli_lsa_lookup_sids3(struct rpc_pipe_client *cli,
     402                                 TALLOC_CTX *mem_ctx,
     403                                 struct policy_handle *pol,
     404                                 int num_sids,
     405                                 const DOM_SID *sids,
     406                                 char ***pdomains,
     407                                 char ***pnames,
     408                                 enum lsa_SidType **ptypes)
     409{
     410        return rpccli_lsa_lookup_sids_generic(cli, mem_ctx, pol, num_sids, sids,
     411                                              pdomains, pnames, ptypes, true);
     412}
     413
    355414/** Lookup a list of names */
    356415
    357 NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
    358                                  TALLOC_CTX *mem_ctx,
    359                                  POLICY_HND *pol, int num_names,
    360                                  const char **names,
    361                                  const char ***dom_names,
    362                                  int level,
    363                                  DOM_SID **sids,
    364                                  enum lsa_SidType **types)
     416static NTSTATUS rpccli_lsa_lookup_names_generic(struct rpc_pipe_client *cli,
     417                                                TALLOC_CTX *mem_ctx,
     418                                                struct policy_handle *pol, int num_names,
     419                                                const char **names,
     420                                                const char ***dom_names,
     421                                                int level,
     422                                                DOM_SID **sids,
     423                                                enum lsa_SidType **types,
     424                                                bool use_lookupnames4)
    365425{
    366426        NTSTATUS result;
     
    369429        struct lsa_RefDomainList *domains = NULL;
    370430        struct lsa_TransSidArray sid_array;
     431        struct lsa_TransSidArray3 sid_array3;
    371432        uint32_t count = 0;
    372433
    373434        ZERO_STRUCT(sid_array);
     435        ZERO_STRUCT(sid_array3);
    374436
    375437        lsa_names = TALLOC_ARRAY(mem_ctx, struct lsa_String, num_names);
     
    382444        }
    383445
    384         result = rpccli_lsa_LookupNames(cli, mem_ctx,
    385                                         pol,
    386                                         num_names,
    387                                         lsa_names,
    388                                         &domains,
    389                                         &sid_array,
    390                                         level,
    391                                         &count);
     446        if (use_lookupnames4) {
     447                result = rpccli_lsa_LookupNames4(cli, mem_ctx,
     448                                                 num_names,
     449                                                 lsa_names,
     450                                                 &domains,
     451                                                 &sid_array3,
     452                                                 level,
     453                                                 &count,
     454                                                 0,
     455                                                 0);
     456        } else {
     457                result = rpccli_lsa_LookupNames(cli, mem_ctx,
     458                                                pol,
     459                                                num_names,
     460                                                lsa_names,
     461                                                &domains,
     462                                                &sid_array,
     463                                                level,
     464                                                &count);
     465        }
    392466
    393467        if (!NT_STATUS_IS_OK(result) && NT_STATUS_V(result) !=
     
    436510
    437511        for (i = 0; i < num_names; i++) {
    438                 uint32_t dom_idx = sid_array.sids[i].sid_index;
    439                 uint32_t dom_rid = sid_array.sids[i].rid;
     512                uint32_t dom_idx;
    440513                DOM_SID *sid = &(*sids)[i];
     514
     515                if (use_lookupnames4) {
     516                        dom_idx         = sid_array3.sids[i].sid_index;
     517                        (*types)[i]     = sid_array3.sids[i].sid_type;
     518                } else {
     519                        dom_idx         = sid_array.sids[i].sid_index;
     520                        (*types)[i]     = sid_array.sids[i].sid_type;
     521                }
    441522
    442523                /* Translate optimised sid through domain index array */
     
    449530                }
    450531
    451                 sid_copy(sid, domains->domains[dom_idx].sid);
    452 
    453                 if (dom_rid != 0xffffffff) {
    454                         sid_append_rid(sid, dom_rid);
    455                 }
    456 
    457                 (*types)[i] = sid_array.sids[i].sid_type;
     532                if (use_lookupnames4) {
     533                        sid_copy(sid, sid_array3.sids[i].sid);
     534                } else {
     535                        sid_copy(sid, domains->domains[dom_idx].sid);
     536
     537                        if (sid_array.sids[i].rid != 0xffffffff) {
     538                                sid_append_rid(sid, sid_array.sids[i].rid);
     539                        }
     540                }
    458541
    459542                if (dom_names == NULL) {
     
    468551        return result;
    469552}
     553
     554NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
     555                                 TALLOC_CTX *mem_ctx,
     556                                 struct policy_handle *pol, int num_names,
     557                                 const char **names,
     558                                 const char ***dom_names,
     559                                 int level,
     560                                 DOM_SID **sids,
     561                                 enum lsa_SidType **types)
     562{
     563        return rpccli_lsa_lookup_names_generic(cli, mem_ctx, pol, num_names,
     564                                               names, dom_names, level, sids,
     565                                               types, false);
     566}
     567
     568NTSTATUS rpccli_lsa_lookup_names4(struct rpc_pipe_client *cli,
     569                                  TALLOC_CTX *mem_ctx,
     570                                  struct policy_handle *pol, int num_names,
     571                                  const char **names,
     572                                  const char ***dom_names,
     573                                  int level,
     574                                  DOM_SID **sids,
     575                                  enum lsa_SidType **types)
     576{
     577        return rpccli_lsa_lookup_names_generic(cli, mem_ctx, pol, num_names,
     578                                               names, dom_names, level, sids,
     579                                               types, true);
     580}
  • branches/samba-3.3.x/source/rpc_client/cli_netlogon.c

    r206 r342  
    602602                struct samr_Password new_password;
    603603
    604                 cred_hash3(new_password.hash,
    605                            new_trust_passwd_hash,
    606                            cli->dc->sess_key, 1);
     604                des_crypt112_16(new_password.hash,
     605                                new_trust_passwd_hash,
     606                                cli->dc->sess_key, 1);
    607607
    608608                result = rpccli_netr_ServerPasswordSet(cli, mem_ctx,
  • branches/samba-3.3.x/source/rpc_client/cli_pipe.c

    r206 r342  
    491491        }
    492492
    493         if (auth_len != RPC_AUTH_SCHANNEL_SIGN_OR_SEAL_CHK_LEN) {
     493        if (auth_len < RPC_AUTH_SCHANNEL_SIGN_OR_SEAL_CHK_LEN) {
    494494                DEBUG(0,("cli_pipe_verify_schannel: auth_len %u.\n", (unsigned int)auth_len ));
    495495                return NT_STATUS_INVALID_PARAMETER;
     
    23202320        return NT_STATUS_OK;
    23212321}
    2322 
    2323 unsigned int rpccli_set_timeout(struct rpc_pipe_client *cli,
     2322unsigned int rpccli_set_timeout(struct rpc_pipe_client *rpc_cli,
    23242323                                unsigned int timeout)
    23252324{
    2326         return cli_set_timeout(cli->trans.np.cli, timeout);
     2325        struct cli_state *cli = rpc_pipe_np_smb_conn(rpc_cli);
     2326
     2327        if (cli == NULL) {
     2328                return 0;
     2329        }
     2330        return cli_set_timeout(cli, timeout);
    23272331}
    23282332
     
    29322936
    29332937static NTSTATUS cli_rpc_pipe_open(struct cli_state *cli,
     2938                                  enum dcerpc_transport_t transport,
    29342939                                  const struct ndr_syntax_id *interface,
    29352940                                  struct rpc_pipe_client **presult)
    29362941{
    2937         if (ndr_syntax_id_equal(interface, &ndr_table_drsuapi.syntax_id)) {
    2938                 /*
    2939                  * We should have a better way to figure out this drsuapi
    2940                  * speciality...
    2941                  */
     2942        switch (transport) {
     2943        case NCACN_IP_TCP:
    29422944                return rpc_pipe_open_tcp(NULL, cli->desthost, interface,
    29432945                                         presult);
    2944         }
    2945 
    2946         return rpc_pipe_open_np(cli, interface, presult);
     2946        case NCACN_NP:
     2947                return rpc_pipe_open_np(cli, interface, presult);
     2948        default:
     2949                return NT_STATUS_NOT_IMPLEMENTED;
     2950        }
    29472951}
    29482952
     
    29512955 ****************************************************************************/
    29522956
    2953 NTSTATUS cli_rpc_pipe_open_noauth(struct cli_state *cli,
    2954                                   const struct ndr_syntax_id *interface,
    2955                                   struct rpc_pipe_client **presult)
     2957NTSTATUS cli_rpc_pipe_open_noauth_transport(struct cli_state *cli,
     2958                                            enum dcerpc_transport_t transport,
     2959                                            const struct ndr_syntax_id *interface,
     2960                                            struct rpc_pipe_client **presult)
    29562961{
    29572962        struct rpc_pipe_client *result;
     
    29592964        NTSTATUS status;
    29602965
    2961         status = cli_rpc_pipe_open(cli, interface, &result);
     2966        status = cli_rpc_pipe_open(cli, transport, interface, &result);
    29622967        if (!NT_STATUS_IS_OK(status)) {
    29632968                return status;
     
    30163021
    30173022/****************************************************************************
     3023 ****************************************************************************/
     3024
     3025NTSTATUS cli_rpc_pipe_open_noauth(struct cli_state *cli,
     3026                                  const struct ndr_syntax_id *interface,
     3027                                  struct rpc_pipe_client **presult)
     3028{
     3029        return cli_rpc_pipe_open_noauth_transport(cli, NCACN_NP,
     3030                                                  interface, presult);
     3031}
     3032
     3033/****************************************************************************
    30183034 Open a named pipe to an SMB server and bind using NTLMSSP or SPNEGO NTLMSSP
    30193035 ****************************************************************************/
     
    30213037static NTSTATUS cli_rpc_pipe_open_ntlmssp_internal(struct cli_state *cli,
    30223038                                                   const struct ndr_syntax_id *interface,
     3039                                                   enum dcerpc_transport_t transport,
    30233040                                                   enum pipe_auth_type auth_type,
    30243041                                                   enum pipe_auth_level auth_level,
     
    30323049        NTSTATUS status;
    30333050
    3034         status = cli_rpc_pipe_open(cli, interface, &result);
     3051        status = cli_rpc_pipe_open(cli, transport, interface, &result);
    30353052        if (!NT_STATUS_IS_OK(status)) {
    30363053                return status;
     
    30743091NTSTATUS cli_rpc_pipe_open_ntlmssp(struct cli_state *cli,
    30753092                                   const struct ndr_syntax_id *interface,
     3093                                   enum dcerpc_transport_t transport,
    30763094                                   enum pipe_auth_level auth_level,
    30773095                                   const char *domain,
     
    30823100        return cli_rpc_pipe_open_ntlmssp_internal(cli,
    30833101                                                interface,
     3102                                                transport,
    30843103                                                PIPE_AUTH_TYPE_NTLMSSP,
    30853104                                                auth_level,
     
    30973116NTSTATUS cli_rpc_pipe_open_spnego_ntlmssp(struct cli_state *cli,
    30983117                                          const struct ndr_syntax_id *interface,
     3118                                          enum dcerpc_transport_t transport,
    30993119                                          enum pipe_auth_level auth_level,
    31003120                                          const char *domain,
     
    31053125        return cli_rpc_pipe_open_ntlmssp_internal(cli,
    31063126                                                interface,
     3127                                                transport,
    31073128                                                PIPE_AUTH_TYPE_SPNEGO_NTLMSSP,
    31083129                                                auth_level,
     
    32023223NTSTATUS cli_rpc_pipe_open_schannel_with_key(struct cli_state *cli,
    32033224                                             const struct ndr_syntax_id *interface,
     3225                                             enum dcerpc_transport_t transport,
    32043226                                             enum pipe_auth_level auth_level,
    32053227                                             const char *domain,
     
    32113233        NTSTATUS status;
    32123234
    3213         status = cli_rpc_pipe_open(cli, interface, &result);
     3235        status = cli_rpc_pipe_open(cli, transport, interface, &result);
    32143236        if (!NT_STATUS_IS_OK(status)) {
    32153237                return status;
     
    32713293
    32723294        status = cli_rpc_pipe_open_spnego_ntlmssp(
    3273                 cli, &ndr_table_netlogon.syntax_id, PIPE_AUTH_LEVEL_PRIVACY,
     3295                cli, &ndr_table_netlogon.syntax_id, NCACN_NP,
     3296                PIPE_AUTH_LEVEL_PRIVACY,
    32743297                domain, username, password, &netlogon_pipe);
    32753298        if (!NT_STATUS_IS_OK(status)) {
     
    32963319NTSTATUS cli_rpc_pipe_open_ntlmssp_auth_schannel(struct cli_state *cli,
    32973320                                                 const struct ndr_syntax_id *interface,
     3321                                                 enum dcerpc_transport_t transport,
    32983322                                                 enum pipe_auth_level auth_level,
    32993323                                                 const char *domain,
     
    33173341
    33183342        status = cli_rpc_pipe_open_schannel_with_key(
    3319                 cli, interface, auth_level, domain, netlogon_pipe->dc,
     3343                cli, interface, transport, auth_level, domain, netlogon_pipe->dc,
    33203344                &result);
    33213345
     
    33363360NTSTATUS cli_rpc_pipe_open_schannel(struct cli_state *cli,
    33373361                                    const struct ndr_syntax_id *interface,
     3362                                    enum dcerpc_transport_t transport,
    33383363                                    enum pipe_auth_level auth_level,
    33393364                                    const char *domain,
     
    33553380
    33563381        status = cli_rpc_pipe_open_schannel_with_key(
    3357                 cli, interface, auth_level, domain, netlogon_pipe->dc,
     3382                cli, interface, transport, auth_level, domain, netlogon_pipe->dc,
    33583383                &result);
    33593384
     
    33873412        NTSTATUS status;
    33883413
    3389         status = cli_rpc_pipe_open(cli, interface, &result);
     3414        status = cli_rpc_pipe_open(cli, NCACN_NP, interface, &result);
    33903415        if (!NT_STATUS_IS_OK(status)) {
    33913416                return status;
  • branches/samba-3.3.x/source/rpc_client/init_netlogon.c

    r206 r342  
    297297                           NETLOGON_EXTRA_SIDS,
    298298                           user_session_key,
    299                            my_name,
     299                           talloc_strdup(sam3, my_name),
    300300                           talloc_strdup(sam3, pdb_get_domain(sampw)),
    301301                           sid,
Note: See TracChangeset for help on using the changeset viewer.