(linenum→info "unix/slp.c:2238")

openssl/0.9.8g/ssl/kssl.c

    1: /* ssl/kssl.c -*- mode: C; c-file-style: "eay" -*- */
    2: /* Written by Vern Staats <staatsvr@asc.hpc.mil> for the OpenSSL project 2000.
    3:  */
    4: /* ====================================================================
    5:  * Copyright (c) 2000 The OpenSSL Project.  All rights reserved.
    6:  *
    7:  * Redistribution and use in source and binary forms, with or without
    8:  * modification, are permitted provided that the following conditions
    9:  * are met:
   10:  *
   11:  * 1. Redistributions of source code must retain the above copyright
   12:  *    notice, this list of conditions and the following disclaimer. 
   13:  *
   14:  * 2. Redistributions in binary form must reproduce the above copyright
   15:  *    notice, this list of conditions and the following disclaimer in
   16:  *    the documentation and/or other materials provided with the
   17:  *    distribution.
   18:  *
   19:  * 3. All advertising materials mentioning features or use of this
   20:  *    software must display the following acknowledgment:
   21:  *    "This product includes software developed by the OpenSSL Project
   22:  *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
   23:  *
   24:  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
   25:  *    endorse or promote products derived from this software without
   26:  *    prior written permission. For written permission, please contact
   27:  *    licensing@OpenSSL.org.
   28:  *
   29:  * 5. Products derived from this software may not be called "OpenSSL"
   30:  *    nor may "OpenSSL" appear in their names without prior written
   31:  *    permission of the OpenSSL Project.
   32:  *
   33:  * 6. Redistributions of any form whatsoever must retain the following
   34:  *    acknowledgment:
   35:  *    "This product includes software developed by the OpenSSL Project
   36:  *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
   37:  *
   38:  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
   39:  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   40:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   41:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
   42:  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   43:  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   44:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   45:  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   46:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   47:  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   48:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
   49:  * OF THE POSSIBILITY OF SUCH DAMAGE.
   50:  * ====================================================================
   51:  *
   52:  * This product includes cryptographic software written by Eric Young
   53:  * (eay@cryptsoft.com).  This product includes software written by Tim
   54:  * Hudson (tjh@cryptsoft.com).
   55:  *
   56:  */
   57: 
   58: 
   59: /*  ssl/kssl.c  --  Routines to support (& debug) Kerberos5 auth for openssl
   60: **
   61: **  19990701    VRS        Started.
   62: **  200011??    Jeffrey Altman, Richard Levitte
   63: **                      Generalized for Heimdal, Newer MIT, & Win32.
   64: **                      Integrated into main OpenSSL 0.9.7 snapshots.
   65: **  20010413    Simon Wilkinson, VRS
   66: **                      Real RFC2712 KerberosWrapper replaces AP_REQ.
   67: */
   68: 
   69: #include <openssl/opensslconf.h>
   70: 
   71: #define _XOPEN_SOURCE 500 /* glibc2 needs this to declare strptime() */
   72: #include <time.h>
   73: #if 0 /* experimental */
   74: #undef _XOPEN_SOURCE /* To avoid clashes with anything else... */
   75: #endif
   76: #include <string.h>
   77: 
   78: #define KRB5_PRIVATE    1
   79: 
   80: #include <openssl/ssl.h>
   81: #include <openssl/evp.h>
   82: #include <openssl/objects.h>
   83: #include <openssl/krb5_asn.h>
   84: 
   85: #ifndef OPENSSL_NO_KRB5
   86: 
   87: #ifndef ENOMEM
   88: #define ENOMEM KRB5KRB_ERR_GENERIC
   89: #endif
   90: 
   91: /* 
   92:  * When OpenSSL is built on Windows, we do not want to require that
   93:  * the Kerberos DLLs be available in order for the OpenSSL DLLs to
   94:  * work.  Therefore, all Kerberos routines are loaded at run time
   95:  * and we do not link to a .LIB file.
   96:  */
   97: 
   98: #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
   99: /* 
  100:  * The purpose of the following pre-processor statements is to provide
  101:  * compatibility with different releases of MIT Kerberos for Windows.
  102:  * All versions up to 1.2 used macros.  But macros do not allow for
  103:  * a binary compatible interface for DLLs.  Therefore, all macros are
  104:  * being replaced by function calls.  The following code will allow
  105:  * an OpenSSL DLL built on Windows to work whether or not the macro
  106:  * or function form of the routines are utilized.
  107:  */
  108: #ifdef  krb5_cc_get_principal
  109: #define NO_DEF_KRB5_CCACHE
  110: #undef  krb5_cc_get_principal
  111: #endif
  112: #define krb5_cc_get_principal    kssl_krb5_cc_get_principal
  113: 
  114: #define krb5_free_data_contents  kssl_krb5_free_data_contents   
  115: #define krb5_free_context        kssl_krb5_free_context         
  116: #define krb5_auth_con_free       kssl_krb5_auth_con_free        
  117: #define krb5_free_principal      kssl_krb5_free_principal       
  118: #define krb5_mk_req_extended     kssl_krb5_mk_req_extended      
  119: #define krb5_get_credentials     kssl_krb5_get_credentials      
  120: #define krb5_cc_default          kssl_krb5_cc_default           
  121: #define krb5_sname_to_principal  kssl_krb5_sname_to_principal   
  122: #define krb5_init_context        kssl_krb5_init_context         
  123: #define krb5_free_ticket         kssl_krb5_free_ticket          
  124: #define krb5_rd_req              kssl_krb5_rd_req               
  125: #define krb5_kt_default          kssl_krb5_kt_default           
  126: #define krb5_kt_resolve          kssl_krb5_kt_resolve           
  127: /* macros in mit 1.2.2 and earlier; functions in mit 1.2.3 and greater */
  128: #ifndef krb5_kt_close
  129: #define krb5_kt_close            kssl_krb5_kt_close
  130: #endif /* krb5_kt_close */
  131: #ifndef krb5_kt_get_entry
  132: #define krb5_kt_get_entry        kssl_krb5_kt_get_entry
  133: #endif /* krb5_kt_get_entry */
  134: #define krb5_auth_con_init       kssl_krb5_auth_con_init        
  135: 
  136: #define krb5_principal_compare   kssl_krb5_principal_compare
  137: #define krb5_decrypt_tkt_part    kssl_krb5_decrypt_tkt_part
  138: #define krb5_timeofday           kssl_krb5_timeofday
  139: #define krb5_rc_default           kssl_krb5_rc_default
  140: 
  141: #ifdef krb5_rc_initialize
  142: #undef krb5_rc_initialize
  143: #endif
  144: #define krb5_rc_initialize   kssl_krb5_rc_initialize
  145: 
  146: #ifdef krb5_rc_get_lifespan
  147: #undef krb5_rc_get_lifespan
  148: #endif
  149: #define krb5_rc_get_lifespan kssl_krb5_rc_get_lifespan
  150: 
  151: #ifdef krb5_rc_destroy
  152: #undef krb5_rc_destroy
  153: #endif
  154: #define krb5_rc_destroy      kssl_krb5_rc_destroy
  155: 
  156: #define valid_cksumtype      kssl_valid_cksumtype
  157: #define krb5_checksum_size   kssl_krb5_checksum_size
  158: #define krb5_kt_free_entry   kssl_krb5_kt_free_entry
  159: #define krb5_auth_con_setrcache  kssl_krb5_auth_con_setrcache
  160: #define krb5_auth_con_getrcache  kssl_krb5_auth_con_getrcache
  161: #define krb5_get_server_rcache   kssl_krb5_get_server_rcache
  162: 
  163: /* Prototypes for built in stubs */
  164: void kssl_krb5_free_data_contents(krb5_context, krb5_data *);
  165: void kssl_krb5_free_principal(krb5_context, krb5_principal );
  166: krb5_error_code kssl_krb5_kt_resolve(krb5_context,
  167:                                      krb5_const char *,
  168:                                      krb5_keytab *);
  169: krb5_error_code kssl_krb5_kt_default(krb5_context,
  170:                                      krb5_keytab *);
  171: krb5_error_code kssl_krb5_free_ticket(krb5_context, krb5_ticket *);
  172: krb5_error_code kssl_krb5_rd_req(krb5_context, krb5_auth_context *, 
  173:                                  krb5_const krb5_data *,
  174:                                  krb5_const_principal, krb5_keytab, 
  175:                                  krb5_flags *,krb5_ticket **);
  176: 
  177: krb5_boolean kssl_krb5_principal_compare(krb5_context, krb5_const_principal,
  178:                                          krb5_const_principal);
  179: krb5_error_code kssl_krb5_mk_req_extended(krb5_context,
  180:                                           krb5_auth_context  *,
  181:                                           krb5_const krb5_flags,
  182:                                           krb5_data  *,
  183:                                           krb5_creds  *,
  184:                                           krb5_data  * );
  185: krb5_error_code kssl_krb5_init_context(krb5_context *);
  186: void kssl_krb5_free_context(krb5_context);
  187: krb5_error_code kssl_krb5_cc_default(krb5_context,krb5_ccache  *);
  188: krb5_error_code kssl_krb5_sname_to_principal(krb5_context,
  189:                                              krb5_const char  *,
  190:                                              krb5_const char  *,
  191:                                              krb5_int32,
  192:                                              krb5_principal  *);
  193: krb5_error_code kssl_krb5_get_credentials(krb5_context,
  194:                                           krb5_const krb5_flags,
  195:                                           krb5_ccache,
  196:                                           krb5_creds  *,
  197:                                           krb5_creds  *  *);
  198: krb5_error_code kssl_krb5_auth_con_init(krb5_context,
  199:                                         krb5_auth_context  *);
  200: krb5_error_code kssl_krb5_cc_get_principal(krb5_context context, 
  201:                                            krb5_ccache cache,
  202:                                            krb5_principal *principal);
  203: krb5_error_code kssl_krb5_auth_con_free(krb5_context,krb5_auth_context);
  204: size_t kssl_krb5_checksum_size(krb5_context context,krb5_cksumtype ctype);
  205: krb5_boolean kssl_valid_cksumtype(krb5_cksumtype ctype);
  206: krb5_error_code krb5_kt_free_entry(krb5_context,krb5_keytab_entry FAR * );
  207: krb5_error_code kssl_krb5_auth_con_setrcache(krb5_context, 
  208:                                              krb5_auth_context, 
  209:                                              krb5_rcache);
  210: krb5_error_code kssl_krb5_get_server_rcache(krb5_context, 
  211:                                             krb5_const krb5_data *,
  212:                                             krb5_rcache *);
  213: krb5_error_code kssl_krb5_auth_con_getrcache(krb5_context, 
  214:                                              krb5_auth_context,
  215:                                              krb5_rcache *);
  216: 
  217: /* Function pointers (almost all Kerberos functions are _stdcall) */
  218: static void (_stdcall *p_krb5_free_data_contents)(krb5_context, krb5_data *)
  219:         =NULL;
  220: static void (_stdcall *p_krb5_free_principal)(krb5_context, krb5_principal )
  221:         =NULL;
  222: static krb5_error_code(_stdcall *p_krb5_kt_resolve)
  223:                         (krb5_context, krb5_const char *, krb5_keytab *)=NULL;
  224: static krb5_error_code (_stdcall *p_krb5_kt_default)(krb5_context,
  225:                                                      krb5_keytab *)=NULL;
  226: static krb5_error_code (_stdcall *p_krb5_free_ticket)(krb5_context, 
  227:                                                       krb5_ticket *)=NULL;
  228: static krb5_error_code (_stdcall *p_krb5_rd_req)(krb5_context, 
  229:                                                  krb5_auth_context *, 
  230:                                                  krb5_const krb5_data *,
  231:                                                  krb5_const_principal, 
  232:                                                  krb5_keytab, krb5_flags *,
  233:                                                  krb5_ticket **)=NULL;
  234: static krb5_error_code (_stdcall *p_krb5_mk_req_extended)
  235:                         (krb5_context, krb5_auth_context *,
  236:                          krb5_const krb5_flags, krb5_data *, krb5_creds *,
  237:                          krb5_data * )=NULL;
  238: static krb5_error_code (_stdcall *p_krb5_init_context)(krb5_context *)=NULL;
  239: static void (_stdcall *p_krb5_free_context)(krb5_context)=NULL;
  240: static krb5_error_code (_stdcall *p_krb5_cc_default)(krb5_context,
  241:                                                      krb5_ccache  *)=NULL;
  242: static krb5_error_code (_stdcall *p_krb5_sname_to_principal)
  243:                         (krb5_context, krb5_const char *, krb5_const char *,
  244:                          krb5_int32, krb5_principal *)=NULL;
  245: static krb5_error_code (_stdcall *p_krb5_get_credentials)
  246:                         (krb5_context, krb5_const krb5_flags, krb5_ccache,
  247:                          krb5_creds *, krb5_creds **)=NULL;
  248: static krb5_error_code (_stdcall *p_krb5_auth_con_init)
  249:                         (krb5_context, krb5_auth_context *)=NULL;
  250: static krb5_error_code (_stdcall *p_krb5_cc_get_principal)
  251:                         (krb5_context context, krb5_ccache cache,
  252:                          krb5_principal *principal)=NULL;
  253: static krb5_error_code (_stdcall *p_krb5_auth_con_free)
  254:                         (krb5_context, krb5_auth_context)=NULL;
  255: static krb5_error_code (_stdcall *p_krb5_decrypt_tkt_part)
  256:                         (krb5_context, krb5_const krb5_keyblock *,
  257:                                            krb5_ticket *)=NULL;
  258: static krb5_error_code (_stdcall *p_krb5_timeofday)
  259:                         (krb5_context context, krb5_int32 *timeret)=NULL;
  260: static krb5_error_code (_stdcall *p_krb5_rc_default)
  261:                         (krb5_context context, krb5_rcache *rc)=NULL;
  262: static krb5_error_code (_stdcall *p_krb5_rc_initialize)
  263:                         (krb5_context context, krb5_rcache rc,
  264:                                      krb5_deltat lifespan)=NULL;
  265: static krb5_error_code (_stdcall *p_krb5_rc_get_lifespan)
  266:                         (krb5_context context, krb5_rcache rc,
  267:                                        krb5_deltat *lifespan)=NULL;
  268: static krb5_error_code (_stdcall *p_krb5_rc_destroy)
  269:                         (krb5_context context, krb5_rcache rc)=NULL;
  270: static krb5_boolean (_stdcall *p_krb5_principal_compare)
  271:                      (krb5_context, krb5_const_principal, krb5_const_principal)=NULL;
  272: static size_t (_stdcall *p_krb5_checksum_size)(krb5_context context,krb5_cksumtype ctype)=NULL;
  273: static krb5_boolean (_stdcall *p_valid_cksumtype)(krb5_cksumtype ctype)=NULL;
  274: static krb5_error_code (_stdcall *p_krb5_kt_free_entry)
  275:                         (krb5_context,krb5_keytab_entry * )=NULL;
  276: static krb5_error_code (_stdcall * p_krb5_auth_con_setrcache)(krb5_context, 
  277:                                                                krb5_auth_context, 
  278:                                                                krb5_rcache)=NULL;
  279: static krb5_error_code (_stdcall * p_krb5_get_server_rcache)(krb5_context, 
  280:                                                               krb5_const krb5_data *, 
  281:                                                               krb5_rcache *)=NULL;
  282: static krb5_error_code (* p_krb5_auth_con_getrcache)(krb5_context, 
  283:                                                       krb5_auth_context,
  284:                                                       krb5_rcache *)=NULL;
  285: static krb5_error_code (_stdcall * p_krb5_kt_close)(krb5_context context, 
  286:                                                     krb5_keytab keytab)=NULL;
  287: static krb5_error_code (_stdcall * p_krb5_kt_get_entry)(krb5_context context, 
  288:                                                         krb5_keytab keytab,
  289:                        krb5_const_principal principal, krb5_kvno vno,
  290:                        krb5_enctype enctype, krb5_keytab_entry *entry)=NULL;
  291: static int krb5_loaded = 0;     /* only attempt to initialize func ptrs once */
  292: 
  293: /* Function to Load the Kerberos 5 DLL and initialize function pointers */
  294: void
  295: load_krb5_dll(void)
  296:         {
  297:         HANDLE hKRB5_32;
  298:     
  299:         krb5_loaded++;
  300:         hKRB5_32 = LoadLibrary(TEXT("KRB5_32"));
  301:         if (!hKRB5_32)
  302:                 return;
  303: 
  304:         (FARPROC) p_krb5_free_data_contents =
  305:                 GetProcAddress( hKRB5_32, "krb5_free_data_contents" );
  306:         (FARPROC) p_krb5_free_context =
  307:                 GetProcAddress( hKRB5_32, "krb5_free_context" );
  308:         (FARPROC) p_krb5_auth_con_free =
  309:                 GetProcAddress( hKRB5_32, "krb5_auth_con_free" );
  310:         (FARPROC) p_krb5_free_principal =
  311:                 GetProcAddress( hKRB5_32, "krb5_free_principal" );
  312:         (FARPROC) p_krb5_mk_req_extended =
  313:                 GetProcAddress( hKRB5_32, "krb5_mk_req_extended" );
  314:         (FARPROC) p_krb5_get_credentials =
  315:                 GetProcAddress( hKRB5_32, "krb5_get_credentials" );
  316:         (FARPROC) p_krb5_cc_get_principal =
  317:                 GetProcAddress( hKRB5_32, "krb5_cc_get_principal" );
  318:         (FARPROC) p_krb5_cc_default =
  319:                 GetProcAddress( hKRB5_32, "krb5_cc_default" );
  320:         (FARPROC) p_krb5_sname_to_principal =
  321:                 GetProcAddress( hKRB5_32, "krb5_sname_to_principal" );
  322:         (FARPROC) p_krb5_init_context =
  323:                 GetProcAddress( hKRB5_32, "krb5_init_context" );
  324:         (FARPROC) p_krb5_free_ticket =
  325:                 GetProcAddress( hKRB5_32, "krb5_free_ticket" );
  326:         (FARPROC) p_krb5_rd_req =
  327:                 GetProcAddress( hKRB5_32, "krb5_rd_req" );
  328:         (FARPROC) p_krb5_principal_compare =
  329:                 GetProcAddress( hKRB5_32, "krb5_principal_compare" );
  330:         (FARPROC) p_krb5_decrypt_tkt_part =
  331:                 GetProcAddress( hKRB5_32, "krb5_decrypt_tkt_part" );
  332:         (FARPROC) p_krb5_timeofday =
  333:                 GetProcAddress( hKRB5_32, "krb5_timeofday" );
  334:         (FARPROC) p_krb5_rc_default =
  335:                 GetProcAddress( hKRB5_32, "krb5_rc_default" );
  336:         (FARPROC) p_krb5_rc_initialize =
  337:                 GetProcAddress( hKRB5_32, "krb5_rc_initialize" );
  338:         (FARPROC) p_krb5_rc_get_lifespan =
  339:                 GetProcAddress( hKRB5_32, "krb5_rc_get_lifespan" );
  340:         (FARPROC) p_krb5_rc_destroy =
  341:                 GetProcAddress( hKRB5_32, "krb5_rc_destroy" );
  342:         (FARPROC) p_krb5_kt_default =
  343:                 GetProcAddress( hKRB5_32, "krb5_kt_default" );
  344:         (FARPROC) p_krb5_kt_resolve =
  345:                 GetProcAddress( hKRB5_32, "krb5_kt_resolve" );
  346:         (FARPROC) p_krb5_auth_con_init =
  347:                 GetProcAddress( hKRB5_32, "krb5_auth_con_init" );
  348:         (FARPROC) p_valid_cksumtype =
  349:                 GetProcAddress( hKRB5_32, "valid_cksumtype" );
  350:         (FARPROC) p_krb5_checksum_size =
  351:                 GetProcAddress( hKRB5_32, "krb5_checksum_size" );
  352:         (FARPROC) p_krb5_kt_free_entry =
  353:                 GetProcAddress( hKRB5_32, "krb5_kt_free_entry" );
  354:         (FARPROC) p_krb5_auth_con_setrcache =
  355:                 GetProcAddress( hKRB5_32, "krb5_auth_con_setrcache" );
  356:         (FARPROC) p_krb5_get_server_rcache =
  357:                 GetProcAddress( hKRB5_32, "krb5_get_server_rcache" );
  358:         (FARPROC) p_krb5_auth_con_getrcache =
  359:                 GetProcAddress( hKRB5_32, "krb5_auth_con_getrcache" );
  360:         (FARPROC) p_krb5_kt_close =
  361:                 GetProcAddress( hKRB5_32, "krb5_kt_close" );
  362:         (FARPROC) p_krb5_kt_get_entry =
  363:                 GetProcAddress( hKRB5_32, "krb5_kt_get_entry" );
  364:         }
  365: 
  366: /* Stubs for each function to be dynamicly loaded */
  367: void
  368: kssl_krb5_free_data_contents(krb5_context CO, krb5_data  * data)
  369:         {
  370:         if (!krb5_loaded)
  371:                 load_krb5_dll();
  372: 
  373:         if ( p_krb5_free_data_contents )
  374:                 p_krb5_free_data_contents(CO,data);
  375:         }
  376: 
  377: krb5_error_code
  378: kssl_krb5_mk_req_extended (krb5_context CO,
  379:                           krb5_auth_context  * pACO,
  380:                           krb5_const krb5_flags F,
  381:                           krb5_data  * pD1,
  382:                           krb5_creds  * pC,
  383:                           krb5_data  * pD2)
  384:         {
  385:         if (!krb5_loaded)
  386:                 load_krb5_dll();
  387: 
  388:         if ( p_krb5_mk_req_extended )
  389:                 return(p_krb5_mk_req_extended(CO,pACO,F,pD1,pC,pD2));
  390:         else
  391:                 return KRB5KRB_ERR_GENERIC;
  392:         }
  393: krb5_error_code
  394: kssl_krb5_auth_con_init(krb5_context CO,
  395:                        krb5_auth_context  * pACO)
  396:         {
  397:         if (!krb5_loaded)
  398:                 load_krb5_dll();
  399: 
  400:         if ( p_krb5_auth_con_init )
  401:                 return(p_krb5_auth_con_init(CO,pACO));
  402:         else
  403:                 return KRB5KRB_ERR_GENERIC;
  404:         }
  405: krb5_error_code
  406: kssl_krb5_auth_con_free (krb5_context CO,
  407:                         krb5_auth_context ACO)
  408:         {
  409:         if (!krb5_loaded)
  410:                 load_krb5_dll();
  411: 
  412:         if ( p_krb5_auth_con_free )
  413:                 return(p_krb5_auth_con_free(CO,ACO));
  414:         else
  415:                 return KRB5KRB_ERR_GENERIC;
  416:         }
  417: krb5_error_code
  418: kssl_krb5_get_credentials(krb5_context CO,
  419:                          krb5_const krb5_flags F,
  420:                          krb5_ccache CC,
  421:                          krb5_creds  * pCR,
  422:                          krb5_creds  ** ppCR)
  423:         {
  424:         if (!krb5_loaded)
  425:                 load_krb5_dll();
  426: 
  427:         if ( p_krb5_get_credentials )
  428:                 return(p_krb5_get_credentials(CO,F,CC,pCR,ppCR));
  429:         else
  430:                 return KRB5KRB_ERR_GENERIC;
  431:         }
  432: krb5_error_code
  433: kssl_krb5_sname_to_principal(krb5_context CO,
  434:                             krb5_const char  * pC1,
  435:                             krb5_const char  * pC2,
  436:                             krb5_int32 I,
  437:                             krb5_principal  * pPR)
  438:         {
  439:         if (!krb5_loaded)
  440:                 load_krb5_dll();
  441: 
  442:         if ( p_krb5_sname_to_principal )
  443:                 return(p_krb5_sname_to_principal(CO,pC1,pC2,I,pPR));
  444:         else
  445:                 return KRB5KRB_ERR_GENERIC;
  446:         }
  447: 
  448: krb5_error_code
  449: kssl_krb5_cc_default(krb5_context CO,
  450:                     krb5_ccache  * pCC)
  451:         {
  452:         if (!krb5_loaded)
  453:                 load_krb5_dll();
  454: 
  455:         if ( p_krb5_cc_default )
  456:                 return(p_krb5_cc_default(CO,pCC));
  457:         else
  458:                 return KRB5KRB_ERR_GENERIC;
  459:         }
  460: 
  461: krb5_error_code
  462: kssl_krb5_init_context(krb5_context * pCO)
  463:         {
  464:         if (!krb5_loaded)
  465:                 load_krb5_dll();
  466: 
  467:         if ( p_krb5_init_context )
  468:                 return(p_krb5_init_context(pCO));
  469:         else
  470:                 return KRB5KRB_ERR_GENERIC;
  471:         }
  472: 
  473: void
  474: kssl_krb5_free_context(krb5_context CO)
  475:         {
  476:         if (!krb5_loaded)
  477:                 load_krb5_dll();
  478: 
  479:         if ( p_krb5_free_context )
  480:                 p_krb5_free_context(CO);
  481:         }
  482: 
  483: void
  484: kssl_krb5_free_principal(krb5_context c, krb5_principal p)
  485:         {
  486:         if (!krb5_loaded)
  487:                 load_krb5_dll();
  488: 
  489:         if ( p_krb5_free_principal )
  490:                 p_krb5_free_principal(c,p);
  491:         }
  492: 
  493: krb5_error_code
  494: kssl_krb5_kt_resolve(krb5_context con,
  495:                     krb5_const char * sz,
  496:                     krb5_keytab * kt)
  497:         {
  498:         if (!krb5_loaded)
  499:                 load_krb5_dll();
  500: 
  501:         if ( p_krb5_kt_resolve )
  502:                 return(p_krb5_kt_resolve(con,sz,kt));
  503:         else
  504:                 return KRB5KRB_ERR_GENERIC;
  505:         }
  506: 
  507: krb5_error_code
  508: kssl_krb5_kt_default(krb5_context con,
  509:                     krb5_keytab * kt)
  510:         {
  511:         if (!krb5_loaded)
  512:                 load_krb5_dll();
  513: 
  514:         if ( p_krb5_kt_default )
  515:                 return(p_krb5_kt_default(con,kt));
  516:         else
  517:                 return KRB5KRB_ERR_GENERIC;
  518:         }
  519: 
  520: krb5_error_code
  521: kssl_krb5_free_ticket(krb5_context con,
  522:                      krb5_ticket * kt)
  523:         {
  524:         if (!krb5_loaded)
  525:                 load_krb5_dll();
  526: 
  527:         if ( p_krb5_free_ticket )
  528:                 return(p_krb5_free_ticket(con,kt));
  529:         else
  530:                 return KRB5KRB_ERR_GENERIC;
  531:         }
  532: 
  533: krb5_error_code
  534: kssl_krb5_rd_req(krb5_context con, krb5_auth_context * pacon,
  535:                 krb5_const krb5_data * data,
  536:                 krb5_const_principal princ, krb5_keytab keytab,
  537:                 krb5_flags * flags, krb5_ticket ** pptkt)
  538:         {
  539:         if (!krb5_loaded)
  540:                 load_krb5_dll();
  541: 
  542:         if ( p_krb5_rd_req )
  543:                 return(p_krb5_rd_req(con,pacon,data,princ,keytab,flags,pptkt));
  544:         else
  545:                 return KRB5KRB_ERR_GENERIC;
  546:         }
  547: