From c4ea5d1a1f1403d54f64c56724edb11c00b69ba3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Kr=C3=BCger?= Date: Wed, 30 Nov 2011 05:29:14 +0100 Subject: [PATCH] edituser.cgi: gracefully deal with invalid SSH keys MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Previously, we ignored errors while processing SSH key updates. Most importantly, this invalidated auth codes even if an invalid SSH key was submitted. Instead, fail early and re-display the update form. Signed-off-by: Jan Krüger --- cgi/edituser.cgi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cgi/edituser.cgi b/cgi/edituser.cgi index 835a7fa..7066575 100755 --- a/cgi/edituser.cgi +++ b/cgi/edituser.cgi @@ -101,12 +101,12 @@ EOT } # Auth valid, keys given -> save - if ($keys) { - $user->keys_fill($gcgi); - $user->del_auth; - $user->keys_save; - print "

Your SSH keys have been updated.

"; - exit; + if ($keys && $user->keys_fill($gcgi)) { + $user->del_auth; + $user->keys_save; + print "

Your SSH keys have been updated.

"; + exit; + } } # Otherwise pre-fill keys -- 2.11.4.GIT