From: "Carlos Soto" Date: Sun, 3 Oct 2010 20:56:06 +0200 Message-ID: <000001cb632c$a2bb8420$e8328c60$@soto@...1413...> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0001_01CB633D.66447B30" Content-Language: es Subject: [Openvpn-devel] Variable common_name can be blank in client-connect script List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: openvpn-devel@lists.sourceforge.net This is a multi-part message in MIME format. ------=_NextPart_000_0001_01CB633D.66447B30 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Author: Carlos Soto > Variable common_name can be blank in client-connect script If a server is configured with auth-user-pass-optional and username-as-common-name it is possible that the auth-user-pass-verify script will validate a connection with no username as it is optional. It that case the common_name becames blank and client-connect script may fail because it does not have a value for the common name. I think that the common name should never be blank so in cases where the username is blank and the username-as-common-name option is enabled, the common_name should keep its original value. diff --git a/ssl.c b/ssl.c index a1268ac..381ab07 100644 --- a/ssl.c +++ b/ssl.c @@ -3718,7 +3718,7 @@ key_method_2_read (struct buffer *buf, struct tls_multi *multi, struct tls_sessi if (man_def_auth != KMDA_UNDEF) ks->auth_deferred = true; #endif - if ((session->opt->ssl_flags & SSLF_USERNAME_AS_COMMON_NAME)) + if ((session->opt->ssl_flags & SSLF_USERNAME_AS_COMMON_NAME) && (strlen (up->username))) set_common_name (session, up->username); #ifdef ENABLE_DEF_AUTH msg (D_HANDSHAKE, "TLS: Username/Password authentication %s for username '%s' %s", ------=_NextPart_000_0001_01CB633D.66447B30 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Author: Carlos Soto &= lt;carlos.soto at terra.es>=

 

Variable= common_name can be blank in client-connect script

&nb= sp;

If a ser= ver is configured with auth-u= ser-pass-optional and username-as-common-name it is possible that the auth-user-pass-verify script will validate a connection with no username as it is optional. It th= at case the common_name becames blank and client-connect script may fail becau= se it does not have a value for the common name. I think that the common name should never be blank so in cases where the username is blank and the usern= ame-as-common-name option is enabled, the common_name should keep its original value.

&nb= sp;

&nb= sp;

diff --g= it a/ssl.c b/ssl.c

index a1268ac..381ab07 100644

--- a/ss= l.c

+++ b/ss= l.c

@@ -3718= ,7 +3718,7 @@ key_method_2_read (struct buffer *buf, struct tls_multi *multi, struct tls_sessi

 &n= bsp;        if (man_def_auth !=3D KMDA_UNDEF)

 &n= bsp;          ks->auth_deferred =3D true;

 #e= ndif

- &= nbsp;       if ((session->opt->ssl_flags & SSLF_USERNAME_AS_COMMON_NAME))

+ &= nbsp;       if ((session->opt->ssl_flags & SSLF_USERNAME_AS_COMMON_NAME) && (strlen (up->username)))

 &n= bsp;          set_common_name (session, up->username);

 #i= fdef ENABLE_DEF_AUTH

 &n= bsp;        msg (D_HANDSHAKE, "TLS: Username/Password authentication %s for userna= me '%s' %s",

&nb= sp;

&nb= sp;

------=_NextPart_000_0001_01CB633D.66447B30--