diff options
author | Günther Deschner <gd@samba.org> | 2010-02-16 02:48:01 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2010-02-18 15:47:59 +0100 |
commit | 28817424935e5b6eaf465fe993dedc2b0a0cf177 (patch) | |
tree | 8e4827f8d0ba646722aaeeb064ae36719d8d3654 /librpc/ndr | |
parent | 70f8b34f513ceeb736061d79e9d44dda39b51642 (diff) | |
download | samba-28817424935e5b6eaf465fe993dedc2b0a0cf177.tar.gz samba-28817424935e5b6eaf465fe993dedc2b0a0cf177.tar.bz2 samba-28817424935e5b6eaf465fe993dedc2b0a0cf177.zip |
spoolss: add spoolss_security_descriptor.
Guenther
Diffstat (limited to 'librpc/ndr')
-rw-r--r-- | librpc/ndr/ndr_spoolss_buf.c | 56 | ||||
-rw-r--r-- | librpc/ndr/ndr_spoolss_buf.h | 3 |
2 files changed, 59 insertions, 0 deletions
diff --git a/librpc/ndr/ndr_spoolss_buf.c b/librpc/ndr/ndr_spoolss_buf.c index 19e7737666..14503a0aab 100644 --- a/librpc/ndr/ndr_spoolss_buf.c +++ b/librpc/ndr/ndr_spoolss_buf.c @@ -24,6 +24,7 @@ #include "includes.h" #include "librpc/gen_ndr/ndr_spoolss.h" +#include "librpc/gen_ndr/ndr_security.h" #if (_SAMBA_BUILD_ >= 4) #include "param/param.h" #endif @@ -1408,3 +1409,58 @@ _PUBLIC_ size_t ndr_size_spoolss_PrinterData(const union spoolss_PrinterData *r, return ndr_size_union(r, flags, level, (ndr_push_flags_fn_t)ndr_push_spoolss_PrinterData, ic); } +void ndr_print_spoolss_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r) +{ + ndr_print_security_descriptor(ndr, name, r); +} + +enum ndr_err_code ndr_pull_spoolss_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r) +{ + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NO_RELATIVE_REVERSE); + NDR_CHECK(ndr_pull_security_descriptor(ndr, ndr_flags, r)); + ndr->flags = _flags_save_STRUCT; + return NDR_ERR_SUCCESS; +} + +enum ndr_err_code ndr_push_spoolss_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN|LIBNDR_FLAG_NO_RELATIVE_REVERSE); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 5)); + NDR_CHECK(ndr_push_security_descriptor_revision(ndr, NDR_SCALARS, r->revision)); + NDR_CHECK(ndr_push_security_descriptor_type(ndr, NDR_SCALARS, r->type)); + NDR_CHECK(ndr_push_relative_ptr1(ndr, r->owner_sid)); + NDR_CHECK(ndr_push_relative_ptr1(ndr, r->group_sid)); + NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sacl)); + NDR_CHECK(ndr_push_relative_ptr1(ndr, r->dacl)); + NDR_CHECK(ndr_push_trailer_align(ndr, 5)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->sacl) { + NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->sacl)); + NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl)); + NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->sacl)); + } + if (r->dacl) { + NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->dacl)); + NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl)); + NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->dacl)); + } + if (r->owner_sid) { + NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->owner_sid)); + NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->owner_sid)); + NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->owner_sid)); + } + if (r->group_sid) { + NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->group_sid)); + NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->group_sid)); + NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->group_sid)); + } + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} diff --git a/librpc/ndr/ndr_spoolss_buf.h b/librpc/ndr/ndr_spoolss_buf.h index a53ab7bb8c..948e910edf 100644 --- a/librpc/ndr/ndr_spoolss_buf.h +++ b/librpc/ndr/ndr_spoolss_buf.h @@ -54,6 +54,9 @@ _PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo101(struct ndr_push *ndr, _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo101(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo101 *r); void ndr_print_spoolss_Field(struct ndr_print *ndr, const char *name, const union spoolss_Field *r); size_t ndr_size_spoolss_PrinterData(const union spoolss_PrinterData *r, uint32_t level, struct smb_iconv_convenience *ic, int flags); +void ndr_print_spoolss_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r); +enum ndr_err_code ndr_pull_spoolss_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r); +enum ndr_err_code ndr_push_spoolss_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r); #undef _PRINTF_ATTRIBUTE #define _PRINTF_ATTRIBUTE(a1, a2) |