"Fossies" - the Fresh Open Source Software Archive

Member "krb5-1.18/src/lib/kadm5/admin_internal.h" (12 Feb 2020, 3826 Bytes) of package /linux/misc/krb5-1.18.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "admin_internal.h" see the Fossies "Dox" file reference documentation.

    1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
    2 /*
    3  * Copyright 1993 OpenVision Technologies, Inc., All Rights Reserved
    4  *
    5  */
    6 
    7 #ifndef __KADM5_ADMIN_INTERNAL_H__
    8 #define __KADM5_ADMIN_INTERNAL_H__
    9 
   10 #include <kadm5/admin.h>
   11 
   12 #define KADM5_SERVER_HANDLE_MAGIC       0x12345800
   13 
   14 #define GENERIC_CHECK_HANDLE(handle, old_api_version, new_api_version)  \
   15     {                                                                   \
   16         kadm5_server_handle_t srvr =                                    \
   17             (kadm5_server_handle_t) handle;                             \
   18                                                                         \
   19         if (! srvr)                                                     \
   20             return KADM5_BAD_SERVER_HANDLE;                             \
   21         if (srvr->magic_number != KADM5_SERVER_HANDLE_MAGIC)            \
   22             return KADM5_BAD_SERVER_HANDLE;                             \
   23         if ((srvr->struct_version & KADM5_MASK_BITS) !=                 \
   24             KADM5_STRUCT_VERSION_MASK)                                  \
   25             return KADM5_BAD_STRUCT_VERSION;                            \
   26         if (srvr->struct_version < KADM5_STRUCT_VERSION_1)              \
   27             return KADM5_OLD_STRUCT_VERSION;                            \
   28         if (srvr->struct_version > KADM5_STRUCT_VERSION_1)              \
   29             return KADM5_NEW_STRUCT_VERSION;                            \
   30         if ((srvr->api_version & KADM5_MASK_BITS) !=                    \
   31             KADM5_API_VERSION_MASK)                                     \
   32             return KADM5_BAD_API_VERSION;                               \
   33         if (srvr->api_version < KADM5_API_VERSION_2)                    \
   34             return old_api_version;                                     \
   35         if (srvr->api_version > KADM5_API_VERSION_4)                    \
   36             return new_api_version;                                     \
   37     }
   38 
   39 /*
   40  * _KADM5_CHECK_HANDLE calls the function _kadm5_check_handle and
   41  * returns any non-zero error code that function returns.
   42  * _kadm5_check_handle, in client_handle.c and server_handle.c, exists
   43  * in both the server- and client- side libraries.  In each library,
   44  * it calls CHECK_HANDLE, which is defined by the appropriate
   45  * _internal.h header file to call GENERIC_CHECK_HANDLE as well as
   46  * CLIENT_CHECK_HANDLE and SERVER_CHECK_HANDLE.
   47  *
   48  * _KADM5_CHECK_HANDLE should be used by a function that needs to
   49  * check the handle but wants to be the same code in both the client
   50  * and server library; it makes a function call to the right handle
   51  * checker.  Code that only exists in one library can call the
   52  * CHECK_HANDLE macro, which inlines the test instead of making
   53  * another function call.
   54  *
   55  * Got that?
   56  */
   57 #define _KADM5_CHECK_HANDLE(handle)                                     \
   58     { int ecode; if ((ecode = _kadm5_check_handle((void *)handle))) return ecode;}
   59 
   60 int         _kadm5_check_handle(void *handle);
   61 kadm5_ret_t _kadm5_chpass_principal_util(void *server_handle,
   62                                          void *lhandle,
   63                                          krb5_principal princ,
   64                                          char *new_pw,
   65                                          char **ret_pw,
   66                                          char *msg_ret,
   67                                          unsigned int msg_len);
   68 
   69 /* this is needed by the alt_prof code I stole.  The functions
   70    maybe shouldn't be named krb5_*, but they are. */
   71 
   72 krb5_error_code
   73 krb5_string_to_keysalts(const char *string, const char *tupleseps,
   74                         const char *ksaltseps, krb5_boolean dups,
   75                         krb5_key_salt_tuple **ksaltp, krb5_int32 *nksaltp);
   76 
   77 #endif /* __KADM5_ADMIN_INTERNAL_H__ */