#define MAX_MSG_SIZE 256
#define MAX_MSPRINC_SIZE 1024
+static BOOL IsWindows2000 (void)
+{
+ static BOOL fChecked = FALSE;
+ static BOOL fIsWin2K = FALSE;
+
+ if (!fChecked)
+ {
+ OSVERSIONINFO Version;
+ fChecked = TRUE;
+
+ memset (&Version, 0x00, sizeof(Version));
+ Version.dwOSVersionInfoSize = sizeof(Version);
+
+ if (GetVersionEx (&Version))
+ {
+ if (Version.dwPlatformId == VER_PLATFORM_WIN32_NT &&
+ Version.dwMajorVersion >= 5)
+ fIsWin2K = TRUE;
+ }
+ }
+
+ return fIsWin2K;
+}
+
static VOID
ShowWinError(LPSTR szAPI, DWORD dwError)
{
ULONG PackageId;
KERB_EXTERNAL_TICKET *msticket;
+ if (!IsWindows2000())
+ return KRB5_FCC_NOFILE;
+
if (!IsKerberosLogon())
return KRB5_FCC_NOFILE;
static krb5_error_code KRB5_CALLCONV
krb5_lcc_initialize(krb5_context context, krb5_ccache id, krb5_principal princ)
{
+ if (!IsWindows2000())
+ return KRB5_FCC_NOFILE;
+
return KRB5_CC_READONLY;
}
krb5_lcc_close(krb5_context context, krb5_ccache id)
{
register int closeval = KRB5_OK;
- register krb5_lcc_data *data = (krb5_lcc_data *) id->data;
-
- CloseHandle(data->LogonHandle);
+ register krb5_lcc_data *data;
+
+ if (!IsWindows2000())
+ return KRB5_FCC_NOFILE;
- krb5_xfree(data);
- krb5_xfree(id);
+ if (id) {
+ data = (krb5_lcc_data *) id->data;
+ if (data) {
+ CloseHandle(data->LogonHandle);
+ krb5_xfree(data);
+ }
+ krb5_xfree(id);
+ }
return closeval;
}
static krb5_error_code KRB5_CALLCONV
krb5_lcc_destroy(krb5_context context, krb5_ccache id)
{
- register krb5_lcc_data *data = (krb5_lcc_data *) id->data;
+ register krb5_lcc_data *data;
+
+ if (!IsWindows2000())
+ return KRB5_FCC_NOFILE;
- return PurgeMSTGT(data->LogonHandle, data->PackageId) ? KRB5_FCC_INTERNAL : KRB5_OK;
+ if (id) {
+ data = (krb5_lcc_data *) id->data;
+
+ return PurgeMSTGT(data->LogonHandle, data->PackageId) ? KRB5_FCC_INTERNAL : KRB5_OK;
+ }
+ return KRB5_FCC_INTERNAL;
}
/*
krb5_lcc_data *data = (krb5_lcc_data *)id->data;
KERB_EXTERNAL_TICKET *msticket;
+ if (!IsWindows2000())
+ return KRB5_FCC_NOFILE;
+
lcursor = (krb5_lcc_cursor *) malloc(sizeof(krb5_lcc_cursor));
if (lcursor == NULL) {
*cursor = 0;
krb5_lcc_next_cred(krb5_context context, krb5_ccache id, krb5_cc_cursor *cursor, krb5_creds *creds)
{
krb5_lcc_cursor *lcursor = (krb5_lcc_cursor *) *cursor;
- krb5_lcc_data *data = (krb5_lcc_data *)id->data;
+ krb5_lcc_data *data;
KERB_EXTERNAL_TICKET *msticket;
krb5_error_code retval = KRB5_OK;
+ if (!IsWindows2000())
+ return KRB5_FCC_NOFILE;
+
+ data = (krb5_lcc_data *)id->data;
+
next_cred:
if ( lcursor->index >= lcursor->response->CountOfTickets ) {
if (retval == KRB5_OK)
{
krb5_lcc_cursor *lcursor = (krb5_lcc_cursor *) *cursor;
+ if (!IsWindows2000())
+ return KRB5_FCC_NOFILE;
+
if ( lcursor ) {
LsaFreeReturnBuffer(lcursor->mstgt);
LsaFreeReturnBuffer(lcursor->response);
static krb5_error_code KRB5_CALLCONV
krb5_lcc_generate_new (krb5_context context, krb5_ccache *id)
{
+ if (!IsWindows2000())
+ return KRB5_FCC_NOFILE;
+
return KRB5_CC_READONLY;
}
static const char * KRB5_CALLCONV
krb5_lcc_get_name (krb5_context context, krb5_ccache id)
{
+
+ if (!IsWindows2000())
+ return KRB5_FCC_NOFILE;
+
+ if ( !id )
+ return "";
+
return (char *) ((krb5_lcc_data *) id->data)->cc_name;
}
{
krb5_error_code kret = KRB5_OK;
+ if (!IsWindows2000())
+ return KRB5_FCC_NOFILE;
+
/* obtain principal */
return krb5_copy_principal(context, ((krb5_lcc_data *) id->data)->princ, princ);
}
krb5_creds * mcreds_noflags;
krb5_creds fetchcreds;
+ if (!IsWindows2000())
+ return KRB5_FCC_NOFILE;
+
memset(&fetchcreds, 0, sizeof(krb5_creds));
/* first try to find out if we have an existing ticket which meets the requirements */
KERB_EXTERNAL_TICKET *msticket = 0;
krb5_creds * creds_noflags;
+ if (!IsWindows2000())
+ return KRB5_FCC_NOFILE;
+
/* if not, we must try to get a ticket without specifying any flags or etypes */
krb5_copy_creds(context, creds, &creds_noflags);
creds_noflags->ticket_flags = 0;
krb5_lcc_remove_cred(krb5_context context, krb5_ccache cache, krb5_flags flags,
krb5_creds *creds)
{
+ if (!IsWindows2000())
+ return KRB5_FCC_NOFILE;
+
return KRB5_CC_READONLY;
}
static krb5_error_code KRB5_CALLCONV
krb5_lcc_set_flags(krb5_context context, krb5_ccache id, krb5_flags flags)
{
+ if (!IsWindows2000())
+ return KRB5_FCC_NOFILE;
+
return KRB5_OK;
}