1 #pragma ident	"%Z%%M%	%I%	%E% SMI"
2 
3 /*
4  * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
5  *
6  *	Openvision retains the copyright to derivative works of
7  *	this source code.  Do *NOT* create a derivative of this
8  *	source code before consulting with your legal department.
9  *	Do *NOT* integrate *ANY* of this source code into another
10  *	product before consulting with your legal department.
11  *
12  *	For further information, read the top-level Openvision
13  *	copyright which is contained in the top-level MIT Kerberos
14  *	copyright.
15  *
16  * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
17  *
18  */
19 
20 
21 /*
22  * Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved
23  *
24  * $Header: /cvs/krbdev/krb5/src/lib/kadm5/admin_internal.h,v 1.13.18.1 2000/05/19 22:24:14 raeburn Exp $
25  */
26 
27 #ifndef __KADM5_ADMIN_INTERNAL_H__
28 #define __KADM5_ADMIN_INTERNAL_H__
29 
30 #include <kadm5/admin.h>
31 
32 #ifdef DEBUG
33 #define ADMIN_LOG(a, b, c) syslog(a, b, c);
34 #define ADMIN_LOGO(a, b) syslog(a, b);
35 #else
36 #define ADMIN_LOG(a, b, c)
37 #define ADMIN_LOGO(a, b)
38 #endif
39 
40 #define KADM5_SERVER_HANDLE_MAGIC	0x12345800
41 
42 #define GENERIC_CHECK_HANDLE(handle, old_api_version, new_api_version) \
43 { \
44 	kadm5_server_handle_t srvr = \
45 	     (kadm5_server_handle_t) handle; \
46  \
47 	if (! srvr) \
48 		return KADM5_BAD_SERVER_HANDLE; \
49 	if (srvr->magic_number != KADM5_SERVER_HANDLE_MAGIC) \
50 		return KADM5_BAD_SERVER_HANDLE; \
51 	if ((srvr->struct_version & KADM5_MASK_BITS) != \
52 	    KADM5_STRUCT_VERSION_MASK) \
53 		return KADM5_BAD_STRUCT_VERSION; \
54 	if (srvr->struct_version < KADM5_STRUCT_VERSION_1) \
55 		return KADM5_OLD_STRUCT_VERSION; \
56 	if (srvr->struct_version > KADM5_STRUCT_VERSION_1) \
57 		return KADM5_NEW_STRUCT_VERSION; \
58 	if ((srvr->api_version & KADM5_MASK_BITS) != \
59 	    KADM5_API_VERSION_MASK) \
60 		return KADM5_BAD_API_VERSION; \
61 	if (srvr->api_version < KADM5_API_VERSION_1) \
62 		return old_api_version; \
63 	if (srvr->api_version > KADM5_API_VERSION_2) \
64 		return new_api_version; \
65 }
66 
67 /*
68  * _KADM5_CHECK_HANDLE calls the function _kadm5_check_handle and
69  * returns any non-zero error code that function returns.
70  * _kadm5_check_handle, in client_handle.c and server_handle.c, exists
71  * in both the server- and client- side libraries.  In each library,
72  * it calls CHECK_HANDLE, which is defined by the appropriate
73  * _internal.h header file to call GENERIC_CHECK_HANDLE as well as
74  * CLIENT_CHECK_HANDLE and SERVER_CHECK_HANDLE.
75  *
76  * _KADM5_CHECK_HANDLE should be used by a function that needs to
77  * check the handle but wants to be the same code in both the client
78  * and server library; it makes a function call to the right handle
79  * checker.  Code that only exists in one library can call the
80  * CHECK_HANDLE macro, which inlines the test instead of making
81  * another function call.
82  *
83  * Got that?
84  */
85 int _kadm5_check_handle();
86 
87 #define _KADM5_CHECK_HANDLE(handle) \
88 { int code; if ((code = _kadm5_check_handle((void *)handle))) return code; }
89 
90 kadm5_ret_t _kadm5_chpass_principal_util(void *server_handle,
91 					 void *lhandle,
92 					 krb5_principal princ,
93 					 char *new_pw,
94 					 char **ret_pw,
95 					 char *msg_ret,
96 					 int msg_len);
97 
98 /* this is needed by the alt_prof code I stole.  The functions
99    maybe shouldn't be named krb5_*, but they are. */
100 
101 krb5_error_code
102 krb5_string_to_keysalts(char *string, const char *tupleseps,
103 			const char *ksaltseps, krb5_boolean dups,
104 			krb5_key_salt_tuple **ksaltp, krb5_int32 *nksaltp);
105 
106 krb5_error_code
107 krb5_string_to_flags(char* string, const char* positive, const char* negative,
108 		     krb5_flags *flagsp);
109 
110 #endif /* __KADM5_ADMIN_INTERNAL_H__ */
111