From 82ed0866182afa6b8a2285f46bdd8f326db9032f Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 6 Sep 2006 22:08:06 +0000 Subject: r18193: Not quite to autogenerated NDR but closer thanks to Jelmer's initial work. I'm including the librpc/gen_ndr directory in svn temporarily just to get some compile issues straightened out. (This used to be commit cf271aa433cfa606be5dbf3ed1d94fe3caf57653) --- source3/librpc/ndr/ndr_misc.c | 171 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 source3/librpc/ndr/ndr_misc.c (limited to 'source3/librpc/ndr/ndr_misc.c') diff --git a/source3/librpc/ndr/ndr_misc.c b/source3/librpc/ndr/ndr_misc.c new file mode 100644 index 0000000000..2f9004ae66 --- /dev/null +++ b/source3/librpc/ndr/ndr_misc.c @@ -0,0 +1,171 @@ +/* + Unix SMB/CIFS implementation. + + UUID/GUID/policy_handle functions + + Copyright (C) Theodore Ts'o 1996, 1997, + Copyright (C) Jim McDonough 2002. + Copyright (C) Andrew Tridgell 2003. + Copyright (C) Stefan (metze) Metzmacher 2004. + + 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 2 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, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" + +/** + build a GUID from a string +*/ +NTSTATUS GUID_from_string(const char *s, struct GUID *guid) +{ + NTSTATUS status = NT_STATUS_INVALID_PARAMETER; + uint32_t time_low; + uint32_t time_mid, time_hi_and_version; + uint32_t clock_seq[2]; + uint32_t node[6]; + int i; + + if (s == NULL) { + return NT_STATUS_INVALID_PARAMETER; + } + + if (11 == sscanf(s, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", + &time_low, &time_mid, &time_hi_and_version, + &clock_seq[0], &clock_seq[1], + &node[0], &node[1], &node[2], &node[3], &node[4], &node[5])) { + status = NT_STATUS_OK; + } else if (11 == sscanf(s, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", + &time_low, &time_mid, &time_hi_and_version, + &clock_seq[0], &clock_seq[1], + &node[0], &node[1], &node[2], &node[3], &node[4], &node[5])) { + status = NT_STATUS_OK; + } + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + guid->time_low = time_low; + guid->time_mid = time_mid; + guid->time_hi_and_version = time_hi_and_version; + guid->clock_seq[0] = clock_seq[0]; + guid->clock_seq[1] = clock_seq[1]; + for (i=0;i<6;i++) { + guid->node[i] = node[i]; + } + + return NT_STATUS_OK; +} + +/** + * generate a random GUID + */ +struct GUID GUID_random(void) +{ + struct GUID guid; + + generate_random_buffer((uint8_t *)&guid, sizeof(guid)); + guid.clock_seq[0] = (guid.clock_seq[0] & 0x3F) | 0x80; + guid.time_hi_and_version = (guid.time_hi_and_version & 0x0FFF) | 0x4000; + + return guid; +} + +/** + * generate an empty GUID + */ +struct GUID GUID_zero(void) +{ + struct GUID guid; + + ZERO_STRUCT(guid); + + return guid; +} + +/** + * see if a range of memory is all zero. A NULL pointer is considered + * to be all zero + */ +BOOL all_zero(const uint8_t *ptr, size_t size) +{ + int i; + if (!ptr) return True; + for (i=0;itime_low != 0 || + u->time_mid != 0 || + u->time_hi_and_version != 0 || + u->clock_seq[0] != 0 || + u->clock_seq[1] != 0 || + !all_zero(u->node, 6)) { + return False; + } + return True; +} + +BOOL GUID_equal(const struct GUID *u1, const struct GUID *u2) +{ + if (u1->time_low != u2->time_low || + u1->time_mid != u2->time_mid || + u1->time_hi_and_version != u2->time_hi_and_version || + u1->clock_seq[0] != u2->clock_seq[0] || + u1->clock_seq[1] != u2->clock_seq[1] || + memcmp(u1->node, u2->node, 6) != 0) { + return False; + } + return True; +} + +/** + its useful to be able to display these in debugging messages +*/ +char *GUID_string(TALLOC_CTX *mem_ctx, const struct GUID *guid) +{ + return talloc_asprintf(mem_ctx, + "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", + guid->time_low, guid->time_mid, + guid->time_hi_and_version, + guid->clock_seq[0], + guid->clock_seq[1], + guid->node[0], guid->node[1], + guid->node[2], guid->node[3], + guid->node[4], guid->node[5]); +} + +char *GUID_string2(TALLOC_CTX *mem_ctx, const struct GUID *guid) +{ + char *ret, *s = GUID_string(mem_ctx, guid); + ret = talloc_asprintf(mem_ctx, "{%s}", s); + talloc_free(s); + return ret; +} + +void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid) +{ + ndr->print(ndr, "%-25s: %s", name, GUID_string(ndr, guid)); +} + +BOOL policy_handle_empty(struct policy_handle *h) +{ + return (h->handle_type == 0 && GUID_all_zero(&h->uuid)); +} -- cgit From 2b27c93a9a8471693d7dcb5fdbe8afe65b22ff66 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 8 Sep 2006 14:28:06 +0000 Subject: r18271: Big change: * autogenerate lsa ndr code * rename 'enum SID_NAME_USE' to 'enum lsa_SidType' * merge a log more security descriptor functions from gen_ndr/ndr_security.c in SAMBA_4_0 The most embarassing thing is the "#define strlen_m strlen" We need a real implementation in SAMBA_3_0 which I'll work on after this code is in. (This used to be commit 3da9f80c28b1e75ef6d46d38fbb81ade6b9fa951) --- source3/librpc/ndr/ndr_misc.c | 68 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) (limited to 'source3/librpc/ndr/ndr_misc.c') diff --git a/source3/librpc/ndr/ndr_misc.c b/source3/librpc/ndr/ndr_misc.c index 2f9004ae66..0be13eec33 100644 --- a/source3/librpc/ndr/ndr_misc.c +++ b/source3/librpc/ndr/ndr_misc.c @@ -25,6 +25,41 @@ #include "includes.h" +NTSTATUS ndr_push_GUID(struct ndr_push *ndr, int ndr_flags, const struct GUID *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->time_low)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->time_mid)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->time_hi_and_version)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->clock_seq, 2)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->node, 6)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_GUID(struct ndr_pull *ndr, int ndr_flags, struct GUID *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->time_low)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->time_mid)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->time_hi_and_version)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->clock_seq, 2)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->node, 6)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +size_t ndr_size_GUID(const struct GUID *r, int flags) +{ + return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_GUID); +} + /** build a GUID from a string */ @@ -169,3 +204,36 @@ BOOL policy_handle_empty(struct policy_handle *h) { return (h->handle_type == 0 && GUID_all_zero(&h->uuid)); } + +NTSTATUS ndr_push_policy_handle(struct ndr_push *ndr, int ndr_flags, const struct policy_handle *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->handle_type)); + NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->uuid)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_policy_handle(struct ndr_pull *ndr, int ndr_flags, struct policy_handle *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->handle_type)); + NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->uuid)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +void ndr_print_policy_handle(struct ndr_print *ndr, const char *name, const struct policy_handle *r) +{ + ndr_print_struct(ndr, name, "policy_handle"); + ndr->depth++; + ndr_print_uint32(ndr, "handle_type", r->handle_type); + ndr_print_GUID(ndr, "uuid", &r->uuid); + ndr->depth--; +} -- cgit From 8bfa9351614115ceb8bfaa6f76355ddc14ec248b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 31 Jan 2007 11:48:14 +0000 Subject: r21074: Preparation for the import of samba4 notify: Add the file notify.idl and the resulting marshalling/unmarshalling routines in gen_ndr/ Volker (This used to be commit a2ea54c23456925a8ed317edb1adf82d074041fc) --- source3/librpc/ndr/ndr_misc.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'source3/librpc/ndr/ndr_misc.c') diff --git a/source3/librpc/ndr/ndr_misc.c b/source3/librpc/ndr/ndr_misc.c index 0be13eec33..54face8d7a 100644 --- a/source3/librpc/ndr/ndr_misc.c +++ b/source3/librpc/ndr/ndr_misc.c @@ -237,3 +237,36 @@ void ndr_print_policy_handle(struct ndr_print *ndr, const char *name, const stru ndr_print_GUID(ndr, "uuid", &r->uuid); ndr->depth--; } + +NTSTATUS ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct server_id *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, + (uint32_t)r->id.pid)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_server_id(struct ndr_pull *ndr, int ndr_flags, struct server_id *r) +{ + if (ndr_flags & NDR_SCALARS) { + uint32_t pid; + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &pid)); + r->id.pid = (pid_t)pid; + } + if (ndr_flags & NDR_BUFFERS) { + } + return NT_STATUS_OK; +} + +void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct server_id *r) +{ + ndr_print_struct(ndr, name, "server_id"); + ndr->depth++; + ndr_print_uint32(ndr, "id", (uint32_t)r->id.pid); + ndr->depth--; +} -- cgit From e6383f47629368d9dd4e803f17566a24e9d7359e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 7 May 2007 09:35:35 +0000 Subject: r22736: Start to merge the low-hanging fruit from the now 7000-line cluster patch. This changes "struct process_id" to "struct server_id", keeping both is just too much hassle. No functional change (I hope ;-)) Volker (This used to be commit 0ad4b1226c9d91b72136310d3bbb640d2c5d67b8) --- source3/librpc/ndr/ndr_misc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/librpc/ndr/ndr_misc.c') diff --git a/source3/librpc/ndr/ndr_misc.c b/source3/librpc/ndr/ndr_misc.c index 54face8d7a..a0796924a2 100644 --- a/source3/librpc/ndr/ndr_misc.c +++ b/source3/librpc/ndr/ndr_misc.c @@ -243,7 +243,7 @@ NTSTATUS ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct se if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, - (uint32_t)r->id.pid)); + (uint32_t)r->pid)); } if (ndr_flags & NDR_BUFFERS) { } @@ -256,7 +256,7 @@ NTSTATUS ndr_pull_server_id(struct ndr_pull *ndr, int ndr_flags, struct server_i uint32_t pid; NDR_CHECK(ndr_pull_align(ndr, 4)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &pid)); - r->id.pid = (pid_t)pid; + r->pid = (pid_t)pid; } if (ndr_flags & NDR_BUFFERS) { } @@ -267,6 +267,6 @@ void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct s { ndr_print_struct(ndr, name, "server_id"); ndr->depth++; - ndr_print_uint32(ndr, "id", (uint32_t)r->id.pid); + ndr_print_uint32(ndr, "id", (uint32_t)r->pid); ndr->depth--; } -- cgit From de565785f5e1f097bd75f57331425c4185185f80 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 10 Jun 2007 17:02:09 +0000 Subject: r23410: Merge the core of the cluster code. I'm 100% certain I've forgotten to merge something, but the main code should be in. It's mainly in dbwrap_ctdb.c, ctdbd_conn.c and messages_ctdbd.c. There should be no changes to the non-cluster case, it does survive make test on my laptop. It survives some very basic tests with ctdbd enables, I did not do the full test suite for clusters yet. Phew... Volker (This used to be commit 15553d6327a3aecdd2b0b94a3656d04bf4106323) --- source3/librpc/ndr/ndr_misc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source3/librpc/ndr/ndr_misc.c') diff --git a/source3/librpc/ndr/ndr_misc.c b/source3/librpc/ndr/ndr_misc.c index a0796924a2..17bba77a01 100644 --- a/source3/librpc/ndr/ndr_misc.c +++ b/source3/librpc/ndr/ndr_misc.c @@ -244,6 +244,10 @@ NTSTATUS ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct se NDR_CHECK(ndr_push_align(ndr, 4)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, (uint32_t)r->pid)); +#ifdef CLUSTER_SUPPORT + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, + (uint32_t)r->vnn)); +#endif } if (ndr_flags & NDR_BUFFERS) { } @@ -256,6 +260,9 @@ NTSTATUS ndr_pull_server_id(struct ndr_pull *ndr, int ndr_flags, struct server_i uint32_t pid; NDR_CHECK(ndr_pull_align(ndr, 4)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &pid)); +#ifdef CLUSTER_SUPPORT + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->vnn)); +#endif r->pid = (pid_t)pid; } if (ndr_flags & NDR_BUFFERS) { @@ -268,5 +275,8 @@ void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct s ndr_print_struct(ndr, name, "server_id"); ndr->depth++; ndr_print_uint32(ndr, "id", (uint32_t)r->pid); +#ifdef CLUSTER_SUPPORT + ndr_print_uint32(ndr, "vnn", (uint32_t)r->vnn); +#endif ndr->depth--; } -- cgit From d824b98f80ba186030cbb70b3a1e5daf80469ecd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 9 Jul 2007 19:25:36 +0000 Subject: r23779: Change from v2 or later to v3 or later. Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3) --- source3/librpc/ndr/ndr_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/librpc/ndr/ndr_misc.c') diff --git a/source3/librpc/ndr/ndr_misc.c b/source3/librpc/ndr/ndr_misc.c index 17bba77a01..419e7729cf 100644 --- a/source3/librpc/ndr/ndr_misc.c +++ b/source3/librpc/ndr/ndr_misc.c @@ -10,7 +10,7 @@ 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 2 of the License, or + 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, -- cgit From 5e54558c6dea67b56bbfaba5698f3a434d3dffb6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 00:52:41 +0000 Subject: r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text (This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07) --- source3/librpc/ndr/ndr_misc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/librpc/ndr/ndr_misc.c') diff --git a/source3/librpc/ndr/ndr_misc.c b/source3/librpc/ndr/ndr_misc.c index 419e7729cf..e66a8b9a5d 100644 --- a/source3/librpc/ndr/ndr_misc.c +++ b/source3/librpc/ndr/ndr_misc.c @@ -19,8 +19,7 @@ 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, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit From 30191d1a5704ad2b158386b511558972d539ce47 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 18 Oct 2007 17:40:25 -0700 Subject: RIP BOOL. Convert BOOL -> bool. I found a few interesting bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f) --- source3/librpc/ndr/ndr_misc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/librpc/ndr/ndr_misc.c') diff --git a/source3/librpc/ndr/ndr_misc.c b/source3/librpc/ndr/ndr_misc.c index e66a8b9a5d..e4bff83650 100644 --- a/source3/librpc/ndr/ndr_misc.c +++ b/source3/librpc/ndr/ndr_misc.c @@ -133,7 +133,7 @@ struct GUID GUID_zero(void) * see if a range of memory is all zero. A NULL pointer is considered * to be all zero */ -BOOL all_zero(const uint8_t *ptr, size_t size) +bool all_zero(const uint8_t *ptr, size_t size) { int i; if (!ptr) return True; @@ -144,7 +144,7 @@ BOOL all_zero(const uint8_t *ptr, size_t size) } -BOOL GUID_all_zero(const struct GUID *u) +bool GUID_all_zero(const struct GUID *u) { if (u->time_low != 0 || u->time_mid != 0 || @@ -157,7 +157,7 @@ BOOL GUID_all_zero(const struct GUID *u) return True; } -BOOL GUID_equal(const struct GUID *u1, const struct GUID *u2) +bool GUID_equal(const struct GUID *u1, const struct GUID *u2) { if (u1->time_low != u2->time_low || u1->time_mid != u2->time_mid || @@ -199,7 +199,7 @@ void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID * ndr->print(ndr, "%-25s: %s", name, GUID_string(ndr, guid)); } -BOOL policy_handle_empty(struct policy_handle *h) +bool policy_handle_empty(struct policy_handle *h) { return (h->handle_type == 0 && GUID_all_zero(&h->uuid)); } -- cgit From 84df45786026800601439dba4656eecec4e4b5f7 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 9 Nov 2007 11:50:14 +0100 Subject: use samba4's librpc/ndr/uuid.c metze (This used to be commit c148e91fdedd20cfb737465dffc86ed6fa7d7c02) --- source3/librpc/ndr/ndr_misc.c | 126 ------------------------------------------ 1 file changed, 126 deletions(-) (limited to 'source3/librpc/ndr/ndr_misc.c') diff --git a/source3/librpc/ndr/ndr_misc.c b/source3/librpc/ndr/ndr_misc.c index e4bff83650..c93e527848 100644 --- a/source3/librpc/ndr/ndr_misc.c +++ b/source3/librpc/ndr/ndr_misc.c @@ -59,76 +59,6 @@ size_t ndr_size_GUID(const struct GUID *r, int flags) return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_GUID); } -/** - build a GUID from a string -*/ -NTSTATUS GUID_from_string(const char *s, struct GUID *guid) -{ - NTSTATUS status = NT_STATUS_INVALID_PARAMETER; - uint32_t time_low; - uint32_t time_mid, time_hi_and_version; - uint32_t clock_seq[2]; - uint32_t node[6]; - int i; - - if (s == NULL) { - return NT_STATUS_INVALID_PARAMETER; - } - - if (11 == sscanf(s, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", - &time_low, &time_mid, &time_hi_and_version, - &clock_seq[0], &clock_seq[1], - &node[0], &node[1], &node[2], &node[3], &node[4], &node[5])) { - status = NT_STATUS_OK; - } else if (11 == sscanf(s, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", - &time_low, &time_mid, &time_hi_and_version, - &clock_seq[0], &clock_seq[1], - &node[0], &node[1], &node[2], &node[3], &node[4], &node[5])) { - status = NT_STATUS_OK; - } - - if (!NT_STATUS_IS_OK(status)) { - return status; - } - - guid->time_low = time_low; - guid->time_mid = time_mid; - guid->time_hi_and_version = time_hi_and_version; - guid->clock_seq[0] = clock_seq[0]; - guid->clock_seq[1] = clock_seq[1]; - for (i=0;i<6;i++) { - guid->node[i] = node[i]; - } - - return NT_STATUS_OK; -} - -/** - * generate a random GUID - */ -struct GUID GUID_random(void) -{ - struct GUID guid; - - generate_random_buffer((uint8_t *)&guid, sizeof(guid)); - guid.clock_seq[0] = (guid.clock_seq[0] & 0x3F) | 0x80; - guid.time_hi_and_version = (guid.time_hi_and_version & 0x0FFF) | 0x4000; - - return guid; -} - -/** - * generate an empty GUID - */ -struct GUID GUID_zero(void) -{ - struct GUID guid; - - ZERO_STRUCT(guid); - - return guid; -} - /** * see if a range of memory is all zero. A NULL pointer is considered * to be all zero @@ -143,67 +73,11 @@ bool all_zero(const uint8_t *ptr, size_t size) return True; } - -bool GUID_all_zero(const struct GUID *u) -{ - if (u->time_low != 0 || - u->time_mid != 0 || - u->time_hi_and_version != 0 || - u->clock_seq[0] != 0 || - u->clock_seq[1] != 0 || - !all_zero(u->node, 6)) { - return False; - } - return True; -} - -bool GUID_equal(const struct GUID *u1, const struct GUID *u2) -{ - if (u1->time_low != u2->time_low || - u1->time_mid != u2->time_mid || - u1->time_hi_and_version != u2->time_hi_and_version || - u1->clock_seq[0] != u2->clock_seq[0] || - u1->clock_seq[1] != u2->clock_seq[1] || - memcmp(u1->node, u2->node, 6) != 0) { - return False; - } - return True; -} - -/** - its useful to be able to display these in debugging messages -*/ -char *GUID_string(TALLOC_CTX *mem_ctx, const struct GUID *guid) -{ - return talloc_asprintf(mem_ctx, - "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", - guid->time_low, guid->time_mid, - guid->time_hi_and_version, - guid->clock_seq[0], - guid->clock_seq[1], - guid->node[0], guid->node[1], - guid->node[2], guid->node[3], - guid->node[4], guid->node[5]); -} - -char *GUID_string2(TALLOC_CTX *mem_ctx, const struct GUID *guid) -{ - char *ret, *s = GUID_string(mem_ctx, guid); - ret = talloc_asprintf(mem_ctx, "{%s}", s); - talloc_free(s); - return ret; -} - void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid) { ndr->print(ndr, "%-25s: %s", name, GUID_string(ndr, guid)); } -bool policy_handle_empty(struct policy_handle *h) -{ - return (h->handle_type == 0 && GUID_all_zero(&h->uuid)); -} - NTSTATUS ndr_push_policy_handle(struct ndr_push *ndr, int ndr_flags, const struct policy_handle *r) { if (ndr_flags & NDR_SCALARS) { -- cgit From 909b03d3c669b655802d7819ee8785562e1c711e Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 9 Nov 2007 13:00:43 +0100 Subject: ndr: change NTSTAUS into enum ndr_err_code (samba3 handwritten stuff) ndr_misc.c ndr_sec.h ndr_sec_helper.c librpc/ndr/sid.c metze (This used to be commit 42590e917af464f894bf4eb1490f0d1075b2c10e) --- source3/librpc/ndr/ndr_misc.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'source3/librpc/ndr/ndr_misc.c') diff --git a/source3/librpc/ndr/ndr_misc.c b/source3/librpc/ndr/ndr_misc.c index c93e527848..2ca0cf08e8 100644 --- a/source3/librpc/ndr/ndr_misc.c +++ b/source3/librpc/ndr/ndr_misc.c @@ -24,7 +24,7 @@ #include "includes.h" -NTSTATUS ndr_push_GUID(struct ndr_push *ndr, int ndr_flags, const struct GUID *r) +enum ndr_err_code ndr_push_GUID(struct ndr_push *ndr, int ndr_flags, const struct GUID *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); @@ -36,10 +36,10 @@ NTSTATUS ndr_push_GUID(struct ndr_push *ndr, int ndr_flags, const struct GUID *r } if (ndr_flags & NDR_BUFFERS) { } - return NT_STATUS_OK; + return NDR_ERR_SUCCESS; } -NTSTATUS ndr_pull_GUID(struct ndr_pull *ndr, int ndr_flags, struct GUID *r) +enum ndr_err_code ndr_pull_GUID(struct ndr_pull *ndr, int ndr_flags, struct GUID *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -51,7 +51,7 @@ NTSTATUS ndr_pull_GUID(struct ndr_pull *ndr, int ndr_flags, struct GUID *r) } if (ndr_flags & NDR_BUFFERS) { } - return NT_STATUS_OK; + return NDR_ERR_SUCCESS; } size_t ndr_size_GUID(const struct GUID *r, int flags) @@ -78,7 +78,7 @@ void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID * ndr->print(ndr, "%-25s: %s", name, GUID_string(ndr, guid)); } -NTSTATUS ndr_push_policy_handle(struct ndr_push *ndr, int ndr_flags, const struct policy_handle *r) +enum ndr_err_code ndr_push_policy_handle(struct ndr_push *ndr, int ndr_flags, const struct policy_handle *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); @@ -87,10 +87,10 @@ NTSTATUS ndr_push_policy_handle(struct ndr_push *ndr, int ndr_flags, const struc } if (ndr_flags & NDR_BUFFERS) { } - return NT_STATUS_OK; + return NDR_ERR_SUCCESS; } -NTSTATUS ndr_pull_policy_handle(struct ndr_pull *ndr, int ndr_flags, struct policy_handle *r) +enum ndr_err_code ndr_pull_policy_handle(struct ndr_pull *ndr, int ndr_flags, struct policy_handle *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_pull_align(ndr, 4)); @@ -99,7 +99,7 @@ NTSTATUS ndr_pull_policy_handle(struct ndr_pull *ndr, int ndr_flags, struct poli } if (ndr_flags & NDR_BUFFERS) { } - return NT_STATUS_OK; + return NDR_ERR_SUCCESS; } void ndr_print_policy_handle(struct ndr_print *ndr, const char *name, const struct policy_handle *r) @@ -111,7 +111,7 @@ void ndr_print_policy_handle(struct ndr_print *ndr, const char *name, const stru ndr->depth--; } -NTSTATUS ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct server_id *r) +enum ndr_err_code ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct server_id *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); @@ -124,10 +124,10 @@ NTSTATUS ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct se } if (ndr_flags & NDR_BUFFERS) { } - return NT_STATUS_OK; + return NDR_ERR_SUCCESS; } -NTSTATUS ndr_pull_server_id(struct ndr_pull *ndr, int ndr_flags, struct server_id *r) +enum ndr_err_code ndr_pull_server_id(struct ndr_pull *ndr, int ndr_flags, struct server_id *r) { if (ndr_flags & NDR_SCALARS) { uint32_t pid; @@ -140,7 +140,7 @@ NTSTATUS ndr_pull_server_id(struct ndr_pull *ndr, int ndr_flags, struct server_i } if (ndr_flags & NDR_BUFFERS) { } - return NT_STATUS_OK; + return NDR_ERR_SUCCESS; } void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct server_id *r) -- cgit From af69a1b43170017bb36bdb20f4c98bfbf95948a1 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 15 Jan 2008 15:20:57 +0100 Subject: Add ndr_print_ads_struct(). Guenther (This used to be commit 0a914a55bab30d765872d72cfdd59889d2afe42a) --- source3/librpc/ndr/ndr_misc.c | 81 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) (limited to 'source3/librpc/ndr/ndr_misc.c') diff --git a/source3/librpc/ndr/ndr_misc.c b/source3/librpc/ndr/ndr_misc.c index 2ca0cf08e8..245ba45215 100644 --- a/source3/librpc/ndr/ndr_misc.c +++ b/source3/librpc/ndr/ndr_misc.c @@ -153,3 +153,84 @@ void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct s #endif ndr->depth--; } + +void ndr_print_ads_struct(struct ndr_print *ndr, const char *name, const struct ads_struct *r) +{ + if (!r) { return; } + + ndr_print_struct(ndr, name, "ads_struct"); + ndr->depth++; + ndr_print_bool(ndr, "is_mine", r->is_mine); + ndr_print_struct(ndr, name, "server"); + ndr->depth++; + ndr_print_string(ndr, "realm", r->server.realm); + ndr_print_string(ndr, "workgroup", r->server.workgroup); + ndr_print_string(ndr, "ldap_server", r->server.ldap_server); + ndr_print_bool(ndr, "foreign", r->server.foreign); + ndr->depth--; + ndr_print_struct(ndr, name, "auth"); + ndr->depth++; + ndr_print_string(ndr, "realm", r->auth.realm); +#ifdef DEBUG_PASSWORD + ndr_print_string(ndr, "password", r->auth.password); +#else + ndr_print_string(ndr, "password", "(PASSWORD ommited)"); +#endif + ndr_print_string(ndr, "user_name", r->auth.user_name); + ndr_print_string(ndr, "kdc_server", r->auth.kdc_server); + ndr_print_uint32(ndr, "flags", r->auth.flags); + ndr_print_uint32(ndr, "time_offset", r->auth.time_offset); + ndr_print_time_t(ndr, "tgt_expire", r->auth.tgt_expire); + ndr_print_time_t(ndr, "tgs_expire", r->auth.tgs_expire); + ndr_print_time_t(ndr, "renewable", r->auth.renewable); + ndr->depth--; + ndr_print_struct(ndr, name, "config"); + ndr->depth++; + ndr_print_uint32(ndr, "flags", r->config.flags); + ndr_print_string(ndr, "realm", r->config.realm); + ndr_print_string(ndr, "bind_path", r->config.bind_path); + ndr_print_string(ndr, "ldap_server_name", r->config.ldap_server_name); + ndr_print_string(ndr, "server_site_name", r->config.server_site_name); + ndr_print_string(ndr, "client_site_name", r->config.client_site_name); + ndr_print_time_t(ndr, "current_time", r->config.current_time); + ndr_print_bool(ndr, "tried_closest_dc", r->config.tried_closest_dc); + ndr_print_string(ndr, "schema_path", r->config.schema_path); + ndr_print_string(ndr, "config_path", r->config.config_path); + ndr->depth--; +#ifdef HAVE_LDAP + ndr_print_struct(ndr, name, "ldap"); + ndr->depth++; + ndr_print_ptr(ndr, "ld", r->ldap.ld); + ndr_print_sockaddr_storage(ndr, "ss", &r->ldap.ss); + ndr_print_time_t(ndr, "last_attempt", r->ldap.last_attempt); + ndr_print_uint32(ndr, "port", r->ldap.port); + ndr_print_uint16(ndr, "wrap_type", r->ldap.wrap_type); +#ifdef HAVE_LDAP_SASL_WRAPPING + ndr_print_ptr(ndr, "sbiod", r->ldap.sbiod); +#endif /* HAVE_LDAP_SASL_WRAPPING */ + ndr_print_ptr(ndr, "mem_ctx", r->ldap.mem_ctx); + ndr_print_ptr(ndr, "wrap_ops", r->ldap.wrap_ops); + ndr_print_ptr(ndr, "wrap_private_data", r->ldap.wrap_private_data); + ndr_print_struct(ndr, name, "in"); + ndr->depth++; + ndr_print_uint32(ndr, "ofs", r->ldap.in.ofs); + ndr_print_uint32(ndr, "needed", r->ldap.in.needed); + ndr_print_uint32(ndr, "left", r->ldap.in.left); + ndr_print_uint32(ndr, "max_wrapped", r->ldap.in.max_wrapped); + ndr_print_uint32(ndr, "min_wrapped", r->ldap.in.min_wrapped); + ndr_print_uint32(ndr, "size", r->ldap.in.size); + ndr_print_array_uint8(ndr, "buf", r->ldap.in.buf, r->ldap.in.size); + ndr->depth--; + ndr_print_struct(ndr, name, "out"); + ndr->depth++; + ndr_print_uint32(ndr, "ofs", r->ldap.out.ofs); + ndr_print_uint32(ndr, "left", r->ldap.out.left); + ndr_print_uint32(ndr, "max_unwrapped", r->ldap.out.max_unwrapped); + ndr_print_uint32(ndr, "sig_size", r->ldap.out.sig_size); + ndr_print_uint32(ndr, "size", r->ldap.out.size); + ndr_print_array_uint8(ndr, "buf", r->ldap.out.buf, r->ldap.out.size); + ndr->depth--; + ndr->depth--; +#endif /* HAVE_LDAP */ + ndr->depth--; +} -- cgit From 101f275b988185ed3e47bc8061483a781c4d47c9 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 17 Jan 2008 10:11:28 +0100 Subject: Use pidl generated data from misc.idl. Guenther (This used to be commit 5d8e5cbc3b3ddd1c5788d66f252e4801739243bb) --- source3/librpc/ndr/ndr_misc.c | 68 ------------------------------------------- 1 file changed, 68 deletions(-) (limited to 'source3/librpc/ndr/ndr_misc.c') diff --git a/source3/librpc/ndr/ndr_misc.c b/source3/librpc/ndr/ndr_misc.c index 245ba45215..c806298ce5 100644 --- a/source3/librpc/ndr/ndr_misc.c +++ b/source3/librpc/ndr/ndr_misc.c @@ -24,41 +24,6 @@ #include "includes.h" -enum ndr_err_code ndr_push_GUID(struct ndr_push *ndr, int ndr_flags, const struct GUID *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->time_low)); - NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->time_mid)); - NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->time_hi_and_version)); - NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->clock_seq, 2)); - NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->node, 6)); - } - if (ndr_flags & NDR_BUFFERS) { - } - return NDR_ERR_SUCCESS; -} - -enum ndr_err_code ndr_pull_GUID(struct ndr_pull *ndr, int ndr_flags, struct GUID *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->time_low)); - NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->time_mid)); - NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->time_hi_and_version)); - NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->clock_seq, 2)); - NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->node, 6)); - } - if (ndr_flags & NDR_BUFFERS) { - } - return NDR_ERR_SUCCESS; -} - -size_t ndr_size_GUID(const struct GUID *r, int flags) -{ - return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_GUID); -} - /** * see if a range of memory is all zero. A NULL pointer is considered * to be all zero @@ -78,39 +43,6 @@ void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID * ndr->print(ndr, "%-25s: %s", name, GUID_string(ndr, guid)); } -enum ndr_err_code ndr_push_policy_handle(struct ndr_push *ndr, int ndr_flags, const struct policy_handle *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->handle_type)); - NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->uuid)); - } - if (ndr_flags & NDR_BUFFERS) { - } - return NDR_ERR_SUCCESS; -} - -enum ndr_err_code ndr_pull_policy_handle(struct ndr_pull *ndr, int ndr_flags, struct policy_handle *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->handle_type)); - NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->uuid)); - } - if (ndr_flags & NDR_BUFFERS) { - } - return NDR_ERR_SUCCESS; -} - -void ndr_print_policy_handle(struct ndr_print *ndr, const char *name, const struct policy_handle *r) -{ - ndr_print_struct(ndr, name, "policy_handle"); - ndr->depth++; - ndr_print_uint32(ndr, "handle_type", r->handle_type); - ndr_print_GUID(ndr, "uuid", &r->uuid); - ndr->depth--; -} - enum ndr_err_code ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct server_id *r) { if (ndr_flags & NDR_SCALARS) { -- cgit From b6529b6f6d3b1c64fd1066b8749abdcc906ad849 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 29 Jan 2008 14:14:09 +0100 Subject: Add ndr_print_ads_auth_flags(). Guenther (This used to be commit 52bd4ce68d7ff24c480ed350cecfd325e51ba0b4) --- source3/librpc/ndr/ndr_misc.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'source3/librpc/ndr/ndr_misc.c') diff --git a/source3/librpc/ndr/ndr_misc.c b/source3/librpc/ndr/ndr_misc.c index c806298ce5..da42230b6f 100644 --- a/source3/librpc/ndr/ndr_misc.c +++ b/source3/librpc/ndr/ndr_misc.c @@ -86,6 +86,21 @@ void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct s ndr->depth--; } +void ndr_print_ads_auth_flags(struct ndr_print *ndr, const char *name, uint32_t r) +{ + ndr_print_uint32(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_DISABLE_KERBEROS", ADS_AUTH_DISABLE_KERBEROS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_NO_BIND", ADS_AUTH_NO_BIND, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_ANON_BIND", ADS_AUTH_ANON_BIND, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_SIMPLE_BIND", ADS_AUTH_SIMPLE_BIND, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_ALLOW_NTLMSSP", ADS_AUTH_ALLOW_NTLMSSP, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_SASL_SIGN", ADS_AUTH_SASL_SIGN, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_SASL_SEAL", ADS_AUTH_SASL_SEAL, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_SASL_FORCE", ADS_AUTH_SASL_FORCE, r); + ndr->depth--; +} + void ndr_print_ads_struct(struct ndr_print *ndr, const char *name, const struct ads_struct *r) { if (!r) { return; } @@ -110,7 +125,7 @@ void ndr_print_ads_struct(struct ndr_print *ndr, const char *name, const struct #endif ndr_print_string(ndr, "user_name", r->auth.user_name); ndr_print_string(ndr, "kdc_server", r->auth.kdc_server); - ndr_print_uint32(ndr, "flags", r->auth.flags); + ndr_print_ads_auth_flags(ndr, "flags", r->auth.flags); ndr_print_uint32(ndr, "time_offset", r->auth.time_offset); ndr_print_time_t(ndr, "tgt_expire", r->auth.tgt_expire); ndr_print_time_t(ndr, "tgs_expire", r->auth.tgs_expire); @@ -118,7 +133,7 @@ void ndr_print_ads_struct(struct ndr_print *ndr, const char *name, const struct ndr->depth--; ndr_print_struct(ndr, name, "config"); ndr->depth++; - ndr_print_uint32(ndr, "flags", r->config.flags); + ndr_print_netr_DsR_DcFlags(ndr, "flags", r->config.flags); ndr_print_string(ndr, "realm", r->config.realm); ndr_print_string(ndr, "bind_path", r->config.bind_path); ndr_print_string(ndr, "ldap_server_name", r->config.ldap_server_name); -- cgit From 7cab0f5c0c3edc3eb74e3ae8fa5a649187dc99c1 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 29 Jan 2008 14:47:47 +0100 Subject: Fix the build. Avoid unrequired ndr_print_ads_struct dependencies. Guenther (This used to be commit c832882e49ff0dac6a717819dda24ab814253b2f) --- source3/librpc/ndr/ndr_misc.c | 96 ------------------------------------------- 1 file changed, 96 deletions(-) (limited to 'source3/librpc/ndr/ndr_misc.c') diff --git a/source3/librpc/ndr/ndr_misc.c b/source3/librpc/ndr/ndr_misc.c index da42230b6f..79761b9251 100644 --- a/source3/librpc/ndr/ndr_misc.c +++ b/source3/librpc/ndr/ndr_misc.c @@ -85,99 +85,3 @@ void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct s #endif ndr->depth--; } - -void ndr_print_ads_auth_flags(struct ndr_print *ndr, const char *name, uint32_t r) -{ - ndr_print_uint32(ndr, name, r); - ndr->depth++; - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_DISABLE_KERBEROS", ADS_AUTH_DISABLE_KERBEROS, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_NO_BIND", ADS_AUTH_NO_BIND, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_ANON_BIND", ADS_AUTH_ANON_BIND, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_SIMPLE_BIND", ADS_AUTH_SIMPLE_BIND, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_ALLOW_NTLMSSP", ADS_AUTH_ALLOW_NTLMSSP, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_SASL_SIGN", ADS_AUTH_SASL_SIGN, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_SASL_SEAL", ADS_AUTH_SASL_SEAL, r); - ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ADS_AUTH_SASL_FORCE", ADS_AUTH_SASL_FORCE, r); - ndr->depth--; -} - -void ndr_print_ads_struct(struct ndr_print *ndr, const char *name, const struct ads_struct *r) -{ - if (!r) { return; } - - ndr_print_struct(ndr, name, "ads_struct"); - ndr->depth++; - ndr_print_bool(ndr, "is_mine", r->is_mine); - ndr_print_struct(ndr, name, "server"); - ndr->depth++; - ndr_print_string(ndr, "realm", r->server.realm); - ndr_print_string(ndr, "workgroup", r->server.workgroup); - ndr_print_string(ndr, "ldap_server", r->server.ldap_server); - ndr_print_bool(ndr, "foreign", r->server.foreign); - ndr->depth--; - ndr_print_struct(ndr, name, "auth"); - ndr->depth++; - ndr_print_string(ndr, "realm", r->auth.realm); -#ifdef DEBUG_PASSWORD - ndr_print_string(ndr, "password", r->auth.password); -#else - ndr_print_string(ndr, "password", "(PASSWORD ommited)"); -#endif - ndr_print_string(ndr, "user_name", r->auth.user_name); - ndr_print_string(ndr, "kdc_server", r->auth.kdc_server); - ndr_print_ads_auth_flags(ndr, "flags", r->auth.flags); - ndr_print_uint32(ndr, "time_offset", r->auth.time_offset); - ndr_print_time_t(ndr, "tgt_expire", r->auth.tgt_expire); - ndr_print_time_t(ndr, "tgs_expire", r->auth.tgs_expire); - ndr_print_time_t(ndr, "renewable", r->auth.renewable); - ndr->depth--; - ndr_print_struct(ndr, name, "config"); - ndr->depth++; - ndr_print_netr_DsR_DcFlags(ndr, "flags", r->config.flags); - ndr_print_string(ndr, "realm", r->config.realm); - ndr_print_string(ndr, "bind_path", r->config.bind_path); - ndr_print_string(ndr, "ldap_server_name", r->config.ldap_server_name); - ndr_print_string(ndr, "server_site_name", r->config.server_site_name); - ndr_print_string(ndr, "client_site_name", r->config.client_site_name); - ndr_print_time_t(ndr, "current_time", r->config.current_time); - ndr_print_bool(ndr, "tried_closest_dc", r->config.tried_closest_dc); - ndr_print_string(ndr, "schema_path", r->config.schema_path); - ndr_print_string(ndr, "config_path", r->config.config_path); - ndr->depth--; -#ifdef HAVE_LDAP - ndr_print_struct(ndr, name, "ldap"); - ndr->depth++; - ndr_print_ptr(ndr, "ld", r->ldap.ld); - ndr_print_sockaddr_storage(ndr, "ss", &r->ldap.ss); - ndr_print_time_t(ndr, "last_attempt", r->ldap.last_attempt); - ndr_print_uint32(ndr, "port", r->ldap.port); - ndr_print_uint16(ndr, "wrap_type", r->ldap.wrap_type); -#ifdef HAVE_LDAP_SASL_WRAPPING - ndr_print_ptr(ndr, "sbiod", r->ldap.sbiod); -#endif /* HAVE_LDAP_SASL_WRAPPING */ - ndr_print_ptr(ndr, "mem_ctx", r->ldap.mem_ctx); - ndr_print_ptr(ndr, "wrap_ops", r->ldap.wrap_ops); - ndr_print_ptr(ndr, "wrap_private_data", r->ldap.wrap_private_data); - ndr_print_struct(ndr, name, "in"); - ndr->depth++; - ndr_print_uint32(ndr, "ofs", r->ldap.in.ofs); - ndr_print_uint32(ndr, "needed", r->ldap.in.needed); - ndr_print_uint32(ndr, "left", r->ldap.in.left); - ndr_print_uint32(ndr, "max_wrapped", r->ldap.in.max_wrapped); - ndr_print_uint32(ndr, "min_wrapped", r->ldap.in.min_wrapped); - ndr_print_uint32(ndr, "size", r->ldap.in.size); - ndr_print_array_uint8(ndr, "buf", r->ldap.in.buf, r->ldap.in.size); - ndr->depth--; - ndr_print_struct(ndr, name, "out"); - ndr->depth++; - ndr_print_uint32(ndr, "ofs", r->ldap.out.ofs); - ndr_print_uint32(ndr, "left", r->ldap.out.left); - ndr_print_uint32(ndr, "max_unwrapped", r->ldap.out.max_unwrapped); - ndr_print_uint32(ndr, "sig_size", r->ldap.out.sig_size); - ndr_print_uint32(ndr, "size", r->ldap.out.size); - ndr_print_array_uint8(ndr, "buf", r->ldap.out.buf, r->ldap.out.size); - ndr->depth--; - ndr->depth--; -#endif /* HAVE_LDAP */ - ndr->depth--; -} -- cgit From e65ea7471e2447ed150ade9a2c4f0a67663fb8d2 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 16 Jul 2008 22:18:43 +0200 Subject: Add ndr_syntax_id_equal() (This used to be commit 5fc90908deb417130af122941e084542304a2543) --- source3/librpc/ndr/ndr_misc.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source3/librpc/ndr/ndr_misc.c') diff --git a/source3/librpc/ndr/ndr_misc.c b/source3/librpc/ndr/ndr_misc.c index 79761b9251..f1468166ff 100644 --- a/source3/librpc/ndr/ndr_misc.c +++ b/source3/librpc/ndr/ndr_misc.c @@ -43,6 +43,13 @@ void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID * ndr->print(ndr, "%-25s: %s", name, GUID_string(ndr, guid)); } +bool ndr_syntax_id_equal(const struct ndr_syntax_id *i1, + const struct ndr_syntax_id *i2) +{ + return guid_equal(&i1->uuid, &i2->uuid) + && (i1->if_version == i2->if_version); +} + enum ndr_err_code ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct server_id *r) { if (ndr_flags & NDR_SCALARS) { -- cgit From 8e02cb17fe5e9931532b0ecf0b61825f500fd719 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Jul 2008 19:50:36 +0200 Subject: Ooops, GUID_equal was already around :-) (This used to be commit 9a0bc277f23831124d049301bc7009a285d91a11) --- source3/librpc/ndr/ndr_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/librpc/ndr/ndr_misc.c') diff --git a/source3/librpc/ndr/ndr_misc.c b/source3/librpc/ndr/ndr_misc.c index f1468166ff..e86842527c 100644 --- a/source3/librpc/ndr/ndr_misc.c +++ b/source3/librpc/ndr/ndr_misc.c @@ -46,7 +46,7 @@ void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID * bool ndr_syntax_id_equal(const struct ndr_syntax_id *i1, const struct ndr_syntax_id *i2) { - return guid_equal(&i1->uuid, &i2->uuid) + return GUID_equal(&i1->uuid, &i2->uuid) && (i1->if_version == i2->if_version); } -- cgit