summaryrefslogtreecommitdiff
path: root/source3/libndr
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-09-06 18:32:20 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:43:56 -0500
commit995205fc60f87e1a02aa1c6f309db55ae18e908a (patch)
treebf796212b1c95b755ef07b1a91b7e26e45dbbd87 /source3/libndr
parenta7be2ec7c5eb8bda76eaec0eaff7e1a7b2b39433 (diff)
downloadsamba-995205fc60f87e1a02aa1c6f309db55ae18e908a.tar.gz
samba-995205fc60f87e1a02aa1c6f309db55ae18e908a.tar.bz2
samba-995205fc60f87e1a02aa1c6f309db55ae18e908a.zip
r18188: merge 3.0-libndr branch
(This used to be commit 1115745caed3093c25d6be01ffee21819fb0a675)
Diffstat (limited to 'source3/libndr')
-rw-r--r--source3/libndr/ndr_basic.c36
-rw-r--r--source3/libndr/ndr_unixinfo.c504
-rw-r--r--source3/libndr/ndr_unixinfo.h41
-rw-r--r--source3/libndr/security.h7
-rw-r--r--source3/libndr/sid.c9
-rw-r--r--source3/libndr/unixinfo.h79
6 files changed, 634 insertions, 42 deletions
diff --git a/source3/libndr/ndr_basic.c b/source3/libndr/ndr_basic.c
index 31a48f67c4..ce2af31784 100644
--- a/source3/libndr/ndr_basic.c
+++ b/source3/libndr/ndr_basic.c
@@ -22,15 +22,6 @@
#include "includes.h"
-/* Evil hack to convert Samba3 NTTIME's to Samba4 NTTIME's */
-
-union NTTIME_big {
- NTTIME s3;
- uint64_t s4;
-};
-
-
-
#define NDR_SVAL(ndr, ofs) (NDR_BE(ndr)?RSVAL(ndr->data,ofs):SVAL(ndr->data,ofs))
#define NDR_IVAL(ndr, ofs) (NDR_BE(ndr)?RIVAL(ndr->data,ofs):IVAL(ndr->data,ofs))
#define NDR_IVALS(ndr, ofs) (NDR_BE(ndr)?RIVALS(ndr->data,ofs):IVALS(ndr->data,ofs))
@@ -514,8 +505,7 @@ NTSTATUS ndr_push_ref_ptr(struct ndr_push *ndr, const void *p)
*/
NTSTATUS ndr_push_NTTIME(struct ndr_push *ndr, int ndr_flags, NTTIME t)
{
- union NTTIME_big b; b.s3 = t;
- NDR_CHECK(ndr_push_udlong(ndr, ndr_flags, b.s4));
+ NDR_CHECK(ndr_push_udlong(ndr, ndr_flags, t));
return NT_STATUS_OK;
}
@@ -524,10 +514,7 @@ NTSTATUS ndr_push_NTTIME(struct ndr_push *ndr, int ndr_flags, NTTIME t)
*/
NTSTATUS ndr_pull_NTTIME(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
{
- union NTTIME_big b;
- NDR_CHECK(ndr_pull_udlong(ndr, ndr_flags, &b.s4));
-
- *t = b.s3;
+ NDR_CHECK(ndr_pull_udlong(ndr, ndr_flags, t));
return NT_STATUS_OK;
}
@@ -536,10 +523,8 @@ NTSTATUS ndr_pull_NTTIME(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
*/
NTSTATUS ndr_push_NTTIME_1sec(struct ndr_push *ndr, int ndr_flags, NTTIME t)
{
- union NTTIME_big b; b.s3 = t;
-
- b.s4 /= 10000000;
- NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, b.s4));
+ t /= 10000000;
+ NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, t));
return NT_STATUS_OK;
}
@@ -548,10 +533,8 @@ NTSTATUS ndr_push_NTTIME_1sec(struct ndr_push *ndr, int ndr_flags, NTTIME t)
*/
NTSTATUS ndr_pull_NTTIME_1sec(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
{
- union NTTIME_big b;
- NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, &b.s4));
- b.s4 *= 10000000;
- *t = b.s3;
+ NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, t));
+ (*t) *= 10000000;
return NT_STATUS_OK;
}
@@ -560,9 +543,7 @@ NTSTATUS ndr_pull_NTTIME_1sec(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
*/
NTSTATUS ndr_pull_NTTIME_hyper(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
{
- union NTTIME_big b;
- NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, &b.s4));
- *t = b.s3;
+ NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, t));
return NT_STATUS_OK;
}
@@ -571,8 +552,7 @@ NTSTATUS ndr_pull_NTTIME_hyper(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
*/
NTSTATUS ndr_push_NTTIME_hyper(struct ndr_push *ndr, int ndr_flags, NTTIME t)
{
- union NTTIME_big b; b.s3 = t;
- NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, b.s4));
+ NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, t));
return NT_STATUS_OK;
}
diff --git a/source3/libndr/ndr_unixinfo.c b/source3/libndr/ndr_unixinfo.c
new file mode 100644
index 0000000000..61b4f4696a
--- /dev/null
+++ b/source3/libndr/ndr_unixinfo.c
@@ -0,0 +1,504 @@
+/* parser auto-generated by pidl */
+
+#include "includes.h"
+#include "libndr/ndr_unixinfo.h"
+static NTSTATUS ndr_push_unixinfo_GetPWUidInfo(struct ndr_push *ndr, int ndr_flags, const struct unixinfo_GetPWUidInfo *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->status));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->homedir));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->shell));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->homedir) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->homedir, CH_UTF8)));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->homedir, CH_UTF8)));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->homedir, ndr_charset_length(r->homedir, CH_UTF8), sizeof(uint8_t), CH_UTF8));
+ }
+ if (r->shell) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->shell, CH_UTF8)));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->shell, CH_UTF8)));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->shell, ndr_charset_length(r->shell, CH_UTF8), sizeof(uint8_t), CH_UTF8));
+ }
+ }
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS ndr_pull_unixinfo_GetPWUidInfo(struct ndr_pull *ndr, int ndr_flags, struct unixinfo_GetPWUidInfo *r)
+{
+ uint32_t _ptr_homedir;
+ TALLOC_CTX *_mem_save_homedir_0;
+ uint32_t _ptr_shell;
+ TALLOC_CTX *_mem_save_shell_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->status));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_homedir));
+ if (_ptr_homedir) {
+ NDR_PULL_ALLOC_SIZE(ndr, r->homedir, 1);
+ } else {
+ r->homedir = NULL;
+ }
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_shell));
+ if (_ptr_shell) {
+ NDR_PULL_ALLOC_SIZE(ndr, r->shell, 1);
+ } else {
+ r->shell = NULL;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->homedir) {
+ _mem_save_homedir_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->homedir, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->homedir));
+ NDR_CHECK(ndr_pull_array_length(ndr, &r->homedir));
+ if (ndr_get_array_length(ndr, &r->homedir) > ndr_get_array_size(ndr, &r->homedir)) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->homedir), ndr_get_array_length(ndr, &r->homedir));
+ }
+ NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->homedir), sizeof(uint8_t)));
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->homedir, ndr_get_array_length(ndr, &r->homedir), sizeof(uint8_t), CH_UTF8));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_homedir_0, 0);
+ }
+ if (r->shell) {
+ _mem_save_shell_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->shell, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->shell));
+ NDR_CHECK(ndr_pull_array_length(ndr, &r->shell));
+ if (ndr_get_array_length(ndr, &r->shell) > ndr_get_array_size(ndr, &r->shell)) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->shell), ndr_get_array_length(ndr, &r->shell));
+ }
+ NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->shell), sizeof(uint8_t)));
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->shell, ndr_get_array_length(ndr, &r->shell), sizeof(uint8_t), CH_UTF8));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_shell_0, 0);
+ }
+ }
+ return NT_STATUS_OK;
+}
+
+void ndr_print_unixinfo_GetPWUidInfo(struct ndr_print *ndr, const char *name, const struct unixinfo_GetPWUidInfo *r)
+{
+ ndr_print_struct(ndr, name, "unixinfo_GetPWUidInfo");
+ ndr->depth++;
+ ndr_print_NTSTATUS(ndr, "status", r->status);
+ ndr_print_ptr(ndr, "homedir", r->homedir);
+ ndr->depth++;
+ if (r->homedir) {
+ ndr_print_string(ndr, "homedir", r->homedir);
+ }
+ ndr->depth--;
+ ndr_print_ptr(ndr, "shell", r->shell);
+ ndr->depth++;
+ if (r->shell) {
+ ndr_print_string(ndr, "shell", r->shell);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
+NTSTATUS ndr_push_unixinfo_SidToUid(struct ndr_push *ndr, int flags, const struct unixinfo_SidToUid *r)
+{
+ if (flags & NDR_IN) {
+ NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.sid));
+ }
+ if (flags & NDR_OUT) {
+ if (r->out.uid == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, *r->out.uid));
+ NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+ }
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_unixinfo_SidToUid(struct ndr_pull *ndr, int flags, struct unixinfo_SidToUid *r)
+{
+ TALLOC_CTX *_mem_save_uid_0;
+ if (flags & NDR_IN) {
+ ZERO_STRUCT(r->out);
+
+ NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.sid));
+ NDR_PULL_ALLOC(ndr, r->out.uid);
+ ZERO_STRUCTP(r->out.uid);
+ }
+ if (flags & NDR_OUT) {
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->out.uid);
+ }
+ _mem_save_uid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.uid, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, r->out.uid));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_uid_0, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+ }
+ return NT_STATUS_OK;
+}
+
+void ndr_print_unixinfo_SidToUid(struct ndr_print *ndr, const char *name, int flags, const struct unixinfo_SidToUid *r)
+{
+ ndr_print_struct(ndr, name, "unixinfo_SidToUid");
+ ndr->depth++;
+ if (flags & NDR_SET_VALUES) {
+ ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+ }
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "unixinfo_SidToUid");
+ ndr->depth++;
+ ndr_print_dom_sid(ndr, "sid", &r->in.sid);
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ ndr_print_struct(ndr, "out", "unixinfo_SidToUid");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "uid", r->out.uid);
+ ndr->depth++;
+ ndr_print_hyper(ndr, "uid", *r->out.uid);
+ ndr->depth--;
+ ndr_print_NTSTATUS(ndr, "result", r->out.result);
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
+NTSTATUS ndr_push_unixinfo_UidToSid(struct ndr_push *ndr, int flags, const struct unixinfo_UidToSid *r)
+{
+ if (flags & NDR_IN) {
+ NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->in.uid));
+ }
+ if (flags & NDR_OUT) {
+ if (r->out.sid == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid));
+ NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+ }
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_unixinfo_UidToSid(struct ndr_pull *ndr, int flags, struct unixinfo_UidToSid *r)
+{
+ TALLOC_CTX *_mem_save_sid_0;
+ if (flags & NDR_IN) {
+ ZERO_STRUCT(r->out);
+
+ NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->in.uid));
+ NDR_PULL_ALLOC(ndr, r->out.sid);
+ ZERO_STRUCTP(r->out.sid);
+ }
+ if (flags & NDR_OUT) {
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->out.sid);
+ }
+ _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.sid, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+ }
+ return NT_STATUS_OK;
+}
+
+void ndr_print_unixinfo_UidToSid(struct ndr_print *ndr, const char *name, int flags, const struct unixinfo_UidToSid *r)
+{
+ ndr_print_struct(ndr, name, "unixinfo_UidToSid");
+ ndr->depth++;
+ if (flags & NDR_SET_VALUES) {
+ ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+ }
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "unixinfo_UidToSid");
+ ndr->depth++;
+ ndr_print_hyper(ndr, "uid", r->in.uid);
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ ndr_print_struct(ndr, "out", "unixinfo_UidToSid");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "sid", r->out.sid);
+ ndr->depth++;
+ ndr_print_dom_sid(ndr, "sid", r->out.sid);
+ ndr->depth--;
+ ndr_print_NTSTATUS(ndr, "result", r->out.result);
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
+NTSTATUS ndr_push_unixinfo_SidToGid(struct ndr_push *ndr, int flags, const struct unixinfo_SidToGid *r)
+{
+ if (flags & NDR_IN) {
+ NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.sid));
+ }
+ if (flags & NDR_OUT) {
+ if (r->out.gid == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, *r->out.gid));
+ NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+ }
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_unixinfo_SidToGid(struct ndr_pull *ndr, int flags, struct unixinfo_SidToGid *r)
+{
+ TALLOC_CTX *_mem_save_gid_0;
+ if (flags & NDR_IN) {
+ ZERO_STRUCT(r->out);
+
+ NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.sid));
+ NDR_PULL_ALLOC(ndr, r->out.gid);
+ ZERO_STRUCTP(r->out.gid);
+ }
+ if (flags & NDR_OUT) {
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->out.gid);
+ }
+ _mem_save_gid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.gid, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, r->out.gid));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_gid_0, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+ }
+ return NT_STATUS_OK;
+}
+
+void ndr_print_unixinfo_SidToGid(struct ndr_print *ndr, const char *name, int flags, const struct unixinfo_SidToGid *r)
+{
+ ndr_print_struct(ndr, name, "unixinfo_SidToGid");
+ ndr->depth++;
+ if (flags & NDR_SET_VALUES) {
+ ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+ }
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "unixinfo_SidToGid");
+ ndr->depth++;
+ ndr_print_dom_sid(ndr, "sid", &r->in.sid);
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ ndr_print_struct(ndr, "out", "unixinfo_SidToGid");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "gid", r->out.gid);
+ ndr->depth++;
+ ndr_print_hyper(ndr, "gid", *r->out.gid);
+ ndr->depth--;
+ ndr_print_NTSTATUS(ndr, "result", r->out.result);
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
+NTSTATUS ndr_push_unixinfo_GidToSid(struct ndr_push *ndr, int flags, const struct unixinfo_GidToSid *r)
+{
+ if (flags & NDR_IN) {
+ NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->in.gid));
+ }
+ if (flags & NDR_OUT) {
+ if (r->out.sid == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid));
+ NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+ }
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_unixinfo_GidToSid(struct ndr_pull *ndr, int flags, struct unixinfo_GidToSid *r)
+{
+ TALLOC_CTX *_mem_save_sid_0;
+ if (flags & NDR_IN) {
+ ZERO_STRUCT(r->out);
+
+ NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->in.gid));
+ NDR_PULL_ALLOC(ndr, r->out.sid);
+ ZERO_STRUCTP(r->out.sid);
+ }
+ if (flags & NDR_OUT) {
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->out.sid);
+ }
+ _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.sid, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+ }
+ return NT_STATUS_OK;
+}
+
+void ndr_print_unixinfo_GidToSid(struct ndr_print *ndr, const char *name, int flags, const struct unixinfo_GidToSid *r)
+{
+ ndr_print_struct(ndr, name, "unixinfo_GidToSid");
+ ndr->depth++;
+ if (flags & NDR_SET_VALUES) {
+ ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+ }
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "unixinfo_GidToSid");
+ ndr->depth++;
+ ndr_print_hyper(ndr, "gid", r->in.gid);
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ ndr_print_struct(ndr, "out", "unixinfo_GidToSid");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "sid", r->out.sid);
+ ndr->depth++;
+ ndr_print_dom_sid(ndr, "sid", r->out.sid);
+ ndr->depth--;
+ ndr_print_NTSTATUS(ndr, "result", r->out.result);
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
+NTSTATUS ndr_push_unixinfo_GetPWUid(struct ndr_push *ndr, int flags, const struct unixinfo_GetPWUid *r)
+{
+ uint32_t cntr_uids_0;
+ uint32_t cntr_infos_1;
+ if (flags & NDR_IN) {
+ if (r->in.count == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.count));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.count));
+ for (cntr_uids_0 = 0; cntr_uids_0 < *r->in.count; cntr_uids_0++) {
+ NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->in.uids[cntr_uids_0]));
+ }
+ }
+ if (flags & NDR_OUT) {
+ if (r->out.count == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.count));
+ if (r->out.infos == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.count));
+ for (cntr_infos_1 = 0; cntr_infos_1 < *r->out.count; cntr_infos_1++) {
+ NDR_CHECK(ndr_push_unixinfo_GetPWUidInfo(ndr, NDR_SCALARS, &r->out.infos[cntr_infos_1]));
+ }
+ for (cntr_infos_1 = 0; cntr_infos_1 < *r->out.count; cntr_infos_1++) {
+ NDR_CHECK(ndr_push_unixinfo_GetPWUidInfo(ndr, NDR_BUFFERS, &r->out.infos[cntr_infos_1]));
+ }
+ NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+ }
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_unixinfo_GetPWUid(struct ndr_pull *ndr, int flags, struct unixinfo_GetPWUid *r)
+{
+ uint32_t cntr_uids_0;
+ uint32_t cntr_infos_1;
+ TALLOC_CTX *_mem_save_count_0;
+ TALLOC_CTX *_mem_save_uids_0;
+ TALLOC_CTX *_mem_save_infos_1;
+ if (flags & NDR_IN) {
+ ZERO_STRUCT(r->out);
+
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->in.count);
+ }
+ _mem_save_count_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.count, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.count));
+ if (*r->in.count < 0 || *r->in.count > 1023) {
+ return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_count_0, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->in.uids));
+ NDR_PULL_ALLOC_N(ndr, r->in.uids, ndr_get_array_size(ndr, &r->in.uids));
+ _mem_save_uids_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.uids, 0);
+ for (cntr_uids_0 = 0; cntr_uids_0 < *r->in.count; cntr_uids_0++) {
+ NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->in.uids[cntr_uids_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_uids_0, 0);
+ NDR_PULL_ALLOC(ndr, r->out.count);
+ *r->out.count = *r->in.count;
+ if (r->in.count == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_PULL_ALLOC_N(ndr, r->out.infos, *r->in.count);
+ memset(r->out.infos, 0, *r->in.count * sizeof(*r->out.infos));
+ if (r->in.uids) {
+ if (r->in.count == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.uids, *r->in.count));
+ }
+ }
+ if (flags & NDR_OUT) {
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->out.count);
+ }
+ _mem_save_count_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.count, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.count));
+ if (*r->out.count < 0 || *r->out.count > 1023) {
+ return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_count_0, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->out.infos));
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC_N(ndr, r->out.infos, ndr_get_array_size(ndr, &r->out.infos));
+ }
+ _mem_save_infos_1 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.infos, 0);
+ for (cntr_infos_1 = 0; cntr_infos_1 < *r->out.count; cntr_infos_1++) {
+ NDR_CHECK(ndr_pull_unixinfo_GetPWUidInfo(ndr, NDR_SCALARS, &r->out.infos[cntr_infos_1]));
+ }
+ for (cntr_infos_1 = 0; cntr_infos_1 < *r->out.count; cntr_infos_1++) {
+ NDR_CHECK(ndr_pull_unixinfo_GetPWUidInfo(ndr, NDR_BUFFERS, &r->out.infos[cntr_infos_1]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_infos_1, 0);
+ NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+ if (r->out.infos) {
+ if (r->out.count == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.infos, *r->out.count));
+ }
+ }
+ return NT_STATUS_OK;
+}
+
+void ndr_print_unixinfo_GetPWUid(struct ndr_print *ndr, const char *name, int flags, const struct unixinfo_GetPWUid *r)
+{
+ uint32_t cntr_uids_0;
+ uint32_t cntr_infos_1;
+ ndr_print_struct(ndr, name, "unixinfo_GetPWUid");
+ ndr->depth++;
+ if (flags & NDR_SET_VALUES) {
+ ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+ }
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "unixinfo_GetPWUid");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "count", r->in.count);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "count", *r->in.count);
+ ndr->depth--;
+ ndr->print(ndr, "%s: ARRAY(%d)", "uids", *r->in.count);
+ ndr->depth++;
+ for (cntr_uids_0=0;cntr_uids_0<*r->in.count;cntr_uids_0++) {
+ char *idx_0=NULL;
+ asprintf(&idx_0, "[%d]", cntr_uids_0);
+ if (idx_0) {
+ ndr_print_hyper(ndr, "uids", r->in.uids[cntr_uids_0]);
+ free(idx_0);
+ }
+ }
+ ndr->depth--;
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ ndr_print_struct(ndr, "out", "unixinfo_GetPWUid");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "count", r->out.count);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "count", *r->out.count);
+ ndr->depth--;
+ ndr_print_ptr(ndr, "infos", r->out.infos);
+ ndr->depth++;
+ ndr->print(ndr, "%s: ARRAY(%d)", "infos", *r->out.count);
+ ndr->depth++;
+ for (cntr_infos_1=0;cntr_infos_1<*r->out.count;cntr_infos_1++) {
+ char *idx_1=NULL;
+ asprintf(&idx_1, "[%d]", cntr_infos_1);
+ if (idx_1) {
+ ndr_print_unixinfo_GetPWUidInfo(ndr, "infos", &r->out.infos[cntr_infos_1]);
+ free(idx_1);
+ }
+ }
+ ndr->depth--;
+ ndr->depth--;
+ ndr_print_NTSTATUS(ndr, "result", r->out.result);
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
+
diff --git a/source3/libndr/ndr_unixinfo.h b/source3/libndr/ndr_unixinfo.h
new file mode 100644
index 0000000000..1741cfc35f
--- /dev/null
+++ b/source3/libndr/ndr_unixinfo.h
@@ -0,0 +1,41 @@
+/* header auto-generated by pidl */
+
+#include "libndr/unixinfo.h"
+
+#ifndef _HEADER_NDR_unixinfo
+#define _HEADER_NDR_unixinfo
+
+#define DCERPC_UNIXINFO_UUID "9c54e310-a955-4885-bd31-78787147dfa6"
+#define DCERPC_UNIXINFO_VERSION 0.0
+#define DCERPC_UNIXINFO_NAME "unixinfo"
+#define DCERPC_UNIXINFO_HELPSTRING "Unixinfo specific stuff"
+extern const struct dcerpc_interface_table dcerpc_table_unixinfo;
+NTSTATUS dcerpc_server_unixinfo_init(void);
+#define DCERPC_UNIXINFO_SIDTOUID (0x00)
+
+#define DCERPC_UNIXINFO_UIDTOSID (0x01)
+
+#define DCERPC_UNIXINFO_SIDTOGID (0x02)
+
+#define DCERPC_UNIXINFO_GIDTOSID (0x03)
+
+#define DCERPC_UNIXINFO_GETPWUID (0x04)
+
+#define DCERPC_UNIXINFO_CALL_COUNT (5)
+void ndr_print_unixinfo_GetPWUidInfo(struct ndr_print *ndr, const char *name, const struct unixinfo_GetPWUidInfo *r);
+NTSTATUS ndr_push_unixinfo_SidToUid(struct ndr_push *ndr, int flags, const struct unixinfo_SidToUid *r);
+NTSTATUS ndr_pull_unixinfo_SidToUid(struct ndr_pull *ndr, int flags, struct unixinfo_SidToUid *r);
+void ndr_print_unixinfo_SidToUid(struct ndr_print *ndr, const char *name, int flags, const struct unixinfo_SidToUid *r);
+NTSTATUS ndr_push_unixinfo_UidToSid(struct ndr_push *ndr, int flags, const struct unixinfo_UidToSid *r);
+NTSTATUS ndr_pull_unixinfo_UidToSid(struct ndr_pull *ndr, int flags, struct unixinfo_UidToSid *r);
+void ndr_print_unixinfo_UidToSid(struct ndr_print *ndr, const char *name, int flags, const struct unixinfo_UidToSid *r);
+NTSTATUS ndr_push_unixinfo_SidToGid(struct ndr_push *ndr, int flags, const struct unixinfo_SidToGid *r);
+NTSTATUS ndr_pull_unixinfo_SidToGid(struct ndr_pull *ndr, int flags, struct unixinfo_SidToGid *r);
+void ndr_print_unixinfo_SidToGid(struct ndr_print *ndr, const char *name, int flags, const struct unixinfo_SidToGid *r);
+NTSTATUS ndr_push_unixinfo_GidToSid(struct ndr_push *ndr, int flags, const struct unixinfo_GidToSid *r);
+NTSTATUS ndr_pull_unixinfo_GidToSid(struct ndr_pull *ndr, int flags, struct unixinfo_GidToSid *r);
+void ndr_print_unixinfo_GidToSid(struct ndr_print *ndr, const char *name, int flags, const struct unixinfo_GidToSid *r);
+NTSTATUS ndr_push_unixinfo_GetPWUid(struct ndr_push *ndr, int flags, const struct unixinfo_GetPWUid *r);
+NTSTATUS ndr_pull_unixinfo_GetPWUid(struct ndr_pull *ndr, int flags, struct unixinfo_GetPWUid *r);
+void ndr_print_unixinfo_GetPWUid(struct ndr_print *ndr, const char *name, int flags, const struct unixinfo_GetPWUid *r);
+#endif /* _HEADER_NDR_unixinfo */
diff --git a/source3/libndr/security.h b/source3/libndr/security.h
index 8f790f387e..61e0ea313f 100644
--- a/source3/libndr/security.h
+++ b/source3/libndr/security.h
@@ -135,13 +135,6 @@ enum sec_privilege {
SEC_PRIV_REMOTE_INTERACTIVE_LOGON=24
};
-struct dom_sid {
- uint8_t sid_rev_num;
- int8_t num_auths;/* [range(0 15)] */
- uint8_t id_auth[6];
- uint32_t *sub_auths;
-}/* [noprint,gensize,noejs,public,nosize] */;
-
/* bitmap security_ace_flags */
#define SEC_ACE_FLAG_OBJECT_INHERIT ( 0x01 )
#define SEC_ACE_FLAG_CONTAINER_INHERIT ( 0x02 )
diff --git a/source3/libndr/sid.c b/source3/libndr/sid.c
index 0bb42a3683..f8c284e93c 100644
--- a/source3/libndr/sid.c
+++ b/source3/libndr/sid.c
@@ -42,22 +42,17 @@ NTSTATUS ndr_push_dom_sid(struct ndr_push *ndr, int ndr_flags, const struct dom_
NTSTATUS ndr_pull_dom_sid(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *r)
{
uint32_t cntr_sub_auths_0;
- TALLOC_CTX *_mem_save_sub_auths_0;
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->sid_rev_num));
- NDR_CHECK(ndr_pull_int8(ndr, NDR_SCALARS, &r->num_auths));
- if (r->num_auths < 0 || r->num_auths > 15) {
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->num_auths));
+ if (r->num_auths > 15) {
return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
}
NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->id_auth, 6));
- NDR_PULL_ALLOC_N(ndr, r->sub_auths, r->num_auths);
- _mem_save_sub_auths_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->sub_auths, 0);
for (cntr_sub_auths_0 = 0; cntr_sub_auths_0 < r->num_auths; cntr_sub_auths_0++) {
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sub_auths[cntr_sub_auths_0]));
}
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sub_auths_0, 0);
}
if (ndr_flags & NDR_BUFFERS) {
}
diff --git a/source3/libndr/unixinfo.h b/source3/libndr/unixinfo.h
new file mode 100644
index 0000000000..5d0434ca72
--- /dev/null
+++ b/source3/libndr/unixinfo.h
@@ -0,0 +1,79 @@
+/* header auto-generated by pidl */
+
+#ifndef _HEADER_unixinfo
+#define _HEADER_unixinfo
+
+struct unixinfo_GetPWUidInfo {
+ NTSTATUS status;
+ const char *homedir;/* [unique,charset(UTF8)] */
+ const char *shell;/* [unique,charset(UTF8)] */
+};
+
+
+struct unixinfo_SidToUid {
+ struct {
+ struct dom_sid sid;
+ } in;
+
+ struct {
+ uint64_t *uid;/* [ref] */
+ NTSTATUS result;
+ } out;
+
+};
+
+
+struct unixinfo_UidToSid {
+ struct {
+ uint64_t uid;
+ } in;
+
+ struct {
+ struct dom_sid *sid;/* [ref] */
+ NTSTATUS result;
+ } out;
+
+};
+
+
+struct unixinfo_SidToGid {
+ struct {
+ struct dom_sid sid;
+ } in;
+
+ struct {
+ uint64_t *gid;/* [ref] */
+ NTSTATUS result;
+ } out;
+
+};
+
+
+struct unixinfo_GidToSid {
+ struct {
+ uint64_t gid;
+ } in;
+
+ struct {
+ struct dom_sid *sid;/* [ref] */
+ NTSTATUS result;
+ } out;
+
+};
+
+
+struct unixinfo_GetPWUid {
+ struct {
+ uint32_t *count;/* [ref,range(0 1023)] */
+ uint64_t *uids;/* [size_is(*count)] */
+ } in;
+
+ struct {
+ uint32_t *count;/* [ref,range(0 1023)] */
+ struct unixinfo_GetPWUidInfo *infos;/* [ref,size_is(*count)] */
+ NTSTATUS result;
+ } out;
+
+};
+
+#endif /* _HEADER_unixinfo */