sss_certmap
 All Functions Typedefs Groups
sss_certmap.h
1 /*
2  SSSD
3 
4  Library for rule based certificate to user mapping
5 
6  Authors:
7  Sumit Bose <sbose@redhat.com>
8 
9  Copyright (C) 2017 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_CERTMAP_H_
26 #define _SSS_CERTMAP_H_
27 
28 #include <stdlib.h>
29 #include <stdint.h>
30 #include <talloc.h>
31 
42 struct sss_certmap_ctx;
43 
47 #define SSS_CERTMAP_MIN_PRIO UINT32_MAX
48 
52 typedef void (sss_certmap_ext_debug)(void *pvt,
53  const char *file, long line,
54  const char *function,
55  const char *format, ...);
69 int sss_certmap_init(TALLOC_CTX *mem_ctx,
70  sss_certmap_ext_debug *debug, void *debug_priv,
71  struct sss_certmap_ctx **ctx);
72 
79 void sss_certmap_free_ctx(struct sss_certmap_ctx *ctx);
80 
97 int sss_certmap_add_rule(struct sss_certmap_ctx *ctx,
98  uint32_t priority, const char *match_rule,
99  const char *map_rule, const char **domains);
100 
114 int sss_certmap_match_cert(struct sss_certmap_ctx *ctx,
115  const uint8_t *der_cert, size_t der_size);
116 
136 int sss_certmap_get_search_filter(struct sss_certmap_ctx *ctx,
137  const uint8_t *der_cert, size_t der_size,
138  char **filter, char ***domains);
139 
160 int sss_certmap_expand_mapping_rule(struct sss_certmap_ctx *ctx,
161  const uint8_t *der_cert, size_t der_size,
162  char **_expanded, char ***_domains);
172 void sss_certmap_free_filter_and_domains(char *filter, char **domains);
173 
188 int sss_certmap_display_cert_content(TALLOC_CTX *mem_cxt,
189  const uint8_t *der_cert, size_t der_size,
190  char **desc);
191 
195 #endif /* _SSS_CERTMAP_H_ */
int sss_certmap_add_rule(struct sss_certmap_ctx *ctx, uint32_t priority, const char *match_rule, const char *map_rule, const char **domains)
Add a rule to the certmap context.
int sss_certmap_display_cert_content(TALLOC_CTX *mem_cxt, const uint8_t *der_cert, size_t der_size, char **desc)
Get a string with the content of the certificate used by the library.
int sss_certmap_expand_mapping_rule(struct sss_certmap_ctx *ctx, const uint8_t *der_cert, size_t der_size, char **_expanded, char ***_domains)
Expand the mapping rule by replacing the templates.
int sss_certmap_init(TALLOC_CTX *mem_ctx, sss_certmap_ext_debug *debug, void *debug_priv, struct sss_certmap_ctx **ctx)
Initialize certmap context.
int sss_certmap_get_search_filter(struct sss_certmap_ctx *ctx, const uint8_t *der_cert, size_t der_size, char **filter, char ***domains)
Get the LDAP filter string for a certificate.
void sss_certmap_free_ctx(struct sss_certmap_ctx *ctx)
Free certmap context.
void sss_certmap_free_filter_and_domains(char *filter, char **domains)
Free data returned by sss_certmap_get_search_filter and sss_certmap_expand_mapping_rule.
void( sss_certmap_ext_debug)(void *pvt, const char *file, long line, const char *function, const char *format,...)
Definition: sss_certmap.h:52
int sss_certmap_match_cert(struct sss_certmap_ctx *ctx, const uint8_t *der_cert, size_t der_size)
Check if a certificate matches any of the applied rules.