summaryrefslogtreecommitdiffstats
path: root/etc/inc/auth.inc
diff options
context:
space:
mode:
authorCarlos Eduardo Ramos <carlos.ramos@bluepex.com>2010-08-13 16:23:37 -0300
committerCarlos Eduardo Ramos <carlos.ramos@bluepex.com>2010-08-13 16:23:56 -0300
commit940214048fa9582a560caefe44973a183beee009 (patch)
treecfa8f2a50b643ee15b17acb6196b84208c42b6f8 /etc/inc/auth.inc
parent5086278bc289cc5ea377f56d9113e01ca5a529d8 (diff)
downloadpfsense-940214048fa9582a560caefe44973a183beee009.zip
pfsense-940214048fa9582a560caefe44973a183beee009.tar.gz
Implement gettext() calls on auth.inc
Diffstat (limited to 'etc/inc/auth.inc')
-rw-r--r--etc/inc/auth.inc72
1 files changed, 36 insertions, 36 deletions
diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc
index f85f897..77e4aa5 100644
--- a/etc/inc/auth.inc
+++ b/etc/inc/auth.inc
@@ -81,7 +81,7 @@ if (function_exists("display_error_form") && !isset($config['system']['webgui'][
$found_host = true;
if($found_host == false) {
- display_error_form("501", "Potential DNS Rebind attack detected, see http://en.wikipedia.org/wiki/DNS_rebinding");
+ display_error_form("501", gettext("Potential DNS Rebind attack detected, see http://en.wikipedia.org/wiki/DNS_rebinding"));
exit;
}
}
@@ -225,7 +225,7 @@ function local_sync_accounts() {
continue;
$cmd = "/usr/sbin/pw userdel {$line[2]}";
if($debug)
- log_error("Running: {$cmd}");
+ log_error(sprintf(gettext("Running: %s"), $cmd));
mwexec($cmd);
}
pclose($fd);
@@ -245,7 +245,7 @@ function local_sync_accounts() {
continue;
$cmd = "/usr/sbin/pw groupdel {$line[2]}";
if($debug)
- log_error("Running: {$cmd}");
+ log_error(sprintf(gettext("Running: %s"), $cmd));
mwexec($cmd);
}
pclose($fd);
@@ -309,7 +309,7 @@ function local_user_set(& $user) {
if ($user_uid == 0) {
$cmd = "/usr/sbin/pw usermod -q -n root -s /bin/sh -H 0";
if($debug)
- log_error("Running: {$cmd}");
+ log_error(sprintf(gettext("Running: %s"), $cmd));
$fd = popen($cmd, "w");
fwrite($fd, $user['password']);
pclose($fd);
@@ -336,7 +336,7 @@ function local_user_set(& $user) {
" -c ".escapeshellarg($user['fullname'])." -H 0 2>&1";
if($debug)
- log_error("Running: {$cmd}");
+ log_error(sprintf(gettext("Running: %s"), $cmd));
$fd = popen($cmd, "w");
fwrite($fd, $user['password']);
pclose($fd);
@@ -380,7 +380,7 @@ function local_user_del($user) {
$cmd = "/usr/sbin/pw userdel {$user['name']} {$rmhome}";
if($debug)
- log_error("Running: {$cmd}");
+ log_error(sprintf(gettext("Running: %s"), $cmd));
mwexec($cmd);
/* Delete user from groups needs a call to write_config() */
@@ -507,7 +507,7 @@ function local_group_set($group, $reset = false) {
$cmd = "/usr/sbin/pw {$group_op} {$group_name} -g {$group_gid} -M {$group_members} 2>&1";
if($debug)
- log_error("Running: {$cmd}");
+ log_error(sprintf(gettext("Running: %s"), $cmd));
mwexec($cmd);
}
@@ -519,7 +519,7 @@ function local_group_del($group) {
$cmd = "/usr/sbin/pw groupdel {$group['name']}";
if($debug)
- log_error("Running: {$cmd}");
+ log_error(sprintf(gettext("Running: %s"), $cmd));
mwexec($cmd);
}
@@ -553,7 +553,7 @@ function ldap_test_connection($authcfg) {
$error = true;
if ($error == true) {
- log_error("ERROR! Could not connect to server {$ldapname}.");
+ log_error(sprintf(gettext("ERROR! Could not connect to server %s."), $ldapname));
return false;
}
@@ -595,7 +595,7 @@ function ldap_test_bind($authcfg) {
$error = true;
if ($error == true) {
- log_error("ERROR! Could not connect to server {$ldapname}.");
+ log_error(sprintf(gettext("ERROR! Could not connect to server %s."), $ldapname));
return false;
}
@@ -648,7 +648,7 @@ function ldap_get_user_ous($show_complete_ou=true, $authcfg) {
/* first check if there is even an LDAP server populated */
if(!$ldapserver) {
- log_error("ERROR! ldap_get_user_ous() backed selected with no LDAP authentication server defined.");
+ log_error(gettext("ERROR! ldap_get_user_ous() backed selected with no LDAP authentication server defined."));
return $ous;
}
@@ -662,7 +662,7 @@ function ldap_get_user_ous($show_complete_ou=true, $authcfg) {
$error = true;
if ($error == true) {
- log_error("ERROR! Could not connect to server {$ldapname}.");
+ log_error(sprintf(gettext("ERROR! Could not connect to server %s."), $ldapname));
return $ous;
}
@@ -673,12 +673,12 @@ function ldap_get_user_ous($show_complete_ou=true, $authcfg) {
if ($ldapanon == true) {
if (!($res = @ldap_bind($ldap))) {
- log_error("ERROR! ldap_get_user_ous() could not bind anonymously to server {$ldapname}.");
+ log_error(sprintf(gettext("ERROR! ldap_get_user_ous() could not bind anonymously to server %s."), $ldapname));
@ldap_close($ldap);
return $ous;
}
} else if (!($res = @ldap_bind($ldap, $ldapbindun, $ldapbindpw))) {
- log_error("ERROR! ldap_get_user_ous() could not bind to server {$ldapname}.");
+ log_error(sprintf(gettext("ERROR! ldap_get_user_ous() could not bind to server %s."), $ldapname));
@ldap_close($ldap);
return $ous;
}
@@ -773,7 +773,7 @@ function ldap_get_groups($username, $authcfg) {
$error = true;
if ($error == true) {
- log_error("ERROR! ldap_get_groups() Could not connect to server {$ldapname}.");
+ log_error(sprintf(gettext("ERROR! ldap_get_groups() Could not connect to server %s."), $ldapname));
return memberof;
}
@@ -783,12 +783,12 @@ function ldap_get_groups($username, $authcfg) {
/* bind as user that has rights to read group attributes */
if ($ldapanon == true) {
if (!($res = @ldap_bind($ldap))) {
- log_error("ERROR! ldap_get_groups() could not bind anonymously to server {$ldapname}.");
+ log_error(sprintf(gettext("ERROR! ldap_get_groups() could not bind anonymously to server %s."), $ldapname));
@ldap_close($ldap);
return false;
}
} else if (!($res = @ldap_bind($ldap, $ldapbindun, $ldapbindpw))) {
- log_error("ERROR! ldap_get_groups() could not bind to server {$ldapname}.");
+ log_error(sprintf(gettext("ERROR! ldap_get_groups() could not bind to server %s."), $ldapname));
@ldap_close($ldap);
return memberof;
}
@@ -872,10 +872,10 @@ function ldap_backed($username, $passwd, $authcfg) {
/* first check if there is even an LDAP server populated */
if(!$ldapserver) {
if ($ldapfallback) {
- log_error("ERROR! ldap_backed() called with no LDAP authentication server defined. Defaulting to local user database. Visit System -> User Manager.");
+ log_error(gettext("ERROR! ldap_backed() called with no LDAP authentication server defined. Defaulting to local user database. Visit System -> User Manager."));
return local_backed($username, $passwd);
} else
- log_error("ERROR! ldap_backed() called with no LDAP authentication server defined.");
+ log_error(gettext("ERROR! ldap_backed() called with no LDAP authentication server defined."));
return false;
}
@@ -893,7 +893,7 @@ function ldap_backed($username, $passwd, $authcfg) {
$error = true;
if ($error == true) {
- log_error("ERROR! Could not connect to server {$ldapname}.");
+ log_error(sprintf(gettext("ERROR! Could not connect to server %s."), $ldapname));
return false;
}
@@ -907,7 +907,7 @@ function ldap_backed($username, $passwd, $authcfg) {
if ($error == true) {
@ldap_close($ldap);
- log_error("ERROR! Could not bind to server {$ldapname}.");
+ log_error(sprintf(gettext("ERROR! Could not bind to server %s."), $ldapname));
return false;
}
@@ -924,11 +924,11 @@ function ldap_backed($username, $passwd, $authcfg) {
/* Person. To later be used by ldap_get_groups. */
/* that way we don't have to search twice. */
/*****************************************************************/
- log_error("Now Searching for {$username} in directory.");
+ log_error(sprintf(gettext("Now Searching for %s in directory."), $username));
/* Iterate through the user containers for search */
foreach ($ldac_splits as $i => $ldac_split) {
/* Make sure we just use the first user we find */
- log_error("Now Searching in server {$ldapname}, container {$ldac_split} with filter {$ldapfilter}.");
+ log_error(sprintf(gettext("Now Searching in server %s, container %s with filter %s."), $ldapname, $ldac_split, $ldapfilter));
if ($ldapscope == "one")
$ldapfunc = "ldap_list";
else
@@ -939,7 +939,7 @@ function ldap_backed($username, $passwd, $authcfg) {
else
$search = @$ldapfunc($ldap,"{$ldac_split},{$ldapbasedn}",$ldapfilter);
if (!$search) {
- log_error("Search resulted in error: " . ldap_error($ldap));
+ log_error(sprintf(gettext("Search resulted in error: %s"), ldap_error($ldap)));
continue;
}
$info = ldap_get_entries($ldap,$search);
@@ -955,18 +955,18 @@ function ldap_backed($username, $passwd, $authcfg) {
if ($usercount != 1){
@ldap_unbind($ldap);
- log_error("ERROR! Either LDAP search failed, or multiple users were found.");
+ log_error(gettext("ERROR! Either LDAP search failed, or multiple users were found."));
return false;
}
/* Now lets bind as the user we found */
if (!($res = @ldap_bind($ldap, $userdn, $passwd))) {
- log_error("ERROR! Could not login to server {$ldapname} as user {$username}.");
+ log_error(sprintf(gettext("ERROR! Could not login to server %s as user %s."), $ldapname, $username));
@ldap_unbind($ldap);
return false;
}
- log_error("Logged in successfully as {$username} via LDAP server {$ldapname} with DN = {$userdn}.");
+ log_error(sprintf(gettext("Logged in successfully as %s via LDAP server %s with DN = %s."), $username, $ldapname, $userdn));
/* At this point we are bound to LDAP so the user was auth'd okay. Close connection. */
@ldap_unbind($ldap);
@@ -997,7 +997,7 @@ function radius_backed($username, $passwd, $authcfg){
$retvalue['auth_val'] = 1;
$retvalue['error'] = $rauth->getError();
if ($debug)
- printf("Radius start: %s<br>\n", $retvalue['error']);
+ printf(gettext("Radius start: %s%s"), $retvalue['error'], "<br>\n");
}
// XXX - billm - somewhere in here we need to handle securid challenge/response
@@ -1008,7 +1008,7 @@ function radius_backed($username, $passwd, $authcfg){
$retvalue['auth_val'] = 1;
$retvalue['error'] = $result->getMessage();
if ($debug)
- printf("Radius send failed: %s<br>\n", $retvalue['error']);
+ printf(gettext("Radius send failed: %s%s"), $retvalue['error'], "<br>\n");
} else if ($result === true) {
$retvalue['auth_val'] = 2;
if ($debug)
@@ -1060,7 +1060,7 @@ function auth_get_authserver($name) {
}
}
if ($name == "Local Database")
- return array("name" => "Local Database", "type" => "Local Auth", "host" => $config['system']['hostname']);
+ return array("name" => gettext("Local Database"), "type" => gettext("Local Auth"), "host" => $config['system']['hostname']);
}
function auth_get_authserver_list() {
@@ -1075,7 +1075,7 @@ function auth_get_authserver_list() {
}
}
- $list["Local Database"] = array( "name" => "Local Database", "type" => "Local Auth", "host" => $config['system']['hostname']);
+ $list["Local Database"] = array( "name" => gettext("Local Database"), "type" => gettext("Local Auth"), "host" => $config['system']['hostname']);
return $list;
}
@@ -1145,7 +1145,7 @@ function session_auth() {
$_SESSION['Logged_In'] = "True";
$_SESSION['Username'] = $_POST['usernamefld'];
$_SESSION['last_access'] = time();
- log_error("Successful login for user '{$_POST['usernamefld']}' from: {$_SERVER['REMOTE_ADDR']}");
+ log_error(sprintf(gettext("Successful login for user '%s' from: %s"), $_POST['usernamefld'], $_SERVER['REMOTE_ADDR']));
$HTTP_SERVER_VARS['AUTH_USER'] = $_SESSION['Username'];
if (isset($_POST['postafterlogin']))
return true;
@@ -1157,8 +1157,8 @@ function session_auth() {
exit;
} else {
/* give the user an error message */
- $_SESSION['Login_Error'] = "Username or Password incorrect";
- log_error("Login attempt with user: '{$_POST['usernamefld']}' from: '{$_SERVER['REMOTE_ADDR']}' failed.");
+ $_SESSION['Login_Error'] = gettext("Username or Password incorrect");
+ log_error(sprintf(gettext("Login attempt with user: '%s' from: '%s' failed."), $_POST['usernamefld'], $_SERVER['REMOTE_ADDR']));
if(isAjax()) {
echo "showajaxmessage('{$_SESSION['Login_Error']}');";
return;
@@ -1198,9 +1198,9 @@ function session_auth() {
if (isset($_GET['logout'])) {
if ($_SESSION['Logout'])
- log_error("Session timed out for user '{$_SESSION['Username']}' from: {$_SERVER['REMOTE_ADDR']}");
+ log_error(sprintf(gettext("Session timed out for user '%s' from: %s"), $_SESSION['Username'], $_SERVER['REMOTE_ADDR']));
else
- log_error("User logged out for user '{$_SESSION['Username']}' from: {$_SERVER['REMOTE_ADDR']}");
+ log_error(sprintf(gettext("User logged out for user '%s' from: %s"), $_SESSION['Username'], $_SERVER['REMOTE_ADDR']));
/* wipe out $_SESSION */
$_SESSION = array();
OpenPOWER on IntegriCloud