summaryrefslogtreecommitdiff
path: root/librpc
diff options
context:
space:
mode:
Diffstat (limited to 'librpc')
-rw-r--r--librpc/ndr/libndr.h3
-rw-r--r--librpc/ndr/util.c31
-rw-r--r--librpc/wscript_build2
3 files changed, 35 insertions, 1 deletions
diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h
index 8c59bb9bb0..cbe9b40440 100644
--- a/librpc/ndr/libndr.h
+++ b/librpc/ndr/libndr.h
@@ -374,6 +374,8 @@ struct ndr_interface_list {
const struct ndr_interface_table *table;
};
+struct sockaddr_storage;
+
/*********************************************************************
Map an NT error code from a NDR error code.
*********************************************************************/
@@ -395,6 +397,7 @@ enum ndr_err_code ndr_pull_dom_sid0(struct ndr_pull *ndr, int ndr_flags, struct
void ndr_print_dom_sid0(struct ndr_print *ndr, const char *name, const struct dom_sid *sid);
size_t ndr_size_dom_sid0(const struct dom_sid *sid, int flags);
void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid);
+void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss);
bool ndr_syntax_id_equal(const struct ndr_syntax_id *i1, const struct ndr_syntax_id *i2);
enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, const void *p, ndr_push_flags_fn_t fn);
enum ndr_err_code ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, uint32_t level, ndr_push_flags_fn_t fn);
diff --git a/librpc/ndr/util.c b/librpc/ndr/util.c
new file mode 100644
index 0000000000..b2df28dde0
--- /dev/null
+++ b/librpc/ndr/util.c
@@ -0,0 +1,31 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ libndr interface
+
+ 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"
+#include "../librpc/ndr/libndr.h"
+#include "system/network.h"
+#include "lib/util/util_net.h"
+
+_PUBLIC_ void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss)
+{
+ char addr[INET6_ADDRSTRLEN];
+ ndr->print(ndr, "%-25s: %s", name, print_sockaddr(addr, sizeof(addr), ss));
+}
diff --git a/librpc/wscript_build b/librpc/wscript_build
index 02600084ba..d8b3fe78ff 100644
--- a/librpc/wscript_build
+++ b/librpc/wscript_build
@@ -565,7 +565,7 @@ bld.SAMBA_LIBRARY('dcerpc-samba',
)
bld.SAMBA_LIBRARY('ndr',
- source='ndr/ndr_string.c ndr/ndr_basic.c ndr/uuid.c ndr/ndr.c ndr/ndr_misc.c gen_ndr/ndr_misc.c',
+ source='ndr/ndr_string.c ndr/ndr_basic.c ndr/uuid.c ndr/ndr.c ndr/ndr_misc.c gen_ndr/ndr_misc.c ndr/util.c',
pc_files='ndr.pc',
public_deps='errors talloc samba-util',
public_headers='gen_ndr/misc.h gen_ndr/ndr_misc.h ndr/libndr.h:ndr.h',