sssd  2.2.3
About: SSSD provides a set of daemons to manage access to remote directories and authentication mechanisms such as LDAP, Kerberos or FreeIPA. It provides also an NSS and PAM interface toward the system.
  Fossies Dox: sssd-2.2.3.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

data_provider.h
Go to the documentation of this file.
1 /*
2  SSSD
3 
4  Data Provider, private header file
5 
6  Copyright (C) Simo Sorce <ssorce@redhat.com> 2008
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #ifndef __DATA_PROVIDER_H__
23 #define __DATA_PROVIDER_H__
24 
25 #include "config.h"
26 
27 #include <stdint.h>
28 #include <sys/un.h>
29 #include <errno.h>
30 #include <stdbool.h>
31 #ifdef USE_KEYRING
32 #include <sys/types.h>
33 #include <keyutils.h>
34 #endif
35 #include <talloc.h>
36 #include <tevent.h>
37 #include <ldb.h>
38 #include <dbus/dbus.h>
39 
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"
46 
47 #define DATA_PROVIDER_VERSION 0x0001
48 #define DATA_PROVIDER_PIPE "private/sbus-dp"
49 
50 #define DP_PATH "/org/freedesktop/sssd/dataprovider"
51  /* end of group pamHandler */
115 
116 #define DP_ERR_DECIDE -1
117 #define DP_ERR_OK 0
118 #define DP_ERR_OFFLINE 1
119 #define DP_ERR_TIMEOUT 2
120 #define DP_ERR_FATAL 3
121 
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
129 
130 #define DP_SEC_ID "secid"
131 #define DP_CERT "cert"
132 /* sizeof() counts the trailing \0 so we must subtract 1 for the string
133  * length */
134 #define DP_SEC_ID_LEN (sizeof(DP_SEC_ID) - 1)
135 #define DP_CERT_LEN (sizeof(DP_CERT) - 1)
136 
137 #define DP_WILDCARD "wildcard"
138 #define DP_WILDCARD_LEN (sizeof(DP_WILDCARD) - 1)
139 
140 #define EXTRA_NAME_IS_UPN "U"
141 #define EXTRA_INPUT_MAYBE_WITH_VIEW "V"
142 
143 /* from dp_auth_util.c */
144 #define SSS_SERVER_INFO 0x80000000
145 
146 #define SSS_KRB5_INFO 0x40000000
147 #define SSS_LDAP_INFO 0x20000000
148 #define SSS_PROXY_INFO 0x10000000
149 
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)
152 
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);
156 
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);
160 
161 void dp_id_callback(DBusPendingCall *pending, void *ptr);
162 
163 /* from dp_sbus.c */
164 int dp_get_sbus_address(TALLOC_CTX *mem_ctx,
165  char **address, const char *domain_name);
166 
167 
168 /* Reserved filter name for request which waits until the files provider finishes mirroring
169  * the file content
170  */
171 #define DP_REQ_OPT_FILES_INITGR "files_initgr_request"
172 
173 /* Helpers */
174 
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 }
180 
186 };
187 
188 struct dp_opt_blob {
189  uint8_t *data;
190  size_t length;
191 };
192 
194  const char *cstring;
195  char *string;
197  int number;
198  bool boolean;
199 };
200 
201 struct dp_option {
202  const char *opt_name;
206 };
207 
208 #define DP_OPTION_TERMINATOR { NULL, 0, NULL_STRING, NULL_STRING }
209 
210 void dp_option_inherit(char **inherit_opt_list,
211  int option,
212  struct dp_option *parent_opts,
213  struct dp_option *subdom_opts);
214 
215 int dp_get_options(TALLOC_CTX *memctx,
216  struct confdb_ctx *cdb,
217  const char *conf_path,
218  struct dp_option *def_opts,
219  int num_opts,
220  struct dp_option **_opts);
221 
222 int dp_copy_options(TALLOC_CTX *memctx,
223  struct dp_option *src_opts,
224  int num_opts,
225  struct dp_option **_opts);
226 
227 int dp_copy_defaults(TALLOC_CTX *memctx,
228  struct dp_option *src_opts,
229  int num_opts,
230  struct dp_option **_opts);
231 
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__)
247 
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__)
260 
261 /* Generic Data Provider options */
262 
263 /* Resolver DP options */
270 
271  DP_RES_OPTS /* attrs counter */
272 };
273 
274 #endif /* __DATA_PROVIDER_ */
_dp_opt_set_string
int _dp_opt_set_string(struct dp_option *opts, int id, const char *s, const char *location)
Definition: data_provider_opts.c:388
DP_RES_OPT_DNS_DOMAIN
@ DP_RES_OPT_DNS_DOMAIN
Definition: data_provider.h:269
DP_RES_OPTS
@ DP_RES_OPTS
Definition: data_provider.h:271
DP_OPT_NUMBER
@ DP_OPT_NUMBER
Definition: data_provider.h:184
_dp_opt_get_blob
struct dp_opt_blob _dp_opt_get_blob(struct dp_option *opts, int id, const char *location)
Definition: data_provider_opts.c:345
DP_RES_OPT_RESOLVER_TIMEOUT
@ DP_RES_OPT_RESOLVER_TIMEOUT
Definition: data_provider.h:266
dp_opt_blob::data
uint8_t * data
Definition: data_provider.h:189
dp_option
Definition: data_provider.h:201
dp_option::val
union dp_opt_value val
Definition: data_provider.h:205
DP_RES_OPT_RESOLVER_SERVER_TIMEOUT
@ DP_RES_OPT_RESOLVER_SERVER_TIMEOUT
Definition: data_provider.h:268
dp_copy_options
int dp_copy_options(TALLOC_CTX *memctx, struct dp_option *src_opts, int num_opts, struct dp_option **_opts)
Definition: data_provider_opts.c:285
_dp_opt_set_bool
int _dp_opt_set_bool(struct dp_option *opts, int id, bool b, const char *location)
Definition: data_provider_opts.c:458
DP_RES_OPT_FAMILY_ORDER
@ DP_RES_OPT_FAMILY_ORDER
Definition: data_provider.h:265
dp_opt_value
Definition: data_provider.h:193
confdb_ctx
Definition: confdb_private.h:25
dp_opt_blob
Definition: data_provider.h:188
dp_unpack_pam_response
bool dp_unpack_pam_response(DBusMessage *msg, struct pam_data *pd, DBusError *dbus_error)
_dp_opt_set_blob
int _dp_opt_set_blob(struct dp_option *opts, int id, struct dp_opt_blob b, const char *location)
Definition: data_provider_opts.c:414
DP_RES_OPT_RESOLVER_OP_TIMEOUT
@ DP_RES_OPT_RESOLVER_OP_TIMEOUT
Definition: data_provider.h:267
dp_pack_pam_response
bool dp_pack_pam_response(DBusMessage *msg, struct pam_data *pd)
data_provider_req.h
dp_opt_value::boolean
bool boolean
Definition: data_provider.h:198
dp_get_options
int dp_get_options(TALLOC_CTX *memctx, struct confdb_ctx *cdb, const char *conf_path, struct dp_option *def_opts, int num_opts, struct dp_option **_opts)
Definition: data_provider_opts.c:83
dp_option::def_val
union dp_opt_value def_val
Definition: data_provider.h:204
pam_data
Definition: sss_pam_data.h:48
dp_get_sbus_address
int dp_get_sbus_address(TALLOC_CTX *mem_ctx, char **address, const char *domain_name)
_dp_opt_get_string
char * _dp_opt_get_string(struct dp_option *opts, int id, const char *location)
Definition: data_provider_opts.c:331
dp_opt_value::string
char * string
Definition: data_provider.h:195
dp_option::type
enum dp_opt_type type
Definition: data_provider.h:203
dp_id_callback
void dp_id_callback(DBusPendingCall *pending, void *ptr)
dp_opt_blob::length
size_t length
Definition: data_provider.h:190
_dp_opt_get_cstring
const char * _dp_opt_get_cstring(struct dp_option *opts, int id, const char *location)
Definition: data_provider_opts.c:317
_dp_opt_get_int
int _dp_opt_get_int(struct dp_option *opts, int id, const char *location)
Definition: data_provider_opts.c:359
dp_unpack_pam_request
bool dp_unpack_pam_request(DBusMessage *msg, TALLOC_CTX *mem_ctx, struct pam_data **new_pd, DBusError *dbus_error)
DP_OPT_BOOL
@ DP_OPT_BOOL
Definition: data_provider.h:185
confdb.h
dp_option_inherit
void dp_option_inherit(char **inherit_opt_list, int option, struct dp_option *parent_opts, struct dp_option *subdom_opts)
Definition: data_provider_opts.c:25
dp_copy_defaults
int dp_copy_defaults(TALLOC_CTX *memctx, struct dp_option *src_opts, int num_opts, struct dp_option **_opts)
Definition: data_provider_opts.c:293
DP_OPT_STRING
@ DP_OPT_STRING
Definition: data_provider.h:182
DP_OPT_BLOB
@ DP_OPT_BLOB
Definition: data_provider.h:183
dp_opt_value::cstring
const char * cstring
Definition: data_provider.h:194
dp_opt_value::blob
struct dp_opt_blob blob
Definition: data_provider.h:196
dp_opt_value::number
int number
Definition: data_provider.h:197
dp_opt_type
dp_opt_type
Definition: data_provider.h:181
dp_option::opt_name
const char * opt_name
Definition: data_provider.h:202
_dp_opt_get_bool
bool _dp_opt_get_bool(struct dp_option *opts, int id, const char *location)
Definition: data_provider_opts.c:373
sss_cli.h
util.h
dp_pack_pam_request
bool dp_pack_pam_request(DBusMessage *msg, struct pam_data *pd)
_dp_opt_set_int
int _dp_opt_set_int(struct dp_option *opts, int id, int i, const char *location)
Definition: data_provider_opts.c:441
dp_res_opts
dp_res_opts
Definition: data_provider.h:264
authtok.h
sss_pam_data.h