17c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 27c478bd9Sstevel@tonic-gate 37c478bd9Sstevel@tonic-gate /* 47c478bd9Sstevel@tonic-gate * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 57c478bd9Sstevel@tonic-gate * 67c478bd9Sstevel@tonic-gate * Openvision retains the copyright to derivative works of 77c478bd9Sstevel@tonic-gate * this source code. Do *NOT* create a derivative of this 87c478bd9Sstevel@tonic-gate * source code before consulting with your legal department. 97c478bd9Sstevel@tonic-gate * Do *NOT* integrate *ANY* of this source code into another 107c478bd9Sstevel@tonic-gate * product before consulting with your legal department. 117c478bd9Sstevel@tonic-gate * 127c478bd9Sstevel@tonic-gate * For further information, read the top-level Openvision 137c478bd9Sstevel@tonic-gate * copyright which is contained in the top-level MIT Kerberos 147c478bd9Sstevel@tonic-gate * copyright. 157c478bd9Sstevel@tonic-gate * 167c478bd9Sstevel@tonic-gate * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING 177c478bd9Sstevel@tonic-gate * 187c478bd9Sstevel@tonic-gate */ 197c478bd9Sstevel@tonic-gate 207c478bd9Sstevel@tonic-gate 217c478bd9Sstevel@tonic-gate /* 227c478bd9Sstevel@tonic-gate * Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved 237c478bd9Sstevel@tonic-gate * 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef __KADM5_ADMIN_INTERNAL_H__ 277c478bd9Sstevel@tonic-gate #define __KADM5_ADMIN_INTERNAL_H__ 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #include <kadm5/admin.h> 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #ifdef DEBUG 327c478bd9Sstevel@tonic-gate #define ADMIN_LOG(a, b, c) syslog(a, b, c); 337c478bd9Sstevel@tonic-gate #define ADMIN_LOGO(a, b) syslog(a, b); 347c478bd9Sstevel@tonic-gate #else 357c478bd9Sstevel@tonic-gate #define ADMIN_LOG(a, b, c) 367c478bd9Sstevel@tonic-gate #define ADMIN_LOGO(a, b) 377c478bd9Sstevel@tonic-gate #endif 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate #define KADM5_SERVER_HANDLE_MAGIC 0x12345800 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate #define GENERIC_CHECK_HANDLE(handle, old_api_version, new_api_version) \ 427c478bd9Sstevel@tonic-gate { \ 437c478bd9Sstevel@tonic-gate kadm5_server_handle_t srvr = \ 447c478bd9Sstevel@tonic-gate (kadm5_server_handle_t) handle; \ 457c478bd9Sstevel@tonic-gate \ 467c478bd9Sstevel@tonic-gate if (! srvr) \ 477c478bd9Sstevel@tonic-gate return KADM5_BAD_SERVER_HANDLE; \ 487c478bd9Sstevel@tonic-gate if (srvr->magic_number != KADM5_SERVER_HANDLE_MAGIC) \ 497c478bd9Sstevel@tonic-gate return KADM5_BAD_SERVER_HANDLE; \ 507c478bd9Sstevel@tonic-gate if ((srvr->struct_version & KADM5_MASK_BITS) != \ 517c478bd9Sstevel@tonic-gate KADM5_STRUCT_VERSION_MASK) \ 527c478bd9Sstevel@tonic-gate return KADM5_BAD_STRUCT_VERSION; \ 537c478bd9Sstevel@tonic-gate if (srvr->struct_version < KADM5_STRUCT_VERSION_1) \ 547c478bd9Sstevel@tonic-gate return KADM5_OLD_STRUCT_VERSION; \ 557c478bd9Sstevel@tonic-gate if (srvr->struct_version > KADM5_STRUCT_VERSION_1) \ 567c478bd9Sstevel@tonic-gate return KADM5_NEW_STRUCT_VERSION; \ 577c478bd9Sstevel@tonic-gate if ((srvr->api_version & KADM5_MASK_BITS) != \ 587c478bd9Sstevel@tonic-gate KADM5_API_VERSION_MASK) \ 597c478bd9Sstevel@tonic-gate return KADM5_BAD_API_VERSION; \ 607c478bd9Sstevel@tonic-gate if (srvr->api_version < KADM5_API_VERSION_1) \ 617c478bd9Sstevel@tonic-gate return old_api_version; \ 627c478bd9Sstevel@tonic-gate if (srvr->api_version > KADM5_API_VERSION_2) \ 637c478bd9Sstevel@tonic-gate return new_api_version; \ 647c478bd9Sstevel@tonic-gate } 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate /* 677c478bd9Sstevel@tonic-gate * _KADM5_CHECK_HANDLE calls the function _kadm5_check_handle and 687c478bd9Sstevel@tonic-gate * returns any non-zero error code that function returns. 697c478bd9Sstevel@tonic-gate * _kadm5_check_handle, in client_handle.c and server_handle.c, exists 707c478bd9Sstevel@tonic-gate * in both the server- and client- side libraries. In each library, 717c478bd9Sstevel@tonic-gate * it calls CHECK_HANDLE, which is defined by the appropriate 727c478bd9Sstevel@tonic-gate * _internal.h header file to call GENERIC_CHECK_HANDLE as well as 737c478bd9Sstevel@tonic-gate * CLIENT_CHECK_HANDLE and SERVER_CHECK_HANDLE. 747c478bd9Sstevel@tonic-gate * 757c478bd9Sstevel@tonic-gate * _KADM5_CHECK_HANDLE should be used by a function that needs to 767c478bd9Sstevel@tonic-gate * check the handle but wants to be the same code in both the client 777c478bd9Sstevel@tonic-gate * and server library; it makes a function call to the right handle 787c478bd9Sstevel@tonic-gate * checker. Code that only exists in one library can call the 797c478bd9Sstevel@tonic-gate * CHECK_HANDLE macro, which inlines the test instead of making 807c478bd9Sstevel@tonic-gate * another function call. 817c478bd9Sstevel@tonic-gate * 827c478bd9Sstevel@tonic-gate * Got that? 837c478bd9Sstevel@tonic-gate */ 847c478bd9Sstevel@tonic-gate #define _KADM5_CHECK_HANDLE(handle) \ 85*56a424ccSmp153739 { int ecode; if ((ecode = _kadm5_check_handle((void *)handle))) return ecode;} 867c478bd9Sstevel@tonic-gate 87*56a424ccSmp153739 int _kadm5_check_handle(void *handle); 887c478bd9Sstevel@tonic-gate kadm5_ret_t _kadm5_chpass_principal_util(void *server_handle, 897c478bd9Sstevel@tonic-gate void *lhandle, 907c478bd9Sstevel@tonic-gate krb5_principal princ, 917c478bd9Sstevel@tonic-gate char *new_pw, 927c478bd9Sstevel@tonic-gate char **ret_pw, 937c478bd9Sstevel@tonic-gate char *msg_ret, 94*56a424ccSmp153739 unsigned int msg_len); 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate /* this is needed by the alt_prof code I stole. The functions 977c478bd9Sstevel@tonic-gate maybe shouldn't be named krb5_*, but they are. */ 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate krb5_error_code 1007c478bd9Sstevel@tonic-gate krb5_string_to_keysalts(char *string, const char *tupleseps, 1017c478bd9Sstevel@tonic-gate const char *ksaltseps, krb5_boolean dups, 1027c478bd9Sstevel@tonic-gate krb5_key_salt_tuple **ksaltp, krb5_int32 *nksaltp); 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate krb5_error_code 1057c478bd9Sstevel@tonic-gate krb5_string_to_flags(char* string, const char* positive, const char* negative, 1067c478bd9Sstevel@tonic-gate krb5_flags *flagsp); 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate #endif /* __KADM5_ADMIN_INTERNAL_H__ */ 109