/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright 1995 by the Massachusetts Institute of Technology. All
* Rights Reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*
*/
/*
* This file contains routines for establishing, verifying, and any other
* necessary functions, for utilizing the pre-authentication field of the
*/
#include "k5-int.h"
#include <stdio.h>
#include <time.h>
/* some typedefs for the function args to make things look a bit cleaner */
const krb5_enctype,
krb5_data *,
krb5_keyblock **);
const krb5_keyblock *,
krb5_kdc_rep *);
static krb5_error_code obtain_enc_ts_padata(
krb5_pa_data *,
krb5_creds *,
krb5_kdc_req *,
krb5_pa_data **);
static krb5_error_code process_pw_salt(
krb5_pa_data *,
krb5_kdc_req *,
krb5_kdc_rep *,
krb5_keyblock **,
krb5_creds *,
krb5_int32 *,
krb5_int32 *);
static krb5_error_code obtain_sam_padata(
krb5_pa_data *,
krb5_creds *,
krb5_kdc_req *,
krb5_pa_data **);
{
0,
0,
},
{
0,
0,
},
{
0,
0,
},
{
0,
0,
},
{ KV5M_PREAUTH_OPS, -1 }
};
static krb5_error_code
krb5_error_code krb5_obtain_padata(krb5_context context, krb5_pa_data **preauth_to_use, git_key_proc key_proc, krb5_const_pointer key_seed, krb5_creds *creds, krb5_kdc_req *request)
{
int size;
int f_salt = 0;
if (preauth_to_use == NULL)
return 0;
/* XXX use the first one. Is there another way to disambiguate? */
if (etype_info)
continue;
if (retval)
return retval;
if (etype_info[0] == NULL) {
etype_info = NULL;
}
}
}
return ENOMEM;
*send_pa = 0;
if (etype_info) {
else
}
/*
* This will set the salt length
*/
goto cleanup;
f_salt = 1;
}
&def_enc_key)))
goto cleanup;
continue;
continue;
if (retval)
goto cleanup;
if (*send_pa)
send_pa++;
*send_pa = 0;
}
retval = 0;
if (send_pa_list[0]) {
send_pa_list = 0;
}
if (etype_info)
if (f_salt)
if (send_pa_list)
if (def_enc_key)
return retval;
}
krb5_process_padata(krb5_context context, krb5_kdc_req *request, krb5_kdc_rep *as_reply, git_key_proc key_proc, krb5_const_pointer keyseed, git_decrypt_proc decrypt_proc, krb5_keyblock **decrypt_key, krb5_creds *creds, krb5_int32 *do_more)
{
*do_more = 0; /* By default, we don't need to repeat... */
return 0;
continue;
continue;
if (retval)
goto cleanup;
if (done)
break;
}
return retval;
}
/*
* This routine is the "obtain" function for the ENC_TIMESTAMP
* preauthentication type. It take the current time and encrypts it
* in the user's key.
*/
static krb5_error_code
obtain_enc_ts_padata(krb5_context context, krb5_pa_data *in_padata, krb5_etype_info etype_info, krb5_keyblock *def_enc_key, git_key_proc key_proc, krb5_const_pointer key_seed, krb5_creds *creds, krb5_kdc_req *request, krb5_pa_data **out_padata)
{
if (retval)
return retval;
return retval;
goto cleanup;
scratch = 0;
goto cleanup;
goto cleanup;
}
*out_padata = pa;
scratch = 0;
retval = 0;
if (scratch)
return retval;
}
static krb5_error_code
process_pw_salt(krb5_context context, krb5_pa_data *padata, krb5_kdc_req *request, krb5_kdc_rep *as_reply, git_key_proc key_proc, krb5_const_pointer keyseed, git_decrypt_proc decrypt_proc, krb5_keyblock **decrypt_key, krb5_creds *creds, krb5_int32 *do_more, krb5_int32 *done)
{
if (*decrypt_key != 0)
return 0;
*decrypt_key = 0;
return retval;
}
return 0;
}
static krb5_error_code
{
ap++;
return(KRB5_PREAUTH_BAD_TYPE);
return 0;
}
extern const char *krb5_default_pwd_prompt1;
static krb5_error_code
sam_get_pass_from_user(krb5_context context, krb5_etype_info etype_info, git_key_proc key_proc, krb5_const_pointer key_seed, krb5_kdc_req *request, krb5_keyblock **new_enc_key, const char *prompt)
{
const char *oldprompt;
/* enctype = request->ktype[0]; */
/* hack with this first! */
{
/* we don't keep the new password, just the key... */
}
return retval;
}
static
{
/* or invalid -- but lets just handle presence now XXX */
case PA_SAM_TYPE_ENIGMA: /* Enigma Logic */
label = "Challenge for Enigma Logic mechanism";
break;
case PA_SAM_TYPE_DIGI_PATH: /* Digital Pathways */
case PA_SAM_TYPE_DIGI_PATH_HEX: /* Digital Pathways */
label = "Challenge for Digital Pathways mechanism";
break;
case PA_SAM_TYPE_ACTIVCARD_DEC: /* Digital Pathways */
case PA_SAM_TYPE_ACTIVCARD_HEX: /* Digital Pathways */
label = "Challenge for Activcard mechanism";
break;
case PA_SAM_TYPE_SKEY_K0: /* S/key where KDC has key 0 */
break;
case PA_SAM_TYPE_SKEY: /* Traditional S/Key */
break;
case PA_SAM_TYPE_SECURID: /* Security Dynamics */
label = "Challenge for Security Dynamics mechanism";
break;
case PA_SAM_TYPE_SECURID_PREDICT: /* predictive Security Dynamics */
label = "Challenge for Security Dynamics mechanism";
break;
}
prompt = "Passcode";
}
/* example:
Challenge for Digital Pathways mechanism: [134591]
Passcode:
*/
if (challenge_len) {
}
return krb5int_buf_data(&buf);
}
/*
* This routine is the "obtain" function for the SAM_CHALLENGE
* preauthentication type. It presents the challenge...
*/
static krb5_error_code
obtain_sam_padata(krb5_context context, krb5_pa_data *in_padata, krb5_etype_info etype_info, krb5_keyblock *def_enc_key, git_key_proc key_proc, krb5_const_pointer key_seed, krb5_creds *creds, krb5_kdc_req *request, krb5_pa_data **out_padata)
{
/* these two get encrypted and stuffed in to sam_response */
if (retval)
return retval;
goto cleanup;
}
if (!sam_challenge->sam_nonce) {
if (retval)
goto cleanup;
}
/* encrypt passcode in key by stuffing it here */
goto cleanup;
}
goto cleanup;
}
if (retval)
goto cleanup;
goto cleanup;
}
prompt);
if (retval)
goto cleanup;
} else {
/* what *was* it? */
goto cleanup;
}
/* so at this point, either sam_use_key is generated from the passcode
* or enc_sam_response_enc.sam_sad is set to it, and we use
* def_enc_key instead. */
/* encode the encoded part of the response */
&scratch)) != 0)
goto cleanup;
0, scratch,
goto cleanup;
scratch = 0;
/* sam_enc_key is reserved for future use */
/* copy things from the challenge */
goto cleanup;
goto cleanup;
}
*out_padata = pa;
retval = 0;
return retval;
}