ldap_common.h revision d81d8d3dc151ebc95cd0e3f3b14c1cdaa48980f1
e59faf65ce864fe95dc00f5d52b8323cdbd0608aTimo Sirainen/*
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen SSSD
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen LDAP Common utility code
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen
b039dabf4c53f72454e795930e7643b6e0e625f9Timo Sirainen Copyright (C) Simo Sorce <ssorce@redhat.com> 2009
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen
a35cbba04d0a2823da98e693bd09a051addffdb2Timo Sirainen This program is free software; you can redistribute it and/or modify
94e1adead9faddec88a623485b9999a87b1684faTimo Sirainen it under the terms of the GNU General Public License as published by
94e1adead9faddec88a623485b9999a87b1684faTimo Sirainen the Free Software Foundation; either version 3 of the License, or
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen (at your option) any later version.
503e5ef896c7b4a51cf73efb0d132860a8c747e6Timo Sirainen
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen This program is distributed in the hope that it will be useful,
cb2b5a7d6e7e651191bf9ee1eda94a6e207288b0Timo Sirainen but WITHOUT ANY WARRANTY; without even the implied warranty of
cb2b5a7d6e7e651191bf9ee1eda94a6e207288b0Timo Sirainen MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7ca2a9f1cca63cbc2ebffc185c7e5a2b32bc2780Timo Sirainen GNU General Public License for more details.
7ca2a9f1cca63cbc2ebffc185c7e5a2b32bc2780Timo Sirainen
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen You should have received a copy of the GNU General Public License
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen along with this program. If not, see <http://www.gnu.org/licenses/>.
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen*/
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen#ifndef _LDAP_COMMON_H_
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen#define _LDAP_COMMON_H_
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen#include "providers/dp_backend.h"
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen#include "providers/ldap/sdap.h"
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen#include "providers/ldap/sdap_id_op.h"
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen#include "providers/fail_over.h"
cb951d3282610a9a0960230865bc5f3e3347b203Timo Sirainen#include "providers/krb5/krb5_common.h"
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen#include "lib/idmap/sss_idmap.h"
cb951d3282610a9a0960230865bc5f3e3347b203Timo Sirainen
a35cbba04d0a2823da98e693bd09a051addffdb2Timo Sirainen#define PWD_POL_OPT_NONE "none"
3fe44a0df5a0bdd80c495f79cbf0e384441d6fccTimo Sirainen#define PWD_POL_OPT_SHADOW "shadow"
a35cbba04d0a2823da98e693bd09a051addffdb2Timo Sirainen#define PWD_POL_OPT_MIT "mit_kerberos"
cb951d3282610a9a0960230865bc5f3e3347b203Timo Sirainen
a35cbba04d0a2823da98e693bd09a051addffdb2Timo Sirainen#define SSS_LDAP_SRV_NAME "ldap"
cb951d3282610a9a0960230865bc5f3e3347b203Timo Sirainen
cb951d3282610a9a0960230865bc5f3e3347b203Timo Sirainen#define LDAP_STANDARD_URI "ldap://"
cb951d3282610a9a0960230865bc5f3e3347b203Timo Sirainen#define LDAP_SSL_URI "ldaps://"
a35cbba04d0a2823da98e693bd09a051addffdb2Timo Sirainen#define LDAP_LDAPI_URI "ldapi://"
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen
3fe44a0df5a0bdd80c495f79cbf0e384441d6fccTimo Sirainen/* a fd the child process would log into */
3fe44a0df5a0bdd80c495f79cbf0e384441d6fccTimo Sirainenextern int ldap_child_debug_fd;
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainenstruct sdap_id_ctx;
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainenstruct sdap_id_conn_ctx {
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen struct sdap_id_ctx *id_ctx;
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen struct sdap_service *service;
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen /* LDAP connection cache */
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen struct sdap_id_conn_cache *conn_cache;
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen /* dlinklist pointers */
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen struct sdap_id_conn_ctx *prev, *next;
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen /* do not go offline, try another connection */
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen bool ignore_mark_offline;
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen};
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainenstruct sdap_id_ctx {
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen struct be_ctx *be;
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen struct sdap_options *opts;
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen /* If using GSSAPI */
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen struct krb5_service *krb5_service;
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen /* connection to a server */
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen struct sdap_id_conn_ctx *conn;
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen struct sdap_server_opts *srv_opts;
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen};
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainenstruct sdap_auth_ctx {
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen struct be_ctx *be;
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen struct sdap_options *opts;
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen struct sdap_service *service;
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen struct sdap_service *chpass_service;
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen};
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainenint sssm_ldap_id_init(struct be_ctx *bectx,
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen struct bet_ops **ops,
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen void **pvt_data);
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainenvoid sdap_check_online(struct be_req *breq);
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainenvoid sdap_do_online_check(struct be_req *be_req, struct sdap_id_ctx *ctx);
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainenstruct tevent_req* sdap_reinit_cleanup_send(TALLOC_CTX *mem_ctx,
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen struct be_ctx *be_ctx,
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen struct sdap_id_ctx *id_ctx);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainenerrno_t sdap_reinit_cleanup_recv(struct tevent_req *req);
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen/* id */
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainenvoid sdap_account_info_handler(struct be_req *breq);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenvoid sdap_handle_account_info(struct be_req *breq, struct sdap_id_ctx *ctx,
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen struct sdap_id_conn_ctx *conn);
abc79eec93e58e0152cd1d483f37be66c26811b9Timo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen/* Set up enumeration and/or cleanup */
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenint ldap_id_setup_tasks(struct sdap_id_ctx *ctx);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenint sdap_id_setup_tasks(struct be_ctx *be_ctx,
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen struct sdap_id_ctx *ctx,
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen struct sdap_domain *sdom,
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen be_ptask_send_t send_fn,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen be_ptask_recv_t recv_fn,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen void *pvt);
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenstruct tevent_req *
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainensdap_handle_acct_req_send(TALLOC_CTX *mem_ctx,
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen struct be_ctx *be_ctx,
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen struct be_acct_req *ar,
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen struct sdap_id_ctx *id_ctx,
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen struct sdap_domain *sdom,
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen struct sdap_id_conn_ctx *conn,
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen bool noexist_delete);
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainenerrno_t
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainensdap_handle_acct_req_recv(struct tevent_req *req,
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen int *_dp_error, const char **_err,
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen int *sdap_ret);
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen/* auth */
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainenvoid sdap_pam_auth_handler(struct be_req *breq);
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen/* chpass */
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainenvoid sdap_pam_chpass_handler(struct be_req *breq);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen/* access */
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainenvoid sdap_pam_access_handler(struct be_req *breq);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen/* autofs */
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenvoid sdap_autofs_handler(struct be_req *breq);
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenvoid sdap_handler_done(struct be_req *req, int dp_err,
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen int error, const char *errstr);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainenint sdap_service_init(TALLOC_CTX *memctx, struct be_ctx *ctx,
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen const char *service_name, const char *dns_service_name,
3fe44a0df5a0bdd80c495f79cbf0e384441d6fccTimo Sirainen const char *urls, const char *backup_urls,
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen struct sdap_service **_service);
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainenint sdap_gssapi_init(TALLOC_CTX *mem_ctx,
fd1f0e9ef52b3e157cfd1a01c464c2ac7458ab17Timo Sirainen struct dp_option *opts,
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen struct be_ctx *bectx,
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen struct sdap_service *sdap_service,
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen struct krb5_service **krb5_service);
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainenerrno_t sdap_install_offline_callback(TALLOC_CTX *mem_ctx,
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen struct be_ctx *be_ctx,
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen const char *realm,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen const char *service_name);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainenerrno_t sdap_install_sigterm_handler(TALLOC_CTX *mem_ctx,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct tevent_context *ev,
3fe44a0df5a0bdd80c495f79cbf0e384441d6fccTimo Sirainen const char *realm);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainenvoid sdap_remove_kdcinfo_files_callback(void *pvt);
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen/* options parser */
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainenint ldap_get_options(TALLOC_CTX *memctx,
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen struct sss_domain_info *dom,
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen struct confdb_ctx *cdb,
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen const char *conf_path,
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen struct sdap_options **_opts);
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainenint ldap_get_sudo_options(TALLOC_CTX *memctx,
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen struct confdb_ctx *cdb,
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen const char *conf_path,
d9b8c65d0a0ffc709ba7d23c449dbf2f46b10674Timo Sirainen struct sdap_options *opts,
d9b8c65d0a0ffc709ba7d23c449dbf2f46b10674Timo Sirainen bool *use_host_filter,
d9b8c65d0a0ffc709ba7d23c449dbf2f46b10674Timo Sirainen bool *include_regexp,
d9b8c65d0a0ffc709ba7d23c449dbf2f46b10674Timo Sirainen bool *include_netgroups);
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenint ldap_get_autofs_options(TALLOC_CTX *memctx,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct confdb_ctx *cdb,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen const char *conf_path,
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen struct sdap_options *opts);
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen/* Calling ldap_setup_enumeration will set up a periodic task
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen * that would periodically call send_fn/recv_fn request. The
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen * send_fn's pvt parameter will be a pointer to ldap_enum_ctx
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen * structure that contains the request data
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen */
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainenstruct ldap_enum_ctx {
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct sdap_domain *sdom;
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen void *pvt;
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen};
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainenerrno_t ldap_setup_enumeration(struct be_ctx *be_ctx,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct sdap_options *opts,
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen struct sdap_domain *sdom,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen be_ptask_send_t send_fn,
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen be_ptask_recv_t recv_fn,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen void *pvt);
e5acc283bf030b0b5c79ca4e52d315c516a299faPascal Volkstruct tevent_req *
e5acc283bf030b0b5c79ca4e52d315c516a299faPascal Volkldap_enumeration_send(TALLOC_CTX *mem_ctx,
e3077468777f5d324224365e34d7bbc449168e52Timo Sirainen struct tevent_context *ev,
e3077468777f5d324224365e34d7bbc449168e52Timo Sirainen struct be_ctx *be_ctx,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct be_ptask *be_ptask,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen void *pvt);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenerrno_t ldap_enumeration_recv(struct tevent_req *req);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenerrno_t ldap_setup_cleanup(struct sdap_id_ctx *id_ctx,
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen struct sdap_domain *sdom);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenerrno_t ldap_id_cleanup(struct sdap_options *opts,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct sdap_domain *sdom);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenvoid sdap_mark_offline(struct sdap_id_ctx *ctx);
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenstruct tevent_req *groups_get_send(TALLOC_CTX *memctx,
0e5819a061034f1636b124c03a89f67d37c852b1Timo Sirainen struct tevent_context *ev,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct sdap_id_ctx *ctx,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct sdap_domain *sdom,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct sdap_id_conn_ctx *conn,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen const char *name,
b1678954f83e1059b981e2def52a70054fa71399Timo Sirainen int filter_type,
b1678954f83e1059b981e2def52a70054fa71399Timo Sirainen int attrs_type,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen bool noexist_delete,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen bool no_members);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenint groups_get_recv(struct tevent_req *req, int *dp_error_out, int *sdap_ret);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenstruct tevent_req *ldap_netgroup_get_send(TALLOC_CTX *memctx,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct tevent_context *ev,
00589bcc8452de52d8a4f753be402487eb83ca41Timo Sirainen struct sdap_id_ctx *ctx,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct sdap_domain *sdom,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct sdap_id_conn_ctx *conn,
65e14cef911d5d3fac8993c8a76911a587f05cd7Timo Sirainen const char *name,
65e14cef911d5d3fac8993c8a76911a587f05cd7Timo Sirainen bool noexist_delete);
65e14cef911d5d3fac8993c8a76911a587f05cd7Timo Sirainenint ldap_netgroup_get_recv(struct tevent_req *req, int *dp_error_out, int *sdap_ret);
d19d3aa4eafa34b48b7d7d311c9db31e1898576aTimo Sirainen
d19d3aa4eafa34b48b7d7d311c9db31e1898576aTimo Sirainenstruct tevent_req *
65e14cef911d5d3fac8993c8a76911a587f05cd7Timo Sirainenservices_get_send(TALLOC_CTX *mem_ctx,
65e14cef911d5d3fac8993c8a76911a587f05cd7Timo Sirainen struct tevent_context *ev,
65e14cef911d5d3fac8993c8a76911a587f05cd7Timo Sirainen struct sdap_id_ctx *id_ctx,
65e14cef911d5d3fac8993c8a76911a587f05cd7Timo Sirainen struct sdap_domain *sdom,
65e14cef911d5d3fac8993c8a76911a587f05cd7Timo Sirainen struct sdap_id_conn_ctx *conn,
65e14cef911d5d3fac8993c8a76911a587f05cd7Timo Sirainen const char *name,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen const char *protocol,
608aa112aa7d94a1720c909747dcd0b61c079453Timo Sirainen int filter_type,
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen bool noexist_delete);
d19d3aa4eafa34b48b7d7d311c9db31e1898576aTimo Sirainen
d19d3aa4eafa34b48b7d7d311c9db31e1898576aTimo Sirainenerrno_t
d19d3aa4eafa34b48b7d7d311c9db31e1898576aTimo Sirainenservices_get_recv(struct tevent_req *req, int *dp_error_out, int *sdap_ret);
d19d3aa4eafa34b48b7d7d311c9db31e1898576aTimo Sirainen
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen/* setup child logging */
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainenint sdap_setup_child(void);
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainenerrno_t string_to_shadowpw_days(const char *s, long *d);
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenerrno_t get_sysdb_attr_name(TALLOC_CTX *mem_ctx,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct sdap_attr_map *map,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen size_t map_size,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen const char *ldap_name,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen char **sysdb_name);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenerrno_t list_missing_attrs(TALLOC_CTX *mem_ctx,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct sdap_attr_map *map,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen size_t map_size,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct sysdb_attrs *recvd_attrs,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen char ***missing_attrs);
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainenbool sdap_is_secure_uri(const char *uri);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenchar *sdap_get_id_specific_filter(TALLOC_CTX *mem_ctx,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen const char *base_filter,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen const char *extra_filter);
8a1c866a4c429f26c8746525f82024bc387f1407Timo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenchar *sdap_get_access_filter(TALLOC_CTX *mem_ctx,
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen const char *base_filter);
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenerrno_t msgs2attrs_array(TALLOC_CTX *mem_ctx, size_t count,
d19d3aa4eafa34b48b7d7d311c9db31e1898576aTimo Sirainen struct ldb_message **msgs,
d19d3aa4eafa34b48b7d7d311c9db31e1898576aTimo Sirainen struct sysdb_attrs ***attrs);
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenerrno_t sdap_domain_add(struct sdap_options *opts,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct sss_domain_info *dom,
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen struct sdap_domain **_sdom);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenerrno_t
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainensdap_domain_subdom_add(struct sdap_id_ctx *sdap_id_ctx,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct sdap_domain *sdom_list,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct sss_domain_info *parent);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
503e5ef896c7b4a51cf73efb0d132860a8c747e6Timo Sirainenvoid
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainensdap_domain_remove(struct sdap_options *opts,
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainen struct sss_domain_info *dom);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainenstruct sdap_domain *sdap_domain_get(struct sdap_options *opts,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct sss_domain_info *dom);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainenstruct sdap_domain *sdap_domain_get_by_dn(struct sdap_options *opts,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen const char *dn);
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainenerrno_t
2b682d8d3661800f16aceaa45fa4de9b6b140a59Timo Sirainensdap_create_search_base(TALLOC_CTX *mem_ctx,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen const char *unparsed_base,
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen int scope,
e20e638805c4bd54e039891a3e92760b1dfa189aTimo Sirainen const char *filter,
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen struct sdap_search_base **_base);
e20e638805c4bd54e039891a3e92760b1dfa189aTimo Sirainen
e20e638805c4bd54e039891a3e92760b1dfa189aTimo Sirainenerrno_t sdap_parse_search_base(TALLOC_CTX *mem_ctx,
e20e638805c4bd54e039891a3e92760b1dfa189aTimo Sirainen struct dp_option *opts, int class,
82995cc154a929f37aa486a72a6485e9f8d34a30Timo Sirainen struct sdap_search_base ***_search_bases);
3ccfcf0856958cb9208a9fc51c3bdf13c58ad52aTimo Sirainenerrno_t common_parse_search_base(TALLOC_CTX *mem_ctx,
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen const char *unparsed_base,
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen const char *class_name,
a449ed9df03e9f7e93d1ec278754416ac3ad9073Timo Sirainen const char *old_filter,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen struct sdap_search_base ***_search_bases);
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen
a449ed9df03e9f7e93d1ec278754416ac3ad9073Timo Sirainenerrno_t
a449ed9df03e9f7e93d1ec278754416ac3ad9073Timo Sirainensdap_attrs_get_sid_str(TALLOC_CTX *mem_ctx,
a449ed9df03e9f7e93d1ec278754416ac3ad9073Timo Sirainen struct sdap_idmap_ctx *idmap_ctx,
a449ed9df03e9f7e93d1ec278754416ac3ad9073Timo Sirainen struct sysdb_attrs *sysdb_attrs,
3851ad9fcb25635f02b46d44586742ef1081876bTimo Sirainen const char *sid_attr,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen char **_sid_str);
a449ed9df03e9f7e93d1ec278754416ac3ad9073Timo Sirainen
a449ed9df03e9f7e93d1ec278754416ac3ad9073Timo Sirainenerrno_t
a449ed9df03e9f7e93d1ec278754416ac3ad9073Timo Sirainensdap_set_sasl_options(struct sdap_options *id_opts,
a449ed9df03e9f7e93d1ec278754416ac3ad9073Timo Sirainen char *default_primary,
d23c747de9d33966483fbdd41f08ad7766da7c5cTimo Sirainen char *default_realm,
a449ed9df03e9f7e93d1ec278754416ac3ad9073Timo Sirainen const char *keytab_path);
a449ed9df03e9f7e93d1ec278754416ac3ad9073Timo Sirainen
a449ed9df03e9f7e93d1ec278754416ac3ad9073Timo Sirainenstruct sdap_id_conn_ctx *
a449ed9df03e9f7e93d1ec278754416ac3ad9073Timo Sirainensdap_id_ctx_conn_add(struct sdap_id_ctx *id_ctx,
a449ed9df03e9f7e93d1ec278754416ac3ad9073Timo Sirainen struct sdap_service *sdap_service);
3851ad9fcb25635f02b46d44586742ef1081876bTimo Sirainen
a449ed9df03e9f7e93d1ec278754416ac3ad9073Timo Sirainenstruct sdap_id_ctx *
3851ad9fcb25635f02b46d44586742ef1081876bTimo Sirainensdap_id_ctx_new(TALLOC_CTX *mem_ctx, struct be_ctx *bectx,
a449ed9df03e9f7e93d1ec278754416ac3ad9073Timo Sirainen struct sdap_service *sdap_service);
a449ed9df03e9f7e93d1ec278754416ac3ad9073Timo Sirainen
a449ed9df03e9f7e93d1ec278754416ac3ad9073Timo Sirainenerrno_t sdap_refresh_init(struct be_refresh_ctx *refresh_ctx,
a449ed9df03e9f7e93d1ec278754416ac3ad9073Timo Sirainen struct sdap_id_ctx *id_ctx);
a449ed9df03e9f7e93d1ec278754416ac3ad9073Timo Sirainen
3851ad9fcb25635f02b46d44586742ef1081876bTimo Sirainen#endif /* _LDAP_COMMON_H_ */
3851ad9fcb25635f02b46d44586742ef1081876bTimo Sirainen