22#ifndef __DATA_PROVIDER_H__
23#define __DATA_PROVIDER_H__
41#include "confdb/confdb.h"
42#include "sss_client/sss_cli.h"
43#include "util/authtok.h"
44#include "util/sss_pam_data.h"
45#include "providers/data_provider_req.h"
47#define DATA_PROVIDER_VERSION 0x0001
113#define DP_ERR_DECIDE -1
115#define DP_ERR_OFFLINE 1
116#define DP_ERR_TIMEOUT 2
117#define DP_ERR_FATAL 3
119#define BE_FILTER_NAME 1
120#define BE_FILTER_IDNUM 2
121#define BE_FILTER_ENUM 3
122#define BE_FILTER_SECID 4
123#define BE_FILTER_UUID 5
124#define BE_FILTER_CERT 6
125#define BE_FILTER_WILDCARD 7
126#define BE_FILTER_ADDR 8
128#define DP_SEC_ID "secid"
129#define DP_CERT "cert"
132#define DP_SEC_ID_LEN (sizeof(DP_SEC_ID) - 1)
133#define DP_CERT_LEN (sizeof(DP_CERT) - 1)
135#define DP_WILDCARD "wildcard"
136#define DP_WILDCARD_LEN (sizeof(DP_WILDCARD) - 1)
138#define EXTRA_NAME_IS_UPN "U"
139#define EXTRA_INPUT_MAYBE_WITH_VIEW "V"
142#define SSS_SERVER_INFO 0x80000000
144#define SSS_KRB5_INFO 0x40000000
145#define SSS_LDAP_INFO 0x20000000
146#define SSS_PROXY_INFO 0x10000000
148#define SSS_KRB5_INFO_TGT_LIFETIME (SSS_SERVER_INFO|SSS_KRB5_INFO|0x01)
149#define SSS_KRB5_INFO_UPN (SSS_SERVER_INFO|SSS_KRB5_INFO|0x02)
151bool dp_pack_pam_request(DBusMessage *msg,
struct pam_data *pd);
152bool dp_unpack_pam_request(DBusMessage *msg, TALLOC_CTX *mem_ctx,
153 struct pam_data **new_pd, DBusError *dbus_error);
155bool dp_pack_pam_response(DBusMessage *msg,
struct pam_data *pd);
156bool dp_unpack_pam_response(DBusMessage *msg,
struct pam_data *pd,
157 DBusError *dbus_error);
159void dp_id_callback(DBusPendingCall *pending,
void *ptr);
161#ifdef BUILD_FILES_PROVIDER
165#define DP_REQ_OPT_FILES_INITGR "files_initgr_request"
170#define NULL_STRING { .string = NULL }
171#define NULL_BLOB { .blob = { NULL, 0 } }
172#define NULL_NUMBER { .number = 0 }
173#define BOOL_FALSE { .boolean = false }
174#define BOOL_TRUE { .boolean = true }
191 struct dp_opt_blob blob;
197 const char *opt_name;
198 enum dp_opt_type type;
199 union dp_opt_value def_val;
200 union dp_opt_value val;
203#define DP_OPTION_TERMINATOR { NULL, 0, NULL_STRING, NULL_STRING }
205void dp_option_inherit_match(
char **inherit_opt_list,
207 struct dp_option *parent_opts,
208 struct dp_option *subdom_opts);
210void dp_option_inherit(
int option,
211 struct dp_option *parent_opts,
212 struct dp_option *subdom_opts);
214int dp_get_options(TALLOC_CTX *memctx,
215 struct confdb_ctx *cdb,
216 const char *conf_path,
217 struct dp_option *def_opts,
219 struct dp_option **_opts);
221int dp_copy_options(TALLOC_CTX *memctx,
222 struct dp_option *src_opts,
224 struct dp_option **_opts);
226int dp_copy_defaults(TALLOC_CTX *memctx,
227 struct dp_option *src_opts,
229 struct dp_option **_opts);
231const char *_dp_opt_get_cstring(
struct dp_option *opts,
232 int id,
const char *location);
233char *_dp_opt_get_string(
struct dp_option *opts,
234 int id,
const char *location);
235struct dp_opt_blob _dp_opt_get_blob(struct dp_option *opts,
236 int id,
const char *location);
237int _dp_opt_get_int(
struct dp_option *opts,
238 int id,
const char *location);
239bool _dp_opt_get_bool(
struct dp_option *opts,
240 int id,
const char *location);
241#define dp_opt_get_cstring(o, i) _dp_opt_get_cstring(o, i, __FUNCTION__)
242#define dp_opt_get_string(o, i) _dp_opt_get_string(o, i, __FUNCTION__)
243#define dp_opt_get_blob(o, i) _dp_opt_get_blob(o, i, __FUNCTION__)
244#define dp_opt_get_int(o, i) _dp_opt_get_int(o, i, __FUNCTION__)
245#define dp_opt_get_bool(o, i) _dp_opt_get_bool(o, i, __FUNCTION__)
247int _dp_opt_set_string(
struct dp_option *opts,
int id,
248 const char *s,
const char *location);
249int _dp_opt_set_blob(
struct dp_option *opts,
int id,
250 struct dp_opt_blob b,
const char *location);
251int _dp_opt_set_int(
struct dp_option *opts,
int id,
252 int i,
const char *location);
253int _dp_opt_set_bool(
struct dp_option *opts,
int id,
254 bool b,
const char *location);
255#define dp_opt_set_string(o, i, v) _dp_opt_set_string(o, i, v, __FUNCTION__)
256#define dp_opt_set_blob(o, i, v) _dp_opt_set_blob(o, i, v, __FUNCTION__)
257#define dp_opt_set_int(o, i, v) _dp_opt_set_int(o, i, v, __FUNCTION__)
258#define dp_opt_set_bool(o, i, v) _dp_opt_set_bool(o, i, v, __FUNCTION__)
264 DP_RES_OPT_FAMILY_ORDER,
265 DP_RES_OPT_RESOLVER_TIMEOUT,
266 DP_RES_OPT_RESOLVER_OP_TIMEOUT,
267 DP_RES_OPT_RESOLVER_SERVER_TIMEOUT,
268 DP_RES_OPT_RESOLVER_USE_SEARCH_LIST,
269 DP_RES_OPT_DNS_DOMAIN,