From 86352459ab6a75866376bac5a3baa94f1a736909 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Sun, 31 May 2015 19:09:14 +0200 Subject: Allow for resetting the SSH public key 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 --- 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="", "", htmlspecialchars($E,ENT_QUOTES), ""); } } - 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, "; -- cgit v1.2.3-70-g09d2