summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/security/config.mk2
-rw-r--r--source4/libcli/security/dom_sid.c32
-rw-r--r--source4/libcli/security/sddl.c2
-rw-r--r--source4/libcli/security/security_token.c1
-rw-r--r--source4/libcli/util/clilsa.c1
5 files changed, 34 insertions, 4 deletions
diff --git a/source4/libcli/security/config.mk b/source4/libcli/security/config.mk
index e19947203d..3c97ec4264 100644
--- a/source4/libcli/security/config.mk
+++ b/source4/libcli/security/config.mk
@@ -8,6 +8,6 @@ OBJ_FILES = security_token.o \
access_check.o \
privilege.o \
sddl.o
-PUBLIC_DEPENDENCIES = NDR_SECURITY
+PUBLIC_DEPENDENCIES = NDR_MISC
# End SUBSYSTEM LIBSECURITY
#################################
diff --git a/source4/libcli/security/dom_sid.c b/source4/libcli/security/dom_sid.c
index 131d1afa9c..39841e5a70 100644
--- a/source4/libcli/security/dom_sid.c
+++ b/source4/libcli/security/dom_sid.c
@@ -240,3 +240,35 @@ BOOL dom_sid_in_domain(const struct dom_sid *domain_sid,
return dom_sid_compare_auth(domain_sid, sid) == 0;
}
+
+/*
+ convert a dom_sid to a string
+*/
+char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid)
+{
+ int i, ofs, maxlen;
+ uint32_t ia;
+ char *ret;
+
+ if (!sid) {
+ return talloc_strdup(mem_ctx, "(NULL SID)");
+ }
+
+ maxlen = sid->num_auths * 11 + 25;
+ ret = talloc_size(mem_ctx, maxlen);
+ if (!ret) return talloc_strdup(mem_ctx, "(SID ERR)");
+
+ ia = (sid->id_auth[5]) +
+ (sid->id_auth[4] << 8 ) +
+ (sid->id_auth[3] << 16) +
+ (sid->id_auth[2] << 24);
+
+ ofs = snprintf(ret, maxlen, "S-%u-%lu",
+ (uint_t)sid->sid_rev_num, (unsigned long)ia);
+
+ for (i = 0; i < sid->num_auths; i++) {
+ ofs += snprintf(ret + ofs, maxlen - ofs, "-%lu", (unsigned long)sid->sub_auths[i]);
+ }
+
+ return ret;
+}
diff --git a/source4/libcli/security/sddl.c b/source4/libcli/security/sddl.c
index 46183ce237..97e811f151 100644
--- a/source4/libcli/security/sddl.c
+++ b/source4/libcli/security/sddl.c
@@ -22,8 +22,8 @@
#include "includes.h"
#include "system/iconv.h"
-#include "librpc/gen_ndr/ndr_security.h"
#include "libcli/security/security.h"
+#include "librpc/gen_ndr/ndr_misc.h"
struct flag_map {
const char *name;
diff --git a/source4/libcli/security/security_token.c b/source4/libcli/security/security_token.c
index 0043678144..28339c969d 100644
--- a/source4/libcli/security/security_token.c
+++ b/source4/libcli/security/security_token.c
@@ -24,7 +24,6 @@
#include "includes.h"
#include "dsdb/samdb/samdb.h"
#include "libcli/security/security.h"
-#include "librpc/gen_ndr/ndr_security.h"
/*
return a blank security token
diff --git a/source4/libcli/util/clilsa.c b/source4/libcli/util/clilsa.c
index f5e49dd577..e491d1c9ee 100644
--- a/source4/libcli/util/clilsa.c
+++ b/source4/libcli/util/clilsa.c
@@ -30,7 +30,6 @@
#include "libcli/raw/libcliraw.h"
#include "libcli/libcli.h"
#include "libcli/security/security.h"
-#include "librpc/gen_ndr/ndr_security.h"
#include "librpc/gen_ndr/ndr_lsa.h"
#include "librpc/gen_ndr/ndr_lsa_c.h"