~ubuntu-branches/ubuntu/maverick/krb5/maverick

« back to all changes in this revision

Viewing changes to src/plugins/preauth/pkinit/pkinit_crypto_openssl.c

  • Committer: Bazaar Package Importer
  • Author(s): Sam Hartman
  • Date: 2009-05-07 16:16:34 UTC
  • mfrom: (13.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20090507161634-xqyk0s9na0le4flj
Tags: 1.7dfsg~beta1-4
When  decrypting the TGS response fails with the subkey, try with the
session key to work around Heimdal bug, Closes: #527353 

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
#include <unistd.h>
37
37
#include <dirent.h>
38
38
 
 
39
#include "k5-platform.h"
 
40
 
39
41
/*
40
42
 * Q: What is this SILLYDECRYPT stuff about?
41
43
 * A: When using the ActivCard Linux pkcs11 library (v2.0.1),
2257
2259
    unsigned char *p = NULL;
2258
2260
    ASN1_INTEGER *pub_key = NULL;
2259
2261
 
 
2262
    *dh_pubkey = *server_key = NULL;
 
2263
    *dh_pubkey_len = *server_key_len = 0;
 
2264
 
2260
2265
    /* get client's received DH parameters that we saved in server_check_dh */
2261
2266
    dh = cryptoctx->dh;
2262
2267
 
3198
3203
{
3199
3204
    krb5_data rdat;
3200
3205
    char *prompt;
 
3206
    const char *warning;
3201
3207
    krb5_prompt kprompt;
3202
3208
    krb5_prompt_type prompt_type;
3203
3209
    int r = 0;
3206
3212
        rdat.data = NULL;
3207
3213
        rdat.length = 0;
3208
3214
    } else {
3209
 
        if ((prompt = (char *) malloc(sizeof (tip->label) + 32)) == NULL)
3210
 
            return ENOMEM;
3211
 
        sprintf(prompt, "%.*s PIN", sizeof (tip->label), tip->label);
3212
3215
        if (tip->flags & CKF_USER_PIN_LOCKED)
3213
 
            strcat(prompt, " (Warning: PIN locked)");
 
3216
            warning = " (Warning: PIN locked)";
3214
3217
        else if (tip->flags & CKF_USER_PIN_FINAL_TRY)
3215
 
            strcat(prompt, " (Warning: PIN final try)");
 
3218
            warning = " (Warning: PIN final try)";
3216
3219
        else if (tip->flags & CKF_USER_PIN_COUNT_LOW)
3217
 
            strcat(prompt, " (Warning: PIN count low)");
 
3220
            warning = " (Warning: PIN count low)";
 
3221
        else
 
3222
            warning = "";
 
3223
        if (asprintf(&prompt, "%.*s PIN%s", (int) sizeof (tip->label),
 
3224
                     tip->label, warning) < 0)
 
3225
            return ENOMEM;
3218
3226
        rdat.data = (char *)malloc(tip->ulMaxPinLen + 2);
3219
3227
        rdat.length = tip->ulMaxPinLen + 1;
3220
3228
 
3736
3744
                 idopts->cert_filename, errno);
3737
3745
        goto cleanup;
3738
3746
    }
 
3747
    set_cloexec_file(fp);
3739
3748
 
3740
3749
    p12 = d2i_PKCS12_fp(fp, NULL);
3741
3750
    fclose(fp);
5607
5616
            break;
5608
5617
    if (pkcs11_errstrings[i].text != NULL)
5609
5618
        return (pkcs11_errstrings[i].text);
5610
 
    sprintf(uc, "unknown code 0x%x", err);
 
5619
    snprintf(uc, sizeof(uc), "unknown code 0x%x", err);
5611
5620
    return (uc);
5612
5621
}