summaryrefslogtreecommitdiff
path: root/source4/librpc/ndr/ndr_sec_helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/librpc/ndr/ndr_sec_helper.c')
-rw-r--r--source4/librpc/ndr/ndr_sec_helper.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/source4/librpc/ndr/ndr_sec_helper.c b/source4/librpc/ndr/ndr_sec_helper.c
index 5a0178bd25..1256d7dd2d 100644
--- a/source4/librpc/ndr/ndr_sec_helper.c
+++ b/source4/librpc/ndr/ndr_sec_helper.c
@@ -48,6 +48,11 @@ size_t ndr_size_dom_sid28(const struct dom_sid *sid, int flags)
return 8 + 4*sid->num_auths;
}
+size_t ndr_size_dom_sid0(const struct dom_sid *sid, int flags)
+{
+ return ndr_size_dom_sid28(sid, flags);
+}
+
/*
return the wire size of a security_ace
*/
@@ -128,6 +133,11 @@ void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct d
ndr_print_dom_sid(ndr, name, sid);
}
+void ndr_print_dom_sid0(struct ndr_print *ndr, const char *name, const struct dom_sid *sid)
+{
+ ndr_print_dom_sid(ndr, name, sid);
+}
+
/*
parse a dom_sid2 - this is a dom_sid but with an extra copy of the num_auths field
@@ -225,3 +235,44 @@ enum ndr_err_code ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const
return NDR_ERR_SUCCESS;
}
+/*
+ parse a dom_sid0 - this is a dom_sid in a variable byte buffer, which is maybe empty
+*/
+enum ndr_err_code ndr_pull_dom_sid0(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid)
+{
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ if (ndr->data_size == ndr->offset) {
+ ZERO_STRUCTP(sid);
+ return NDR_ERR_SUCCESS;
+ }
+
+ return ndr_pull_dom_sid(ndr, ndr_flags, sid);
+}
+
+/*
+ push a dom_sid0 - this is a dom_sid in a variable byte buffer, which is maybe empty
+*/
+enum ndr_err_code ndr_push_dom_sid0(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid)
+{
+ struct dom_sid zero_sid;
+
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ if (!sid) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ ZERO_STRUCT(zero_sid);
+
+ if (memcmp(&zero_sid, sid, sizeof(zero_sid)) == 0) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ return ndr_push_dom_sid(ndr, ndr_flags, sid);
+}
+