kerb_mit.c | kerb_mit.c | |||
---|---|---|---|---|
/* ======================================================================== | ||||
* Copyright 1988-2006 University of Washington | ||||
* | ||||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||||
* you may not use this file except in compliance with the License. | ||||
* You may obtain a copy of the License at | ||||
* | ||||
* http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | ||||
* | ||||
* ======================================================================== | ||||
*/ | ||||
/* | /* | |||
* Program: MIT Kerberos routines | * Program: MIT Kerberos routines | |||
* | * | |||
* Author: Mark Crispin | * Author: Mark Crispin | |||
* Networks and Distributed Computing | * Networks and Distributed Computing | |||
* Computing & Communications | * Computing & Communications | |||
* University of Washington | * University of Washington | |||
* Administration Building, AG-44 | * Administration Building, AG-44 | |||
* Seattle, WA 98195 | * Seattle, WA 98195 | |||
* Internet: MRC@CAC.Washington.EDU | * Internet: MRC@CAC.Washington.EDU | |||
* | * | |||
* Date: 4 March 2003 | * Date: 4 March 2003 | |||
* Last Edited: 17 October 2003 | * Last Edited: 30 August 2006 | |||
* | ||||
* The IMAP toolkit provided in this Distribution is | ||||
* Copyright 1988-2003 University of Washington. | ||||
* The full text of our legal notices is contained in the file called | ||||
* CPYRIGHT, included with this Distribution. | ||||
*/ | */ | |||
#define PROTOTYPE(x) x | #define PROTOTYPE(x) x | |||
#include <gssapi/gssapi_generic.h> | #include <gssapi/gssapi_generic.h> | |||
#include <gssapi/gssapi_krb5.h> | #include <gssapi/gssapi_krb5.h> | |||
long kerberos_server_valid (void); | long kerberos_server_valid (void); | |||
long kerberos_try_kinit (OM_uint32 error); | long kerberos_try_kinit (OM_uint32 error); | |||
char *kerberos_login (char *user,char *authuser,int argc,char *argv[]); | char *kerberos_login (char *user,char *authuser,int argc,char *argv[]); | |||
/* Kerberos server valid check | /* Kerberos server valid check | |||
* Returns: T if have keytab, NIL otherwise | * Returns: T if have keytab, NIL otherwise | |||
* | ||||
* Note that this routine will probably return T only if the process is roo | ||||
t. | ||||
* This is alright since the server is probably still root at this point. | ||||
*/ | */ | |||
long kerberos_server_valid () | long kerberos_server_valid () | |||
{ | { | |||
krb5_context ctx; | krb5_context ctx; | |||
krb5_keytab kt; | krb5_keytab kt; | |||
krb5_kt_cursor csr; | krb5_kt_cursor csr; | |||
long ret = NIL; | long ret = NIL; | |||
/* make a context */ | /* make a context */ | |||
if (!krb5_init_context (&ctx)) { | if (!krb5_init_context (&ctx)) { | |||
/* get default keytab */ | /* get default keytab */ | |||
if (!krb5_kt_default (ctx,&kt)) { | if (!krb5_kt_default (ctx,&kt)) { | |||
/* can do server if have good keytab */ | /* can do server if have good keytab */ | |||
if (!krb5_kt_start_seq_get (ctx,kt,&csr)) ret = LONGT; | if (!krb5_kt_start_seq_get (ctx,kt,&csr) && | |||
!krb5_kt_end_seq_get (ctx,kt,&csr)) ret = LONGT; | ||||
krb5_kt_close (ctx,kt); /* finished with keytab */ | krb5_kt_close (ctx,kt); /* finished with keytab */ | |||
} | } | |||
krb5_free_context (ctx); /* finished with context */ | krb5_free_context (ctx); /* finished with context */ | |||
} | } | |||
return ret; | return ret; | |||
} | } | |||
/* Kerberos check for missing or expired credentials | /* Kerberos check for missing or expired credentials | |||
* Returns: T if should suggest running kinit, NIL otherwise | * Returns: T if should suggest running kinit, NIL otherwise | |||
*/ | */ | |||
End of changes. 4 change blocks. | ||||
7 lines changed or deleted | 20 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |