summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/netapi/netapi.h15
-rw-r--r--source3/lib/netapi/sid.c26
2 files changed, 41 insertions, 0 deletions
diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h
index a1041c009d..2c6b667123 100644
--- a/source3/lib/netapi/netapi.h
+++ b/source3/lib/netapi/netapi.h
@@ -424,6 +424,21 @@ int ConvertSidToStringSid(const struct domsid *sid,
/************************************************************//**
*
+ * 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
*
* @brief Join a computer to a domain or workgroup
diff --git a/source3/lib/netapi/sid.c b/source3/lib/netapi/sid.c
index 4db98bf3d2..a9bca2689f 100644
--- a/source3/lib/netapi/sid.c
+++ b/source3/lib/netapi/sid.c
@@ -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;
+}