This file is part of CAcert. CAcert has been released under the CAcert Source License which can be found included with these source files or can be downloaded from the internet from the following address: http://www.cacert.org/src-lic.php CAcert is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more details. */ ?>
/dev/null`;
		//echo "gpg says\n".htmlspecialchars($gpg);
		foreach (explode("\n", $gpg) as $line) {
			$bits = explode(":", $line);
			if ($bits[0] != "pub" && $bits[0] != "uid") {
				continue;
			}
			$nameRegEx = "/^(" 
				     . preg_quote($user['fname'], "/")
				     . "\s+("
				     . preg_quote($user['mname'], "/")
				     . "\s+)?"
				     . preg_quote($user['lname'], "/")
				     . "(\s+"
				     . preg_quote($user['suffix'], "/")
				     . ")?)?"
				     . "(\s*\(.*\))?"; // optional comment
			$match = false;
			if (preg_match($nameRegEx . "$/", $bits[9])) {
				// full name without email address
				$match = true;
			} else {
				foreach ($addrs as $addr) {
					$quotAddr =preg_quote("<".$addr[0].">",
							      "/");
					$match = $match
						 || preg_match($nameRegEx
							       . "\s+"
							       . $quotAddr
							       . "$/",
							       $bits[9]);
				}
			}
			if (!$match) {
				echo "gpg cert #" . $key[0] . "'s uid '"
				     . htmlspecialchars($bits[9])
				     . "' doesn't match user #"
				     . $key[1] . "'s name + addresses "
				     . htmlspecialchars($nameRegEx);
				foreach ($addrs as $addr) {
					echo "<".$addr[0].">";
				}
			}
		}
	}

?>