1
0
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:
Günther Deschner 2008-08-01 15:15:05 +02:00
parent 9d88cc3394
commit c7c3510810
2 changed files with 41 additions and 0 deletions

View File

@ -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

View File

@ -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;
}