From cc2d77d5218c188119fa954c856e858cbde76947 Mon Sep 17 00:00:00 2001 From: Pavel Březina Date: Wed, 20 Jan 2016 13:07:23 +0100 Subject: Rename dp_backend.h to backend.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Sumit Bose Reviewed-by: Jakub Hrozek Reviewed-by: Lukáš Slebodník --- Makefile.am | 2 +- src/p11_child/p11_child_nss.c | 2 +- src/providers/ad/ad_access.c | 2 +- src/providers/ad/ad_gpo.c | 2 +- src/providers/ad/ad_gpo_child.c | 2 +- src/providers/ad/ad_srv.c | 2 +- src/providers/ad/ad_subdomains.h | 2 +- src/providers/backend.h | 331 +++++++++++++++++++++++++++++ src/providers/be_dyndns.c | 2 +- src/providers/be_ptask.c | 2 +- src/providers/be_refresh.c | 2 +- src/providers/data_provider_be.c | 2 +- src/providers/data_provider_callbacks.c | 2 +- src/providers/data_provider_fo.c | 2 +- src/providers/dp_backend.h | 331 ----------------------------- src/providers/ipa/ipa_auth.h | 2 +- src/providers/ipa/ipa_dyndns.h | 2 +- src/providers/ipa/ipa_subdomains.h | 2 +- src/providers/ipa/selinux_child.c | 2 +- src/providers/krb5/krb5_auth.h | 2 +- src/providers/krb5/krb5_child.c | 2 +- src/providers/krb5/krb5_common.c | 2 +- src/providers/krb5/krb5_common.h | 2 +- src/providers/ldap/ldap_access.c | 2 +- src/providers/ldap/ldap_child.c | 2 +- src/providers/ldap/ldap_common.h | 2 +- src/providers/ldap/sdap.h | 2 +- src/providers/ldap/sdap_access.c | 2 +- src/providers/ldap/sdap_access.h | 2 +- src/providers/ldap/sdap_async.h | 2 +- src/providers/ldap/sdap_async_sudo.c | 2 +- src/providers/ldap/sdap_autofs.c | 2 +- src/providers/ldap/sdap_dyndns.c | 2 +- src/providers/ldap/sdap_dyndns.h | 2 +- src/providers/ldap/sdap_sudo.c | 2 +- src/providers/ldap/sdap_sudo.h | 2 +- src/providers/ldap/sdap_sudo_shared.h | 2 +- src/providers/proxy/proxy.h | 2 +- src/providers/proxy/proxy_child.c | 2 +- src/providers/simple/simple_access.c | 2 +- src/providers/simple/simple_access_check.c | 2 +- src/tests/cmocka/test_be_ptask.c | 2 +- src/tests/cmocka/test_data_provider_be.c | 2 +- 43 files changed, 372 insertions(+), 372 deletions(-) create mode 100644 src/providers/backend.h delete mode 100644 src/providers/dp_backend.h diff --git a/Makefile.am b/Makefile.am index eae57e8fa..8b314124f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -614,7 +614,7 @@ dist_noinst_HEADERS = \ src/providers/data_provider.h \ src/providers/data_provider_req.h \ src/providers/data_provider_iface_generated.h \ - src/providers/dp_backend.h \ + src/providers/backend.h \ src/providers/be_dyndns.h \ src/providers/be_ptask_private.h \ src/providers/be_ptask.h \ diff --git a/src/p11_child/p11_child_nss.c b/src/p11_child/p11_child_nss.c index feae88436..84772692e 100644 --- a/src/p11_child/p11_child_nss.c +++ b/src/p11_child/p11_child_nss.c @@ -41,7 +41,7 @@ #include #include "util/child_common.h" -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "util/crypto/sss_crypto.h" #include "util/cert.h" diff --git a/src/providers/ad/ad_access.c b/src/providers/ad/ad_access.c index 00b5c9e83..bf03f8637 100644 --- a/src/providers/ad/ad_access.c +++ b/src/providers/ad/ad_access.c @@ -25,7 +25,7 @@ #include "src/util/util.h" #include "src/providers/data_provider.h" -#include "src/providers/dp_backend.h" +#include "src/providers/backend.h" #include "src/providers/ad/ad_access.h" #include "providers/ad/ad_gpo.h" #include "src/providers/ad/ad_common.h" diff --git a/src/providers/ad/ad_gpo.c b/src/providers/ad/ad_gpo.c index 208770297..5f58cb77c 100644 --- a/src/providers/ad/ad_gpo.c +++ b/src/providers/ad/ad_gpo.c @@ -39,7 +39,7 @@ #include "util/strtonum.h" #include "util/child_common.h" #include "providers/data_provider.h" -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/ad/ad_access.h" #include "providers/ad/ad_common.h" #include "providers/ad/ad_domain_info.h" diff --git a/src/providers/ad/ad_gpo_child.c b/src/providers/ad/ad_gpo_child.c index e37abe394..8e5e06254 100644 --- a/src/providers/ad/ad_gpo_child.c +++ b/src/providers/ad/ad_gpo_child.c @@ -32,7 +32,7 @@ #include "util/util.h" #include "util/child_common.h" -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/ad/ad_gpo.h" #include "sss_cli.h" diff --git a/src/providers/ad/ad_srv.c b/src/providers/ad/ad_srv.c index e71927252..9602945e6 100644 --- a/src/providers/ad/ad_srv.c +++ b/src/providers/ad/ad_srv.c @@ -27,7 +27,7 @@ #include "util/util.h" #include "util/sss_ldap.h" #include "resolv/async_resolv.h" -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/ad/ad_srv.h" #include "providers/ad/ad_common.h" #include "providers/fail_over.h" diff --git a/src/providers/ad/ad_subdomains.h b/src/providers/ad/ad_subdomains.h index da93af379..b4b0e765d 100644 --- a/src/providers/ad/ad_subdomains.h +++ b/src/providers/ad/ad_subdomains.h @@ -25,7 +25,7 @@ #ifndef _AD_SUBDOMAINS_H_ #define _AD_SUBDOMAINS_H_ -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/ad/ad_common.h" int ad_subdom_init(struct be_ctx *be_ctx, diff --git a/src/providers/backend.h b/src/providers/backend.h new file mode 100644 index 000000000..cfb9044b5 --- /dev/null +++ b/src/providers/backend.h @@ -0,0 +1,331 @@ +/* + SSSD + + Data Provider, private header file + + Copyright (C) Simo Sorce 2008 + + 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 __DP_BACKEND_H__ +#define __DP_BACKEND_H__ + +#include "providers/data_provider.h" +#include "providers/fail_over.h" +#include "providers/be_refresh.h" +#include "util/child_common.h" +#include "db/sysdb.h" + +/* a special token, if used in place of the hostname, denotes that real + * hostnames should be looked up from DNS using SRV requests + */ +#define BE_SRV_IDENTIFIER "_srv_" + +struct be_ctx; +struct bet_ops; +struct be_req; + +typedef int (*bet_init_fn_t)(TALLOC_CTX *, struct bet_ops **, void **); +typedef void (*be_shutdown_fn)(void *); +typedef void (*be_req_fn_t)(struct be_req *); +typedef void (*be_async_callback_t)(struct be_req *, int, int, const char *); + +typedef void (*be_callback_t)(void *); + +enum bet_type { + BET_NULL = 0, + BET_ID, + BET_AUTH, + BET_ACCESS, + BET_CHPASS, + BET_SUDO, + BET_AUTOFS, + BET_SELINUX, + BET_HOSTID, + BET_SUBDOMAINS, + BET_MAX +}; + +struct bet_data { + enum bet_type bet_type; + const char *option_name; + const char *mod_init_fn_name_fmt; +}; + +struct loaded_be { + char *be_name; + void *handle; +}; + +struct bet_info { + enum bet_type bet_type; + struct bet_ops *bet_ops; + void *pvt_bet_data; + char *mod_name; + struct bet_queue_item *req_queue; +}; + +struct be_offline_status { + time_t went_offline; + bool offline; +}; + +struct be_resolv_ctx { + struct resolv_ctx *resolv; + struct dp_option *opts; + + enum restrict_family family_order; +}; + +struct be_client { + struct be_ctx *bectx; + struct sbus_connection *conn; + struct tevent_timer *timeout; + bool initialized; +}; + +struct be_failover_ctx; + +struct be_cb; + +struct be_ctx { + struct tevent_context *ev; + struct confdb_ctx *cdb; + struct sss_domain_info *domain; + const char *identity; + const char *conf_path; + uid_t uid; + gid_t gid; + struct be_failover_ctx *be_fo; + struct be_resolv_ctx *be_res; + + /* Functions to be invoked when the + * backend goes online or offline + */ + struct be_cb *online_cb_list; + bool run_online_cb; + struct be_cb *offline_cb_list; + struct be_cb *reconnect_cb_list; + /* In contrast to online_cb_list which are only run if the backend is + * offline the unconditional_online_cb_list should be run whenever the + * backend receives a request to go online. The typical use case is to + * reset timers independenly of the state of the backend. */ + struct be_cb *unconditional_online_cb_list; + + struct be_offline_status offstat; + /* Periodicly check if we can go online. */ + struct be_ptask *check_if_online_ptask; + + struct sbus_connection *mon_conn; + struct sbus_connection *sbus_srv; + + struct be_client *nss_cli; + struct be_client *pam_cli; + struct be_client *sudo_cli; + struct be_client *autofs_cli; + struct be_client *ssh_cli; + struct be_client *pac_cli; + struct be_client *ifp_cli; + + struct loaded_be loaded_be[BET_MAX]; + struct bet_info bet_info[BET_MAX]; + + struct be_refresh_ctx *refresh_ctx; + + size_t check_online_ref_count; + + /* List of ongoing requests */ + struct be_req *active_requests; +}; + +struct bet_ops { + be_req_fn_t check_online; + be_req_fn_t handler; + be_req_fn_t finalize; +}; + +struct be_acct_req { + int entry_type; + int attr_type; + int filter_type; + char *filter_value; + char *extra_value; + char *domain; +}; + +struct be_sudo_req { + uint32_t type; + char **rules; +}; + +struct be_autofs_req { + char *mapname; + bool invalidate; +}; + +struct be_subdom_req { + bool force; + char *domain_hint; +}; + +struct be_host_req { + uint32_t type; + int filter_type; + char *name; + char *alias; +}; + +bool be_is_offline(struct be_ctx *ctx); +void be_mark_offline(struct be_ctx *ctx); +void be_mark_dom_offline(struct sss_domain_info *dom, struct be_ctx *ctx); + +int be_add_reconnect_cb(TALLOC_CTX *mem_ctx, + struct be_ctx *ctx, + be_callback_t cb, + void *pvt, + struct be_cb **reconnect_cb); +void be_run_reconnect_cb(struct be_ctx *be); + +int be_add_online_cb(TALLOC_CTX *mem_ctx, + struct be_ctx *ctx, + be_callback_t cb, + void *pvt, + struct be_cb **online_cb); +void be_run_online_cb(struct be_ctx *be); +int be_add_unconditional_online_cb(TALLOC_CTX *mem_ctx, struct be_ctx *ctx, + be_callback_t cb, void *pvt, + struct be_cb **unconditional_online_cb); +void be_run_unconditional_online_cb(struct be_ctx *be); + +int be_add_offline_cb(TALLOC_CTX *mem_ctx, + struct be_ctx *ctx, + be_callback_t cb, + void *pvt, + struct be_cb **online_cb); +void be_run_offline_cb(struct be_ctx *be); + +/* from data_provider_fo.c */ +enum be_fo_protocol { + BE_FO_PROTO_TCP, + BE_FO_PROTO_UDP, + BE_FO_PROTO_SENTINEL +}; + +typedef void (be_svc_callback_fn_t)(void *, struct fo_server *); + +int be_init_failover(struct be_ctx *ctx); +int be_fo_is_srv_identifier(const char *server); +int be_fo_add_service(struct be_ctx *ctx, const char *service_name, + datacmp_fn user_data_cmp); +int be_fo_service_add_callback(TALLOC_CTX *memctx, + struct be_ctx *ctx, const char *service_name, + be_svc_callback_fn_t *fn, void *private_data); +int be_fo_get_server_count(struct be_ctx *ctx, const char *service_name); + +void be_fo_set_srv_lookup_plugin(struct be_ctx *ctx, + fo_srv_lookup_plugin_send_t send_fn, + fo_srv_lookup_plugin_recv_t recv_fn, + void *pvt, + const char *plugin_name); + +errno_t be_fo_set_dns_srv_lookup_plugin(struct be_ctx *be_ctx, + const char *hostname); + +int be_fo_add_srv_server(struct be_ctx *ctx, + const char *service_name, + const char *query_service, + const char *default_discovery_domain, + enum be_fo_protocol proto, + bool proto_fallback, void *user_data); +int be_fo_add_server(struct be_ctx *ctx, const char *service_name, + const char *server, int port, void *user_data, + bool primary); + +struct tevent_req *be_resolve_server_send(TALLOC_CTX *memctx, + struct tevent_context *ev, + struct be_ctx *ctx, + const char *service_name, + bool first_try); +int be_resolve_server_recv(struct tevent_req *req, + TALLOC_CTX *ref_ctx, + struct fo_server **srv); + +#define be_fo_set_port_status(ctx, service_name, server, status) \ + _be_fo_set_port_status(ctx, service_name, server, status, \ + __LINE__, __FILE__, __FUNCTION__) + +void _be_fo_set_port_status(struct be_ctx *ctx, + const char *service_name, + struct fo_server *server, + enum port_status status, + int line, + const char *file, + const char *function); + +/* + * Instruct fail-over to try next server on the next connect attempt. + * Should be used after connection to service was unexpectedly dropped + * but there is no authoritative information on whether active server is down. + */ +void be_fo_try_next_server(struct be_ctx *ctx, const char *service_name); + +int be_fo_run_callbacks_at_next_request(struct be_ctx *ctx, + const char *service_name); + +void reset_fo(struct be_ctx *be_ctx); +void be_fo_reset_svc(struct be_ctx *be_ctx, const char *svc_name); + +const char *be_fo_get_active_server_name(struct be_ctx *ctx, + const char *service_name); + +errno_t be_res_init(struct be_ctx *ctx); + +/* be_req helpers */ + +/* Create a back end request and call fn when done. Please note the + * request name is not duplicated. The caller should either provide + * a static string or steal a dynamic string onto req context. + */ +struct be_req *be_req_create(TALLOC_CTX *mem_ctx, + struct be_client *becli, + struct be_ctx *be_ctx, + const char *name, + be_async_callback_t fn, + void *pvt_fn_data); +struct be_ctx *be_req_get_be_ctx(struct be_req *be_req); + +void *be_req_get_data(struct be_req *be_req); + +void be_req_terminate(struct be_req *be_req, + int dp_err_type, int errnum, const char *errstr); + +void be_terminate_domain_requests(struct be_ctx *be_ctx, + const char *domain); + +/* Request account information */ +struct tevent_req * +be_get_account_info_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct be_client *becli, + struct be_ctx *be_ctx, + struct be_acct_req *ar); + +errno_t be_get_account_info_recv(struct tevent_req *req, + TALLOC_CTX *mem_ctx, + int *_err_maj, + int *_err_min, + const char **_err_msg); + +#endif /* __DP_BACKEND_H___ */ diff --git a/src/providers/be_dyndns.c b/src/providers/be_dyndns.c index a136dbe05..07dc3339d 100644 --- a/src/providers/be_dyndns.c +++ b/src/providers/be_dyndns.c @@ -34,7 +34,7 @@ #include "confdb/confdb.h" #include "util/child_common.h" #include "providers/data_provider.h" -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/be_dyndns.h" #include "resolv/async_resolv.h" diff --git a/src/providers/be_ptask.c b/src/providers/be_ptask.c index 18e8681ea..dc3c57db5 100644 --- a/src/providers/be_ptask.c +++ b/src/providers/be_ptask.c @@ -24,7 +24,7 @@ #include #include "util/util.h" -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/be_ptask_private.h" #include "providers/be_ptask.h" diff --git a/src/providers/be_refresh.c b/src/providers/be_refresh.c index 47b626055..81f2c5d1d 100644 --- a/src/providers/be_refresh.c +++ b/src/providers/be_refresh.c @@ -23,7 +23,7 @@ #include #include -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/be_ptask.h" #include "providers/be_refresh.h" #include "util/util_errors.h" diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c index 0a686041e..58c32dca4 100644 --- a/src/providers/data_provider_be.c +++ b/src/providers/data_provider_be.c @@ -41,7 +41,7 @@ #include "confdb/confdb.h" #include "db/sysdb.h" #include "sbus/sssd_dbus.h" -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/fail_over.h" #include "providers/be_refresh.h" #include "providers/be_ptask.h" diff --git a/src/providers/data_provider_callbacks.c b/src/providers/data_provider_callbacks.c index 327d41f1b..436357e22 100644 --- a/src/providers/data_provider_callbacks.c +++ b/src/providers/data_provider_callbacks.c @@ -25,7 +25,7 @@ */ #include "util/util.h" -#include "providers/dp_backend.h" +#include "providers/backend.h" struct be_cb { struct be_cb *prev; diff --git a/src/providers/data_provider_fo.c b/src/providers/data_provider_fo.c index 38a23a23b..1e858c354 100644 --- a/src/providers/data_provider_fo.c +++ b/src/providers/data_provider_fo.c @@ -21,7 +21,7 @@ #include #include -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "resolv/async_resolv.h" struct be_svc_callback { diff --git a/src/providers/dp_backend.h b/src/providers/dp_backend.h deleted file mode 100644 index cfb9044b5..000000000 --- a/src/providers/dp_backend.h +++ /dev/null @@ -1,331 +0,0 @@ -/* - SSSD - - Data Provider, private header file - - Copyright (C) Simo Sorce 2008 - - 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 __DP_BACKEND_H__ -#define __DP_BACKEND_H__ - -#include "providers/data_provider.h" -#include "providers/fail_over.h" -#include "providers/be_refresh.h" -#include "util/child_common.h" -#include "db/sysdb.h" - -/* a special token, if used in place of the hostname, denotes that real - * hostnames should be looked up from DNS using SRV requests - */ -#define BE_SRV_IDENTIFIER "_srv_" - -struct be_ctx; -struct bet_ops; -struct be_req; - -typedef int (*bet_init_fn_t)(TALLOC_CTX *, struct bet_ops **, void **); -typedef void (*be_shutdown_fn)(void *); -typedef void (*be_req_fn_t)(struct be_req *); -typedef void (*be_async_callback_t)(struct be_req *, int, int, const char *); - -typedef void (*be_callback_t)(void *); - -enum bet_type { - BET_NULL = 0, - BET_ID, - BET_AUTH, - BET_ACCESS, - BET_CHPASS, - BET_SUDO, - BET_AUTOFS, - BET_SELINUX, - BET_HOSTID, - BET_SUBDOMAINS, - BET_MAX -}; - -struct bet_data { - enum bet_type bet_type; - const char *option_name; - const char *mod_init_fn_name_fmt; -}; - -struct loaded_be { - char *be_name; - void *handle; -}; - -struct bet_info { - enum bet_type bet_type; - struct bet_ops *bet_ops; - void *pvt_bet_data; - char *mod_name; - struct bet_queue_item *req_queue; -}; - -struct be_offline_status { - time_t went_offline; - bool offline; -}; - -struct be_resolv_ctx { - struct resolv_ctx *resolv; - struct dp_option *opts; - - enum restrict_family family_order; -}; - -struct be_client { - struct be_ctx *bectx; - struct sbus_connection *conn; - struct tevent_timer *timeout; - bool initialized; -}; - -struct be_failover_ctx; - -struct be_cb; - -struct be_ctx { - struct tevent_context *ev; - struct confdb_ctx *cdb; - struct sss_domain_info *domain; - const char *identity; - const char *conf_path; - uid_t uid; - gid_t gid; - struct be_failover_ctx *be_fo; - struct be_resolv_ctx *be_res; - - /* Functions to be invoked when the - * backend goes online or offline - */ - struct be_cb *online_cb_list; - bool run_online_cb; - struct be_cb *offline_cb_list; - struct be_cb *reconnect_cb_list; - /* In contrast to online_cb_list which are only run if the backend is - * offline the unconditional_online_cb_list should be run whenever the - * backend receives a request to go online. The typical use case is to - * reset timers independenly of the state of the backend. */ - struct be_cb *unconditional_online_cb_list; - - struct be_offline_status offstat; - /* Periodicly check if we can go online. */ - struct be_ptask *check_if_online_ptask; - - struct sbus_connection *mon_conn; - struct sbus_connection *sbus_srv; - - struct be_client *nss_cli; - struct be_client *pam_cli; - struct be_client *sudo_cli; - struct be_client *autofs_cli; - struct be_client *ssh_cli; - struct be_client *pac_cli; - struct be_client *ifp_cli; - - struct loaded_be loaded_be[BET_MAX]; - struct bet_info bet_info[BET_MAX]; - - struct be_refresh_ctx *refresh_ctx; - - size_t check_online_ref_count; - - /* List of ongoing requests */ - struct be_req *active_requests; -}; - -struct bet_ops { - be_req_fn_t check_online; - be_req_fn_t handler; - be_req_fn_t finalize; -}; - -struct be_acct_req { - int entry_type; - int attr_type; - int filter_type; - char *filter_value; - char *extra_value; - char *domain; -}; - -struct be_sudo_req { - uint32_t type; - char **rules; -}; - -struct be_autofs_req { - char *mapname; - bool invalidate; -}; - -struct be_subdom_req { - bool force; - char *domain_hint; -}; - -struct be_host_req { - uint32_t type; - int filter_type; - char *name; - char *alias; -}; - -bool be_is_offline(struct be_ctx *ctx); -void be_mark_offline(struct be_ctx *ctx); -void be_mark_dom_offline(struct sss_domain_info *dom, struct be_ctx *ctx); - -int be_add_reconnect_cb(TALLOC_CTX *mem_ctx, - struct be_ctx *ctx, - be_callback_t cb, - void *pvt, - struct be_cb **reconnect_cb); -void be_run_reconnect_cb(struct be_ctx *be); - -int be_add_online_cb(TALLOC_CTX *mem_ctx, - struct be_ctx *ctx, - be_callback_t cb, - void *pvt, - struct be_cb **online_cb); -void be_run_online_cb(struct be_ctx *be); -int be_add_unconditional_online_cb(TALLOC_CTX *mem_ctx, struct be_ctx *ctx, - be_callback_t cb, void *pvt, - struct be_cb **unconditional_online_cb); -void be_run_unconditional_online_cb(struct be_ctx *be); - -int be_add_offline_cb(TALLOC_CTX *mem_ctx, - struct be_ctx *ctx, - be_callback_t cb, - void *pvt, - struct be_cb **online_cb); -void be_run_offline_cb(struct be_ctx *be); - -/* from data_provider_fo.c */ -enum be_fo_protocol { - BE_FO_PROTO_TCP, - BE_FO_PROTO_UDP, - BE_FO_PROTO_SENTINEL -}; - -typedef void (be_svc_callback_fn_t)(void *, struct fo_server *); - -int be_init_failover(struct be_ctx *ctx); -int be_fo_is_srv_identifier(const char *server); -int be_fo_add_service(struct be_ctx *ctx, const char *service_name, - datacmp_fn user_data_cmp); -int be_fo_service_add_callback(TALLOC_CTX *memctx, - struct be_ctx *ctx, const char *service_name, - be_svc_callback_fn_t *fn, void *private_data); -int be_fo_get_server_count(struct be_ctx *ctx, const char *service_name); - -void be_fo_set_srv_lookup_plugin(struct be_ctx *ctx, - fo_srv_lookup_plugin_send_t send_fn, - fo_srv_lookup_plugin_recv_t recv_fn, - void *pvt, - const char *plugin_name); - -errno_t be_fo_set_dns_srv_lookup_plugin(struct be_ctx *be_ctx, - const char *hostname); - -int be_fo_add_srv_server(struct be_ctx *ctx, - const char *service_name, - const char *query_service, - const char *default_discovery_domain, - enum be_fo_protocol proto, - bool proto_fallback, void *user_data); -int be_fo_add_server(struct be_ctx *ctx, const char *service_name, - const char *server, int port, void *user_data, - bool primary); - -struct tevent_req *be_resolve_server_send(TALLOC_CTX *memctx, - struct tevent_context *ev, - struct be_ctx *ctx, - const char *service_name, - bool first_try); -int be_resolve_server_recv(struct tevent_req *req, - TALLOC_CTX *ref_ctx, - struct fo_server **srv); - -#define be_fo_set_port_status(ctx, service_name, server, status) \ - _be_fo_set_port_status(ctx, service_name, server, status, \ - __LINE__, __FILE__, __FUNCTION__) - -void _be_fo_set_port_status(struct be_ctx *ctx, - const char *service_name, - struct fo_server *server, - enum port_status status, - int line, - const char *file, - const char *function); - -/* - * Instruct fail-over to try next server on the next connect attempt. - * Should be used after connection to service was unexpectedly dropped - * but there is no authoritative information on whether active server is down. - */ -void be_fo_try_next_server(struct be_ctx *ctx, const char *service_name); - -int be_fo_run_callbacks_at_next_request(struct be_ctx *ctx, - const char *service_name); - -void reset_fo(struct be_ctx *be_ctx); -void be_fo_reset_svc(struct be_ctx *be_ctx, const char *svc_name); - -const char *be_fo_get_active_server_name(struct be_ctx *ctx, - const char *service_name); - -errno_t be_res_init(struct be_ctx *ctx); - -/* be_req helpers */ - -/* Create a back end request and call fn when done. Please note the - * request name is not duplicated. The caller should either provide - * a static string or steal a dynamic string onto req context. - */ -struct be_req *be_req_create(TALLOC_CTX *mem_ctx, - struct be_client *becli, - struct be_ctx *be_ctx, - const char *name, - be_async_callback_t fn, - void *pvt_fn_data); -struct be_ctx *be_req_get_be_ctx(struct be_req *be_req); - -void *be_req_get_data(struct be_req *be_req); - -void be_req_terminate(struct be_req *be_req, - int dp_err_type, int errnum, const char *errstr); - -void be_terminate_domain_requests(struct be_ctx *be_ctx, - const char *domain); - -/* Request account information */ -struct tevent_req * -be_get_account_info_send(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - struct be_client *becli, - struct be_ctx *be_ctx, - struct be_acct_req *ar); - -errno_t be_get_account_info_recv(struct tevent_req *req, - TALLOC_CTX *mem_ctx, - int *_err_maj, - int *_err_min, - const char **_err_msg); - -#endif /* __DP_BACKEND_H___ */ diff --git a/src/providers/ipa/ipa_auth.h b/src/providers/ipa/ipa_auth.h index 3079bbd1b..5cd318bae 100644 --- a/src/providers/ipa/ipa_auth.h +++ b/src/providers/ipa/ipa_auth.h @@ -25,7 +25,7 @@ #ifndef _IPA_AUTH_H_ #define _IPA_AUTH_H_ -#include "providers/dp_backend.h" +#include "providers/backend.h" void ipa_auth(struct be_req *be_req); diff --git a/src/providers/ipa/ipa_dyndns.h b/src/providers/ipa/ipa_dyndns.h index 0ecd79369..38a68c010 100644 --- a/src/providers/ipa/ipa_dyndns.h +++ b/src/providers/ipa/ipa_dyndns.h @@ -27,7 +27,7 @@ #include "util/util_errors.h" #include "providers/ipa/ipa_common.h" -#include "providers/dp_backend.h" +#include "providers/backend.h" void ipa_dyndns_update(void *pvt); void ipa_dyndns_timer(void *pvt); diff --git a/src/providers/ipa/ipa_subdomains.h b/src/providers/ipa/ipa_subdomains.h index 9eb841b02..270867fb0 100644 --- a/src/providers/ipa/ipa_subdomains.h +++ b/src/providers/ipa/ipa_subdomains.h @@ -25,7 +25,7 @@ #ifndef _IPA_SUBDOMAINS_H_ #define _IPA_SUBDOMAINS_H_ -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/ipa/ipa_common.h" #include "config.h" diff --git a/src/providers/ipa/selinux_child.c b/src/providers/ipa/selinux_child.c index 3a15e7f51..380005c7a 100644 --- a/src/providers/ipa/selinux_child.c +++ b/src/providers/ipa/selinux_child.c @@ -30,7 +30,7 @@ #include "util/util.h" #include "util/child_common.h" -#include "providers/dp_backend.h" +#include "providers/backend.h" struct input_buffer { const char *seuser; diff --git a/src/providers/krb5/krb5_auth.h b/src/providers/krb5/krb5_auth.h index 205e70665..1822f2b98 100644 --- a/src/providers/krb5/krb5_auth.h +++ b/src/providers/krb5/krb5_auth.h @@ -29,7 +29,7 @@ #include #include "util/sss_krb5.h" -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "util/child_common.h" #include "providers/krb5/krb5_common.h" #include "providers/krb5/krb5_ccache.h" diff --git a/src/providers/krb5/krb5_child.c b/src/providers/krb5/krb5_child.c index 3157e38af..3b3ebd9a9 100644 --- a/src/providers/krb5/krb5_child.c +++ b/src/providers/krb5/krb5_child.c @@ -35,7 +35,7 @@ #include "util/child_common.h" #include "util/find_uid.h" #include "src/util/util_errors.h" -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/krb5/krb5_auth.h" #include "providers/krb5/krb5_utils.h" #include "sss_cli.h" diff --git a/src/providers/krb5/krb5_common.c b/src/providers/krb5/krb5_common.c index 1b2aabec5..5f6173179 100644 --- a/src/providers/krb5/krb5_common.c +++ b/src/providers/krb5/krb5_common.c @@ -28,7 +28,7 @@ #include #include -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/krb5/krb5_common.h" #include "providers/krb5/krb5_opts.h" #include "providers/krb5/krb5_utils.h" diff --git a/src/providers/krb5/krb5_common.h b/src/providers/krb5/krb5_common.h index 34c0eb960..367b56e08 100644 --- a/src/providers/krb5/krb5_common.h +++ b/src/providers/krb5/krb5_common.h @@ -29,7 +29,7 @@ #include "config.h" #include -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "util/util.h" #include "util/sss_krb5.h" diff --git a/src/providers/ldap/ldap_access.c b/src/providers/ldap/ldap_access.c index 7ebdb20c0..eb60f720d 100644 --- a/src/providers/ldap/ldap_access.c +++ b/src/providers/ldap/ldap_access.c @@ -25,7 +25,7 @@ #include #include "src/util/util.h" #include "src/providers/data_provider.h" -#include "src/providers/dp_backend.h" +#include "src/providers/backend.h" #include "src/providers/ldap/sdap_access.h" #include "providers/ldap/ldap_common.h" diff --git a/src/providers/ldap/ldap_child.c b/src/providers/ldap/ldap_child.c index 7ce8d4e6c..52c271f36 100644 --- a/src/providers/ldap/ldap_child.c +++ b/src/providers/ldap/ldap_child.c @@ -30,7 +30,7 @@ #include "util/util.h" #include "util/sss_krb5.h" #include "util/child_common.h" -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/krb5/krb5_common.h" static krb5_context krb5_error_ctx; diff --git a/src/providers/ldap/ldap_common.h b/src/providers/ldap/ldap_common.h index bdd02d822..d50473c88 100644 --- a/src/providers/ldap/ldap_common.h +++ b/src/providers/ldap/ldap_common.h @@ -22,7 +22,7 @@ #ifndef _LDAP_COMMON_H_ #define _LDAP_COMMON_H_ -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/ldap/sdap.h" #include "providers/ldap/sdap_id_op.h" #include "providers/fail_over.h" diff --git a/src/providers/ldap/sdap.h b/src/providers/ldap/sdap.h index 10c8ff6e0..81da1144c 100644 --- a/src/providers/ldap/sdap.h +++ b/src/providers/ldap/sdap.h @@ -22,7 +22,7 @@ #ifndef _SDAP_H_ #define _SDAP_H_ -#include "providers/dp_backend.h" +#include "providers/backend.h" #include #include "util/sss_ldap.h" diff --git a/src/providers/ldap/sdap_access.c b/src/providers/ldap/sdap_access.c index 14ec34508..d9a164814 100644 --- a/src/providers/ldap/sdap_access.c +++ b/src/providers/ldap/sdap_access.c @@ -39,7 +39,7 @@ #include "providers/ldap/sdap_access.h" #include "providers/ldap/sdap_async.h" #include "providers/data_provider.h" -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/ldap/ldap_auth.h" #define PERMANENTLY_LOCKED_ACCOUNT "000001010000Z" diff --git a/src/providers/ldap/sdap_access.h b/src/providers/ldap/sdap_access.h index 6e637be56..93ddfd5e5 100644 --- a/src/providers/ldap/sdap_access.h +++ b/src/providers/ldap/sdap_access.h @@ -25,7 +25,7 @@ #ifndef SDAP_ACCESS_H_ #define SDAP_ACCESS_H_ -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/ldap/ldap_common.h" /* Attributes in sysdb, used for caching last values of lockout or filter diff --git a/src/providers/ldap/sdap_async.h b/src/providers/ldap/sdap_async.h index f86f1890b..8a14395ef 100644 --- a/src/providers/ldap/sdap_async.h +++ b/src/providers/ldap/sdap_async.h @@ -26,7 +26,7 @@ #include #include #include -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/ldap/sdap.h" #include "providers/ldap/sdap_id_op.h" #include "providers/fail_over.h" diff --git a/src/providers/ldap/sdap_async_sudo.c b/src/providers/ldap/sdap_async_sudo.c index e3f3da186..feb533cf3 100644 --- a/src/providers/ldap/sdap_async_sudo.c +++ b/src/providers/ldap/sdap_async_sudo.c @@ -26,7 +26,7 @@ #include #include -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/ldap/ldap_common.h" #include "providers/ldap/sdap.h" #include "providers/ldap/sdap_ops.h" diff --git a/src/providers/ldap/sdap_autofs.c b/src/providers/ldap/sdap_autofs.c index 5432a6f37..f65b6ea61 100644 --- a/src/providers/ldap/sdap_autofs.c +++ b/src/providers/ldap/sdap_autofs.c @@ -29,7 +29,7 @@ #include "providers/ldap/sdap_autofs.h" #include "providers/ldap/sdap.h" #include "providers/ldap/sdap_async.h" -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/data_provider.h" #include "db/sysdb_autofs.h" #include "util/util.h" diff --git a/src/providers/ldap/sdap_dyndns.c b/src/providers/ldap/sdap_dyndns.c index 8b3b2a75d..83ec05183 100644 --- a/src/providers/ldap/sdap_dyndns.c +++ b/src/providers/ldap/sdap_dyndns.c @@ -24,7 +24,7 @@ #include "util/util.h" #include "resolv/async_resolv.h" -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/be_dyndns.h" #include "providers/ldap/sdap_async_private.h" #include "providers/ldap/sdap_dyndns.h" diff --git a/src/providers/ldap/sdap_dyndns.h b/src/providers/ldap/sdap_dyndns.h index 415faf8e8..b31c37321 100644 --- a/src/providers/ldap/sdap_dyndns.h +++ b/src/providers/ldap/sdap_dyndns.h @@ -26,7 +26,7 @@ #define SDAP_DYNDNS_H_ #include "util/util.h" -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/be_dyndns.h" #include "providers/ldap/ldap_common.h" diff --git a/src/providers/ldap/sdap_sudo.c b/src/providers/ldap/sdap_sudo.c index e653c4636..2ed97b9aa 100644 --- a/src/providers/ldap/sdap_sudo.c +++ b/src/providers/ldap/sdap_sudo.c @@ -22,7 +22,7 @@ #include #include -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/ldap/ldap_common.h" #include "providers/ldap/sdap.h" #include "providers/ldap/sdap_async.h" diff --git a/src/providers/ldap/sdap_sudo.h b/src/providers/ldap/sdap_sudo.h index 060f9fe36..fccd64c2f 100644 --- a/src/providers/ldap/sdap_sudo.h +++ b/src/providers/ldap/sdap_sudo.h @@ -21,7 +21,7 @@ #ifndef _SDAP_SUDO_H_ #define _SDAP_SUDO_H_ -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/ldap/ldap_common.h" struct sdap_sudo_ctx { diff --git a/src/providers/ldap/sdap_sudo_shared.h b/src/providers/ldap/sdap_sudo_shared.h index fcb45d693..dd49a6756 100644 --- a/src/providers/ldap/sdap_sudo_shared.h +++ b/src/providers/ldap/sdap_sudo_shared.h @@ -21,7 +21,7 @@ #ifndef _SDAP_SUDO_SHARED_H_ #define _SDAP_SUDO_SHARED_H_ -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/be_ptask.h" errno_t diff --git a/src/providers/proxy/proxy.h b/src/providers/proxy/proxy.h index 7f4dfc984..65479a448 100644 --- a/src/providers/proxy/proxy.h +++ b/src/providers/proxy/proxy.h @@ -37,7 +37,7 @@ #include #include "util/util.h" -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "db/sysdb.h" #include "sss_client/nss_compat.h" #include diff --git a/src/providers/proxy/proxy_child.c b/src/providers/proxy/proxy_child.c index 9876b9328..c52d482e2 100644 --- a/src/providers/proxy/proxy_child.c +++ b/src/providers/proxy/proxy_child.c @@ -45,7 +45,7 @@ #include "sbus/sssd_dbus.h" #include "providers/proxy/proxy.h" -#include "providers/dp_backend.h" +#include "providers/backend.h" static int pc_pam_handler(struct sbus_request *dbus_req, void *user_data); diff --git a/src/providers/simple/simple_access.c b/src/providers/simple/simple_access.c index edb4f2f3e..d4fa615f2 100644 --- a/src/providers/simple/simple_access.c +++ b/src/providers/simple/simple_access.c @@ -23,7 +23,7 @@ #include "providers/simple/simple_access.h" #include "util/sss_utf8.h" -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "db/sysdb.h" #define CONFDB_SIMPLE_ALLOW_USERS "simple_allow_users" diff --git a/src/providers/simple/simple_access_check.c b/src/providers/simple/simple_access_check.c index 14d833be2..3b7c2fe93 100644 --- a/src/providers/simple/simple_access_check.c +++ b/src/providers/simple/simple_access_check.c @@ -19,7 +19,7 @@ along with this program. If not, see . */ -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/simple/simple_access.h" #include "util/sss_utf8.h" #include "db/sysdb.h" diff --git a/src/tests/cmocka/test_be_ptask.c b/src/tests/cmocka/test_be_ptask.c index 883ed81e8..e2318c08b 100644 --- a/src/tests/cmocka/test_be_ptask.c +++ b/src/tests/cmocka/test_be_ptask.c @@ -24,7 +24,7 @@ #include #include -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "providers/be_ptask_private.h" #include "providers/be_ptask.h" #include "tests/cmocka/common_mock.h" diff --git a/src/tests/cmocka/test_data_provider_be.c b/src/tests/cmocka/test_data_provider_be.c index 52d65076c..1b5db79f5 100644 --- a/src/tests/cmocka/test_data_provider_be.c +++ b/src/tests/cmocka/test_data_provider_be.c @@ -21,7 +21,7 @@ #include #include -#include "providers/dp_backend.h" +#include "providers/backend.h" #include "tests/cmocka/common_mock.h" #include "tests/cmocka/common_mock_be.h" #include "tests/common.h" -- cgit