xref: /minix3/crypto/external/bsd/heimdal/dist/lib/kadm5/common_glue.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /*	$NetBSD: common_glue.c,v 1.1.1.2 2014/04/24 12:45:48 pettai Exp $	*/
2ebfedea0SLionel Sambuc 
3ebfedea0SLionel Sambuc /*
4ebfedea0SLionel Sambuc  * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan
5ebfedea0SLionel Sambuc  * (Royal Institute of Technology, Stockholm, Sweden).
6ebfedea0SLionel Sambuc  * All rights reserved.
7ebfedea0SLionel Sambuc  *
8ebfedea0SLionel Sambuc  * Redistribution and use in source and binary forms, with or without
9ebfedea0SLionel Sambuc  * modification, are permitted provided that the following conditions
10ebfedea0SLionel Sambuc  * are met:
11ebfedea0SLionel Sambuc  *
12ebfedea0SLionel Sambuc  * 1. Redistributions of source code must retain the above copyright
13ebfedea0SLionel Sambuc  *    notice, this list of conditions and the following disclaimer.
14ebfedea0SLionel Sambuc  *
15ebfedea0SLionel Sambuc  * 2. Redistributions in binary form must reproduce the above copyright
16ebfedea0SLionel Sambuc  *    notice, this list of conditions and the following disclaimer in the
17ebfedea0SLionel Sambuc  *    documentation and/or other materials provided with the distribution.
18ebfedea0SLionel Sambuc  *
19ebfedea0SLionel Sambuc  * 3. Neither the name of the Institute nor the names of its contributors
20ebfedea0SLionel Sambuc  *    may be used to endorse or promote products derived from this software
21ebfedea0SLionel Sambuc  *    without specific prior written permission.
22ebfedea0SLionel Sambuc  *
23ebfedea0SLionel Sambuc  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
24ebfedea0SLionel Sambuc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25ebfedea0SLionel Sambuc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26ebfedea0SLionel Sambuc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
27ebfedea0SLionel Sambuc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28ebfedea0SLionel Sambuc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29ebfedea0SLionel Sambuc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30ebfedea0SLionel Sambuc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31ebfedea0SLionel Sambuc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32ebfedea0SLionel Sambuc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33ebfedea0SLionel Sambuc  * SUCH DAMAGE.
34ebfedea0SLionel Sambuc  */
35ebfedea0SLionel Sambuc 
36ebfedea0SLionel Sambuc #include "kadm5_locl.h"
37ebfedea0SLionel Sambuc 
38*0a6a1f1dSLionel Sambuc __RCSID("NetBSD");
39ebfedea0SLionel Sambuc 
40ebfedea0SLionel Sambuc #define __CALL(F, P) (*((kadm5_common_context*)server_handle)->funcs.F)P;
41ebfedea0SLionel Sambuc 
42ebfedea0SLionel Sambuc kadm5_ret_t
kadm5_chpass_principal(void * server_handle,krb5_principal princ,const char * password)43ebfedea0SLionel Sambuc kadm5_chpass_principal(void *server_handle,
44ebfedea0SLionel Sambuc 		       krb5_principal princ,
45ebfedea0SLionel Sambuc 		       const char *password)
46ebfedea0SLionel Sambuc {
47ebfedea0SLionel Sambuc     return __CALL(chpass_principal, (server_handle, princ, password));
48ebfedea0SLionel Sambuc }
49ebfedea0SLionel Sambuc 
50ebfedea0SLionel Sambuc kadm5_ret_t
kadm5_chpass_principal_with_key(void * server_handle,krb5_principal princ,int n_key_data,krb5_key_data * key_data)51ebfedea0SLionel Sambuc kadm5_chpass_principal_with_key(void *server_handle,
52ebfedea0SLionel Sambuc 				krb5_principal princ,
53ebfedea0SLionel Sambuc 				int n_key_data,
54ebfedea0SLionel Sambuc 				krb5_key_data *key_data)
55ebfedea0SLionel Sambuc {
56ebfedea0SLionel Sambuc     return __CALL(chpass_principal_with_key,
57ebfedea0SLionel Sambuc 		  (server_handle, princ, n_key_data, key_data));
58ebfedea0SLionel Sambuc }
59ebfedea0SLionel Sambuc 
60ebfedea0SLionel Sambuc kadm5_ret_t
kadm5_create_principal(void * server_handle,kadm5_principal_ent_t princ,uint32_t mask,const char * password)61ebfedea0SLionel Sambuc kadm5_create_principal(void *server_handle,
62ebfedea0SLionel Sambuc 		       kadm5_principal_ent_t princ,
63ebfedea0SLionel Sambuc 		       uint32_t mask,
64ebfedea0SLionel Sambuc 		       const char *password)
65ebfedea0SLionel Sambuc {
66ebfedea0SLionel Sambuc     return __CALL(create_principal, (server_handle, princ, mask, password));
67ebfedea0SLionel Sambuc }
68ebfedea0SLionel Sambuc 
69ebfedea0SLionel Sambuc kadm5_ret_t
kadm5_delete_principal(void * server_handle,krb5_principal princ)70ebfedea0SLionel Sambuc kadm5_delete_principal(void *server_handle,
71ebfedea0SLionel Sambuc 		       krb5_principal princ)
72ebfedea0SLionel Sambuc {
73ebfedea0SLionel Sambuc     return __CALL(delete_principal, (server_handle, princ));
74ebfedea0SLionel Sambuc }
75ebfedea0SLionel Sambuc 
76ebfedea0SLionel Sambuc kadm5_ret_t
kadm5_destroy(void * server_handle)77ebfedea0SLionel Sambuc kadm5_destroy (void *server_handle)
78ebfedea0SLionel Sambuc {
79ebfedea0SLionel Sambuc     return __CALL(destroy, (server_handle));
80ebfedea0SLionel Sambuc }
81ebfedea0SLionel Sambuc 
82ebfedea0SLionel Sambuc kadm5_ret_t
kadm5_flush(void * server_handle)83ebfedea0SLionel Sambuc kadm5_flush (void *server_handle)
84ebfedea0SLionel Sambuc {
85ebfedea0SLionel Sambuc     return __CALL(flush, (server_handle));
86ebfedea0SLionel Sambuc }
87ebfedea0SLionel Sambuc 
88ebfedea0SLionel Sambuc kadm5_ret_t
kadm5_get_principal(void * server_handle,krb5_principal princ,kadm5_principal_ent_t out,uint32_t mask)89ebfedea0SLionel Sambuc kadm5_get_principal(void *server_handle,
90ebfedea0SLionel Sambuc 		    krb5_principal princ,
91ebfedea0SLionel Sambuc 		    kadm5_principal_ent_t out,
92ebfedea0SLionel Sambuc 		    uint32_t mask)
93ebfedea0SLionel Sambuc {
94ebfedea0SLionel Sambuc     return __CALL(get_principal, (server_handle, princ, out, mask));
95ebfedea0SLionel Sambuc }
96ebfedea0SLionel Sambuc 
97ebfedea0SLionel Sambuc kadm5_ret_t
kadm5_modify_principal(void * server_handle,kadm5_principal_ent_t princ,uint32_t mask)98ebfedea0SLionel Sambuc kadm5_modify_principal(void *server_handle,
99ebfedea0SLionel Sambuc 		       kadm5_principal_ent_t princ,
100ebfedea0SLionel Sambuc 		       uint32_t mask)
101ebfedea0SLionel Sambuc {
102ebfedea0SLionel Sambuc     return __CALL(modify_principal, (server_handle, princ, mask));
103ebfedea0SLionel Sambuc }
104ebfedea0SLionel Sambuc 
105ebfedea0SLionel Sambuc kadm5_ret_t
kadm5_randkey_principal(void * server_handle,krb5_principal princ,krb5_keyblock ** new_keys,int * n_keys)106ebfedea0SLionel Sambuc kadm5_randkey_principal(void *server_handle,
107ebfedea0SLionel Sambuc 			krb5_principal princ,
108ebfedea0SLionel Sambuc 			krb5_keyblock **new_keys,
109ebfedea0SLionel Sambuc 			int *n_keys)
110ebfedea0SLionel Sambuc {
111ebfedea0SLionel Sambuc     return __CALL(randkey_principal, (server_handle, princ, new_keys, n_keys));
112ebfedea0SLionel Sambuc }
113ebfedea0SLionel Sambuc 
114ebfedea0SLionel Sambuc kadm5_ret_t
kadm5_rename_principal(void * server_handle,krb5_principal source,krb5_principal target)115ebfedea0SLionel Sambuc kadm5_rename_principal(void *server_handle,
116ebfedea0SLionel Sambuc 		       krb5_principal source,
117ebfedea0SLionel Sambuc 		       krb5_principal target)
118ebfedea0SLionel Sambuc {
119ebfedea0SLionel Sambuc     return __CALL(rename_principal, (server_handle, source, target));
120ebfedea0SLionel Sambuc }
121ebfedea0SLionel Sambuc 
122ebfedea0SLionel Sambuc kadm5_ret_t
kadm5_get_principals(void * server_handle,const char * expression,char *** princs,int * count)123ebfedea0SLionel Sambuc kadm5_get_principals(void *server_handle,
124ebfedea0SLionel Sambuc 		     const char *expression,
125ebfedea0SLionel Sambuc 		     char ***princs,
126ebfedea0SLionel Sambuc 		     int *count)
127ebfedea0SLionel Sambuc {
128ebfedea0SLionel Sambuc     return __CALL(get_principals, (server_handle, expression, princs, count));
129ebfedea0SLionel Sambuc }
130ebfedea0SLionel Sambuc 
131ebfedea0SLionel Sambuc kadm5_ret_t
kadm5_get_privs(void * server_handle,uint32_t * privs)132ebfedea0SLionel Sambuc kadm5_get_privs(void *server_handle,
133ebfedea0SLionel Sambuc 		uint32_t *privs)
134ebfedea0SLionel Sambuc {
135ebfedea0SLionel Sambuc     return __CALL(get_privs, (server_handle, privs));
136ebfedea0SLionel Sambuc }
137