sss_certmap
src/lib/certmap/sss_certmap.h
00001 /*
00002     SSSD
00003 
00004     Library for rule based certificate to user mapping
00005 
00006     Authors:
00007         Sumit Bose <sbose@redhat.com>
00008 
00009     Copyright (C) 2017 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_CERTMAP_H_
00026 #define _SSS_CERTMAP_H_
00027 
00028 #include <stdlib.h>
00029 #include <stdint.h>
00030 #include <talloc.h>
00031 
00042 struct sss_certmap_ctx;
00043 
00047 #define SSS_CERTMAP_MIN_PRIO UINT32_MAX
00048 
00052 typedef void (sss_certmap_ext_debug)(void *pvt,
00053                                      const char *file, long line,
00054                                      const char *function,
00055                                      const char *format, ...);
00069 int sss_certmap_init(TALLOC_CTX *mem_ctx,
00070                      sss_certmap_ext_debug *debug, void *debug_priv,
00071                      struct sss_certmap_ctx **ctx);
00072 
00079 void sss_certmap_free_ctx(struct sss_certmap_ctx *ctx);
00080 
00097 int sss_certmap_add_rule(struct sss_certmap_ctx *ctx,
00098                          uint32_t priority, const char *match_rule,
00099                          const char *map_rule, const char **domains);
00100 
00114 int sss_certmap_match_cert(struct sss_certmap_ctx *ctx,
00115                            const uint8_t *der_cert, size_t der_size);
00116 
00135 int sss_certmap_get_search_filter(struct sss_certmap_ctx *ctx,
00136                                   const uint8_t *der_cert, size_t der_size,
00137                                   char **filter, char ***domains);
00138 
00147 void sss_certmap_free_filter_and_domains(char *filter, char **domains);
00148 
00152 #endif /* _SSS_CERTMAP_H_ */