mirror of
https://github.com/samba-team/samba.git
synced 2025-03-01 04:58:35 +03:00
s3-net: Use wbcSidToStringBuf
This commit is contained in:
parent
e0fae3d494
commit
c97ea5976c
@ -4617,7 +4617,7 @@ static bool get_user_sids(const char *domain, const char *user, struct security_
|
||||
enum wbcSidType type;
|
||||
fstring full_name;
|
||||
struct wbcDomainSid wsid;
|
||||
char *sid_str = NULL;
|
||||
char sid_str[WBC_SID_STRING_BUFLEN];
|
||||
struct dom_sid user_sid;
|
||||
uint32_t num_groups;
|
||||
gid_t *groups = NULL;
|
||||
@ -4636,13 +4636,9 @@ static bool get_user_sids(const char *domain, const char *user, struct security_
|
||||
return false;
|
||||
}
|
||||
|
||||
wbc_status = wbcSidToString(&wsid, &sid_str);
|
||||
if (!WBC_ERROR_IS_OK(wbc_status)) {
|
||||
return false;
|
||||
}
|
||||
wbcSidToStringBuf(&wsid, sid_str, sizeof(sid_str));
|
||||
|
||||
if (type != WBC_SID_NAME_USER) {
|
||||
wbcFreeMemory(sid_str);
|
||||
DEBUG(1, ("%s is not a user\n", full_name));
|
||||
return false;
|
||||
}
|
||||
@ -4652,9 +4648,6 @@ static bool get_user_sids(const char *domain, const char *user, struct security_
|
||||
return false;
|
||||
}
|
||||
|
||||
wbcFreeMemory(sid_str);
|
||||
sid_str = NULL;
|
||||
|
||||
init_user_token(token, &user_sid);
|
||||
|
||||
/* And now the groups winbind knows about */
|
||||
@ -4678,18 +4671,11 @@ static bool get_user_sids(const char *domain, const char *user, struct security_
|
||||
return false;
|
||||
}
|
||||
|
||||
wbc_status = wbcSidToString(&wsid, &sid_str);
|
||||
if (!WBC_ERROR_IS_OK(wbc_status)) {
|
||||
wbcFreeMemory(groups);
|
||||
return false;
|
||||
}
|
||||
wbcSidToStringBuf(&wsid, sid_str, sizeof(sid_str));
|
||||
|
||||
DEBUG(3, (" %s\n", sid_str));
|
||||
|
||||
string_to_sid(&sid, sid_str);
|
||||
wbcFreeMemory(sid_str);
|
||||
sid_str = NULL;
|
||||
|
||||
add_sid_to_token(token, &sid);
|
||||
}
|
||||
wbcFreeMemory(groups);
|
||||
|
Loading…
x
Reference in New Issue
Block a user