sss_nss_idmap  2.11.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 
36 enum 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 
43 struct sss_nss_kv {
44  char *key;
45  char *value;
46 };
47 
65 int sss_nss_getsidbyname(const char *fq_name, char **sid,
66  enum sss_id_type *type);
67 
79 int sss_nss_getsidbyusername(const char *fq_name,
80  char **sid,
81  enum sss_id_type *type);
82 
94 int sss_nss_getsidbygroupname(const char *fq_name,
95  char **sid,
96  enum sss_id_type *type);
97 
109 int sss_nss_getsidbyid(uint32_t id, char **sid, enum sss_id_type *type);
110 
122 int sss_nss_getsidbyuid(uint32_t uid, char **sid, enum sss_id_type *type);
123 
135 int sss_nss_getsidbygid(uint32_t id, char **sid, enum sss_id_type *type);
136 
148 int sss_nss_getnamebysid(const char *sid, char **fq_name,
149  enum sss_id_type *type);
150 
161 int sss_nss_getidbysid(const char *sid, uint32_t *id,
162  enum sss_id_type *id_type);
163 
182 int sss_nss_getorigbyname(const char *fq_name, struct sss_nss_kv **kv_list,
183  enum sss_id_type *type);
184 
203 int sss_nss_getorigbyusername(const char *fq_name, struct sss_nss_kv **kv_list,
204  enum sss_id_type *type);
205 
224 int sss_nss_getorigbygroupname(const char *fq_name, struct sss_nss_kv **kv_list,
225  enum sss_id_type *type);
226 
239 int sss_nss_getnamebycert(const char *cert, char **fq_name,
240  enum sss_id_type *type);
241 
254 int sss_nss_getlistbycert(const char *cert, char ***fq_name,
255  enum sss_id_type **type);
256 
263 void sss_nss_free_kv(struct sss_nss_kv *kv_list);
264 
269 #define SSS_NSS_EX_FLAG_NO_FLAGS 0
270 
274 #define SSS_NSS_EX_FLAG_NO_CACHE (1 << 0)
275 
279 #define SSS_NSS_EX_FLAG_INVALIDATE_CACHE (1 << 1)
280 
281 #ifdef IPA_389DS_PLUGIN_HELPER_CALLS
282 
301 int sss_nss_getpwnam_timeout(const char *name, struct passwd *pwd,
302  char *buffer, size_t buflen,
303  struct passwd **result,
304  uint32_t flags, unsigned int timeout);
305 
324 int sss_nss_getpwuid_timeout(uid_t uid, struct passwd *pwd,
325  char *buffer, size_t buflen,
326  struct passwd **result,
327  uint32_t flags, unsigned int timeout);
328 
347 int sss_nss_getgrnam_timeout(const char *name, struct group *grp,
348  char *buffer, size_t buflen, struct group **result,
349  uint32_t flags, unsigned int timeout);
350 
369 int sss_nss_getgrgid_timeout(gid_t gid, struct group *grp,
370  char *buffer, size_t buflen, struct group **result,
371  uint32_t flags, unsigned int timeout);
372 
397 int sss_nss_getgrouplist_timeout(const char *name, gid_t group,
398  gid_t *groups, int *ngroups,
399  uint32_t flags, unsigned int timeout);
419 int sss_nss_getsidbyname_timeout(const char *fq_name, unsigned int timeout,
420  char **sid, enum sss_id_type *type);
421 
434 int sss_nss_getsidbyusername_timeout(const char *fq_name,
435  unsigned int timeout,
436  char **sid,
437  enum sss_id_type *type);
438 
451 int sss_nss_getsidbygroupname_timeout(const char *fq_name,
452  unsigned int timeout,
453  char **sid,
454  enum sss_id_type *type);
455 
468 int sss_nss_getsidbyid_timeout(uint32_t id, unsigned int timeout,
469  char **sid, enum sss_id_type *type);
482 int sss_nss_getsidbyuid_timeout(uint32_t uid, unsigned int timeout,
483  char **sid, enum sss_id_type *type);
484 
497 int sss_nss_getsidbygid_timeout(uint32_t gid, unsigned int timeout,
498  char **sid, enum sss_id_type *type);
499 
500 
513 int sss_nss_getnamebysid_timeout(const char *sid, unsigned int timeout,
514  char **fq_name, enum sss_id_type *type);
515 
527 int sss_nss_getidbysid_timeout(const char *sid, unsigned int timeout,
528  uint32_t *id, enum sss_id_type *id_type);
529 
550 int sss_nss_getorigbyname_timeout(const char *fq_name, unsigned int timeout,
551  struct sss_nss_kv **kv_list,
552  enum sss_id_type *type);
553 
574 int sss_nss_getorigbyusername_timeout(const char *fq_name, unsigned int timeout,
575  struct sss_nss_kv **kv_list,
576  enum sss_id_type *type);
577 
598 int sss_nss_getorigbygroupname_timeout(const char *fq_name, unsigned int timeout,
599  struct sss_nss_kv **kv_list,
600  enum sss_id_type *type);
601 
615 int sss_nss_getnamebycert_timeout(const char *cert, unsigned int timeout,
616  char **fq_name, enum sss_id_type *type);
617 
631 int sss_nss_getlistbycert_timeout(const char *cert, unsigned int timeout,
632  char ***fq_name, enum sss_id_type **type);
633 
634 #endif /* IPA_389DS_PLUGIN_HELPER_CALLS */
635 #endif /* SSS_NSS_IDMAP_H_ */