2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
5 #ifndef __KADM5_ADMIN_H__
6 #define __KADM5_ADMIN_H__
14 * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
16 * Openvision retains the copyright to derivative works of
17 * this source code. Do *NOT* create a derivative of this
18 * source code before consulting with your legal department.
19 * Do *NOT* integrate *ANY* of this source code into another
20 * product before consulting with your legal department.
22 * For further information, read the top-level Openvision
23 * copyright which is contained in the top-level MIT Kerberos
26 * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
32 * Copyright 2001 by the Massachusetts Institute of Technology.
33 * All Rights Reserved.
35 * Export of this software from the United States of America may
36 * require a specific license from the United States Government.
37 * It is the responsibility of any person or organization contemplating
38 * export to obtain such a license before exporting.
40 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
41 * distribute this software and its documentation for any purpose and
42 * without fee is hereby granted, provided that the above copyright
43 * notice appear in all copies and that both that copyright notice and
44 * this permission notice appear in supporting documentation, and that
45 * the name of M.I.T. not be used in advertising or publicity pertaining
46 * to distribution of the software without specific, written prior
47 * permission. Furthermore if you modify this software you must label
48 * your software as modified software and not distribute it in such a
49 * fashion that it might be confused with the original M.I.T. software.
50 * M.I.T. makes no representations about the suitability of
51 * this software for any purpose. It is provided "as is" without express
52 * or implied warranty.
56 * Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved
61 #include <sys/types.h>
62 #include <rpc/types.h>
68 #include <kadm5/kadm_err.h>
69 #include <kadm5/chpass_util_strings.h>
71 #define KADM5_ADMIN_SERVICE_P "kadmin@admin"
74 * The kadmin/admin principal is unused on Solaris. This principal is used
75 * in AUTH_GSSAPI but Solaris doesn't support AUTH_GSSAPI. RPCSEC_GSS can only
76 * be used with host-based principals.
79 /* #define KADM5_ADMIN_SERVICE "kadmin/admin" */
80 #define KADM5_CHANGEPW_SERVICE_P "kadmin@changepw"
81 #define KADM5_CHANGEPW_SERVICE "kadmin/changepw"
82 #define KADM5_HIST_PRINCIPAL "kadmin/history"
83 #define KADM5_ADMIN_HOST_SERVICE "kadmin"
84 #define KADM5_CHANGEPW_HOST_SERVICE "changepw"
85 #define KADM5_KIPROP_HOST_SERVICE "kiprop"
87 typedef krb5_principal kadm5_princ_t
;
88 typedef char *kadm5_policy_t
;
89 typedef long kadm5_ret_t
;
90 typedef int rpc_int32
;
91 typedef unsigned int rpc_u_int32
;
93 #define KADM5_PW_FIRST_PROMPT \
94 (error_message(CHPASS_UTIL_NEW_PASSWORD_PROMPT))
95 #define KADM5_PW_SECOND_PROMPT \
96 (error_message(CHPASS_UTIL_NEW_PASSWORD_AGAIN_PROMPT))
99 * Successful return code
107 /* kadm5_principal_ent_t */
108 #define KADM5_PRINCIPAL 0x000001
109 #define KADM5_PRINC_EXPIRE_TIME 0x000002
110 #define KADM5_PW_EXPIRATION 0x000004
111 #define KADM5_LAST_PWD_CHANGE 0x000008
112 #define KADM5_ATTRIBUTES 0x000010
113 #define KADM5_MAX_LIFE 0x000020
114 #define KADM5_MOD_TIME 0x000040
115 #define KADM5_MOD_NAME 0x000080
116 #define KADM5_KVNO 0x000100
117 #define KADM5_MKVNO 0x000200
118 #define KADM5_AUX_ATTRIBUTES 0x000400
119 #define KADM5_POLICY 0x000800
120 #define KADM5_POLICY_CLR 0x001000
121 /* version 2 masks */
122 #define KADM5_MAX_RLIFE 0x002000
123 #define KADM5_LAST_SUCCESS 0x004000
124 #define KADM5_LAST_FAILED 0x008000
125 #define KADM5_FAIL_AUTH_COUNT 0x010000
126 #define KADM5_KEY_DATA 0x020000
127 #define KADM5_TL_DATA 0x040000
128 #ifdef notyet /* Novell */
129 #define KADM5_CPW_FUNCTION 0x080000
130 #define KADM5_RANDKEY_USED 0x100000
132 #define KADM5_LOAD 0x200000
133 /* Solaris Kerberos: adding support for key history in LDAP KDB */
134 #define KADM5_KEY_HIST 0x400000
136 /* all but KEY_DATA and TL_DATA */
137 #define KADM5_PRINCIPAL_NORMAL_MASK 0x01ffff
140 /* kadm5_policy_ent_t */
141 #define KADM5_PW_MAX_LIFE 0x004000
142 #define KADM5_PW_MIN_LIFE 0x008000
143 #define KADM5_PW_MIN_LENGTH 0x010000
144 #define KADM5_PW_MIN_CLASSES 0x020000
145 #define KADM5_PW_HISTORY_NUM 0x040000
146 #define KADM5_REF_COUNT 0x080000
148 /* kadm5_config_params */
149 #define KADM5_CONFIG_REALM 0x0000001
150 #define KADM5_CONFIG_DBNAME 0x0000002
151 #define KADM5_CONFIG_MKEY_NAME 0x0000004
152 #define KADM5_CONFIG_MAX_LIFE 0x0000008
153 #define KADM5_CONFIG_MAX_RLIFE 0x0000010
154 #define KADM5_CONFIG_EXPIRATION 0x0000020
155 #define KADM5_CONFIG_FLAGS 0x0000040
156 #define KADM5_CONFIG_ADMIN_KEYTAB 0x0000080
157 #define KADM5_CONFIG_STASH_FILE 0x0000100
158 #define KADM5_CONFIG_ENCTYPE 0x0000200
159 #define KADM5_CONFIG_ADBNAME 0x0000400
160 #define KADM5_CONFIG_ADB_LOCKFILE 0x0000800
161 #define KADM5_CONFIG_PROFILE 0x0001000
162 #define KADM5_CONFIG_ACL_FILE 0x0002000
163 #define KADM5_CONFIG_KADMIND_PORT 0x0004000
164 #define KADM5_CONFIG_ENCTYPES 0x0008000
165 #define KADM5_CONFIG_ADMIN_SERVER 0x0010000
166 #define KADM5_CONFIG_DICT_FILE 0x0020000
167 #define KADM5_CONFIG_MKEY_FROM_KBD 0x0040000
168 #define KADM5_CONFIG_KPASSWD_PORT 0x0080000
169 #define KADM5_CONFIG_KPASSWD_SERVER 0x0100000
170 #define KADM5_CONFIG_KPASSWD_PROTOCOL 0x0200000
171 #define KADM5_CONFIG_IPROP_ENABLED 0x0400000
172 #define KADM5_CONFIG_ULOG_SIZE 0x0800000
173 #define KADM5_CONFIG_POLL_TIME 0x1000000
175 /* password change constants */
176 #define KRB5_KPASSWD_SUCCESS 0
177 #define KRB5_KPASSWD_MALFORMED 1
178 #define KRB5_KPASSWD_HARDERROR 2
179 #define KRB5_KPASSWD_AUTHERROR 3
180 #define KRB5_KPASSWD_SOFTERROR 4
181 #define KRB5_KPASSWD_ACCESSDENIED 5
182 #define KRB5_KPASSWD_BAD_VERSION 6
183 #define KRB5_KPASSWD_INITIAL_FLAG_NEEDED 7
184 #define KRB5_KPASSWD_POLICY_REJECT 8
185 #define KRB5_KPASSWD_BAD_PRINCIPAL 9
186 #define KRB5_KPASSWD_ETYPE_NOSUPP 10
191 #define KADM5_PRIV_GET 0x01
192 #define KADM5_PRIV_ADD 0x02
193 #define KADM5_PRIV_MODIFY 0x04
194 #define KADM5_PRIV_DELETE 0x08
197 * API versioning constants
199 #define KADM5_MASK_BITS 0xffffff00
201 #define KADM5_STRUCT_VERSION_MASK 0x12345600
202 #define KADM5_STRUCT_VERSION_1 (KADM5_STRUCT_VERSION_MASK|0x01)
203 #define KADM5_STRUCT_VERSION KADM5_STRUCT_VERSION_1
205 #define KADM5_API_VERSION_MASK 0x12345700
206 #define KADM5_API_VERSION_1 (KADM5_API_VERSION_MASK|0x01)
207 #define KADM5_API_VERSION_2 (KADM5_API_VERSION_MASK|0x02)
209 #ifdef KRB5_DNS_LOOKUP
211 * Name length constants for DNS lookups
213 #define MAX_HOST_NAMELEN 256
214 #define MAX_DNS_NAMELEN (15*(MAX_HOST_NAMELEN + 1)+1)
215 #endif /* KRB5_DNS_LOOKUP */
217 typedef struct _kadm5_principal_ent_t_v2
{
218 krb5_principal principal
;
219 krb5_timestamp princ_expire_time
;
220 krb5_timestamp last_pwd_change
;
221 krb5_timestamp pw_expiration
;
222 krb5_deltat max_life
;
223 krb5_principal mod_name
;
224 krb5_timestamp mod_date
;
225 krb5_flags attributes
;
231 /* version 2 fields */
232 krb5_deltat max_renewable_life
;
233 krb5_timestamp last_success
;
234 krb5_timestamp last_failed
;
235 krb5_kvno fail_auth_count
;
236 krb5_int16 n_key_data
;
237 krb5_int16 n_tl_data
;
238 krb5_tl_data
*tl_data
;
239 krb5_key_data
*key_data
;
240 } kadm5_principal_ent_rec_v2
, *kadm5_principal_ent_t_v2
;
242 typedef struct _kadm5_principal_ent_t_v1
{
243 krb5_principal principal
;
244 krb5_timestamp princ_expire_time
;
245 krb5_timestamp last_pwd_change
;
246 krb5_timestamp pw_expiration
;
247 krb5_deltat max_life
;
248 krb5_principal mod_name
;
249 krb5_timestamp mod_date
;
250 krb5_flags attributes
;
255 } kadm5_principal_ent_rec_v1
, *kadm5_principal_ent_t_v1
;
257 #if USE_KADM5_API_VERSION == 1
258 typedef struct _kadm5_principal_ent_t_v1
259 kadm5_principal_ent_rec
, *kadm5_principal_ent_t
;
261 typedef struct _kadm5_principal_ent_t_v2
262 kadm5_principal_ent_rec
, *kadm5_principal_ent_t
;
265 typedef struct _kadm5_policy_ent_t
{
273 } kadm5_policy_ent_rec
, *kadm5_policy_ent_t
;
276 * New types to indicate which protocol to use when sending
277 * password change requests
281 KRB5_CHGPWD_CHANGEPW_V2
285 * Data structure returned by kadm5_get_config_params()
287 typedef struct _kadm5_config_params
{
294 #ifdef notyet /* Novell */ /* ABI change? */
295 char * kpasswd_server
;
300 char * admin_lockfile
;
308 krb5_enctype enctype
;
309 krb5_deltat max_life
;
310 krb5_deltat max_rlife
;
311 krb5_timestamp expiration
;
313 krb5_key_salt_tuple
*keysalts
;
314 krb5_int32 num_keysalts
;
315 char *kpasswd_server
;
317 krb5_chgpwd_prot kpasswd_protocol
;
318 bool_t iprop_enabled
;
320 char *iprop_polltime
;
321 } kadm5_config_params
;
323 /***********************************************************************
324 * This is the old krb5_realm_read_params, which I mutated into
325 * kadm5_get_config_params but which old code (kdb5_* and krb5kdc)
327 ***********************************************************************/
330 * Data structure returned by krb5_read_realm_params()
332 typedef struct __krb5_realm_params
{
333 char * realm_profile
;
335 char * realm_mkey_name
;
336 char * realm_stash_file
;
337 char * realm_kdc_ports
;
338 char * realm_kdc_tcp_ports
;
339 char * realm_acl_file
;
340 krb5_int32 realm_kadmind_port
;
341 krb5_enctype realm_enctype
;
342 krb5_deltat realm_max_life
;
343 krb5_deltat realm_max_rlife
;
344 krb5_timestamp realm_expiration
;
345 krb5_flags realm_flags
;
346 krb5_key_salt_tuple
*realm_keysalts
;
347 unsigned int realm_reject_bad_transit
:1;
348 unsigned int realm_kadmind_port_valid
:1;
349 unsigned int realm_enctype_valid
:1;
350 unsigned int realm_max_life_valid
:1;
351 unsigned int realm_max_rlife_valid
:1;
352 unsigned int realm_expiration_valid
:1;
353 unsigned int realm_flags_valid
:1;
354 unsigned int realm_reject_bad_transit_valid
:1;
355 krb5_int32 realm_num_keysalts
;
363 kadm5_get_adm_host_srv_name(krb5_context context
,
364 const char *realm
, char **host_service_name
);
367 kadm5_get_cpw_host_srv_name(krb5_context context
,
368 const char *realm
, char **host_service_name
);
370 #if USE_KADM5_API_VERSION > 1
371 krb5_error_code
kadm5_get_config_params(krb5_context context
,
373 kadm5_config_params
*params_in
,
374 kadm5_config_params
*params_out
);
376 krb5_error_code
kadm5_free_config_params(krb5_context context
,
377 kadm5_config_params
*params
);
379 krb5_error_code
kadm5_free_realm_params(krb5_context kcontext
,
380 kadm5_config_params
*params
);
382 krb5_error_code
kadm5_get_admin_service_name(krb5_context
, char *,
386 kadm5_ret_t
kadm5_init(char *client_name
, char *pass
,
388 #if USE_KADM5_API_VERSION == 1
391 kadm5_config_params
*params
,
393 krb5_ui_4 struct_version
,
394 krb5_ui_4 api_version
,
396 void **server_handle
);
397 kadm5_ret_t
kadm5_init_with_password(char *client_name
,
400 #if USE_KADM5_API_VERSION == 1
403 kadm5_config_params
*params
,
405 krb5_ui_4 struct_version
,
406 krb5_ui_4 api_version
,
408 void **server_handle
);
409 kadm5_ret_t
kadm5_init_with_skey(char *client_name
,
412 #if USE_KADM5_API_VERSION == 1
415 kadm5_config_params
*params
,
417 krb5_ui_4 struct_version
,
418 krb5_ui_4 api_version
,
420 void **server_handle
);
421 #if USE_KADM5_API_VERSION > 1
422 kadm5_ret_t
kadm5_init_with_creds(char *client_name
,
425 kadm5_config_params
*params
,
426 krb5_ui_4 struct_version
,
427 krb5_ui_4 api_version
,
429 void **server_handle
);
431 kadm5_ret_t
kadm5_lock(void *server_handle
);
432 kadm5_ret_t
kadm5_unlock(void *server_handle
);
433 kadm5_ret_t
kadm5_flush(void *server_handle
);
434 kadm5_ret_t
kadm5_destroy(void *server_handle
);
435 kadm5_ret_t
kadm5_check_min_life(void *server_handle
, /* Solaris Kerberos */
436 krb5_principal principal
,
438 unsigned int msg_len
);
439 kadm5_ret_t
kadm5_create_principal(void *server_handle
,
440 kadm5_principal_ent_t ent
,
441 long mask
, char *pass
);
442 kadm5_ret_t
kadm5_create_principal_3(void *server_handle
,
443 kadm5_principal_ent_t ent
,
446 krb5_key_salt_tuple
*ks_tuple
,
448 kadm5_ret_t
kadm5_delete_principal(void *server_handle
,
449 krb5_principal principal
);
450 kadm5_ret_t
kadm5_modify_principal(void *server_handle
,
451 kadm5_principal_ent_t ent
,
453 kadm5_ret_t
kadm5_rename_principal(void *server_handle
,
454 krb5_principal
,krb5_principal
);
455 #if USE_KADM5_API_VERSION == 1
456 kadm5_ret_t
kadm5_get_principal(void *server_handle
,
457 krb5_principal principal
,
458 kadm5_principal_ent_t
*ent
);
460 kadm5_ret_t
kadm5_get_principal(void *server_handle
,
461 krb5_principal principal
,
462 kadm5_principal_ent_t ent
,
465 kadm5_ret_t
kadm5_chpass_principal(void *server_handle
,
466 krb5_principal principal
,
468 kadm5_ret_t
kadm5_chpass_principal_3(void *server_handle
,
469 krb5_principal principal
,
470 krb5_boolean keepold
,
472 krb5_key_salt_tuple
*ks_tuple
,
474 #if USE_KADM5_API_VERSION == 1
475 kadm5_ret_t
kadm5_randkey_principal(void *server_handle
,
476 krb5_principal principal
,
477 krb5_keyblock
**keyblock
);
482 * this routine is only implemented in the client library.
484 kadm5_ret_t
kadm5_randkey_principal_old(void *server_handle
,
485 krb5_principal principal
,
486 krb5_keyblock
**keyblocks
,
489 kadm5_ret_t
kadm5_randkey_principal(void *server_handle
,
490 krb5_principal principal
,
491 krb5_keyblock
**keyblocks
,
493 kadm5_ret_t
kadm5_randkey_principal_3(void *server_handle
,
494 krb5_principal principal
,
495 krb5_boolean keepold
,
497 krb5_key_salt_tuple
*ks_tuple
,
498 krb5_keyblock
**keyblocks
,
501 kadm5_ret_t
kadm5_setv4key_principal(void *server_handle
,
502 krb5_principal principal
,
503 krb5_keyblock
*keyblock
);
505 kadm5_ret_t
kadm5_setkey_principal(void *server_handle
,
506 krb5_principal principal
,
507 krb5_keyblock
*keyblocks
,
510 kadm5_ret_t
kadm5_setkey_principal_3(void *server_handle
,
511 krb5_principal principal
,
512 krb5_boolean keepold
,
514 krb5_key_salt_tuple
*ks_tuple
,
515 krb5_keyblock
*keyblocks
,
518 kadm5_ret_t
kadm5_decrypt_key(void *server_handle
,
519 kadm5_principal_ent_t entry
, krb5_int32
520 ktype
, krb5_int32 stype
, krb5_int32
521 kvno
, krb5_keyblock
*keyblock
,
522 krb5_keysalt
*keysalt
, int *kvnop
);
524 kadm5_ret_t
kadm5_create_policy(void *server_handle
,
525 kadm5_policy_ent_t ent
,
528 * kadm5_create_policy_internal is not part of the supported,
529 * exposed API. It is available only in the server library, and you
530 * shouldn't use it unless you know why it's there and how it's
531 * different from kadm5_create_policy.
533 kadm5_ret_t
kadm5_create_policy_internal(void *server_handle
,
536 kadm5_ret_t
kadm5_delete_policy(void *server_handle
,
537 kadm5_policy_t policy
);
538 kadm5_ret_t
kadm5_modify_policy(void *server_handle
,
539 kadm5_policy_ent_t ent
,
542 * kadm5_modify_policy_internal is not part of the supported,
543 * exposed API. It is available only in the server library, and you
544 * shouldn't use it unless you know why it's there and how it's
545 * different from kadm5_modify_policy.
547 kadm5_ret_t
kadm5_modify_policy_internal(void *server_handle
,
550 #if USE_KADM5_API_VERSION == 1
551 kadm5_ret_t
kadm5_get_policy(void *server_handle
,
552 kadm5_policy_t policy
,
553 kadm5_policy_ent_t
*ent
);
555 kadm5_ret_t
kadm5_get_policy(void *server_handle
,
556 kadm5_policy_t policy
,
557 kadm5_policy_ent_t ent
);
559 kadm5_ret_t
kadm5_get_privs(void *server_handle
,
562 kadm5_ret_t
kadm5_chpass_principal_util(void *server_handle
,
563 krb5_principal princ
,
567 unsigned int msg_len
);
569 kadm5_ret_t
kadm5_free_principal_ent(void *server_handle
,
570 kadm5_principal_ent_t
572 kadm5_ret_t
kadm5_free_policy_ent(void *server_handle
,
573 kadm5_policy_ent_t ent
);
575 kadm5_ret_t
kadm5_get_principals(void *server_handle
,
576 char *exp
, char ***princs
,
579 kadm5_ret_t
kadm5_get_policies(void *server_handle
,
580 char *exp
, char ***pols
,
583 #if USE_KADM5_API_VERSION > 1
584 kadm5_ret_t
kadm5_free_key_data(void *server_handle
,
585 krb5_int16
*n_key_data
,
586 krb5_key_data
*key_data
);
589 kadm5_ret_t
kadm5_free_name_list(void *server_handle
, char **names
,
592 krb5_error_code
kadm5_init_krb5_context (krb5_context
*);
594 #if USE_KADM5_API_VERSION == 1
596 * OVSEC_KADM_API_VERSION_1 should be, if possible, compile-time
597 * compatible with KADM5_API_VERSION_2. Basically, this means we have
598 * to continue to provide all the old ovsec_kadm function and symbol
602 #define OVSEC_KADM_ACLFILE "/krb5/ovsec_adm.acl"
603 #define OVSEC_KADM_WORDFILE "/krb5/ovsec_adm.dict"
605 #define OVSEC_KADM_ADMIN_SERVICE "ovsec_adm/admin"
606 #define OVSEC_KADM_CHANGEPW_SERVICE "ovsec_adm/changepw"
607 #define OVSEC_KADM_HIST_PRINCIPAL "ovsec_adm/history"
609 typedef krb5_principal ovsec_kadm_princ_t
;
610 typedef krb5_keyblock ovsec_kadm_keyblock
;
611 typedef char *ovsec_kadm_policy_t
;
612 typedef long ovsec_kadm_ret_t
;
614 enum ovsec_kadm_salttype
{ OVSEC_KADM_SALT_V4
, OVSEC_KADM_SALT_NORMAL
};
615 enum ovsec_kadm_saltmod
{ OVSEC_KADM_MOD_KEEP
, OVSEC_KADM_MOD_V4
, OVSEC_KADM_MOD_NORMAL
};
617 #define OVSEC_KADM_PW_FIRST_PROMPT \
618 ((char *) error_message(CHPASS_UTIL_NEW_PASSWORD_PROMPT))
619 #define OVSEC_KADM_PW_SECOND_PROMPT \
620 ((char *) error_message(CHPASS_UTIL_NEW_PASSWORD_AGAIN_PROMPT))
623 * Successful return code
625 #define OVSEC_KADM_OK 0
628 * Create/Modify masks
631 #define OVSEC_KADM_PRINCIPAL 0x000001
632 #define OVSEC_KADM_PRINC_EXPIRE_TIME 0x000002
633 #define OVSEC_KADM_PW_EXPIRATION 0x000004
634 #define OVSEC_KADM_LAST_PWD_CHANGE 0x000008
635 #define OVSEC_KADM_ATTRIBUTES 0x000010
636 #define OVSEC_KADM_MAX_LIFE 0x000020
637 #define OVSEC_KADM_MOD_TIME 0x000040
638 #define OVSEC_KADM_MOD_NAME 0x000080
639 #define OVSEC_KADM_KVNO 0x000100
640 #define OVSEC_KADM_MKVNO 0x000200
641 #define OVSEC_KADM_AUX_ATTRIBUTES 0x000400
642 #define OVSEC_KADM_POLICY 0x000800
643 #define OVSEC_KADM_POLICY_CLR 0x001000
645 #define OVSEC_KADM_PW_MAX_LIFE 0x004000
646 #define OVSEC_KADM_PW_MIN_LIFE 0x008000
647 #define OVSEC_KADM_PW_MIN_LENGTH 0x010000
648 #define OVSEC_KADM_PW_MIN_CLASSES 0x020000
649 #define OVSEC_KADM_PW_HISTORY_NUM 0x040000
650 #define OVSEC_KADM_REF_COUNT 0x080000
655 #define OVSEC_KADM_PRIV_GET 0x01
656 #define OVSEC_KADM_PRIV_ADD 0x02
657 #define OVSEC_KADM_PRIV_MODIFY 0x04
658 #define OVSEC_KADM_PRIV_DELETE 0x08
661 * API versioning constants
663 #define OVSEC_KADM_MASK_BITS 0xffffff00
665 #define OVSEC_KADM_STRUCT_VERSION_MASK 0x12345600
666 #define OVSEC_KADM_STRUCT_VERSION_1 (OVSEC_KADM_STRUCT_VERSION_MASK|0x01)
667 #define OVSEC_KADM_STRUCT_VERSION OVSEC_KADM_STRUCT_VERSION_1
669 #define OVSEC_KADM_API_VERSION_MASK 0x12345700
670 #define OVSEC_KADM_API_VERSION_1 (OVSEC_KADM_API_VERSION_MASK|0x01)
673 typedef struct _ovsec_kadm_principal_ent_t
{
674 krb5_principal principal
;
675 krb5_timestamp princ_expire_time
;
676 krb5_timestamp last_pwd_change
;
677 krb5_timestamp pw_expiration
;
678 krb5_deltat max_life
;
679 krb5_principal mod_name
;
680 krb5_timestamp mod_date
;
681 krb5_flags attributes
;
686 } ovsec_kadm_principal_ent_rec
, *ovsec_kadm_principal_ent_t
;
688 typedef struct _ovsec_kadm_policy_ent_t
{
696 } ovsec_kadm_policy_ent_rec
, *ovsec_kadm_policy_ent_t
;
701 ovsec_kadm_ret_t
ovsec_kadm_init(char *client_name
, char *pass
,
702 char *service_name
, char *realm
,
703 krb5_ui_4 struct_version
,
704 krb5_ui_4 api_version
,
706 void **server_handle
);
707 ovsec_kadm_ret_t
ovsec_kadm_init_with_password(char *client_name
,
711 krb5_ui_4 struct_version
,
712 krb5_ui_4 api_version
,
714 void **server_handle
);
715 ovsec_kadm_ret_t
ovsec_kadm_init_with_skey(char *client_name
,
719 krb5_ui_4 struct_version
,
720 krb5_ui_4 api_version
,
722 void **server_handle
);
723 ovsec_kadm_ret_t
ovsec_kadm_flush(void *server_handle
);
724 ovsec_kadm_ret_t
ovsec_kadm_destroy(void *server_handle
);
725 ovsec_kadm_ret_t
ovsec_kadm_create_principal(void *server_handle
,
726 ovsec_kadm_principal_ent_t ent
,
727 long mask
, char *pass
);
728 ovsec_kadm_ret_t
ovsec_kadm_delete_principal(void *server_handle
,
729 krb5_principal principal
);
730 ovsec_kadm_ret_t
ovsec_kadm_modify_principal(void *server_handle
,
731 ovsec_kadm_principal_ent_t ent
,
733 ovsec_kadm_ret_t
ovsec_kadm_rename_principal(void *server_handle
,
734 krb5_principal
,krb5_principal
);
735 ovsec_kadm_ret_t
ovsec_kadm_get_principal(void *server_handle
,
736 krb5_principal principal
,
737 ovsec_kadm_principal_ent_t
*ent
);
738 ovsec_kadm_ret_t
ovsec_kadm_chpass_principal(void *server_handle
,
739 krb5_principal principal
,
741 ovsec_kadm_ret_t
ovsec_kadm_randkey_principal(void *server_handle
,
742 krb5_principal principal
,
743 krb5_keyblock
**keyblock
);
744 ovsec_kadm_ret_t
ovsec_kadm_create_policy(void *server_handle
,
745 ovsec_kadm_policy_ent_t ent
,
748 * ovsec_kadm_create_policy_internal is not part of the supported,
749 * exposed API. It is available only in the server library, and you
750 * shouldn't use it unless you know why it's there and how it's
751 * different from ovsec_kadm_create_policy.
753 ovsec_kadm_ret_t
ovsec_kadm_create_policy_internal(void *server_handle
,
754 ovsec_kadm_policy_ent_t
756 ovsec_kadm_ret_t
ovsec_kadm_delete_policy(void *server_handle
,
757 ovsec_kadm_policy_t policy
);
758 ovsec_kadm_ret_t
ovsec_kadm_modify_policy(void *server_handle
,
759 ovsec_kadm_policy_ent_t ent
,
762 * ovsec_kadm_modify_policy_internal is not part of the supported,
763 * exposed API. It is available only in the server library, and you
764 * shouldn't use it unless you know why it's there and how it's
765 * different from ovsec_kadm_modify_policy.
767 ovsec_kadm_ret_t
ovsec_kadm_modify_policy_internal(void *server_handle
,
768 ovsec_kadm_policy_ent_t
770 ovsec_kadm_ret_t
ovsec_kadm_get_policy(void *server_handle
,
771 ovsec_kadm_policy_t policy
,
772 ovsec_kadm_policy_ent_t
*ent
);
773 ovsec_kadm_ret_t
ovsec_kadm_get_privs(void *server_handle
,
776 ovsec_kadm_ret_t
ovsec_kadm_chpass_principal_util(void *server_handle
,
777 krb5_principal princ
,
782 ovsec_kadm_ret_t
ovsec_kadm_free_principal_ent(void *server_handle
,
783 ovsec_kadm_principal_ent_t
785 ovsec_kadm_ret_t
ovsec_kadm_free_policy_ent(void *server_handle
,
786 ovsec_kadm_policy_ent_t ent
);
788 ovsec_kadm_ret_t
ovsec_kadm_free_name_list(void *server_handle
,
789 char **names
, int count
);
791 ovsec_kadm_ret_t
ovsec_kadm_get_principals(void *server_handle
,
792 char *exp
, char ***princs
,
795 ovsec_kadm_ret_t
ovsec_kadm_get_policies(void *server_handle
,
796 char *exp
, char ***pols
,
799 #define OVSEC_KADM_FAILURE KADM5_FAILURE
800 #define OVSEC_KADM_AUTH_GET KADM5_AUTH_GET
801 #define OVSEC_KADM_AUTH_ADD KADM5_AUTH_ADD
802 #define OVSEC_KADM_AUTH_MODIFY KADM5_AUTH_MODIFY
803 #define OVSEC_KADM_AUTH_DELETE KADM5_AUTH_DELETE
804 #define OVSEC_KADM_AUTH_INSUFFICIENT KADM5_AUTH_INSUFFICIENT
805 #define OVSEC_KADM_BAD_DB KADM5_BAD_DB
806 #define OVSEC_KADM_DUP KADM5_DUP
807 #define OVSEC_KADM_RPC_ERROR KADM5_RPC_ERROR
808 #define OVSEC_KADM_NO_SRV KADM5_NO_SRV
809 #define OVSEC_KADM_BAD_HIST_KEY KADM5_BAD_HIST_KEY
810 #define OVSEC_KADM_NOT_INIT KADM5_NOT_INIT
811 #define OVSEC_KADM_UNK_PRINC KADM5_UNK_PRINC
812 #define OVSEC_KADM_UNK_POLICY KADM5_UNK_POLICY
813 #define OVSEC_KADM_BAD_MASK KADM5_BAD_MASK
814 #define OVSEC_KADM_BAD_CLASS KADM5_BAD_CLASS
815 #define OVSEC_KADM_BAD_LENGTH KADM5_BAD_LENGTH
816 #define OVSEC_KADM_BAD_POLICY KADM5_BAD_POLICY
817 #define OVSEC_KADM_BAD_PRINCIPAL KADM5_BAD_PRINCIPAL
818 #define OVSEC_KADM_BAD_AUX_ATTR KADM5_BAD_AUX_ATTR
819 #define OVSEC_KADM_BAD_HISTORY KADM5_BAD_HISTORY
820 #define OVSEC_KADM_BAD_MIN_PASS_LIFE KADM5_BAD_MIN_PASS_LIFE
821 #define OVSEC_KADM_PASS_Q_TOOSHORT KADM5_PASS_Q_TOOSHORT
822 #define OVSEC_KADM_PASS_Q_CLASS KADM5_PASS_Q_CLASS
823 #define OVSEC_KADM_PASS_Q_DICT KADM5_PASS_Q_DICT
824 #define OVSEC_KADM_PASS_REUSE KADM5_PASS_REUSE
825 #define OVSEC_KADM_PASS_TOOSOON KADM5_PASS_TOOSOON
826 #define OVSEC_KADM_POLICY_REF KADM5_POLICY_REF
827 #define OVSEC_KADM_INIT KADM5_INIT
828 #define OVSEC_KADM_BAD_PASSWORD KADM5_BAD_PASSWORD
829 #define OVSEC_KADM_PROTECT_PRINCIPAL KADM5_PROTECT_PRINCIPAL
830 #define OVSEC_KADM_BAD_SERVER_HANDLE KADM5_BAD_SERVER_HANDLE
831 #define OVSEC_KADM_BAD_STRUCT_VERSION KADM5_BAD_STRUCT_VERSION
832 #define OVSEC_KADM_OLD_STRUCT_VERSION KADM5_OLD_STRUCT_VERSION
833 #define OVSEC_KADM_NEW_STRUCT_VERSION KADM5_NEW_STRUCT_VERSION
834 #define OVSEC_KADM_BAD_API_VERSION KADM5_BAD_API_VERSION
835 #define OVSEC_KADM_OLD_LIB_API_VERSION KADM5_OLD_LIB_API_VERSION
836 #define OVSEC_KADM_OLD_SERVER_API_VERSION KADM5_OLD_SERVER_API_VERSION
837 #define OVSEC_KADM_NEW_LIB_API_VERSION KADM5_NEW_LIB_API_VERSION
838 #define OVSEC_KADM_NEW_SERVER_API_VERSION KADM5_NEW_SERVER_API_VERSION
839 #define OVSEC_KADM_SECURE_PRINC_MISSING KADM5_SECURE_PRINC_MISSING
840 #define OVSEC_KADM_NO_RENAME_SALT KADM5_NO_RENAME_SALT
842 #endif /* USE_KADM5_API_VERSION == 1 */
844 #define MAXPRINCLEN 125
846 void trunc_name(size_t *len
, char **dots
);
848 krb5_chgpwd_prot
_kadm5_get_kpasswd_protocol(void *server_handle
);
849 kadm5_ret_t
kadm5_chpass_principal_v2(void *server_handle
,
850 krb5_principal princ
,
852 kadm5_ret_t
*srvr_rsp_code
,
853 krb5_data
*srvr_msg
);
855 void handle_chpw(krb5_context context
, int s
, void *serverhandle
,
856 kadm5_config_params
*params
);
862 #endif /* __KADM5_ADMIN_H__ */