summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/util/dom_sid.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/source4/libcli/util/dom_sid.c b/source4/libcli/util/dom_sid.c
index cdf89ccf96..9b8b45e302 100644
--- a/source4/libcli/util/dom_sid.c
+++ b/source4/libcli/util/dom_sid.c
@@ -89,3 +89,36 @@ struct dom_sid *dom_sid_parse_talloc(TALLOC_CTX *mem_ctx, const char *sidstr)
return ret;
}
+/*
+ convert a string to a dom_sid, returning a talloc'd dom_sid
+*/
+struct dom_sid *dom_sid_dup(TALLOC_CTX *mem_ctx, struct dom_sid *dom_sid)
+{
+ struct dom_sid *ret;
+ int i;
+ ret = talloc_p(mem_ctx, struct dom_sid);
+ if (!ret) {
+ return NULL;
+ }
+
+ ret->sub_auths = talloc_array_p(mem_ctx, uint32_t, dom_sid->num_auths);
+ if (!ret->sub_auths) {
+ return NULL;
+ }
+
+ ret->sid_rev_num = dom_sid->sid_rev_num;
+ ret->id_auth[0] = dom_sid->id_auth[0];
+ ret->id_auth[1] = dom_sid->id_auth[1];
+ ret->id_auth[2] = dom_sid->id_auth[2];
+ ret->id_auth[3] = dom_sid->id_auth[3];
+ ret->id_auth[4] = dom_sid->id_auth[4];
+ ret->id_auth[5] = dom_sid->id_auth[5];
+ ret->num_auths = dom_sid->num_auths;
+
+ for (i=0;i<dom_sid->num_auths;i++) {
+ ret->sub_auths[i] = dom_sid->sub_auths[i];
+ }
+
+ return ret;
+}
+