Changeset 14404


Ignorieren:
Zeitstempel:
08.09.2017 07:37:16 (vor 3 Monaten)
Autor:
er13
Nachricht:

stunnel:

Ort:
trunk/make/stunnel
Dateien:
2 bearbeitet

Legende:

Unverändert
Hinzugefügt
Entfernt
  • trunk/make/stunnel/patches/boxcert/900-box_certificate.patch

    r14222 r14404  
    11--- src/ctx.c 
    22+++ src/ctx.c 
    3 @@ -720,16 +720,42 @@ 
     3@@ -720,16 +720,38 @@ 
    44     return 0; /* OK */ 
    55 } 
     
    77+#include <privatekeypassword/privatekeypassword.h> 
    88+ 
    9 +static 
    10 +int fritzbox_passwd_get_cb(char *buf, int size, int rwflag, void *userdata) { 
    11 +   (void)userdata; 
    12 +#ifdef CUSTOM_PRIVATEKEYPASSWORD_METHOD 
    13 +   getPrivateKeyPassword_setMethod(CUSTOM_PRIVATEKEYPASSWORD_METHOD); 
    14 +#endif 
    15 +   return getPrivateKeyPassword_OpenSSL_Callback(buf, size, rwflag, NULL); 
     9+NOEXPORT int fritzbox_passwd_get_cb(char *buf, int size, int rwflag, __attribute__((unused)) void *userdata) { 
     10+    return getPrivateKeyPassword_OpenSSL_Callback(buf, size, rwflag, NULL); 
    1611+} 
    1712+ 
    18 +static 
    19 +int is_fritzbox_key(const char *file_name) { 
     13+NOEXPORT int is_fritzbox_key(const char *file_name) { 
    2014+    struct stat sb; 
    21 +    if (!stat(file_name, &sb)) 
     15+ 
     16+    if (stat(file_name, &sb)) 
    2217+        return 0; 
    2318+    /* if it's a character device, assume it's the Fritz!OS private key file from TFFS */ 
     
    2621+ 
    2722 NOEXPORT int load_key_file(SERVICE_OPTIONS *section) { 
    28      int i, success; 
    29 +    int fritzbox_key=is_fritzbox_key(section->key); 
     23-    int i, success; 
     24+    int i, success, fritzbox_key; 
     25+ 
     26+    fritzbox_key=is_fritzbox_key(section->key); 
    3027  
    31      s_log(LOG_INFO, "Loading private key from file: %s", section->key); 
     28-    s_log(LOG_INFO, "Loading private key from file: %s", section->key); 
    3229-    if(file_permissions(section->key)) 
     30+    s_log(LOG_INFO, "Loading private%s key from file: %s", (fritzbox_key ? " FRITZ!Box" : ""), section->key); 
    3331+    if(!fritzbox_key && file_permissions(section->key)) 
    3432         return 1; /* FAILED */ 
     
    3634-    /* try the cached value first */ 
    3735     set_prompt(section->key); 
    38 +  if (fritzbox_key) { 
    39 +    /* read the Fritz!Box key */ 
    40 +    SSL_CTX_set_default_passwd_cb(section->ctx, fritzbox_passwd_get_cb); 
    41 +  } else { 
    42 +    /* try the cached value first */ 
    43      SSL_CTX_set_default_passwd_cb(section->ctx, cache_passwd_get_cb); 
    44 +  } 
     36-    SSL_CTX_set_default_passwd_cb(section->ctx, cache_passwd_get_cb); 
     37+    if (fritzbox_key) { 
     38+      /* read the Fritz!Box key */ 
     39+      SSL_CTX_set_default_passwd_cb(section->ctx, fritzbox_passwd_get_cb); 
     40+    } else { 
     41+      /* try the cached value first */ 
     42+      SSL_CTX_set_default_passwd_cb(section->ctx, cache_passwd_get_cb); 
     43+    } 
    4544     success=SSL_CTX_use_PrivateKey_file(section->ctx, section->key, 
    4645         SSL_FILETYPE_PEM); 
  • trunk/make/stunnel/stunnel.mk

    r14375 r14404  
    2929 
    3030ifeq ($(strip $(FREETZ_PACKAGE_STUNNEL_STATIC)),y) 
    31 $(PKG)_EXTRA_CFLAGS += -DCUSTOM_PRIVATEKEYPASSWORD_METHOD=PRIVATEKEYPASSWORD_METHOD_PROXY 
    3231$(PKG)_EXTRA_LDFLAGS += -all-static 
    3332$(PKG)_STATIC_LIBS += $(OPENSSL_LIBCRYPTO_EXTRA_LIBS) 
Hinweis: Hilfe zur Verwendung der Changeset-Ansicht finden Sie unter TracChangeset.