Ticket #1286: patch

File patch, 2.3 KB (added by lvd2, 4 years ago)
  • src/openvpn/init.c

    diff --git a/src/openvpn/init.c b/src/openvpn/init.c
    index 70cd493a..c90c449d 100644
    a b context_init_1(struct context *c) 
    654654    if (c->first_time)
    655655    {
    656656        int i;
    657         pkcs11_initialize(true, c->options.pkcs11_pin_cache_period);
     657        pkcs11_initialize(true, c->options.pkcs11_pin_cache_period,c->options.key_pass_file);
    658658        for (i = 0; i<MAX_PARMS && c->options.pkcs11_providers[i] != NULL; i++)
    659659        {
    660660            pkcs11_addProvider(c->options.pkcs11_providers[i], c->options.pkcs11_protected_authentication[i],
  • src/openvpn/pkcs11.c

    diff --git a/src/openvpn/pkcs11.c b/src/openvpn/pkcs11.c
    index d40ca458..1b616a50 100644
    a b  
    3434#include <pkcs11-helper-1.0/pkcs11h-certificate.h>
    3535#include "basic.h"
    3636#include "error.h"
     37#include "options.h"
    3738#include "manage.h"
    3839#include "base64.h"
    3940#include "pkcs11.h"
    _pkcs11_openvpn_pin_prompt( 
    241242    struct user_pass token_pass;
    242243    char prompt[1024];
    243244
    244     (void)global_data;
     245//    (void)global_data;
    245246    (void)user_data;
    246247    (void)retry;
    247248
    _pkcs11_openvpn_pin_prompt( 
    255256    if (
    256257        !get_user_pass(
    257258            &token_pass,
    258             NULL,
     259            (const char *)global_data,
    259260            prompt,
    260261            GET_USER_PASS_MANAGEMENT|GET_USER_PASS_PASSWORD_ONLY|GET_USER_PASS_NOFATAL
    261262            )
    _pkcs11_openvpn_pin_prompt( 
    282283bool
    283284pkcs11_initialize(
    284285    const bool protected_auth,
    285     const int nPINCachePeriod
     286    const int nPINCachePeriod,
     287    const char * key_pass_file
    286288    )
    287289{
    288290    CK_RV rv = CKR_FUNCTION_FAILED;
    pkcs11_initialize( 
    324326        goto cleanup;
    325327    }
    326328
    327     if ((rv = pkcs11h_setPINPromptHook(_pkcs11_openvpn_pin_prompt, NULL)) != CKR_OK)
     329    if ((rv = pkcs11h_setPINPromptHook(_pkcs11_openvpn_pin_prompt, (void *)key_pass_file)) != CKR_OK)
    328330    {
    329331        msg(M_FATAL, "PKCS#11: Cannot set hooks %ld-'%s'", rv, pkcs11h_getMessage(rv));
    330332        goto cleanup;
  • src/openvpn/pkcs11.h

    diff --git a/src/openvpn/pkcs11.h b/src/openvpn/pkcs11.h
    index 66c6a7e1..8ffcaacf 100644
    a b  
    3131bool
    3232pkcs11_initialize(
    3333    const bool fProtectedAuthentication,
    34     const int nPINCachePeriod
     34    const int nPINCachePeriod,
     35    const char * key_pass_file
    3536    );
    3637
    3738void