From b9229952972e0379994b1df5d931f304679f1efd Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 06 Sep 2015 12:24:41 -0400
Subject: [PATCH] CS fixes
---
plugins/password/password.php | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/plugins/password/password.php b/plugins/password/password.php
index c184fe4..5ad5095 100644
--- a/plugins/password/password.php
+++ b/plugins/password/password.php
@@ -440,20 +440,24 @@
case 'sha256-crypt':
$rounds = (int) $rcmail->config->get('password_crypt_rounds');
- if ($rounds < 1000)
- $prefix = '$5$';
- else
- $prefix = '$5$rounds=' . $rounds . '$';
+ $prefix = '$5$';
+
+ if ($rounds > 1000) {
+ $prefix .= 'rounds=' . $rounds . '$';
+ }
+
$crypted = crypt($password, $prefix . self::random_salt(16));
$prefix = '{CRYPT}';
break;
case 'sha512-crypt':
$rounds = (int) $rcmail->config->get('password_crypt_rounds');
- if ($rounds < 1000)
- $prefix = '$6$';
- else
- $prefix = '$6$rounds=' . $rounds . '$';
+ $prefix = '$6$';
+
+ if ($rounds > 1000) {
+ $prefix .= 'rounds=' . $rounds . '$';
+ }
+
$crypted = crypt($password, $prefix . self::random_salt(16));
$prefix = '{CRYPT}';
break;
--
Gitblit v1.9.1