summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-08-01 15:15:05 +0200
committerGünther Deschner <gd@samba.org>2008-08-11 19:03:38 +0200
commitc7c35108105eea60e3cf81f2d53d241889349c91 (patch)
tree304880fdf7e9f932cac521ae2d8ddbdfa59b44dd /source3
parent9d88cc33944b48c97ab90806d3593ae41f3d6dcc (diff)
downloadsamba-c7c35108105eea60e3cf81f2d53d241889349c91.tar.gz
samba-c7c35108105eea60e3cf81f2d53d241889349c91.tar.bz2
samba-c7c35108105eea60e3cf81f2d53d241889349c91.zip
netapi: add ConvertStringSidToSid().
Guenther (This used to be commit 36f1e45e4ec295115f1ba39ec7ad3690a96dac3e)
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;
+}