2 * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the Institute nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 #include "kadm5_locl.h"
40 kadm5_s_init_with_context(krb5_context context
,
41 const char *client_name
,
42 const char *service_name
,
43 kadm5_config_params
*realm_params
,
44 unsigned long struct_version
,
45 unsigned long api_version
,
49 kadm5_server_context
*ctx
;
50 ret
= _kadm5_s_init_context(&ctx
, realm_params
, context
);
54 assert(ctx
->config
.dbname
!= NULL
);
55 assert(ctx
->config
.stash_file
!= NULL
);
56 assert(ctx
->config
.acl_file
!= NULL
);
57 assert(ctx
->log_context
.log_file
!= NULL
);
58 assert(ctx
->log_context
.socket_name
.sun_path
[0] != '\0');
60 ret
= hdb_create(ctx
->context
, &ctx
->db
, ctx
->config
.dbname
);
63 ret
= hdb_set_master_keyfile (ctx
->context
,
64 ctx
->db
, ctx
->config
.stash_file
);
68 ctx
->log_context
.log_fd
= -1;
70 ctx
->log_context
.socket_fd
= socket (AF_UNIX
, SOCK_DGRAM
, 0);
72 ret
= krb5_parse_name(ctx
->context
, client_name
, &ctx
->caller
);
76 ret
= _kadm5_acl_init(ctx
);
85 kadm5_s_init_with_password_ctx(krb5_context context
,
86 const char *client_name
,
88 const char *service_name
,
89 kadm5_config_params
*realm_params
,
90 unsigned long struct_version
,
91 unsigned long api_version
,
94 return kadm5_s_init_with_context(context
,
104 kadm5_s_init_with_password(const char *client_name
,
105 const char *password
,
106 const char *service_name
,
107 kadm5_config_params
*realm_params
,
108 unsigned long struct_version
,
109 unsigned long api_version
,
110 void **server_handle
)
112 krb5_context context
;
114 kadm5_server_context
*ctx
;
116 ret
= krb5_init_context(&context
);
119 ret
= kadm5_s_init_with_password_ctx(context
,
128 krb5_free_context(context
);
131 ctx
= *server_handle
;
137 kadm5_s_init_with_skey_ctx(krb5_context context
,
138 const char *client_name
,
140 const char *service_name
,
141 kadm5_config_params
*realm_params
,
142 unsigned long struct_version
,
143 unsigned long api_version
,
144 void **server_handle
)
146 return kadm5_s_init_with_context(context
,
156 kadm5_s_init_with_skey(const char *client_name
,
158 const char *service_name
,
159 kadm5_config_params
*realm_params
,
160 unsigned long struct_version
,
161 unsigned long api_version
,
162 void **server_handle
)
164 krb5_context context
;
166 kadm5_server_context
*ctx
;
168 ret
= krb5_init_context(&context
);
171 ret
= kadm5_s_init_with_skey_ctx(context
,
180 krb5_free_context(context
);
183 ctx
= *server_handle
;
189 kadm5_s_init_with_creds_ctx(krb5_context context
,
190 const char *client_name
,
192 const char *service_name
,
193 kadm5_config_params
*realm_params
,
194 unsigned long struct_version
,
195 unsigned long api_version
,
196 void **server_handle
)
198 return kadm5_s_init_with_context(context
,
208 kadm5_s_init_with_creds(const char *client_name
,
210 const char *service_name
,
211 kadm5_config_params
*realm_params
,
212 unsigned long struct_version
,
213 unsigned long api_version
,
214 void **server_handle
)
216 krb5_context context
;
218 kadm5_server_context
*ctx
;
220 ret
= krb5_init_context(&context
);
223 ret
= kadm5_s_init_with_creds_ctx(context
,
232 krb5_free_context(context
);
235 ctx
= *server_handle
;