summaryrefslogtreecommitdiff
path: root/libcli
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-12-15 15:47:01 +1100
committerAndrew Bartlett <abartlet@samba.org>2010-12-16 15:54:30 +1100
commit4a4d8e4b0fae1288cbdf6c8a95a2863c84676106 (patch)
treed2fa1d3058e65205dd00c0398dd977b1212e6d5d /libcli
parent94b149f3cb6c82834f83b73928f5b40e388eb6e5 (diff)
downloadsamba-4a4d8e4b0fae1288cbdf6c8a95a2863c84676106.tar.gz
libcli/security Add sid_blob_parse() to directly parse a binary SID blob
Diffstat (limited to 'libcli')
-rw-r--r--libcli/security/dom_sid.h1
-rw-r--r--libcli/security/util_sid.c16
2 files changed, 14 insertions, 3 deletions
diff --git a/libcli/security/dom_sid.h b/libcli/security/dom_sid.h
index 3d1161fdc73..8d59b1824c1 100644
--- a/libcli/security/dom_sid.h
+++ b/libcli/security/dom_sid.h
@@ -81,6 +81,7 @@ bool sid_split_rid(struct dom_sid *sid, uint32_t *rid);
bool sid_peek_rid(const struct dom_sid *sid, uint32_t *rid);
bool sid_peek_check_rid(const struct dom_sid *exp_dom_sid, const struct dom_sid *sid, uint32_t *rid);
void sid_copy(struct dom_sid *dst, const struct dom_sid *src);
+bool sid_blob_parse(DATA_BLOB in, struct dom_sid *sid);
bool sid_parse(const char *inbuf, size_t len, struct dom_sid *sid);
int sid_compare_domain(const struct dom_sid *sid1, const struct dom_sid *sid2);
bool sid_equal(const struct dom_sid *sid1, const struct dom_sid *sid2);
diff --git a/libcli/security/util_sid.c b/libcli/security/util_sid.c
index 9ba28ebc750..18b99519606 100644
--- a/libcli/security/util_sid.c
+++ b/libcli/security/util_sid.c
@@ -233,13 +233,12 @@ void sid_copy(struct dom_sid *dst, const struct dom_sid *src)
}
/*****************************************************************
- Parse a on-the-wire SID to a struct dom_sid.
+ Parse a on-the-wire SID (in a DATA_BLOB) to a struct dom_sid.
*****************************************************************/
-bool sid_parse(const char *inbuf, size_t len, struct dom_sid *sid)
+bool sid_blob_parse(DATA_BLOB in, struct dom_sid *sid)
{
enum ndr_err_code ndr_err;
- DATA_BLOB in = data_blob_const(inbuf, len);
ndr_err = ndr_pull_struct_blob_all(&in, NULL, sid,
(ndr_pull_flags_fn_t)ndr_pull_dom_sid);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -249,6 +248,17 @@ bool sid_parse(const char *inbuf, size_t len, struct dom_sid *sid)
}
/*****************************************************************
+ Parse a on-the-wire SID to a struct dom_sid.
+*****************************************************************/
+
+bool sid_parse(const char *inbuf, size_t len, struct dom_sid *sid)
+{
+ enum ndr_err_code ndr_err;
+ DATA_BLOB in = data_blob_const(inbuf, len);
+ return sid_blob_parse(in, sid);
+}
+
+/*****************************************************************
See if 2 SIDs are in the same domain
this just compares the leading sub-auths
*****************************************************************/