Adjust the generated session_id
authorNeutron Soutmun <neo.neutron@gmail.com>
Mon, 4 May 2009 01:24:31 +0000 (08:24 +0700)
committerNeutron Soutmun <neo.neutron@gmail.com>
Mon, 4 May 2009 01:24:31 +0000 (08:24 +0700)
[core]
2009-05-04  Neutron Soutmun <neo.neutron@gmail.com>

* +weblogin/ChangeLog: Fork the changelog for weblogin.

[weblogin]
2009-05-04  Neutron Soutmun <neo.neutron@gmail.com>

* rahu_radius.class.php:
  - Adjust the generated session_id to always be the same string length.

ChangeLog
weblogin/ChangeLog [new file with mode: 0644]
weblogin/rahu_radius.class.php

index 2429c22..044bca1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-05-04  Neutron Soutmun <neo.neutron@gmail.com>
+
+       * +weblogin/ChangeLog: Fork the changelog for weblogin.
+
 2009-04-30  Neutron Soutmun <neo.neutron@gmail.com>
 
        * tools/weblogin-config-update.sh.in: Add the updating table nas in database.
diff --git a/weblogin/ChangeLog b/weblogin/ChangeLog
new file mode 100644 (file)
index 0000000..4934c1e
--- /dev/null
@@ -0,0 +1,4 @@
+2009-05-04  Neutron Soutmun <neo.neutron@gmail.com>
+
+       * rahu_radius.class.php: 
+         - Adjust the generated session_id to always be the same string length.
index d49cbd1..a72db1c 100644 (file)
@@ -189,8 +189,11 @@ class rahu_radius_acct {
     $randno2 = rand(0,65535);
     $randno3 = rand(0,65535);
     $randno4 = rand(0,65535);
-    $randno = sprintf("%s%s%s%s", dechex($randno1), dechex($randno2),
-                                    dechex($randno3), dechex($randno4));
+    $randno = sprintf("%s%s%s%s", 
+                str_pad(dechex($randno1), 4, "0", STR_PAD_LEFT), 
+                str_pad(dechex($randno2), 4, "0", STR_PAD_LEFT), 
+                str_pad(dechex($randno3), 4, "0", STR_PAD_LEFT), 
+                str_pad(dechex($randno4), 4, "0", STR_PAD_LEFT));
     $this->session_id = $randno;
                                                      
     return $this->session_id;