diff options
Diffstat (limited to 'source3/passdb/pdb_get_set.c')
-rw-r--r-- | source3/passdb/pdb_get_set.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c index 0b5a1053ae..980850b89c 100644 --- a/source3/passdb/pdb_get_set.c +++ b/source3/passdb/pdb_get_set.c @@ -177,7 +177,7 @@ uint32 pdb_get_user_rid (const SAM_ACCOUNT *sampass) uint32 u_rid; if (sampass) - if (sid_peek_check_rid(get_global_sam_sid(), (DOM_SID *) pdb_get_user_sid(sampass),&u_rid)) + if (sid_peek_check_rid(get_global_sam_sid(), pdb_get_user_sid(sampass),&u_rid)) return u_rid; return (-1); @@ -188,7 +188,7 @@ uint32 pdb_get_group_rid (const SAM_ACCOUNT *sampass) uint32 g_rid; if (sampass) - if (sid_peek_check_rid(get_global_sam_sid(), (DOM_SID *) pdb_get_group_sid(sampass),&g_rid)) + if (sid_peek_check_rid(get_global_sam_sid(), pdb_get_group_sid(sampass),&g_rid)) return g_rid; return (-1); } @@ -537,11 +537,17 @@ BOOL pdb_set_group_sid(SAM_ACCOUNT *sampass, DOM_SID *g_sid) BOOL pdb_set_user_sid_from_rid (SAM_ACCOUNT *sampass, uint32 rid) { DOM_SID u_sid; - + const DOM_SID *global_sam_sid; + if (!sampass) return False; - sid_copy(&u_sid, get_global_sam_sid()); + if (!(global_sam_sid = get_global_sam_sid())) { + DEBUG(1, ("pdb_set_user_sid_from_rid: Could not read global sam sid!\n")); + return False; + } + + sid_copy(&u_sid, global_sam_sid); if (!sid_append_rid(&u_sid, rid)) return False; @@ -558,11 +564,17 @@ BOOL pdb_set_user_sid_from_rid (SAM_ACCOUNT *sampass, uint32 rid) BOOL pdb_set_group_sid_from_rid (SAM_ACCOUNT *sampass, uint32 grid) { DOM_SID g_sid; + const DOM_SID *global_sam_sid; if (!sampass) return False; - sid_copy(&g_sid, get_global_sam_sid()); + if (!(global_sam_sid = get_global_sam_sid())) { + DEBUG(1, ("pdb_set_user_sid_from_rid: Could not read global sam sid!\n")); + return False; + } + + sid_copy(&g_sid, global_sam_sid); if (!sid_append_rid(&g_sid, grid)) return False; |