From: Volker Lendecke Date: Sat, 10 Mar 2018 14:31:11 +0000 (+0100) Subject: libsmb: Give namequery.c its own header X-Git-Tag: ldb-1.4.0~663 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=39bdd175e94584504edeb9f1ccf11890185bfdbf;p=thirdparty%2Fsamba.git libsmb: Give namequery.c its own header Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/include/proto.h b/source3/include/proto.h index 778107a4d84..3dab5d7ade6 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -713,96 +713,6 @@ bool namecache_status_fetch(const char *keyname, const struct sockaddr_storage *keyip, char *srvname_out); -/* The following definitions come from libsmb/namequery.c */ - -bool saf_store( const char *domain, const char *servername ); -bool saf_join_store( const char *domain, const char *servername ); -bool saf_delete( const char *domain ); -char *saf_fetch(TALLOC_CTX *mem_ctx, const char *domain ); -struct tevent_req *node_status_query_send(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - struct nmb_name *name, - const struct sockaddr_storage *addr); -NTSTATUS node_status_query_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, - struct node_status **pnode_status, - int *pnum_names, - struct node_status_extra *extra); -NTSTATUS node_status_query(TALLOC_CTX *mem_ctx, struct nmb_name *name, - const struct sockaddr_storage *addr, - struct node_status **pnode_status, - int *pnum_names, - struct node_status_extra *extra); -bool name_status_find(const char *q_name, - int q_type, - int type, - const struct sockaddr_storage *to_ss, - fstring name); -int remove_duplicate_addrs2(struct ip_service *iplist, int count ); -struct tevent_req *name_query_send(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - const char *name, int name_type, - bool bcast, bool recurse, - const struct sockaddr_storage *addr); -NTSTATUS name_query_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, - struct sockaddr_storage **addrs, int *num_addrs, - uint8_t *flags); -NTSTATUS name_query(const char *name, int name_type, - bool bcast, bool recurse, - const struct sockaddr_storage *to_ss, - TALLOC_CTX *mem_ctx, - struct sockaddr_storage **addrs, - int *num_addrs, uint8_t *flags); -struct tevent_req *name_resolve_bcast_send(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - const char *name, - int name_type); -NTSTATUS name_resolve_bcast_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, - struct sockaddr_storage **addrs, - int *num_addrs); -NTSTATUS name_resolve_bcast(const char *name, - int name_type, - TALLOC_CTX *mem_ctx, - struct sockaddr_storage **return_iplist, - int *return_count); -struct tevent_req *resolve_wins_send(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - const char *name, - int name_type); -NTSTATUS resolve_wins_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, - struct sockaddr_storage **addrs, - int *num_addrs, uint8_t *flags); -NTSTATUS resolve_wins(const char *name, - int name_type, - TALLOC_CTX *mem_ctx, - struct sockaddr_storage **return_iplist, - int *return_count); -NTSTATUS internal_resolve_name(const char *name, - int name_type, - const char *sitename, - struct ip_service **return_iplist, - int *return_count, - const char **resolve_order); -bool resolve_name(const char *name, - struct sockaddr_storage *return_ss, - int name_type, - bool prefer_ipv4); -NTSTATUS resolve_name_list(TALLOC_CTX *ctx, - const char *name, - int name_type, - struct sockaddr_storage **return_ss_arr, - unsigned int *p_num_entries); -bool find_master_ip(const char *group, struct sockaddr_storage *master_ss); -bool get_pdc_ip(const char *domain, struct sockaddr_storage *pss); -NTSTATUS get_sorted_dc_list( const char *domain, - const char *sitename, - struct ip_service **ip_list, - int *count, - bool ads_only ); -NTSTATUS get_kdc_list( const char *realm, - const char *sitename, - struct ip_service **ip_list, - int *count); - /* The following definitions come from libsmb/namequery_dc.c */ bool get_dc_name(const char *domain, diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c index 82f118a021e..e623f2456a8 100644 --- a/source3/libads/kerberos.c +++ b/source3/libads/kerberos.c @@ -22,6 +22,7 @@ */ #include "includes.h" +#include "libsmb/namequery.h" #include "system/filesys.h" #include "smb_krb5.h" #include "../librpc/gen_ndr/ndr_misc.h" diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index f9463043cc8..e8dcd1baa57 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -31,6 +31,7 @@ #include "../libcli/security/security.h" #include "../librpc/gen_ndr/netlogon.h" #include "lib/param/loadparm.h" +#include "libsmb/namequery.h" #ifdef HAVE_LDAP diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index bbe604b729e..5bf0b7fff2d 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -20,6 +20,7 @@ #include "includes.h" #include "ads.h" +#include "libsmb/namequery.h" #include "librpc/gen_ndr/ndr_libnet_join.h" #include "libnet/libnet_join.h" #include "libcli/auth/libcli_auth.h" diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index 7689910fae9..837299d9220 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -22,6 +22,7 @@ #include "includes.h" #include "libsmb/libsmb.h" +#include "libsmb/namequery.h" #include "auth_info.h" #include "../libcli/auth/libcli_auth.h" #include "../libcli/auth/spnego.h" diff --git a/source3/libsmb/dsgetdcname.c b/source3/libsmb/dsgetdcname.c index a7fe5a1e748..98649006324 100644 --- a/source3/libsmb/dsgetdcname.c +++ b/source3/libsmb/dsgetdcname.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "libsmb/namequery.h" #include "libads/sitename_cache.h" #include "../librpc/gen_ndr/ndr_netlogon.h" #include "libads/cldap.h" diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c index 72441c46736..8c3fed672f8 100644 --- a/source3/libsmb/libsmb_dir.c +++ b/source3/libsmb/libsmb_dir.c @@ -23,6 +23,7 @@ */ #include "includes.h" +#include "libsmb/namequery.h" #include "libsmb/libsmb.h" #include "auth_info.h" #include "libsmbclient.h" diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index b616a64b896..8c23f09f442 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -19,6 +19,7 @@ */ #include "includes.h" +#include "libsmb/namequery.h" #include "../lib/util/tevent_ntstatus.h" #include "libads/sitename_cache.h" #include "../lib/addns/dnsquery.h" diff --git a/source3/libsmb/namequery.h b/source3/libsmb/namequery.h new file mode 100644 index 00000000000..d7bd4d338b4 --- /dev/null +++ b/source3/libsmb/namequery.h @@ -0,0 +1,115 @@ +/* + * Unix SMB/CIFS implementation. + * Copyright (C) Volker Lendecke 2018 + * + * 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 . + */ + +#ifndef __LIBSMB_NAMEQUERY_H__ +#define __LIBSMB_NAMEQUERY_H__ + +#include "includes.h" +#include + +/* The following definitions come from libsmb/namequery.c */ + +bool saf_store( const char *domain, const char *servername ); +bool saf_join_store( const char *domain, const char *servername ); +bool saf_delete( const char *domain ); +char *saf_fetch(TALLOC_CTX *mem_ctx, const char *domain ); +struct tevent_req *node_status_query_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct nmb_name *name, + const struct sockaddr_storage *addr); +NTSTATUS node_status_query_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, + struct node_status **pnode_status, + int *pnum_names, + struct node_status_extra *extra); +NTSTATUS node_status_query(TALLOC_CTX *mem_ctx, struct nmb_name *name, + const struct sockaddr_storage *addr, + struct node_status **pnode_status, + int *pnum_names, + struct node_status_extra *extra); +bool name_status_find(const char *q_name, + int q_type, + int type, + const struct sockaddr_storage *to_ss, + fstring name); +int remove_duplicate_addrs2(struct ip_service *iplist, int count ); +struct tevent_req *name_query_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + const char *name, int name_type, + bool bcast, bool recurse, + const struct sockaddr_storage *addr); +NTSTATUS name_query_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, + struct sockaddr_storage **addrs, int *num_addrs, + uint8_t *flags); +NTSTATUS name_query(const char *name, int name_type, + bool bcast, bool recurse, + const struct sockaddr_storage *to_ss, + TALLOC_CTX *mem_ctx, + struct sockaddr_storage **addrs, + int *num_addrs, uint8_t *flags); +struct tevent_req *name_resolve_bcast_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + const char *name, + int name_type); +NTSTATUS name_resolve_bcast_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, + struct sockaddr_storage **addrs, + int *num_addrs); +NTSTATUS name_resolve_bcast(const char *name, + int name_type, + TALLOC_CTX *mem_ctx, + struct sockaddr_storage **return_iplist, + int *return_count); +struct tevent_req *resolve_wins_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + const char *name, + int name_type); +NTSTATUS resolve_wins_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, + struct sockaddr_storage **addrs, + int *num_addrs, uint8_t *flags); +NTSTATUS resolve_wins(const char *name, + int name_type, + TALLOC_CTX *mem_ctx, + struct sockaddr_storage **return_iplist, + int *return_count); +NTSTATUS internal_resolve_name(const char *name, + int name_type, + const char *sitename, + struct ip_service **return_iplist, + int *return_count, + const char **resolve_order); +bool resolve_name(const char *name, + struct sockaddr_storage *return_ss, + int name_type, + bool prefer_ipv4); +NTSTATUS resolve_name_list(TALLOC_CTX *ctx, + const char *name, + int name_type, + struct sockaddr_storage **return_ss_arr, + unsigned int *p_num_entries); +bool find_master_ip(const char *group, struct sockaddr_storage *master_ss); +bool get_pdc_ip(const char *domain, struct sockaddr_storage *pss); +NTSTATUS get_sorted_dc_list( const char *domain, + const char *sitename, + struct ip_service **ip_list, + int *count, + bool ads_only ); +NTSTATUS get_kdc_list( const char *realm, + const char *sitename, + struct ip_service **ip_list, + int *count); + +#endif diff --git a/source3/libsmb/namequery_dc.c b/source3/libsmb/namequery_dc.c index d08456590f6..4ee5b5278e4 100644 --- a/source3/libsmb/namequery_dc.c +++ b/source3/libsmb/namequery_dc.c @@ -23,6 +23,7 @@ #include "includes.h" +#include "libsmb/namequery.h" #include "libads/sitename_cache.h" #include "ads.h" #include "../librpc/gen_ndr/nbt.h" diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index d449a828b5a..81b6bfb75bf 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "libsmb/namequery.h" #include "../lib/util/tevent_ntstatus.h" #include "librpc/gen_ndr/ndr_epmapper_c.h" #include "../librpc/gen_ndr/ndr_dssetup.h" diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index 9e492d5a396..f9a89194cc5 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -28,6 +28,7 @@ up, all the errors returned are DOS errors, not NT status codes. */ #include "includes.h" +#include "libsmb/namequery.h" #include "ntdomain.h" #include "nt_printing.h" #include "srv_spoolss_util.h" diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 881667a6b44..92a65f5b90b 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -25,6 +25,7 @@ */ #include "includes.h" +#include "libsmb/namequery.h" #include "system/filesys.h" #include "printing.h" #include "smbd/smbd.h" diff --git a/source3/torture/torture.c b/source3/torture/torture.c index df6604de9fe..56cc6ff3628 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -20,6 +20,7 @@ #include "includes.h" #include "system/shmem.h" +#include "libsmb/namequery.h" #include "wbc_async.h" #include "torture/proto.h" #include "libcli/security/security.h" diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index c4c1a0d4051..ffa67d8f525 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -22,6 +22,7 @@ #include "includes.h" #include "utils/net.h" +#include "libsmb/namequery.h" #include "rpc_client/cli_pipe.h" #include "librpc/gen_ndr/ndr_krb5pac.h" #include "../librpc/gen_ndr/ndr_spoolss.h" diff --git a/source3/utils/net_lookup.c b/source3/utils/net_lookup.c index 597e098e2e1..4e7a74d1e00 100644 --- a/source3/utils/net_lookup.c +++ b/source3/utils/net_lookup.c @@ -18,6 +18,7 @@ #include "includes.h" #include "utils/net.h" +#include "libsmb/namequery.h" #include "libads/sitename_cache.h" #include "../lib/addns/dnsquery.h" #include "../librpc/gen_ndr/ndr_netlogon.h" diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 8a989d790f2..52d313edfaa 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -22,6 +22,7 @@ #include "includes.h" #include "utils/net.h" +#include "libsmb/namequery.h" #include "rpc_client/cli_pipe.h" #include "../libcli/auth/libcli_auth.h" #include "../librpc/gen_ndr/ndr_samr_c.h" diff --git a/source3/utils/net_time.c b/source3/utils/net_time.c index 595d903c0be..0091fc86333 100644 --- a/source3/utils/net_time.c +++ b/source3/utils/net_time.c @@ -19,6 +19,7 @@ #include "includes.h" #include "utils/net.h" #include "libsmb/nmblib.h" +#include "libsmb/namequery.h" #include "libsmb/libsmb.h" #include "../libcli/smb/smbXcli_base.h" diff --git a/source3/utils/net_util.c b/source3/utils/net_util.c index 86a46672f56..a84b4f5500e 100644 --- a/source3/utils/net_util.c +++ b/source3/utils/net_util.c @@ -21,6 +21,7 @@ #include "includes.h" #include "utils/net.h" +#include "libsmb/namequery.h" #include "rpc_client/cli_pipe.h" #include "../librpc/gen_ndr/ndr_lsa_c.h" #include "rpc_client/cli_lsarpc.h" diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c index dadd30fdb74..602f3cd4624 100644 --- a/source3/utils/nmblookup.c +++ b/source3/utils/nmblookup.c @@ -22,6 +22,7 @@ #include "includes.h" #include "popt_common.h" #include "libsmb/nmblib.h" +#include "libsmb/namequery.h" static bool give_flags = false; static bool use_bcast = true; diff --git a/source3/utils/smbfilter.c b/source3/utils/smbfilter.c index 85aca4f9334..35fb7521384 100644 --- a/source3/utils/smbfilter.c +++ b/source3/utils/smbfilter.c @@ -20,6 +20,7 @@ #include "includes.h" #include "system/filesys.h" #include "system/select.h" +#include "libsmb/namequery.h" #include "../lib/util/select.h" #include "libsmb/nmblib.h" #include "lib/util/sys_rw_data.h" diff --git a/source3/utils/smbtree.c b/source3/utils/smbtree.c index fb0c130d350..3b539ef1045 100644 --- a/source3/utils/smbtree.c +++ b/source3/utils/smbtree.c @@ -24,6 +24,7 @@ #include "rpc_client/cli_pipe.h" #include "../librpc/gen_ndr/ndr_srvsvc_c.h" #include "libsmb/libsmb.h" +#include "libsmb/namequery.h" #include "libsmb/clirap.h" static int use_bcast; diff --git a/source3/winbindd/idmap_ad.c b/source3/winbindd/idmap_ad.c index 15304109a2d..8f1cb375dfb 100644 --- a/source3/winbindd/idmap_ad.c +++ b/source3/winbindd/idmap_ad.c @@ -19,6 +19,7 @@ #include "includes.h" #include "winbindd.h" +#include "libsmb/namequery.h" #include "idmap.h" #include "tldap_gensec_bind.h" #include "tldap_util.h" diff --git a/source3/winbindd/winbindd_ads.c b/source3/winbindd/winbindd_ads.c index 725fa4ff977..76d6a304366 100644 --- a/source3/winbindd/winbindd_ads.c +++ b/source3/winbindd/winbindd_ads.c @@ -24,6 +24,7 @@ #include "includes.h" #include "winbindd.h" #include "winbindd_ads.h" +#include "libsmb/namequery.h" #include "rpc_client/rpc_client.h" #include "../librpc/gen_ndr/ndr_netlogon_c.h" #include "../libds/common/flags.h" diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index bf5a2b4d7b1..30f65c66bc4 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -60,6 +60,7 @@ #include "includes.h" #include "winbindd.h" +#include "libsmb/namequery.h" #include "../libcli/auth/libcli_auth.h" #include "../librpc/gen_ndr/ndr_netlogon_c.h" #include "rpc_client/cli_pipe.h" diff --git a/source3/winbindd/winbindd_pam.c b/source3/winbindd/winbindd_pam.c index 8403d7d57b6..e273ab3b8be 100644 --- a/source3/winbindd/winbindd_pam.c +++ b/source3/winbindd/winbindd_pam.c @@ -24,6 +24,7 @@ #include "includes.h" #include "winbindd.h" +#include "libsmb/namequery.h" #include "../libcli/auth/libcli_auth.h" #include "../librpc/gen_ndr/ndr_samr_c.h" #include "rpc_client/cli_pipe.h" diff --git a/source3/winbindd/winbindd_wins_byip.c b/source3/winbindd/winbindd_wins_byip.c index c995dd1b0dc..4d3dddf0864 100644 --- a/source3/winbindd/winbindd_wins_byip.c +++ b/source3/winbindd/winbindd_wins_byip.c @@ -19,6 +19,7 @@ #include "includes.h" #include "winbindd.h" +#include "libsmb/namequery.h" #include "librpc/gen_ndr/ndr_winbind_c.h" #include "libsmb/nmblib.h" diff --git a/source3/winbindd/winbindd_wins_byname.c b/source3/winbindd/winbindd_wins_byname.c index db6a04d4ecb..8661401331a 100644 --- a/source3/winbindd/winbindd_wins_byname.c +++ b/source3/winbindd/winbindd_wins_byname.c @@ -19,6 +19,7 @@ #include "includes.h" #include "winbindd.h" +#include "libsmb/namequery.h" #include "librpc/gen_ndr/ndr_winbind_c.h" #include "libsmb/nmblib.h" #include "lib/util/string_wrappers.h"