Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/lib/privileges.c

    r740 r988  
    2424#include "includes.h"
    2525#include "lib/privileges.h"
    26 #include "dbwrap.h"
     26#include "dbwrap/dbwrap.h"
    2727#include "libcli/security/privileges_private.h"
    2828#include "../libcli/security/security.h"
     
    7777        fstring tmp, keystr;
    7878        TDB_DATA data;
     79        NTSTATUS status;
    7980
    8081        /* Fail if the admin has not enable privileges */
     
    9192        fstr_sprintf(keystr, "%s%s", PRIVPREFIX, sid_to_fstring(tmp, sid));
    9293
    93         data = dbwrap_fetch_bystring( db, talloc_tos(), keystr );
    94 
    95         if ( !data.dptr ) {
     94        status = dbwrap_fetch_bystring(db, talloc_tos(), keystr, &data);
     95
     96        if (!NT_STATUS_IS_OK(status)) {
    9697                DEBUG(4, ("get_privileges: No privileges assigned to SID "
    9798                          "[%s]\n", sid_string_dbg(sid)));
     
    210211        struct dom_sid sid;
    211212        fstring sid_string;
     213        TDB_DATA key;
     214
     215        key = dbwrap_record_get_key(rec);
    212216
    213217        /* check we have a PRIV_+SID entry */
    214218
    215         if ( strncmp((char *)rec->key.dptr, PRIVPREFIX, prefixlen) != 0)
     219        if (strncmp((char *)key.dptr, PRIVPREFIX, prefixlen) != 0)
    216220                return 0;
    217221
    218222        /* check to see if we are looking for a particular privilege */
    219223
    220         fstrcpy( sid_string, (char *)&(rec->key.dptr[strlen(PRIVPREFIX)]) );
     224        fstrcpy( sid_string, (char *)&(key.dptr[strlen(PRIVPREFIX)]) );
    221225
    222226        if (priv->privilege != 0) {
    223227                uint64_t mask;
    224 
    225                 if (rec->value.dsize == 4*4) {
    226                         mask = map_old_SE_PRIV(rec->value.dptr);
     228                TDB_DATA value;
     229
     230                value = dbwrap_record_get_value(rec);
     231
     232                if (value.dsize == 4*4) {
     233                        mask = map_old_SE_PRIV(value.dptr);
    227234                } else {
    228                         if (rec->value.dsize != sizeof( uint64_t ) ) {
     235                        if (value.dsize != sizeof( uint64_t ) ) {
    229236                                DEBUG(3, ("get_privileges: Invalid privileges record assigned to SID "
    230237                                          "[%s]\n", sid_string));
    231238                                return 0;
    232239                        }
    233                         mask = BVAL(rec->value.dptr, 0);
     240                        mask = BVAL(value.dptr, 0);
    234241                }
    235242
     
    265272
    266273/*********************************************************************
    267  Retreive list of privileged SIDs (for _lsa_enumerate_accounts()
     274 Retrieve list of privileged SIDs (for _lsa_enumerate_accounts()
    268275*********************************************************************/
    269276
     
    272279        struct db_context *db = get_account_pol_db();
    273280        PRIV_SID_LIST priv;
     281        NTSTATUS status;
    274282
    275283        if (db == NULL) {
     
    279287        ZERO_STRUCT(priv);
    280288
    281         db->traverse_read(db, priv_traverse_fn, &priv);
     289        status = dbwrap_traverse_read(db, priv_traverse_fn, &priv, NULL);
     290        if (!NT_STATUS_IS_OK(status)) {
     291                return status;
     292        }
    282293
    283294        /* give the memory away; caller will free */
     
    298309        struct db_context *db = get_account_pol_db();
    299310        PRIV_SID_LIST priv;
     311        NTSTATUS status;
    300312
    301313        if (db == NULL) {
     
    308320        priv.mem_ctx = mem_ctx;
    309321
    310         db->traverse_read(db, priv_traverse_fn, &priv);
     322        status = dbwrap_traverse_read(db, priv_traverse_fn, &priv, NULL);
     323        if (!NT_STATUS_IS_OK(status)) {
     324                return status;
     325        }
    311326
    312327        /* give the memory away; caller will free */
Note: See TracChangeset for help on using the changeset viewer.