remove trailing whitespace
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23815 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 1997 - 2008 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "krb5_locl.h"
|
||||
@@ -93,15 +93,15 @@ check_server_referral(krb5_context context,
|
||||
goto noreferral;
|
||||
|
||||
pa = krb5_find_padata(rep->kdc_rep.padata->val,
|
||||
rep->kdc_rep.padata->len,
|
||||
rep->kdc_rep.padata->len,
|
||||
KRB5_PADATA_SERVER_REFERRAL, &i);
|
||||
if (pa == NULL)
|
||||
goto noreferral;
|
||||
|
||||
memset(&ed, 0, sizeof(ed));
|
||||
memset(&ref, 0, sizeof(ref));
|
||||
|
||||
ret = decode_EncryptedData(pa->padata_value.data,
|
||||
|
||||
ret = decode_EncryptedData(pa->padata_value.data,
|
||||
pa->padata_value.length,
|
||||
&ed, &len);
|
||||
if (ret)
|
||||
@@ -113,13 +113,13 @@ check_server_referral(krb5_context context,
|
||||
"realm"), requested->realm);
|
||||
return KRB5KRB_AP_ERR_MODIFIED;
|
||||
}
|
||||
|
||||
|
||||
ret = krb5_crypto_init(context, key, 0, &session);
|
||||
if (ret) {
|
||||
free_EncryptedData(&ed);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
ret = krb5_decrypt_EncryptedData(context, session,
|
||||
KRB5_KU_PA_SERVER_REFERRAL,
|
||||
&ed, &data);
|
||||
@@ -127,14 +127,14 @@ check_server_referral(krb5_context context,
|
||||
krb5_crypto_destroy(context, session);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
||||
ret = decode_PA_ServerReferralData(data.data, data.length, &ref, &len);
|
||||
if (ret) {
|
||||
krb5_data_free(&data);
|
||||
return ret;
|
||||
}
|
||||
krb5_data_free(&data);
|
||||
|
||||
|
||||
if (strcmp(requested->realm, returned->realm) != 0) {
|
||||
free_PA_ServerReferralData(&ref);
|
||||
krb5_set_error_message(context, KRB5KRB_AP_ERR_MODIFIED,
|
||||
@@ -220,12 +220,12 @@ check_client_referral(krb5_context context,
|
||||
goto noreferral;
|
||||
|
||||
pa = krb5_find_padata(rep->kdc_rep.padata->val,
|
||||
rep->kdc_rep.padata->len,
|
||||
rep->kdc_rep.padata->len,
|
||||
KRB5_PADATA_CLIENT_CANONICALIZED, &i);
|
||||
if (pa == NULL)
|
||||
goto noreferral;
|
||||
|
||||
ret = decode_PA_ClientCanonicalized(pa->padata_value.data,
|
||||
ret = decode_PA_ClientCanonicalized(pa->padata_value.data,
|
||||
pa->padata_value.length,
|
||||
&canon, &len);
|
||||
if (ret) {
|
||||
@@ -234,7 +234,7 @@ check_client_referral(krb5_context context,
|
||||
"from realm %s", ""), requested->realm);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
ASN1_MALLOC_ENCODE(PA_ClientCanonicalizedNames, data.data, data.length,
|
||||
&canon.names, &len, ret);
|
||||
if (ret) {
|
||||
@@ -243,14 +243,14 @@ check_client_referral(krb5_context context,
|
||||
}
|
||||
if (data.length != len)
|
||||
krb5_abortx(context, "internal asn.1 error");
|
||||
|
||||
|
||||
ret = krb5_crypto_init(context, key, 0, &crypto);
|
||||
if (ret) {
|
||||
free(data.data);
|
||||
free_PA_ClientCanonicalized(&canon);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
ret = krb5_verify_checksum(context, crypto, KRB5_KU_CANONICALIZED_NAMES,
|
||||
data.data, data.length,
|
||||
&canon.canon_checksum);
|
||||
@@ -259,13 +259,13 @@ check_client_referral(krb5_context context,
|
||||
if (ret) {
|
||||
krb5_set_error_message(context, ret,
|
||||
N_("Failed to verify client canonicalized "
|
||||
"data from realm %s", ""),
|
||||
"data from realm %s", ""),
|
||||
requested->realm);
|
||||
free_PA_ClientCanonicalized(&canon);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!_krb5_principal_compare_PrincipalName(context,
|
||||
if (!_krb5_principal_compare_PrincipalName(context,
|
||||
requested,
|
||||
&canon.names.requested_name))
|
||||
{
|
||||
@@ -329,13 +329,13 @@ decrypt_tkt (krb5_context context,
|
||||
ret = krb5_decode_EncASRepPart(context,
|
||||
data.data,
|
||||
data.length,
|
||||
&dec_rep->enc_part,
|
||||
&dec_rep->enc_part,
|
||||
&size);
|
||||
if (ret)
|
||||
ret = krb5_decode_EncTGSRepPart(context,
|
||||
data.data,
|
||||
data.length,
|
||||
&dec_rep->enc_part,
|
||||
&dec_rep->enc_part,
|
||||
&size);
|
||||
krb5_data_free (&data);
|
||||
if (ret)
|
||||
@@ -366,7 +366,7 @@ _krb5_extract_ticket(krb5_context context,
|
||||
|
||||
if (decrypt_proc == NULL)
|
||||
decrypt_proc = decrypt_tkt;
|
||||
|
||||
|
||||
ret = (*decrypt_proc)(context, key, key_usage, decryptarg, rep);
|
||||
if (ret)
|
||||
goto out;
|
||||
@@ -416,7 +416,7 @@ _krb5_extract_ticket(krb5_context context,
|
||||
goto out;
|
||||
if((flags & EXTRACT_TICKET_ALLOW_SERVER_MISMATCH) == 0){
|
||||
ret = check_server_referral(context,
|
||||
rep,
|
||||
rep,
|
||||
flags,
|
||||
creds->server,
|
||||
tmp_principal,
|
||||
@@ -524,12 +524,12 @@ _krb5_extract_ticket(krb5_context context,
|
||||
creds->addresses.val = NULL;
|
||||
}
|
||||
creds->flags.b = rep->enc_part.flags;
|
||||
|
||||
|
||||
creds->authdata.len = 0;
|
||||
creds->authdata.val = NULL;
|
||||
|
||||
/* extract ticket */
|
||||
ASN1_MALLOC_ENCODE(Ticket, creds->ticket.data, creds->ticket.length,
|
||||
ASN1_MALLOC_ENCODE(Ticket, creds->ticket.data, creds->ticket.length,
|
||||
&rep->kdc_rep.ticket, &len, ret);
|
||||
if(ret)
|
||||
goto out;
|
||||
@@ -547,7 +547,7 @@ out:
|
||||
|
||||
|
||||
static krb5_error_code
|
||||
make_pa_enc_timestamp(krb5_context context, PA_DATA *pa,
|
||||
make_pa_enc_timestamp(krb5_context context, PA_DATA *pa,
|
||||
krb5_enctype etype, krb5_keyblock *key)
|
||||
{
|
||||
PA_ENC_TS_ENC p;
|
||||
@@ -559,7 +559,7 @@ make_pa_enc_timestamp(krb5_context context, PA_DATA *pa,
|
||||
int32_t usec;
|
||||
int usec2;
|
||||
krb5_crypto crypto;
|
||||
|
||||
|
||||
krb5_us_timeofday (context, &p.patimestamp, &usec);
|
||||
usec2 = usec;
|
||||
p.pausec = &usec2;
|
||||
@@ -574,7 +574,7 @@ make_pa_enc_timestamp(krb5_context context, PA_DATA *pa,
|
||||
free(buf);
|
||||
return ret;
|
||||
}
|
||||
ret = krb5_encrypt_EncryptedData(context,
|
||||
ret = krb5_encrypt_EncryptedData(context,
|
||||
crypto,
|
||||
KRB5_KU_PA_ENC_TIMESTAMP,
|
||||
buf,
|
||||
@@ -585,7 +585,7 @@ make_pa_enc_timestamp(krb5_context context, PA_DATA *pa,
|
||||
krb5_crypto_destroy(context, crypto);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
||||
ASN1_MALLOC_ENCODE(EncryptedData, buf, buf_size, &encdata, &len, ret);
|
||||
free_EncryptedData(&encdata);
|
||||
if (ret)
|
||||
@@ -600,7 +600,7 @@ make_pa_enc_timestamp(krb5_context context, PA_DATA *pa,
|
||||
|
||||
static krb5_error_code
|
||||
add_padata(krb5_context context,
|
||||
METHOD_DATA *md,
|
||||
METHOD_DATA *md,
|
||||
krb5_principal client,
|
||||
krb5_key_proc key_proc,
|
||||
krb5_const_pointer keyseed,
|
||||
@@ -613,7 +613,7 @@ add_padata(krb5_context context,
|
||||
krb5_salt salt2;
|
||||
krb5_enctype *ep;
|
||||
int i;
|
||||
|
||||
|
||||
if(salt == NULL) {
|
||||
/* default to standard salt */
|
||||
ret = krb5_get_pw_salt (context, client, &salt2);
|
||||
@@ -780,8 +780,8 @@ init_as_req (krb5_context context,
|
||||
sp = NULL;
|
||||
else
|
||||
krb5_data_zero(&salt.saltvalue);
|
||||
ret = add_padata(context, a->padata, creds->client,
|
||||
key_proc, keyseed,
|
||||
ret = add_padata(context, a->padata, creds->client,
|
||||
key_proc, keyseed,
|
||||
&preauth->val[i].info.val[j].etype, 1,
|
||||
sp);
|
||||
if (ret == 0)
|
||||
@@ -789,7 +789,7 @@ init_as_req (krb5_context context,
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
} else
|
||||
/* not sure this is the way to use `ptypes' */
|
||||
if (ptypes == NULL || *ptypes == KRB5_PADATA_NONE)
|
||||
a->padata = NULL;
|
||||
@@ -804,14 +804,14 @@ init_as_req (krb5_context context,
|
||||
a->padata->val = NULL;
|
||||
|
||||
/* make a v5 salted pa-data */
|
||||
add_padata(context, a->padata, creds->client,
|
||||
add_padata(context, a->padata, creds->client,
|
||||
key_proc, keyseed, a->req_body.etype.val,
|
||||
a->req_body.etype.len, NULL);
|
||||
|
||||
/* make a v4 salted pa-data */
|
||||
salt.salttype = KRB5_PW_SALT;
|
||||
krb5_data_zero(&salt.saltvalue);
|
||||
add_padata(context, a->padata, creds->client,
|
||||
add_padata(context, a->padata, creds->client,
|
||||
key_proc, keyseed, a->req_body.etype.val,
|
||||
a->req_body.etype.len, &salt);
|
||||
} else {
|
||||
@@ -829,7 +829,7 @@ fail:
|
||||
|
||||
static int
|
||||
set_ptypes(krb5_context context,
|
||||
KRB_ERROR *error,
|
||||
KRB_ERROR *error,
|
||||
const krb5_preauthtype **ptypes,
|
||||
krb5_preauthdata **preauth)
|
||||
{
|
||||
@@ -839,9 +839,9 @@ set_ptypes(krb5_context context,
|
||||
if(error->e_data) {
|
||||
METHOD_DATA md;
|
||||
int i;
|
||||
decode_METHOD_DATA(error->e_data->data,
|
||||
error->e_data->length,
|
||||
&md,
|
||||
decode_METHOD_DATA(error->e_data->data,
|
||||
error->e_data->length,
|
||||
&md,
|
||||
NULL);
|
||||
for(i = 0; i < md.len; i++){
|
||||
switch(md.val[i].padata_type){
|
||||
@@ -853,7 +853,7 @@ set_ptypes(krb5_context context,
|
||||
ALLOC_SEQ(*preauth, 1);
|
||||
(*preauth)->val[0].type = KRB5_PADATA_ENC_TIMESTAMP;
|
||||
krb5_decode_ETYPE_INFO(context,
|
||||
md.val[i].padata_value.data,
|
||||
md.val[i].padata_value.data,
|
||||
md.val[i].padata_value.length,
|
||||
&(*preauth)->val[0].info,
|
||||
NULL);
|
||||
@@ -973,17 +973,17 @@ krb5_get_in_cred(krb5_context context,
|
||||
}
|
||||
krb5_data_free(&resp);
|
||||
} while(!done);
|
||||
|
||||
|
||||
pa = NULL;
|
||||
etype = rep.kdc_rep.enc_part.etype;
|
||||
if(rep.kdc_rep.padata){
|
||||
int i = 0;
|
||||
pa = krb5_find_padata(rep.kdc_rep.padata->val, rep.kdc_rep.padata->len,
|
||||
pa = krb5_find_padata(rep.kdc_rep.padata->val, rep.kdc_rep.padata->len,
|
||||
KRB5_PADATA_PW_SALT, &i);
|
||||
if(pa == NULL) {
|
||||
i = 0;
|
||||
pa = krb5_find_padata(rep.kdc_rep.padata->val,
|
||||
rep.kdc_rep.padata->len,
|
||||
pa = krb5_find_padata(rep.kdc_rep.padata->val,
|
||||
rep.kdc_rep.padata->len,
|
||||
KRB5_PADATA_AFS3_SALT, &i);
|
||||
}
|
||||
}
|
||||
@@ -1009,16 +1009,16 @@ krb5_get_in_cred(krb5_context context,
|
||||
if (opts.request_anonymous)
|
||||
flags |= EXTRACT_TICKET_ALLOW_SERVER_MISMATCH;
|
||||
|
||||
ret = _krb5_extract_ticket(context,
|
||||
&rep,
|
||||
creds,
|
||||
key,
|
||||
keyseed,
|
||||
ret = _krb5_extract_ticket(context,
|
||||
&rep,
|
||||
creds,
|
||||
key,
|
||||
keyseed,
|
||||
KRB5_KU_AS_REP_ENC_PART,
|
||||
NULL,
|
||||
nonce,
|
||||
NULL,
|
||||
nonce,
|
||||
flags,
|
||||
decrypt_proc,
|
||||
decrypt_proc,
|
||||
decryptarg);
|
||||
}
|
||||
memset (key->keyvalue.data, 0, key->keyvalue.length);
|
||||
@@ -1048,7 +1048,7 @@ krb5_get_in_tkt(krb5_context context,
|
||||
krb5_kdc_rep *ret_as_reply)
|
||||
{
|
||||
krb5_error_code ret;
|
||||
|
||||
|
||||
ret = krb5_get_in_cred (context,
|
||||
options,
|
||||
addrs,
|
||||
@@ -1061,7 +1061,7 @@ krb5_get_in_tkt(krb5_context context,
|
||||
decryptarg,
|
||||
creds,
|
||||
ret_as_reply);
|
||||
if(ret)
|
||||
if(ret)
|
||||
return ret;
|
||||
if (ccache)
|
||||
ret = krb5_cc_store_cred (context, ccache, creds);
|
||||
|
Reference in New Issue
Block a user