From 41b3c38587f1153d49c1805869aa186b66501f7a Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 16 May 2011 21:18:25 +1000 Subject: librpc/ndr Merge ndr_print_sockaddr_storage() into common code There is no longer a reason to leave this source3 specific, and this brings it into a library (avoiding duplicate symbols). Andrew Bartlett --- librpc/ndr/libndr.h | 3 +++ librpc/ndr/util.c | 31 +++++++++++++++++++++++++++++++ librpc/wscript_build | 2 +- source3/Makefile.in | 2 +- source3/librpc/ndr/util.c | 30 ------------------------------ source3/wscript_build | 10 ++-------- 6 files changed, 38 insertions(+), 40 deletions(-) create mode 100644 librpc/ndr/util.c delete mode 100644 source3/librpc/ndr/util.c 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 . +*/ + +#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', diff --git a/source3/Makefile.in b/source3/Makefile.in index 84bfd9aa39..847f811e89 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -322,7 +322,7 @@ LIBNDR_OBJ = ../librpc/ndr/ndr_basic.o \ ../librpc/ndr/ndr_sec_helper.o \ ../librpc/ndr/ndr_string.o \ ../librpc/ndr/uuid.o \ - librpc/ndr/util.o \ + ../librpc/ndr/util.o \ librpc/gen_ndr/ndr_server_id.o \ librpc/gen_ndr/ndr_dcerpc.o diff --git a/source3/librpc/ndr/util.c b/source3/librpc/ndr/util.c deleted file mode 100644 index 6bbe054959..0000000000 --- a/source3/librpc/ndr/util.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - 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 . -*/ - -#include "includes.h" -#include "../librpc/ndr/libndr.h" -#include "librpc/ndr/util.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/source3/wscript_build b/source3/wscript_build index 6d644fa8ad..3e8b2b278f 100755 --- a/source3/wscript_build +++ b/source3/wscript_build @@ -39,8 +39,6 @@ COMPRESSION_SRC = '../lib/compression/mszip.c' DRSUAPI_SRC = '''${COMPRESSION_SRC}''' -LIBNDR_SRC = '''librpc/ndr/util.c''' - LIBCLI_SPOOLSS_SRC = '''rpc_client/cli_spoolss.c rpc_client/init_spoolss.c''' @@ -699,7 +697,7 @@ bld.SAMBA3_LIBRARY('nss_wins', bld.SAMBA3_LIBRARY('msrpc3', source='${LIBMSRPC_SRC}', - deps='''ndr ndr-util ndr-standard + deps='''ndr ndr-standard RPC_NDR_EPMAPPER NTLMSSP_COMMON COMMON_SCHANNEL LIBCLI_AUTH LIBTSOCKET KRB5_WRAP rpccommon LIBSMB''', @@ -786,7 +784,7 @@ bld.SAMBA3_SUBSYSTEM('KRBCLIENT', bld.SAMBA3_LIBRARY('samba3core', source=LIB_SRC, - deps='LIBCRYPTO ndr ndr-util security NDR_SECURITY samba-util NDR_MESSAGING LIBASYNC_REQ tdb-wrap3 UTIL_TDB UTIL_PW SAMBA_VERSION KRB5_WRAP flag_mapping util_reg passdb PTHREADPOOL interfaces', + deps='LIBCRYPTO ndr security NDR_SECURITY samba-util NDR_MESSAGING LIBASYNC_REQ tdb-wrap3 UTIL_TDB UTIL_PW SAMBA_VERSION KRB5_WRAP flag_mapping util_reg passdb PTHREADPOOL interfaces', private_library=True, vars=locals()) @@ -966,10 +964,6 @@ bld.SAMBA3_SUBSYSTEM('DCUTIL', deps='ads', vars=locals()) -bld.SAMBA3_SUBSYSTEM('ndr-util', - source=LIBNDR_SRC, - vars=locals()) - bld.SAMBA3_SUBSYSTEM('tdb-wrap3', source='lib/util_tdb.c', deps='tdb-wrap', -- cgit