mirror of
https://github.com/samba-team/samba.git
synced 2024-12-29 11:21:54 +03:00
We have an API to compare the domain parts of two SIDs, so use it.
Volker
(This used to be commit 39308ff138
)
This commit is contained in:
parent
9c15a65dc3
commit
e9681cc658
@ -1089,22 +1089,17 @@ DOM_SID *local_uid_to_sid(DOM_SID *psid, uid_t uid)
|
|||||||
|
|
||||||
BOOL local_sid_to_uid(uid_t *puid, const DOM_SID *psid, enum SID_NAME_USE *name_type)
|
BOOL local_sid_to_uid(uid_t *puid, const DOM_SID *psid, enum SID_NAME_USE *name_type)
|
||||||
{
|
{
|
||||||
DOM_SID dom_sid;
|
|
||||||
uint32 rid;
|
|
||||||
SAM_ACCOUNT *sampw = NULL;
|
SAM_ACCOUNT *sampw = NULL;
|
||||||
struct passwd *unix_pw;
|
struct passwd *unix_pw;
|
||||||
const char *user_name;
|
const char *user_name;
|
||||||
|
|
||||||
*name_type = SID_NAME_UNKNOWN;
|
*name_type = SID_NAME_UNKNOWN;
|
||||||
|
|
||||||
sid_copy(&dom_sid, psid);
|
|
||||||
sid_split_rid(&dom_sid, &rid);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We can only convert to a uid if this is our local
|
* We can only convert to a uid if this is our local
|
||||||
* Domain SID (ie. we are the controling authority).
|
* Domain SID (ie. we are the controling authority).
|
||||||
*/
|
*/
|
||||||
if ( !sid_equal(get_global_sam_sid(), &dom_sid) )
|
if ( !sid_compare_domain(get_global_sam_sid(), psid) )
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user