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:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source3/winbindd/idmap_hash/idmap_hash.c

    r414 r745  
    2121#include "includes.h"
    2222#include "winbindd/winbindd.h"
     23#include "idmap.h"
    2324#include "idmap_hash.h"
     25#include "ads.h"
     26#include "nss_info.h"
     27#include "../libcli/security/dom_sid.h"
    2428
    2529#undef DBGC_CLASS
     
    2731
    2832struct sid_hash_table {
    29         DOM_SID *sid;
     33        struct dom_sid *sid;
    3034};
    3135
    32 struct sid_hash_table *hashed_domains = NULL;
    33 
    3436/*********************************************************************
    3537 Hash a domain SID (S-1-5-12-aaa-bbb-ccc) to a 12bit number
    3638 ********************************************************************/
    3739
    38 static uint32_t hash_domain_sid(const DOM_SID *sid)
     40static uint32_t hash_domain_sid(const struct dom_sid *sid)
    3941{
    4042        uint32_t hash;
     
    103105 ********************************************************************/
    104106
    105 static NTSTATUS be_init(struct idmap_domain *dom,
    106                         const char *params)
    107 {
     107static NTSTATUS be_init(struct idmap_domain *dom)
     108{
     109        struct sid_hash_table *hashed_domains;
    108110        NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
    109111        struct winbindd_tdc_domain *dom_list = NULL;
     
    111113        int i;
    112114
    113         /* If the domain SID hash talbe has been initialized, assume
     115        /* If the domain SID hash table has been initialized, assume
    114116           that we completed this function previously */
    115117
    116         if ( hashed_domains ) {
     118        if (dom->private_data != NULL) {
    117119                nt_status = NT_STATUS_OK;
    118120                goto done;
     
    126128        /* Create the hash table of domain SIDs */
    127129
    128         hashed_domains = TALLOC_ZERO_ARRAY(NULL, struct sid_hash_table, 4096);
     130        hashed_domains = TALLOC_ZERO_ARRAY(dom, struct sid_hash_table, 4096);
    129131        BAIL_ON_PTR_NT_ERROR(hashed_domains, nt_status);
    130132
     
    144146                         hash));
    145147
    146                 hashed_domains[hash].sid = talloc(hashed_domains, DOM_SID);
     148                hashed_domains[hash].sid = talloc(hashed_domains, struct dom_sid);
    147149                sid_copy(hashed_domains[hash].sid, &dom_list[i].sid);
    148150        }
     151
     152        dom->private_data = hashed_domains;
    149153
    150154done:
     
    158162                                struct id_map **ids)
    159163{
     164        struct sid_hash_table *hashed_domains = talloc_get_type_abort(
     165                dom->private_data, struct sid_hash_table);
    160166        NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
    161167        int i;
     
    165171                ids[i]->status = ID_UNKNOWN;
    166172        }
    167        
    168         nt_status = be_init(dom, NULL);
     173
     174        nt_status = be_init(dom);
    169175        BAIL_ON_NTSTATUS_ERROR(nt_status);
    170176
     
    194200                        continue;
    195201
    196                 sid_copy(ids[i]->sid, hashed_domains[h_domain].sid);
    197                 sid_append_rid(ids[i]->sid, h_rid);
     202                sid_compose(ids[i]->sid, hashed_domains[h_domain].sid, h_rid);
    198203                ids[i]->status = ID_MAPPED;
    199204        }
     
    216221                ids[i]->status = ID_UNKNOWN;
    217222        }
    218        
    219         nt_status = be_init(dom, NULL);
     223
     224        nt_status = be_init(dom);
    220225        BAIL_ON_NTSTATUS_ERROR(nt_status);
    221226
     
    226231
    227232        for (i=0; ids[i]; i++) {
    228                 DOM_SID sid;
     233                struct dom_sid sid;
    229234                uint32_t rid;
    230235                uint32_t h_domain, h_rid;
     
    253258 ********************************************************************/
    254259
    255 static NTSTATUS be_close(struct idmap_domain *dom)
    256 {
    257         if (hashed_domains)
    258                 talloc_free(hashed_domains);
    259 
    260         return NT_STATUS_OK;
    261 }
    262 
    263 /*********************************************************************
    264  ********************************************************************/
    265 
    266260static NTSTATUS nss_hash_init(struct nss_domain_entry *e )
    267261{
    268         return be_init(NULL, NULL);
     262        return be_init(NULL);
    269263}
    270264
     
    273267
    274268static NTSTATUS nss_hash_get_info(struct nss_domain_entry *e,
    275                                     const DOM_SID *sid,
     269                                    const struct dom_sid *sid,
    276270                                    TALLOC_CTX *ctx,
    277                                     ADS_STRUCT *ads,
    278                                     LDAPMessage *msg,
    279271                                    const char **homedir,
    280272                                    const char **shell,
     
    359351        .unixids_to_sids = unixids_to_sids,
    360352        .sids_to_unixids = sids_to_unixids,
    361         .close_fn        = be_close
    362353};
    363354
  • trunk/server/source3/winbindd/idmap_hash/mapfile.c

    r414 r745  
    2020
    2121#include "includes.h"
     22#include "system/filesys.h"
    2223#include "winbindd/winbindd.h"
     24#include "idmap.h"
    2325#include "idmap_hash.h"
    2426#include <stdio.h>
Note: See TracChangeset for help on using the changeset viewer.