Subject: CAcert Code Development list.
List archive
- From: "Malte S. Stretz" <mss AT apache.org>
- To: cacert-devel AT lists.cacert.org
- Subject: [PATCH] Allow shortened middle names for GPG signing
- Date: Fri, 21 May 2010 16:50:41 +0200
Hi,
I just tried to have my GPG key signed with CAcert and it was refused. The
issue was that I have entered my full middle name in CAcert, but prefer to
use
the abbreviated version in reality. There is a hack in the Wiki on how to
circumvent this, but thats suboptimal.
Here is a patch which makes verifyName() accept the most common abbreviated
version (ie.as I use it), too. This should be fine and isn't a regression
information wise as the code already accepts a key with "$fname $lname" even
if you have a $mname set.
As you can see I changed the whole function to use a loop over an array
instead of the repeated string concatenations. This makes it not only more
readable (I think), but also simpler to extend and simplifies the check for
the
suffix (which is allowed for all combinations).
Maybe the code here should be even more flexible, eg. people from some
countries (France?) seem to prefer to have their last name in upper cases, so
a case insensitive comparison might work better. Also, I noticed that while
suffixes are allowed, titles/prefixes aren't. Once I am "Dr. Malte S.
Stretz" I
will come back with another patch ;) For now the attached one should be fine.
Cheers,
Malte
diff -ur cacert.orig/www/gpg.php cacert/www/gpg.php --- cacert.orig/www/gpg.php 2010-03-29 21:40:34.000000000 +0200 +++ cacert/www/gpg.php 2010-05-21 16:33:13.149629732 +0200 @@ -60,13 +60,20 @@ function verifyName($name) { - if($name == "") return 0; - if($name == $_SESSION['profile']['fname']." ".$_SESSION['profile']['lname']) return 1; - if($name == $_SESSION['profile']['fname']." ".$_SESSION['profile']['mname']." ".$_SESSION['profile']['lname']) return 1; - if($name == $_SESSION['profile']['fname']." ".$_SESSION['profile']['lname']." ".$_SESSION['profile']['suffix']) return 1; - if($name == $_SESSION['profile']['fname']." ".$_SESSION['profile']['mname']." ".$_SESSION['profile']['lname']." ".$_SESSION['profile']['suffix']) return 1; + $fname = $_SESSION['profile']['fname']; + $mname = $_SESSION['profile']['mname']; + $lname = $_SESSION['profile']['lname']; + $suffx = $_SESSION['profile']['suffix']; + foreach(array( + array($fname, $lname), + array($fname, $mname, $lname), + array($fname, substr($mname, 0, 1).".", $lname) + ) as $n) { + $n = implode(" ", $n); + if($name == $n) return 1; + if($name == $n." ".$suffx) return 1; + } return 0; - } function verifyEmail($email)
Attachment:
signature.asc
Description: This is a digitally signed message part.
- [PATCH] Allow shortened middle names for GPG signing, Malte S. Stretz, 05/21/2010
- Re: [PATCH] Allow shortened middle names for GPG signing, Pieter van Emmerik, 05/21/2010
- Re: [PATCH] Allow shortened middle names for GPG signing, Malte S. Stretz, 05/21/2010
- Re: [PATCH] Allow shortened middle names for GPG signing, Ian G, 05/22/2010
- Re: [PATCH] Allow shortened middle names for GPG signing, Malte S. Stretz, 05/23/2010
- Re: [PATCH] Allow shortened middle names for GPG signing, Malte S. Stretz, 05/23/2010
- Re: [PATCH] Allow shortened middle names for GPG signing, Malte S. Stretz, 05/23/2010
- Re: [PATCH] Allow shortened middle names for GPG signing, Pieter van Emmerik, 05/21/2010
Archive powered by MHonArc 2.6.16.