Skip to Content.
Sympa Menu

cacert-devel - Patch Request Bug #1184

Subject: CAcert Code Development list.

List archive

Patch Request Bug #1184


Chronological Thread 
  • From: Benny Baumann <benbe AT cacert.org>
  • To: "critical-admin AT cacert.org" <critical-admin AT cacert.org>
  • Cc: cacert-devel AT lists.cacert.org, Michael Tänzer <michael.taenzer AT cacert.org>, Eva Stöwe <estoewe AT cacert.org>, Marcus Mängel <inopiae AT cacert.org>
  • Subject: Patch Request Bug #1184
  • Date: Tue, 15 Apr 2014 23:56:14 +0200

Hi folks,

We have a fix for https://bugs.cacert.org/view.php?id=1184
"hex2bin function"

The fix was reviewed by me (BenBE) and Michael Tänzer (NEOatNHNG). The
fix was reviewed by Eva Stöwe (katzazi) and Marcus Mängel (INOPIAE).

Find the patch attached to this mail. No update of the translations is
required.

Regards,
Benny Baumann
CAcert SoftWare Assessment Team
diff --git a/includes/general.php b/includes/general.php
index 5c61ec0..f36ccdf 100644
--- a/includes/general.php
+++ b/includes/general.php
@@ -506,7 +506,7 @@
 		return(0);
 	}
 
-	function hex2bin($data)
+	function gpg_hex2bin($data)
 	{
 		while(strstr($data, "\\x"))
 		{
diff --git a/scripts/gpgfillmissingemail.php b/scripts/gpgfillmissingemail.php
index f328876..39f9d8f 100644
--- a/scripts/gpgfillmissingemail.php
+++ b/scripts/gpgfillmissingemail.php
@@ -18,7 +18,7 @@
 	require_once("../includes/mysql.php"); //general.php");
 	//include "../includes/general.php";
 
-function hex2bin($data)
+function gpg_hex2bin($data)
 	{
 		while(strstr($data, "\\x"))
 		{
@@ -69,7 +69,7 @@ echo "Found:\n";
 				if (preg_match("/<([\w.-]*\@[\w.-]*)>/", $bits[9],$match)) 
 				{
                                   //echo "Found: ".$match[1];
-                                   $mail = trim(hex2bin($match[1]));
+                                   $mail = trim(gpg_hex2bin($match[1]));
 
 
 				echo "EMail: *$mail**\n";
diff --git a/www/gpg.php b/www/gpg.php
index 829bbcf..263c1d3 100644
--- a/www/gpg.php
+++ b/www/gpg.php
@@ -187,18 +187,18 @@ function verifyEmail($email)
 			// Name (Comment) <Email>
 			if(preg_match("/^([^\(\)\[@<>]+) \(([^\(\)@<>]*)\) <([\w=\/%.-]*\@[\w.-]*|[\w.-]*\![\w=\/%.-]*)>/",$bits[9],$matches))
 			{
-			  $name=trim(hex2bin($matches[1]));
+			  $name=trim(gpg_hex2bin($matches[1]));
 			  $nocomment=0;
-			  $comm=trim(hex2bin($matches[2]));
-			  $mail=trim(hex2bin($matches[3]));
+			  $comm=trim(gpg_hex2bin($matches[2]));
+			  $mail=trim(gpg_hex2bin($matches[3]));
 			}
 			// Name <EMail>
 			elseif(preg_match("/^([^\(\)\[@<>]+) <([\w=\/%.-]*\@[\w.-]*|[\w.-]*\![\w=\/%.-]*)>/",$bits[9],$matches))
 			{
-			  $name=trim(hex2bin($matches[1]));
+			  $name=trim(gpg_hex2bin($matches[1]));
 			  $nocomment=1;
 			  $comm="";
-			  $mail=trim(hex2bin($matches[2]));
+			  $mail=trim(gpg_hex2bin($matches[2]));
 			}
 			// Unrecognized format
 			else
@@ -357,13 +357,13 @@ function verifyEmail($email)
 					$pos = strlen($bits[9]);
 				}
 
-				$name = trim(hex2bin(trim(substr($bits[9], 0, $pos))));
+				$name = trim(gpg_hex2bin(trim(substr($bits[9], 0, $pos))));
 				$nameok=verifyName($name);
 				if($nocomment == 0)
 				{
 					$pos += 2;
 					$pos2 = strpos($bits[9], ")");
-					$comm = trim(hex2bin(trim(substr($bits[9], $pos, $pos2 - $pos))));
+					$comm = trim(gpg_hex2bin(trim(substr($bits[9], $pos, $pos2 - $pos))));
 					if($comm != "")
 						$comment[] = $comm;
 					$pos = $pos2 + 3;
@@ -374,7 +374,7 @@ function verifyEmail($email)
 				$mail="";
 				if (preg_match("/<([\w.-]*\@[\w.-]*)>/", $bits[9],$match)) {
 					//echo "Found: ".$match[1];
-					$mail = trim(hex2bin($match[1]));
+					$mail = trim(gpg_hex2bin($match[1]));
 				}
 				else
 				{

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature




Archive powered by MHonArc 2.6.18.

Top of Page