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