From b5f654a2be67d476f20777aeb2190ad349a6f7e7 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Mon, 08 Mar 2010 09:57:42 -0500
Subject: [PATCH] Fixed the salt generation algorithm in remoting lib.

---
 interface/lib/classes/remoting_lib.inc.php |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/interface/lib/classes/remoting_lib.inc.php b/interface/lib/classes/remoting_lib.inc.php
index 565cad1..26153c4 100644
--- a/interface/lib/classes/remoting_lib.inc.php
+++ b/interface/lib/classes/remoting_lib.inc.php
@@ -492,8 +492,10 @@
                                                         $sql_insert_key .= "`$key`, ";
                                                         if($field['encryption'] == 'CRYPT') {
                                                                 $salt="$1$";
+																$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
 																for ($n=0;$n<8;$n++) {
-																	$salt.=chr(mt_rand(64,126));
+																	//$salt.=chr(mt_rand(64,126));
+																	$salt.=$base64_alphabet[mt_rand(0,63)];
 																}
 																$salt.="$";
 																// $salt = substr(md5(time()),0,2);
@@ -519,8 +521,10 @@
                                                 if($field['formtype'] == 'PASSWORD') {
 														if($field['encryption'] == 'CRYPT') {
                                                                 $salt="$1$";
+																$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
 																for ($n=0;$n<8;$n++) {
-																	$salt.=chr(mt_rand(64,126));
+																	//$salt.=chr(mt_rand(64,126));
+																	$salt.=$base64_alphabet[mt_rand(0,63)];
 																}
 																$salt.="$";
 																// $salt = substr(md5(time()),0,2);

--
Gitblit v1.9.1