Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (12 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified vendor/current/source3/libsmb/samlogon_cache.c

    r414 r740  
    2323
    2424#include "includes.h"
     25#include "system/filesys.h"
    2526#include "librpc/gen_ndr/ndr_krb5pac.h"
     27#include "../libcli/security/security.h"
     28#include "util_tdb.h"
    2629
    2730#define NETSAMLOGON_TDB "netsamlogon_cache.tdb"
     
    4649        path = cache_path(NETSAMLOGON_TDB);
    4750again:
    48         tdb = tdb_open_log(path, 0, TDB_DEFAULT,
     51        tdb = tdb_open_log(path, 0, TDB_DEFAULT|TDB_INCOMPATIBLE_HASH,
    4952                           O_RDWR | O_CREAT, 0600);
    5053        if (tdb == NULL) {
     
    7073
    7174        DEBUG(0,("retry after CLEAR_IF_FIRST for '%s'\n", path));
    72         tdb = tdb_open_log(path, 0, TDB_CLEAR_IF_FIRST,
     75        tdb = tdb_open_log(path, 0, TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
    7376                           O_RDWR | O_CREAT, 0600);
    7477        if (tdb) {
     
    99102***********************************************************************/
    100103
    101 void netsamlogon_clear_cached_user(struct netr_SamInfo3 *info3)
    102 {
    103         DOM_SID user_sid;
    104         fstring keystr, tmp;
    105 
    106         if (!info3) {
    107                 return;
    108         }
     104void netsamlogon_clear_cached_user(const struct dom_sid *user_sid)
     105{
     106        fstring keystr;
    109107
    110108        if (!netsamlogon_cache_init()) {
     
    114112                return;
    115113        }
    116         sid_copy(&user_sid, info3->base.domain_sid);
    117         sid_append_rid(&user_sid, info3->base.rid);
    118114
    119115        /* Prepare key as DOMAIN-SID/USER-RID string */
    120         slprintf(keystr, sizeof(keystr), "%s", sid_to_fstring(tmp, &user_sid));
     116        sid_to_fstring(keystr, user_sid);
    121117
    122118        DEBUG(10,("netsamlogon_clear_cached_user: SID [%s]\n", keystr));
     
    133129{
    134130        TDB_DATA data;
    135         fstring keystr, tmp;
     131        fstring keystr;
    136132        bool result = false;
    137         DOM_SID user_sid;
     133        struct dom_sid  user_sid;
    138134        time_t t = time(NULL);
    139135        TALLOC_CTX *mem_ctx;
     
    152148        }
    153149
    154         sid_copy(&user_sid, info3->base.domain_sid);
    155         sid_append_rid(&user_sid, info3->base.rid);
     150        sid_compose(&user_sid, info3->base.domain_sid, info3->base.rid);
    156151
    157152        /* Prepare key as DOMAIN-SID/USER-RID string */
    158         slprintf(keystr, sizeof(keystr), "%s", sid_to_fstring(tmp, &user_sid));
     153        sid_to_fstring(keystr, &user_sid);
    159154
    160155        DEBUG(10,("netsamlogon_cache_store: SID [%s]\n", keystr));
     
    181176        }
    182177
    183         ndr_err = ndr_push_struct_blob(&blob, mem_ctx, NULL, &r,
     178        ndr_err = ndr_push_struct_blob(&blob, mem_ctx, &r,
    184179                                       (ndr_push_flags_fn_t)ndr_push_netsamlogoncache_entry);
    185180        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     
    206201***********************************************************************/
    207202
    208 struct netr_SamInfo3 *netsamlogon_cache_get(TALLOC_CTX *mem_ctx, const DOM_SID *user_sid)
     203struct netr_SamInfo3 *netsamlogon_cache_get(TALLOC_CTX *mem_ctx, const struct dom_sid *user_sid)
    209204{
    210205        struct netr_SamInfo3 *info3 = NULL;
     
    237232        blob = data_blob_const(data.dptr, data.dsize);
    238233
    239         ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, NULL, &r,
     234        ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, &r,
    240235                                      (ndr_pull_flags_fn_t)ndr_pull_netsamlogoncache_entry);
    241236
     
    279274}
    280275
    281 bool netsamlogon_cache_have(const DOM_SID *user_sid)
     276bool netsamlogon_cache_have(const struct dom_sid *user_sid)
    282277{
    283278        TALLOC_CTX *mem_ctx = talloc_init("netsamlogon_cache_have");
Note: See TracChangeset for help on using the changeset viewer.