mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
netapi: add ConvertStringSidToSid().
Guenther
(This used to be commit 36f1e45e4e
)
This commit is contained in:
parent
9d88cc3394
commit
c7c3510810
@ -422,6 +422,21 @@ NET_API_STATUS NetApiBufferFree(void *buffer);
|
||||
int ConvertSidToStringSid(const struct domsid *sid,
|
||||
char **sid_string);
|
||||
|
||||
/************************************************************//**
|
||||
*
|
||||
* ConvertStringSidToSid
|
||||
*
|
||||
* @brief Convert a string into a domain sid
|
||||
*
|
||||
* @param[in] sid_string A pointer to a sid string.
|
||||
* @param[in] sid A pointer that holds a pointer to a sid structure.
|
||||
* Caller needs to free with free(3)
|
||||
* @return bool
|
||||
***************************************************************/
|
||||
|
||||
int ConvertStringSidToSid(const char *sid_string,
|
||||
struct domsid **sid);
|
||||
|
||||
/************************************************************//**
|
||||
*
|
||||
* NetJoinDomain
|
||||
|
@ -48,3 +48,29 @@ int ConvertSidToStringSid(const struct domsid *sid,
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/****************************************************************
|
||||
****************************************************************/
|
||||
|
||||
int ConvertStringSidToSid(const char *sid_string,
|
||||
struct domsid **sid)
|
||||
{
|
||||
struct dom_sid _sid;
|
||||
|
||||
if (!sid_string || !sid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!string_to_sid(&_sid, sid_string)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*sid = (struct domsid *)SMB_MALLOC(sizeof(struct domsid));
|
||||
if (!*sid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
sid_copy((struct dom_sid*)*sid, &_sid);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user