22 #ifndef __DATA_PROVIDER_H__
23 #define __DATA_PROVIDER_H__
32 #include <sys/types.h>
38 #include <dbus/dbus.h>
40 #include "util/util.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
48 #define DATA_PROVIDER_PIPE "private/sbus-dp"
50 #define DP_PATH "/org/freedesktop/sssd/dataprovider"
116 #define DP_ERR_DECIDE -1
118 #define DP_ERR_OFFLINE 1
119 #define DP_ERR_TIMEOUT 2
120 #define DP_ERR_FATAL 3
122 #define BE_FILTER_NAME 1
123 #define BE_FILTER_IDNUM 2
124 #define BE_FILTER_ENUM 3
125 #define BE_FILTER_SECID 4
126 #define BE_FILTER_UUID 5
127 #define BE_FILTER_CERT 6
128 #define BE_FILTER_WILDCARD 7
130 #define DP_SEC_ID "secid"
131 #define DP_CERT "cert"
134 #define DP_SEC_ID_LEN (sizeof(DP_SEC_ID) - 1)
135 #define DP_CERT_LEN (sizeof(DP_CERT) - 1)
137 #define DP_WILDCARD "wildcard"
138 #define DP_WILDCARD_LEN (sizeof(DP_WILDCARD) - 1)
140 #define EXTRA_NAME_IS_UPN "U"
141 #define EXTRA_INPUT_MAYBE_WITH_VIEW "V"
144 #define SSS_SERVER_INFO 0x80000000
146 #define SSS_KRB5_INFO 0x40000000
147 #define SSS_LDAP_INFO 0x20000000
148 #define SSS_PROXY_INFO 0x10000000
150 #define SSS_KRB5_INFO_TGT_LIFETIME (SSS_SERVER_INFO|SSS_KRB5_INFO|0x01)
151 #define SSS_KRB5_INFO_UPN (SSS_SERVER_INFO|SSS_KRB5_INFO|0x02)
153 bool dp_pack_pam_request(DBusMessage *msg,
struct pam_data *pd);
154 bool dp_unpack_pam_request(DBusMessage *msg, TALLOC_CTX *mem_ctx,
155 struct pam_data **new_pd, DBusError *dbus_error);
157 bool dp_pack_pam_response(DBusMessage *msg,
struct pam_data *pd);
158 bool dp_unpack_pam_response(DBusMessage *msg,
struct pam_data *pd,
159 DBusError *dbus_error);
161 void dp_id_callback(DBusPendingCall *pending,
void *ptr);
164 int dp_get_sbus_address(TALLOC_CTX *mem_ctx,
165 char **address,
const char *domain_name);
171 #define DP_REQ_OPT_FILES_INITGR "files_initgr_request"
175 #define NULL_STRING { .string = NULL }
176 #define NULL_BLOB { .blob = { NULL, 0 } }
177 #define NULL_NUMBER { .number = 0 }
178 #define BOOL_FALSE { .boolean = false }
179 #define BOOL_TRUE { .boolean = true }
196 struct dp_opt_blob blob;
202 const char *opt_name;
203 enum dp_opt_type type;
204 union dp_opt_value def_val;
205 union dp_opt_value val;
208 #define DP_OPTION_TERMINATOR { NULL, 0, NULL_STRING, NULL_STRING }
210 void dp_option_inherit(
char **inherit_opt_list,
212 struct dp_option *parent_opts,
213 struct dp_option *subdom_opts);
215 int dp_get_options(TALLOC_CTX *memctx,
216 struct confdb_ctx *cdb,
217 const char *conf_path,
218 struct dp_option *def_opts,
220 struct dp_option **_opts);
222 int dp_copy_options(TALLOC_CTX *memctx,
223 struct dp_option *src_opts,
225 struct dp_option **_opts);
227 int dp_copy_defaults(TALLOC_CTX *memctx,
228 struct dp_option *src_opts,
230 struct dp_option **_opts);
232 const char *_dp_opt_get_cstring(
struct dp_option *opts,
233 int id,
const char *location);
234 char *_dp_opt_get_string(
struct dp_option *opts,
235 int id,
const char *location);
236 struct dp_opt_blob _dp_opt_get_blob(struct dp_option *opts,
237 int id,
const char *location);
238 int _dp_opt_get_int(
struct dp_option *opts,
239 int id,
const char *location);
240 bool _dp_opt_get_bool(
struct dp_option *opts,
241 int id,
const char *location);
242 #define dp_opt_get_cstring(o, i) _dp_opt_get_cstring(o, i, __FUNCTION__)
243 #define dp_opt_get_string(o, i) _dp_opt_get_string(o, i, __FUNCTION__)
244 #define dp_opt_get_blob(o, i) _dp_opt_get_blob(o, i, __FUNCTION__)
245 #define dp_opt_get_int(o, i) _dp_opt_get_int(o, i, __FUNCTION__)
246 #define dp_opt_get_bool(o, i) _dp_opt_get_bool(o, i, __FUNCTION__)
248 int _dp_opt_set_string(
struct dp_option *opts,
int id,
249 const char *s,
const char *location);
250 int _dp_opt_set_blob(
struct dp_option *opts,
int id,
251 struct dp_opt_blob b,
const char *location);
252 int _dp_opt_set_int(
struct dp_option *opts,
int id,
253 int i,
const char *location);
254 int _dp_opt_set_bool(
struct dp_option *opts,
int id,
255 bool b,
const char *location);
256 #define dp_opt_set_string(o, i, v) _dp_opt_set_string(o, i, v, __FUNCTION__)
257 #define dp_opt_set_blob(o, i, v) _dp_opt_set_blob(o, i, v, __FUNCTION__)
258 #define dp_opt_set_int(o, i, v) _dp_opt_set_int(o, i, v, __FUNCTION__)
259 #define dp_opt_set_bool(o, i, v) _dp_opt_set_bool(o, i, v, __FUNCTION__)
265 DP_RES_OPT_FAMILY_ORDER,
266 DP_RES_OPT_RESOLVER_TIMEOUT,
267 DP_RES_OPT_RESOLVER_OP_TIMEOUT,
268 DP_RES_OPT_RESOLVER_SERVER_TIMEOUT,
269 DP_RES_OPT_DNS_DOMAIN,