X-Git-Url: http://git.samba.org/samba.git/?p=ira%2Fwip.git;a=blobdiff_plain;f=source3%2Flib%2Fprivileges.c;h=c8be360dc643c16ef6847bb48e7e428f3c1c83ae;hp=b3574da858deedb426b6395f37637c4b5b24f280;hb=dccecdf33850ec4d763b8b0e7ba7be7a8eb873de;hpb=118f343b05ba86a1f8fd28394433aa6e961e2d6c diff --git a/source3/lib/privileges.c b/source3/lib/privileges.c index b3574da858d..c8be360dc64 100644 --- a/source3/lib/privileges.c +++ b/source3/lib/privileges.c @@ -359,6 +359,34 @@ NTSTATUS privilege_create_account(const DOM_SID *sid ) return ( grant_privilege(sid, &se_priv_none) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL); } +/*************************************************************************** + Delete a privileged account +****************************************************************************/ + +NTSTATUS privilege_delete_account(const struct dom_sid *sid) +{ + struct db_context *db = get_account_pol_db(); + fstring tmp, keystr; + + if (!lp_enable_privileges()) { + return NT_STATUS_OK; + } + + if (!db) { + return NT_STATUS_INVALID_HANDLE; + } + + if (!sid || (sid->num_auths == 0)) { + return NT_STATUS_INVALID_SID; + } + + /* PRIV_ (NULL terminated) as the key */ + + fstr_sprintf(keystr, "%s%s", PRIVPREFIX, sid_to_fstring(tmp, sid)); + + return dbwrap_delete_bystring(db, keystr); +} + /**************************************************************************** initialise a privilege list and set the talloc context ****************************************************************************/