krb5pac: no need for a noprint PAC_BUFFER.
authorGünther Deschner <gd@samba.org>
Mon, 18 Mar 2013 15:25:06 +0000 (16:25 +0100)
committerStefan Metzmacher <metze@samba.org>
Wed, 20 Jul 2016 19:27:18 +0000 (21:27 +0200)
Guenther

@@ -1,6 +1,7 @@
 _PUBLIC_ void ndr_print_PAC_BUFFER(struct ndr_print *ndr, const char *name, const struct PAC_BUFFER *r)
 {
        ndr_print_struct(ndr, name, "PAC_BUFFER");
+       if (r == NULL) { ndr_print_null(ndr); return; }
        ndr->depth++;
        ndr_print_PAC_TYPE(ndr, "type", r->type);
        ndr_print_uint32(ndr, "_ndr_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?_ndr_size_PAC_INFO(r->info,r->type,0):r->_ndr_size);
@@ -11,7 +12,7 @@
                ndr_print_PAC_INFO(ndr, "info", r->info);
        }
        ndr->depth--;
-       ndr_print_uint32(ndr, "_pad", r->_pad);
+       ndr_print_uint32(ndr, "_pad", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?0:r->_pad);
        ndr->depth--;
 }

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
librpc/idl/krb5pac.idl
librpc/ndr/ndr_krb5pac.c
librpc/ndr/ndr_krb5pac.h [new file with mode: 0644]
librpc/wscript_build

index e6ebe359ddd511bc00611c24ad80f554bec95f66..ed67bd11151fee4544371b66735e4f6d97ccda17 100644 (file)
@@ -10,7 +10,8 @@ import "security.idl", "lsa.idl", "netlogon.idl", "samr.idl";
   uuid("12345778-1234-abcd-0000-00000000"),
   version(0.0),
   pointer_default(unique),
-  helpstring("Active Directory KRB5 PAC")
+  helpstring("Active Directory KRB5 PAC"),
+  helper("../librpc/ndr/ndr_krb5pac.h")
 ]
 interface krb5pac
 {
@@ -129,7 +130,7 @@ interface krb5pac
                /* [case(PAC_TYPE_UNKNOWN_12)]  PAC_UNKNOWN_12 unknown; */
        } PAC_INFO;
 
-       typedef [public,nopush,nopull,noprint] struct {
+       typedef [public,nopush,nopull] struct {
                PAC_TYPE type;
                [value(_ndr_size_PAC_INFO(info, type, 0))] uint32 _ndr_size;
                [relative,switch_is(type),subcontext(0),subcontext_size(_subcontext_size_PAC_INFO(r, ndr->flags)),flag(NDR_ALIGN8)] PAC_INFO *info;
index f7db79110762416cc4c72b8c77f75f4245211fbd..fcbc1f377d03d4644bc4f9aea8a7984e5474e430 100644 (file)
@@ -23,7 +23,7 @@
 #include "includes.h"
 #include "librpc/gen_ndr/ndr_krb5pac.h"
 
-static size_t _ndr_size_PAC_INFO(const union PAC_INFO *r, uint32_t level, int flags)
+size_t _ndr_size_PAC_INFO(const union PAC_INFO *r, uint32_t level, int flags)
 {
        size_t s = ndr_size_PAC_INFO(r, level, flags);
        switch (level) {
@@ -125,20 +125,3 @@ enum ndr_err_code ndr_pull_PAC_BUFFER(struct ndr_pull *ndr, int ndr_flags, struc
        }
        return NDR_ERR_SUCCESS;
 }
-
-void ndr_print_PAC_BUFFER(struct ndr_print *ndr, const char *name, const struct PAC_BUFFER *r)
-{
-       ndr_print_struct(ndr, name, "PAC_BUFFER");
-       ndr->depth++;
-       ndr_print_PAC_TYPE(ndr, "type", r->type);
-       ndr_print_uint32(ndr, "_ndr_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?_ndr_size_PAC_INFO(r->info,r->type,0):r->_ndr_size);
-       ndr_print_ptr(ndr, "info", r->info);
-       ndr->depth++;
-       if (r->info) {
-               ndr_print_set_switch_value(ndr, r->info, r->type);
-               ndr_print_PAC_INFO(ndr, "info", r->info);
-       }
-       ndr->depth--;
-       ndr_print_uint32(ndr, "_pad", r->_pad);
-       ndr->depth--;
-}
diff --git a/librpc/ndr/ndr_krb5pac.h b/librpc/ndr/ndr_krb5pac.h
new file mode 100644 (file)
index 0000000..f539161
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   routines for marshalling/unmarshalling spoolss subcontext buffer structures
+
+   Copyright (C) Stefan Metzmacher 2005
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include "librpc/gen_ndr/ndr_krb5pac.h"
+
+size_t _ndr_size_PAC_INFO(const union PAC_INFO *r, uint32_t level, int flags);
+
index f883570588fbf88b33f01512d0f6b0507c181e46..eceb0c485c91f5fb706baf562183e3eb7e4e36fc 100644 (file)
@@ -364,8 +364,8 @@ bld.SAMBA_SUBSYSTEM('NDR_DRSBLOBS',
 bld.SAMBA_LIBRARY('ndr-krb5pac',
     source='ndr/ndr_krb5pac.c gen_ndr/ndr_krb5pac.c',
     public_deps='ndr ndr-standard NDR_SECURITY',
-    public_headers='gen_ndr/krb5pac.h gen_ndr/ndr_krb5pac.h',
-    header_path='gen_ndr',
+    public_headers='gen_ndr/krb5pac.h gen_ndr/ndr_krb5pac.h ndr/ndr_krb5pac.h',
+    header_path=[ ('gen_ndr*', 'gen_ndr'), ('ndr*', 'ndr')],
     pc_files='ndr_krb5pac.pc',
     vnum='0.0.1'
     )