sss_nss_idmap 2.8.0
sss_nss_idmap.h
1/*
2 SSSD
3
4 NSS Responder ID-mapping interface
5
6 Authors:
7 Sumit Bose <sbose@redhat.com>
8
9 Copyright (C) 2013 Red Hat
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 3 of the License, or
14 (at your option) any later version.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program. If not, see <http://www.gnu.org/licenses/>.
23*/
24
25#ifndef SSS_NSS_IDMAP_H_
26#define SSS_NSS_IDMAP_H_
27
28#include <stdint.h>
29#include <sys/types.h>
30#include <pwd.h>
31#include <grp.h>
32
36enum sss_id_type {
37 SSS_ID_TYPE_NOT_SPECIFIED = 0,
38 SSS_ID_TYPE_UID,
39 SSS_ID_TYPE_GID,
40 SSS_ID_TYPE_BOTH /* used for user or magic private groups */
41};
42
43struct sss_nss_kv {
44 char *key;
45 char *value;
46};
47
65int sss_nss_getsidbyname(const char *fq_name, char **sid,
66 enum sss_id_type *type);
67
79int sss_nss_getsidbyid(uint32_t id, char **sid, enum sss_id_type *type);
80
92int sss_nss_getsidbyuid(uint32_t uid, char **sid, enum sss_id_type *type);
93
105int sss_nss_getsidbygid(uint32_t id, char **sid, enum sss_id_type *type);
106
118int sss_nss_getnamebysid(const char *sid, char **fq_name,
119 enum sss_id_type *type);
120
131int sss_nss_getidbysid(const char *sid, uint32_t *id,
132 enum sss_id_type *id_type);
133
152int sss_nss_getorigbyname(const char *fq_name, struct sss_nss_kv **kv_list,
153 enum sss_id_type *type);
154
173int sss_nss_getorigbyusername(const char *fq_name, struct sss_nss_kv **kv_list,
174 enum sss_id_type *type);
175
194int sss_nss_getorigbygroupname(const char *fq_name, struct sss_nss_kv **kv_list,
195 enum sss_id_type *type);
196
209int sss_nss_getnamebycert(const char *cert, char **fq_name,
210 enum sss_id_type *type);
211
224int sss_nss_getlistbycert(const char *cert, char ***fq_name,
225 enum sss_id_type **type);
226
233void sss_nss_free_kv(struct sss_nss_kv *kv_list);
234
239#define SSS_NSS_EX_FLAG_NO_FLAGS 0
240
244#define SSS_NSS_EX_FLAG_NO_CACHE (1 << 0)
245
249#define SSS_NSS_EX_FLAG_INVALIDATE_CACHE (1 << 1)
250
251#ifdef IPA_389DS_PLUGIN_HELPER_CALLS
252
272int sss_nss_getpwnam_timeout(const char *name, struct passwd *pwd,
273 char *buffer, size_t buflen,
274 struct passwd **result,
275 uint32_t flags, unsigned int timeout);
276
296int sss_nss_getpwuid_timeout(uid_t uid, struct passwd *pwd,
297 char *buffer, size_t buflen,
298 struct passwd **result,
299 uint32_t flags, unsigned int timeout);
300
320int sss_nss_getgrnam_timeout(const char *name, struct group *grp,
321 char *buffer, size_t buflen, struct group **result,
322 uint32_t flags, unsigned int timeout);
323
343int sss_nss_getgrgid_timeout(gid_t gid, struct group *grp,
344 char *buffer, size_t buflen, struct group **result,
345 uint32_t flags, unsigned int timeout);
346
372int sss_nss_getgrouplist_timeout(const char *name, gid_t group,
373 gid_t *groups, int *ngroups,
374 uint32_t flags, unsigned int timeout);
395int sss_nss_getsidbyname_timeout(const char *fq_name, unsigned int timeout,
396 char **sid, enum sss_id_type *type);
397
410int sss_nss_getsidbyid_timeout(uint32_t id, unsigned int timeout,
411 char **sid, enum sss_id_type *type);
424int sss_nss_getsidbyuid_timeout(uint32_t uid, unsigned int timeout,
425 char **sid, enum sss_id_type *type);
426
439int sss_nss_getsidbygid_timeout(uint32_t gid, unsigned int timeout,
440 char **sid, enum sss_id_type *type);
441
442
455int sss_nss_getnamebysid_timeout(const char *sid, unsigned int timeout,
456 char **fq_name, enum sss_id_type *type);
457
469int sss_nss_getidbysid_timeout(const char *sid, unsigned int timeout,
470 uint32_t *id, enum sss_id_type *id_type);
471
493int sss_nss_getorigbyname_timeout(const char *fq_name, unsigned int timeout,
494 struct sss_nss_kv **kv_list,
495 enum sss_id_type *type);
496
518int sss_nss_getorigbyusername_timeout(const char *fq_name, unsigned int timeout,
519 struct sss_nss_kv **kv_list,
520 enum sss_id_type *type);
521
543int sss_nss_getorigbygroupname_timeout(const char *fq_name, unsigned int timeout,
544 struct sss_nss_kv **kv_list,
545 enum sss_id_type *type);
546
560int sss_nss_getnamebycert_timeout(const char *cert, unsigned int timeout,
561 char **fq_name, enum sss_id_type *type);
562
576int sss_nss_getlistbycert_timeout(const char *cert, unsigned int timeout,
577 char ***fq_name, enum sss_id_type **type);
578
579#endif /* IPA_389DS_PLUGIN_HELPER_CALLS */
580#endif /* SSS_NSS_IDMAP_H_ */