[aur-dev] [PATCH 1/3] Allow for resetting the SSH public key

Lukas Fleischer lfleischer at archlinux.org
Sun May 31 17:32:26 UTC 2015


Use NULL instead of an empty string if the SSH public key field is left
empty. Additionally, do not check for duplicate keys in that case.

Fixes FS#45109.

Signed-off-by: Lukas Fleischer <lfleischer at archlinux.org>
---
 web/lib/acctfuncs.inc.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php
index 20ac081..993cd34 100644
--- a/web/lib/acctfuncs.inc.php
+++ b/web/lib/acctfuncs.inc.php
@@ -203,7 +203,7 @@ function process_account_form($TYPE,$A,$U="",$T="",$S="",$E="",$P="",$C="",
 					"<strong>", htmlspecialchars($E,ENT_QUOTES), "</strong>");
 		}
 	}
-	if (!$error) {
+	if (!$error && !empty($PK)) {
 		/*
 		 * Check whether the SSH public key is available.
 		 * TODO: Fix race condition.
@@ -247,7 +247,7 @@ function process_account_form($TYPE,$A,$U="",$T="",$S="",$E="",$P="",$C="",
 		$L = $dbh->quote($L);
 		$I = $dbh->quote($I);
 		$K = $dbh->quote(str_replace(" ", "", $K));
-		$PK = $dbh->quote($PK);
+		$PK = empty($PK) ? "NULL" : $dbh->quote($PK);
 		$q = "INSERT INTO Users (AccountTypeID, Suspended, ";
 		$q.= "InactivityTS, Username, Email, Passwd, Salt, ";
 		$q.= "RealName, LangPreference, IRCNick, PGPKey, ";
-- 
2.4.1


More information about the aur-dev mailing list