summaryrefslogtreecommitdiff
path: root/source4/libcli/security
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-04-29 17:34:49 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:05:17 -0500
commite002300f238dd0937dd9f768e366c006945e8baa (patch)
tree87bc52b059c4331faac801876d4a567f08659d85 /source4/libcli/security
parent1a4effad3d4c9d69a8aec4a7bb509c4dff309edb (diff)
downloadsamba-e002300f238dd0937dd9f768e366c006945e8baa.tar.gz
samba-e002300f238dd0937dd9f768e366c006945e8baa.tar.bz2
samba-e002300f238dd0937dd9f768e366c006945e8baa.zip
r15328: Move some functions around, remove dependencies.
Remove some autogenerated headers (which had prototypes now autogenerated by pidl) Remove ndr_security.h from a few places - it's no longer necessary (This used to be commit c19c2b51d3e1ad347120b06a22bda5ec586c22e8)
Diffstat (limited to 'source4/libcli/security')
-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
4 files changed, 34 insertions, 3 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