summaryrefslogtreecommitdiffstats
path: root/etc/inc
diff options
context:
space:
mode:
authormgrooms <mgrooms@shrew.net>2009-03-15 00:31:55 +0000
committermgrooms <mgrooms@shrew.net>2009-03-15 00:39:19 +0000
commit0092b3bd47bdfa8b3bc24e140235e4693918ee46 (patch)
tree1618c52053505a6eb015e0a683fa5e95b2e1ecfc /etc/inc
parentd1d1e96136b30e0069474d8c204feca6c9e25985 (diff)
downloadpfsense-0092b3bd47bdfa8b3bc24e140235e4693918ee46.zip
pfsense-0092b3bd47bdfa8b3bc24e140235e4693918ee46.tar.gz
Modify captive portal to use centralized user management. The user manager has
been modified to include an account expiration option to support this service.
Diffstat (limited to 'etc/inc')
-rw-r--r--etc/inc/auth.inc20
-rw-r--r--etc/inc/config.inc26
-rw-r--r--etc/inc/globals.inc2
3 files changed, 43 insertions, 5 deletions
diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc
index ab04846..f45dbae 100644
--- a/etc/inc/auth.inc
+++ b/etc/inc/auth.inc
@@ -113,9 +113,21 @@ function local_backed($username, $passwd) {
if (!$user)
return false;
- $passwd = crypt($passwd, $user['password']);
+ if ($user['password'])
+ {
+ $passwd = crypt($passwd, $user['password']);
+ if ($passwd == $user['password'])
+ return true;
+ }
+
+ if ($user['md5-hash'])
+ {
+ $passwd = md5($passwd);
+ if ($passwd == $user['md5-hash'])
+ return true;
+ }
- return ($passwd == $user['password']);
+ return false;
}
function local_sync_accounts() {
@@ -366,7 +378,7 @@ function local_group_set($group, $reset = false) {
if($debug)
log_error("Running: {$cmd}");
- $fd = popen($cmd, "w");
+ $fd = popen($cmd, "w");
fwrite($fd, $user['password']);
pclose($fd);
@@ -882,4 +894,4 @@ function session_auth($backing) {
return true;
}
-?>
+?>
diff --git a/etc/inc/config.inc b/etc/inc/config.inc
index 7c8597e..026b90f 100644
--- a/etc/inc/config.inc
+++ b/etc/inc/config.inc
@@ -2217,6 +2217,32 @@ endif;
$config['version'] = "5.6";
}
+ /* Convert 5.6 -> 5.7 */
+ if ($config['version'] <= 5.6) {
+
+ /* migrate captivate portal to user manager */
+ if (is_array($config['captiveportal']['user'])) {
+ foreach($config['captiveportal']['user'] as $user) {
+ // avoid user conflicts
+ if ($config['system']['user'][$user['name']])
+ continue;
+ $user['scope'] = "user";
+ if (isset($user['expirationdate'])) {
+ $user['expires'] = $user['expirationdate'];
+ unset($user['expirationdate']);
+ }
+ if (isset($user['password'])) {
+ $user['md5-hash'] = $user['password'];
+ unset($user['password']);
+ }
+ $config['system']['user'][] = $user;
+ }
+ unset($config['captiveportal']['user']);
+ }
+
+ $config['version'] = "5.7";
+ }
+
$now = date("H:i:s");
log_error("Ended Configuration upgrade at $now");
diff --git a/etc/inc/globals.inc b/etc/inc/globals.inc
index 66632d9..c8ae12d 100644
--- a/etc/inc/globals.inc
+++ b/etc/inc/globals.inc
@@ -58,7 +58,7 @@ $g = array(
"product_website_footer" => "http://www.pfsense.org/?gui20",
"product_email" => "coreteam@pfsense.org",
"debug" => false,
- "latest_config" => "5.6",
+ "latest_config" => "5.7",
"nopkg_platforms" => array("cdrom"),
"minimum_ram_warning" => "115",
"minimum_ram_warning_text" => "128 megabytes",
OpenPOWER on IntegriCloud