Changeset 988 for vendor/current/source3/lib/privileges.c
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/lib/privileges.c
r740 r988 24 24 #include "includes.h" 25 25 #include "lib/privileges.h" 26 #include "dbwrap .h"26 #include "dbwrap/dbwrap.h" 27 27 #include "libcli/security/privileges_private.h" 28 28 #include "../libcli/security/security.h" … … 77 77 fstring tmp, keystr; 78 78 TDB_DATA data; 79 NTSTATUS status; 79 80 80 81 /* Fail if the admin has not enable privileges */ … … 91 92 fstr_sprintf(keystr, "%s%s", PRIVPREFIX, sid_to_fstring(tmp, sid)); 92 93 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)) { 96 97 DEBUG(4, ("get_privileges: No privileges assigned to SID " 97 98 "[%s]\n", sid_string_dbg(sid))); … … 210 211 struct dom_sid sid; 211 212 fstring sid_string; 213 TDB_DATA key; 214 215 key = dbwrap_record_get_key(rec); 212 216 213 217 /* check we have a PRIV_+SID entry */ 214 218 215 if ( strncmp((char *)rec->key.dptr, PRIVPREFIX, prefixlen) != 0)219 if (strncmp((char *)key.dptr, PRIVPREFIX, prefixlen) != 0) 216 220 return 0; 217 221 218 222 /* check to see if we are looking for a particular privilege */ 219 223 220 fstrcpy( sid_string, (char *)&( rec->key.dptr[strlen(PRIVPREFIX)]) );224 fstrcpy( sid_string, (char *)&(key.dptr[strlen(PRIVPREFIX)]) ); 221 225 222 226 if (priv->privilege != 0) { 223 227 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); 227 234 } else { 228 if ( rec->value.dsize != sizeof( uint64_t ) ) {235 if (value.dsize != sizeof( uint64_t ) ) { 229 236 DEBUG(3, ("get_privileges: Invalid privileges record assigned to SID " 230 237 "[%s]\n", sid_string)); 231 238 return 0; 232 239 } 233 mask = BVAL( rec->value.dptr, 0);240 mask = BVAL(value.dptr, 0); 234 241 } 235 242 … … 265 272 266 273 /********************************************************************* 267 Retr eive list of privileged SIDs (for _lsa_enumerate_accounts()274 Retrieve list of privileged SIDs (for _lsa_enumerate_accounts() 268 275 *********************************************************************/ 269 276 … … 272 279 struct db_context *db = get_account_pol_db(); 273 280 PRIV_SID_LIST priv; 281 NTSTATUS status; 274 282 275 283 if (db == NULL) { … … 279 287 ZERO_STRUCT(priv); 280 288 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 } 282 293 283 294 /* give the memory away; caller will free */ … … 298 309 struct db_context *db = get_account_pol_db(); 299 310 PRIV_SID_LIST priv; 311 NTSTATUS status; 300 312 301 313 if (db == NULL) { … … 308 320 priv.mem_ctx = mem_ctx; 309 321 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 } 311 326 312 327 /* give the memory away; caller will free */
Note:
See TracChangeset
for help on using the changeset viewer.