sss_nss_idmap  1.16.4
src/sss_client/idmap/sss_nss_idmap.h
00001 /*
00002     SSSD
00003 
00004     NSS  Responder ID-mapping interface
00005 
00006     Authors:
00007         Sumit Bose <sbose@redhat.com>
00008 
00009     Copyright (C) 2013 Red Hat
00010 
00011     This program is free software; you can redistribute it and/or modify
00012     it under the terms of the GNU General Public License as published by
00013     the Free Software Foundation; either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     This program is distributed in the hope that it will be useful,
00017     but WITHOUT ANY WARRANTY; without even the implied warranty of
00018     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019     GNU General Public License for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00023 */
00024 
00025 #ifndef SSS_NSS_IDMAP_H_
00026 #define SSS_NSS_IDMAP_H_
00027 
00028 #include <stdint.h>
00029 #include <sys/types.h>
00030 #include <pwd.h>
00031 #include <grp.h>
00032 
00036 enum sss_id_type {
00037     SSS_ID_TYPE_NOT_SPECIFIED = 0,
00038     SSS_ID_TYPE_UID,
00039     SSS_ID_TYPE_GID,
00040     SSS_ID_TYPE_BOTH /* used for user or magic private groups */
00041 };
00042 
00043 struct sss_nss_kv {
00044     char *key;
00045     char *value;
00046 };
00047 
00065 int sss_nss_getsidbyname(const char *fq_name, char **sid,
00066                          enum sss_id_type *type);
00067 
00079 int sss_nss_getsidbyid(uint32_t id, char **sid, enum sss_id_type *type);
00080 
00092 int sss_nss_getsidbyuid(uint32_t uid, char **sid, enum sss_id_type *type);
00093 
00105 int sss_nss_getsidbygid(uint32_t id, char **sid, enum sss_id_type *type);
00106 
00118 int sss_nss_getnamebysid(const char *sid, char **fq_name,
00119                          enum sss_id_type *type);
00120 
00131 int sss_nss_getidbysid(const char *sid, uint32_t *id,
00132                        enum sss_id_type *id_type);
00133 
00152 int sss_nss_getorigbyname(const char *fq_name, struct sss_nss_kv **kv_list,
00153                           enum sss_id_type *type);
00154 
00167 int sss_nss_getnamebycert(const char *cert, char **fq_name,
00168                           enum sss_id_type *type);
00169 
00182 int sss_nss_getlistbycert(const char *cert, char ***fq_name,
00183                           enum sss_id_type **type);
00184 
00190 void sss_nss_free_kv(struct sss_nss_kv *kv_list);
00191 
00196 #define SSS_NSS_EX_FLAG_NO_FLAGS 0
00197 
00201 #define SSS_NSS_EX_FLAG_NO_CACHE (1 << 0)
00202 
00206 #define SSS_NSS_EX_FLAG_INVALIDATE_CACHE (1 << 1)
00207 
00208 #ifdef IPA_389DS_PLUGIN_HELPER_CALLS
00209 
00229 int sss_nss_getpwnam_timeout(const char *name, struct passwd *pwd,
00230                              char *buffer, size_t buflen,
00231                              struct passwd **result,
00232                              uint32_t flags, unsigned int timeout);
00233 
00253 int sss_nss_getpwuid_timeout(uid_t uid, struct passwd *pwd,
00254                              char *buffer, size_t buflen,
00255                              struct passwd **result,
00256                              uint32_t flags, unsigned int timeout);
00257 
00277 int sss_nss_getgrnam_timeout(const char *name, struct group *grp,
00278                              char *buffer, size_t buflen, struct group **result,
00279                              uint32_t flags, unsigned int timeout);
00280 
00300 int sss_nss_getgrgid_timeout(gid_t gid, struct group *grp,
00301                              char *buffer, size_t buflen, struct group **result,
00302                              uint32_t flags, unsigned int timeout);
00303 
00329 int sss_nss_getgrouplist_timeout(const char *name, gid_t group,
00330                                  gid_t *groups, int *ngroups,
00331                                  uint32_t flags, unsigned int timeout);
00352 int sss_nss_getsidbyname_timeout(const char *fq_name, unsigned int timeout,
00353                                  char **sid, enum sss_id_type *type);
00354 
00367 int sss_nss_getsidbyid_timeout(uint32_t id, unsigned int timeout,
00368                                char **sid, enum sss_id_type *type);
00381 int sss_nss_getsidbyuid_timeout(uint32_t uid, unsigned int timeout,
00382                                 char **sid, enum sss_id_type *type);
00383 
00396 int sss_nss_getsidbygid_timeout(uint32_t gid, unsigned int timeout,
00397                                 char **sid, enum sss_id_type *type);
00398 
00399 
00412 int sss_nss_getnamebysid_timeout(const char *sid, unsigned int timeout,
00413                                  char **fq_name, enum sss_id_type *type);
00414 
00426 int sss_nss_getidbysid_timeout(const char *sid, unsigned int timeout,
00427                                uint32_t *id, enum sss_id_type *id_type);
00428 
00450 int sss_nss_getorigbyname_timeout(const char *fq_name, unsigned int timeout,
00451                                   struct sss_nss_kv **kv_list,
00452                                   enum sss_id_type *type);
00453 
00467 int sss_nss_getnamebycert_timeout(const char *cert, unsigned int timeout,
00468                                   char **fq_name, enum sss_id_type *type);
00469 
00483 int sss_nss_getlistbycert_timeout(const char *cert, unsigned int timeout,
00484                                   char ***fq_name, enum sss_id_type **type);
00485 
00486 #endif /* IPA_389DS_PLUGIN_HELPER_CALLS */
00487 #endif /* SSS_NSS_IDMAP_H_ */