summaryrefslogtreecommitdiff
path: root/source3/lib/privileges.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-03-27 09:59:32 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:18:54 -0500
commit8960af95585cca9312e6df2f9214fcad8cff73c7 (patch)
tree93d8230f3c116c1f62b1e05be398fb77fa70dd60 /source3/lib/privileges.c
parent1c98e62118df05dd87ee71711b20280faeed9053 (diff)
downloadsamba-8960af95585cca9312e6df2f9214fcad8cff73c7.tar.gz
samba-8960af95585cca9312e6df2f9214fcad8cff73c7.tar.bz2
samba-8960af95585cca9312e6df2f9214fcad8cff73c7.zip
r21976: make use of tdb_*_bystring() and string_term_tdb_data() in lib/
to avoid creating the TDB_DATA struct from strings "by hand" metze (This used to be commit c22b86595a502eb48c9d0038faee8a9ee41b8438)
Diffstat (limited to 'source3/lib/privileges.c')
-rw-r--r--source3/lib/privileges.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/source3/lib/privileges.c b/source3/lib/privileges.c
index c0f7857c95..2348995dc8 100644
--- a/source3/lib/privileges.c
+++ b/source3/lib/privileges.c
@@ -237,7 +237,7 @@ static BOOL get_privileges( const DOM_SID *sid, SE_PRIV *mask )
{
TDB_CONTEXT *tdb = get_account_pol_tdb();
fstring keystr;
- TDB_DATA key, data;
+ TDB_DATA data;
/* Fail if the admin has not enable privileges */
@@ -251,10 +251,8 @@ static BOOL get_privileges( const DOM_SID *sid, SE_PRIV *mask )
/* PRIV_<SID> (NULL terminated) as the key */
fstr_sprintf( keystr, "%s%s", PRIVPREFIX, sid_string_static(sid) );
- key.dptr = keystr;
- key.dsize = strlen(keystr) + 1;
- data = tdb_fetch( tdb, key );
+ data = tdb_fetch_bystring( tdb, keystr );
if ( !data.dptr ) {
DEBUG(3,("get_privileges: No privileges assigned to SID [%s]\n",
@@ -278,7 +276,7 @@ static BOOL set_privileges( const DOM_SID *sid, SE_PRIV *mask )
{
TDB_CONTEXT *tdb = get_account_pol_tdb();
fstring keystr;
- TDB_DATA key, data;
+ TDB_DATA data;
if ( !lp_enable_privileges() )
return False;
@@ -294,15 +292,13 @@ static BOOL set_privileges( const DOM_SID *sid, SE_PRIV *mask )
/* PRIV_<SID> (NULL terminated) as the key */
fstr_sprintf( keystr, "%s%s", PRIVPREFIX, sid_string_static(sid) );
- key.dptr = keystr;
- key.dsize = strlen(keystr) + 1;
/* no packing. static size structure, just write it out */
data.dptr = (char*)mask;
data.dsize = sizeof(SE_PRIV);
- return ( tdb_store(tdb, key, data, TDB_REPLACE) != -1 );
+ return ( tdb_store_bystring(tdb, keystr, data, TDB_REPLACE) != -1 );
}
/****************************************************************************