s3: security.idl: split of dom_sid stuff into dom_sid.idl
authorStefan Metzmacher <metze@samba.org>
Fri, 7 Nov 2008 20:31:04 +0000 (21:31 +0100)
committerStefan Metzmacher <metze@samba.org>
Sat, 8 Nov 2008 07:02:26 +0000 (08:02 +0100)
And use the toplevel ndr_sec_helper.c

metze

librpc/idl/security.idl
source3/Makefile.in
source3/librpc/gen_ndr/dom_sid.h [new file with mode: 0644]
source3/librpc/gen_ndr/ndr_security.c
source3/librpc/gen_ndr/ndr_security.h
source3/librpc/gen_ndr/security.h
source3/librpc/idl/dom_sid.idl [new file with mode: 0644]
source3/librpc/ndr/ndr_sec.h [deleted file]
source3/librpc/ndr/ndr_sec_helper.c [deleted file]
source3/librpc/ndr/sid.c

index 690f40608114f6cc0bdcb0897e1801637f89917d..a9c9392c53381c7d064ddec15ef33f29ec9e0ae8 100644 (file)
@@ -5,27 +5,10 @@
 */
 
 import "misc.idl";
-
-/* 
-   use the same structure for dom_sid2 as dom_sid. A dom_sid2 is really
-   just a dom sid, but with the sub_auths represented as a conformant
-   array. As with all in-structure conformant arrays, the array length
-   is placed before the start of the structure. That's what gives rise
-   to the extra num_auths elemenent. We don't want the Samba code to
-   have to bother with such esoteric NDR details, so its easier to just
-   define it as a dom_sid and use pidl magic to make it all work. It
-   just means you need to mark a sid as a "dom_sid2" in the IDL when you
-   know it is of the conformant array variety
-*/
-cpp_quote("#define dom_sid2 dom_sid")
-
-/* same struct as dom_sid but inside a 28 bytes fixed buffer in NDR */
-cpp_quote("#define dom_sid28 dom_sid")
-
-/* same struct as dom_sid but in a variable byte buffer, which is maybe empty in NDR */
-cpp_quote("#define dom_sid0 dom_sid")
+import "dom_sid.idl";
 
 [
+       helper("librpc/gen_ndr/ndr_dom_sid.h"),
        pointer_default(unique)
 ]
 interface security
index b8646aa931f93c3e5b3d9ff589593d0879862448..a644eeae64da674a3fe51ffde91f1c948398dcbf 100644 (file)
@@ -267,7 +267,7 @@ LIBNDR_OBJ = ../librpc/ndr/ndr_basic.o \
             ../librpc/ndr/ndr_misc.o \
             librpc/gen_ndr/ndr_misc.o \
             librpc/gen_ndr/ndr_security.o \
-            librpc/ndr/ndr_sec_helper.o \
+            ../librpc/ndr/ndr_sec_helper.o \
             librpc/ndr/ndr_string.o \
             librpc/ndr/sid.o \
             ../librpc/ndr/uuid.o \
@@ -1225,7 +1225,7 @@ samba3-idl::
                ../librpc/idl/security.idl ../librpc/idl/dssetup.idl ../librpc/idl/krb5pac.idl \
                ../librpc/idl/ntsvcs.idl librpc/idl/libnetapi.idl ../librpc/idl/drsuapi.idl \
                ../librpc/idl/drsblobs.idl ../librpc/idl/nbt.idl \
-               ../librpc/idl/named_pipe_auth.idl
+               ../librpc/idl/named_pipe_auth.idl librpc/idl/dom_sid.idl
 
 librpc/gen_ndr/tables.c:: librpc/gen_ndr/*.h
        @echo "Generating $@"
diff --git a/source3/librpc/gen_ndr/dom_sid.h b/source3/librpc/gen_ndr/dom_sid.h
new file mode 100644 (file)
index 0000000..57dd168
--- /dev/null
@@ -0,0 +1,15 @@
+/* header auto-generated by pidl */
+
+#include <stdint.h>
+
+#define dom_sid2 dom_sid
+#define dom_sid28 dom_sid
+#define dom_sid0 dom_sid
+#ifndef _HEADER_dom_sid
+#define _HEADER_dom_sid
+
+struct _dummy_domsid {
+       uint8_t dummy;
+};
+
+#endif /* _HEADER_dom_sid */
index de899241ab5b701b61a91edf8abfe210a06df01b..b93a051d7a54dc8d734ea755cef06c978da78a9b 100644 (file)
@@ -4,6 +4,7 @@
 #include "librpc/gen_ndr/ndr_security.h"
 
 #include "librpc/gen_ndr/ndr_misc.h"
+#include "librpc/gen_ndr/ndr_dom_sid.h"
 static enum ndr_err_code ndr_push_security_ace_flags(struct ndr_push *ndr, int ndr_flags, uint8_t r)
 {
        NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
index 7a2ff7430970162fa568531579166e21b233e0d3..90800d3d1bc2d782a5dbf3fef6ac473a5310348c 100644 (file)
@@ -6,6 +6,7 @@
 #ifndef _HEADER_NDR_security
 #define _HEADER_NDR_security
 
+#include "librpc/gen_ndr/ndr_dom_sid.h"
 #define NDR_SECURITY_CALL_COUNT (0)
 void ndr_print_security_ace_flags(struct ndr_print *ndr, const char *name, uint8_t r);
 void ndr_print_security_ace_type(struct ndr_print *ndr, const char *name, enum security_ace_type r);
index bb06dc2584d02eb8b1796f107daaf37e5628e00e..59b00a56a9555e2c64b2ac13533f38ceeb4bb023 100644 (file)
@@ -3,9 +3,7 @@
 #include <stdint.h>
 
 #include "librpc/gen_ndr/misc.h"
-#define dom_sid2 dom_sid
-#define dom_sid28 dom_sid
-#define dom_sid0 dom_sid
+#include "librpc/gen_ndr/dom_sid.h"
 #ifndef _HEADER_security
 #define _HEADER_security
 
diff --git a/source3/librpc/idl/dom_sid.idl b/source3/librpc/idl/dom_sid.idl
new file mode 100644 (file)
index 0000000..c405c18
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+   use the same structure for dom_sid2 as dom_sid. A dom_sid2 is really
+   just a dom sid, but with the sub_auths represented as a conformant
+   array. As with all in-structure conformant arrays, the array length
+   is placed before the start of the structure. That's what gives rise
+   to the extra num_auths elemenent. We don't want the Samba code to
+   have to bother with such esoteric NDR details, so its easier to just
+   define it as a dom_sid and use pidl magic to make it all work. It
+   just means you need to mark a sid as a "dom_sid2" in the IDL when you
+   know it is of the conformant array variety
+*/
+cpp_quote("#define dom_sid2 dom_sid")
+
+/* same struct as dom_sid but inside a 28 bytes fixed buffer in NDR */
+cpp_quote("#define dom_sid28 dom_sid")
+
+/* same struct as dom_sid but in a variable byte buffer, which is maybe empty in NDR */
+cpp_quote("#define dom_sid0 dom_sid")
+
+[
+       pointer_default(unique)
+]
+interface dom_sid
+{
+       struct _dummy_domsid {
+               uint8 dummy;
+       };
+}
+
diff --git a/source3/librpc/ndr/ndr_sec.h b/source3/librpc/ndr/ndr_sec.h
deleted file mode 100644 (file)
index 8034367..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef __LIBRPC_NDR_NDR_SEC_H__
-#define __LIBRPC_NDR_NDR_SEC_H__
-
-#undef _PRINTF_ATTRIBUTE
-#define _PRINTF_ATTRIBUTE(a1, a2) PRINTF_ATTRIBUTE(a1, a2)
-/* This file was automatically generated by mkproto.pl. DO NOT EDIT */
-
-#ifndef _PUBLIC_
-#define _PUBLIC_
-#endif
-
-
-/* The following definitions come from librpc/ndr/ndr_sec_helper.c  */
-
-size_t ndr_size_dom_sid(const struct dom_sid *sid);
-size_t ndr_length_dom_sid(const struct dom_sid *sid);
-size_t ndr_size_security_ace(const struct security_ace *ace);
-size_t ndr_size_security_acl(const struct security_acl *acl);
-size_t ndr_size_security_descriptor(const struct security_descriptor *sd);
-void ndr_print_dom_sid(struct ndr_print *ndr, const char *name, const struct dom_sid *sid);
-void ndr_print_dom_sid2(struct ndr_print *ndr, const char *name, const struct dom_sid *sid);
-void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct dom_sid *sid);
-char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
-
-/* The following definitions come from librpc/ndr/ndr_sec.c  */
-
-enum ndr_err_code ndr_pull_dom_sid2(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid);
-enum ndr_err_code ndr_push_dom_sid2(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid);
-enum ndr_err_code ndr_pull_dom_sid28(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid);
-enum ndr_err_code ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid);
-#undef _PRINTF_ATTRIBUTE
-#define _PRINTF_ATTRIBUTE(a1, a2)
-
-#endif /* __LIBRPC_NDR_NDR_SEC_H__ */
-
diff --git a/source3/librpc/ndr/ndr_sec_helper.c b/source3/librpc/ndr/ndr_sec_helper.c
deleted file mode 100644 (file)
index 18d3437..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-
-   fast routines for getting the wire size of security objects
-
-   Copyright (C) Andrew Tridgell 2003
-   
-   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 "includes.h"
-
-/*
-  return the wire size of a dom_sid
-*/
-size_t ndr_size_dom_sid(const struct dom_sid *sid, int flags)
-{
-       if (!sid) return 0;
-       return 8 + 4*sid->num_auths;
-}
-
-size_t ndr_size_dom_sid28(const struct dom_sid *sid, int flags)
-{
-       struct dom_sid zero_sid;
-
-       if (!sid) return 0;
-
-       ZERO_STRUCT(zero_sid);
-
-       if (memcmp(&zero_sid, sid, sizeof(zero_sid)) == 0) {
-               return 0;
-       }
-
-       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
-*/
-size_t ndr_size_security_ace(const struct security_ace *ace, int flags)
-{
-       if (!ace) return 0;
-       return 8 + ndr_size_dom_sid(&ace->trustee, flags);
-}
-
-
-/*
-  return the wire size of a security_acl
-*/
-size_t ndr_size_security_acl(const struct security_acl *acl, int flags)
-{
-       size_t ret;
-       int i;
-       if (!acl) return 0;
-       ret = 8;
-       for (i=0;i<acl->num_aces;i++) {
-               ret += ndr_size_security_ace(&acl->aces[i], flags);
-       }
-       return ret;
-}
-
-/*
-  return the wire size of a security descriptor
-*/
-size_t ndr_size_security_descriptor(const struct security_descriptor *sd, int flags)
-{
-       size_t ret;
-       if (!sd) return 0;
-       
-       ret = 20;
-       ret += ndr_size_dom_sid(sd->owner_sid, flags);
-       ret += ndr_size_dom_sid(sd->group_sid, flags);
-       ret += ndr_size_security_acl(sd->dacl, flags);
-       ret += ndr_size_security_acl(sd->sacl, flags);
-       return ret;
-}
-
-/*
-  print a dom_sid
-*/
-void ndr_print_dom_sid(struct ndr_print *ndr, const char *name, const struct dom_sid *sid)
-{
-       ndr->print(ndr, "%-25s: %s", name, dom_sid_string(ndr, sid));
-}
-
-void ndr_print_dom_sid2(struct ndr_print *ndr, const char *name, const struct dom_sid *sid)
-{
-       ndr_print_dom_sid(ndr, name, sid);
-}
-
-void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct dom_sid *sid)
-{
-       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);
-}
-
index ed27375de1cc02df93d95f3004a4625fa5de3d31..39b7e3cd59dee9b6a536aac10597fb4b8dbd3db6 100644 (file)
 
 #include "includes.h"
 
+/*
+  return the wire size of a dom_sid
+*/
+size_t ndr_size_dom_sid(const struct dom_sid *sid, int flags)
+{
+       if (!sid) return 0;
+       return 8 + 4*sid->num_auths;
+}
+
+size_t ndr_size_dom_sid28(const struct dom_sid *sid, int flags)
+{
+       struct dom_sid zero_sid;
+
+       if (!sid) return 0;
+
+       ZERO_STRUCT(zero_sid);
+
+       if (memcmp(&zero_sid, sid, sizeof(zero_sid)) == 0) {
+               return 0;
+       }
+
+       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);
+}
+
 enum ndr_err_code ndr_push_dom_sid(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *r)
 {
        uint32_t cntr_sub_auths_0;
@@ -228,3 +257,27 @@ enum ndr_err_code ndr_push_dom_sid0(struct ndr_push *ndr, int ndr_flags, const s
 
        return ndr_push_dom_sid(ndr, ndr_flags, sid);
 }
+
+/*
+  print a dom_sid
+*/
+void ndr_print_dom_sid(struct ndr_print *ndr, const char *name, const struct dom_sid *sid)
+{
+       ndr->print(ndr, "%-25s: %s", name, dom_sid_string(ndr, sid));
+}
+
+void ndr_print_dom_sid2(struct ndr_print *ndr, const char *name, const struct dom_sid *sid)
+{
+       ndr_print_dom_sid(ndr, name, sid);
+}
+
+void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct dom_sid *sid)
+{
+       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);
+}
+