]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
netapi: add ConvertStringSidToSid().
authorGünther Deschner <gd@samba.org>
Fri, 1 Aug 2008 13:15:05 +0000 (15:15 +0200)
committerGünther Deschner <gd@samba.org>
Mon, 11 Aug 2008 17:03:38 +0000 (19:03 +0200)
Guenther

source/lib/netapi/netapi.h
source/lib/netapi/sid.c

index a1041c009d0f999163dc451c4e0d38d9eaf4cf2a..2c6b667123f107f160a79925f525d49834fe8b20 100644 (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
index 4db98bf3d255db9f0f408fd1a336fc6cf3ca8fbd..a9bca2689fbff991c005088367fabafcfb781bf9 100644 (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;
+}