]> git.entuzijast.net Git - freeradius-dialup-admin.git/commitdiff
* Move the xlat function to a separate file in lib/xlat.php3
authorkkalev <kkalev>
Fri, 18 Jun 2004 13:01:56 +0000 (13:01 +0000)
committerkkalev <kkalev>
Fri, 18 Jun 2004 13:01:56 +0000 (13:01 +0000)
* Add a lib/sql/nas_list.php3 to also get the nas list from sql (naslist.conf still works)
* add realms nasdb and nasadmin in username.mappings. nasadmin is used to signify if the
  user is allowed to use the nas_admin page. nasdb is used to shorten the nas list to only
  a few specific entries. That way administrator responsible for a few access servers will
  only be able to administer those access servers and not see the rest of the nas list.
* Add username searching in the find page as suggested by joram agten
* Don't use nas_list in nas_admin

21 files changed:
Changelog
conf/admin.conf
conf/config.php3
conf/username.mappings
doc/TODO
htdocs/accounting.php3
htdocs/clear_opensessions.php3
htdocs/failed_logins.php3
htdocs/find.php3
htdocs/nas_admin.php3
htdocs/stats.php3
htdocs/user_accounting.php3
htdocs/user_finger.php3
htdocs/user_stats.php3
lib/ldap/defaults.php3
lib/ldap/functions.php3
lib/ldap/user_info.php3
lib/sql/find.php3
lib/sql/functions.php3
lib/sql/nas_list.php3 [new file with mode: 0644]
lib/xlat.php3 [new file with mode: 0644]

index bff65d5a58342f7dd06b16bd39e3e0799b8d2940..32d2db1f5ea4fa548a53c7f25715644d9373da43 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,12 @@
+Ver 1.72:
+* Move the xlat function to a separate file in lib/xlat.php3
+* Add a lib/sql/nas_list.php3 to also get the nas list from sql (naslist.conf still works)
+* add realms nasdb and nasadmin in username.mappings. nasadmin is used to signify if the
+  user is allowed to use the nas_admin page. nasdb is used to shorten the nas list to only
+  a few specific entries. That way administrator responsible for a few access servers will
+  only be able to administer those access servers and not see the rest of the nas list.
+* Add username searching in the find page as suggested by joram agten
+* Don't use nas_list in nas_admin
 Ver 1.70:
 * Add the /bin postgresql compatibility patch from Guy Fraser
 * Add ldap_userdn as a configuration directive. If set we use that for
index 2062d0b0490a29224a6f2a00bbfa271803d3c536..9ef077804a948fe5135132d4dc8e65457d2f58e9 100644 (file)
@@ -142,6 +142,12 @@ general_stats_use_totacct: no
 # in the badusers table
 #
 general_restrict_badusers_access: no
+#
+# If set to yes then we restrict access to the nas administration page only to those
+# users which are allowed by their username mapping (nasadmin is set to yes)
+#
+general_restrict_nasadmin_access: yes
+
 
 INCLUDE: %{general_base_dir}/conf/naslist.conf
 
@@ -196,6 +202,8 @@ ldap_regular_profile_attr: dialupregularprofile
 # %U: username provided though http authentication
 # %mu: mappings for userdb
 # %ma: mappings for accounting
+# %mn: mappings for nasdb
+# %mN: mappings for nas administration
 #
 # One use of this would be to restrict access to only the user's belonging to
 # a specific administrator like this:
index 412d8841426e0aaae9f5db157a7925996afecd6a..9b10af4003e25aebc15431b6c7887b1d965ceb43 100644 (file)
@@ -80,8 +80,18 @@ if (!isset($mappings) && $config[general_username_mappings_file] != ''){
                if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
                        continue;
                list($key,$realm,$v)=split(":[[:space:]]*",$val,2);
-               if ($realm == 'accounting' || $realm == 'userdb')
+               if ($realm == 'accounting' || $realm == 'userdb' || $realm == 'nasdb' || $realm == 'nasadmin')
                        $mappings["$key"][$realm] = $v;
+               if ($realm == 'nasdb'){
+                       $NAS_ARR = array();
+                       $NAS_ARR = split(',',$v);
+                       foreach ($nas_list as $key => $nas){
+                               foreach ($NAS_ARR as $nas_check){
+                                       if ($nas_check == $nas[name])
+                                               unset($nas_list[$key]);
+                               }
+                       }
+               }
        }
        if ($config[general_use_session] == 'yes')
                session_register('mappings');
index e7d7b12abfd1faafb7b38281b85fb2f4b7d27c04..31803651439076da1b078c83903048b65707ae63 100644 (file)
@@ -2,7 +2,20 @@
 # Format:
 # Username:realm:query
 #
-# where realm is accounting or userdb
+# where realm is:
+# accounting: for the map to be used when querying the accounting db
+# userdb: for the map to be used when querying the user db
+# nasdb: To only map specific NASes to the username (separated by ,)
+# nasadmin: To allow the user to use the nas_admin page (yes or no)
 #
 library-admin:accounting:AND nasipaddress = '123.123.123.123'
 library-admin:userdb:AND Admin = 'library-admin'
+library-admin:nasdb:nas.lib.company.com
+library-admin:nasadmin:no
+#
+lab-admin:accounting:AND nasipaddress =  '123.123.124.123'
+lab-admin:userdb:AND Admin = 'lab-admin'
+lab-admin:nasdb:nas.lab.company.com
+lab-admin:nasadmin:no
+#
+admin:nasadmin:yes
index 315d454395bf69eca42dee0f81eda8dceb8cca83..2d71d3f7af6325dfdf9d278e707c26b0f27981bf 100644 (file)
--- a/doc/TODO
+++ b/doc/TODO
@@ -17,3 +17,4 @@
 * Parse the radius dictionary files so that we can show a pull down menu of possible values
   for various attributes.
 * Check the sql user code for sql injections
+* Also be able to keep username mappings in sql. Create and administration page
index 1d42015bd0766040f8988ceea2e007e902cc3a9a..db57b45bc0b4bfd921ebfd5fa7d76454d35745ad 100644 (file)
@@ -227,7 +227,7 @@ foreach ($accounting_show_attrs as $val)
 $query_view = ereg_replace(',$','',$query_view);
 $sql_extra_query = '';
 if ($config[sql_accounting_extra_query] != '')
-       $sql_extra_query = sql_xlat($config[sql_accounting_extra_query],$login,$config);
+       $sql_extra_query = xlat($config[sql_accounting_extra_query],$login,$config);
 $query="SELECT $query_view FROM $config[sql_accounting_table] $where $sql_extra_query ORDER BY $order LIMIT $maxresults;";
 
 echo <<<EOM
index 10349dc874a1b4c8cff8375f8a5ca2c90305e723..133ce708a965cbf7ab5378990e2a401cc6b5b7b8 100644 (file)
@@ -41,7 +41,7 @@ $open_sessions = 0;
 
 $sql_extra_query = '';
 if ($config[sql_accounting_extra_query] != '')
-       $sql_extra_query = sql_xlat($config[sql_accounting_extra_query],$login,$config);
+       $sql_extra_query = xlat($config[sql_accounting_extra_query],$login,$config);
 
 print <<<EOM
 </table>
index 23b77c43e4a3872070df75b64ab155a21d4305f4..475d84ea94ca7cfc23becd70710630795a6d7249 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 require('../conf/config.php3');
 require('../lib/attrshow.php3');
+require('../lib/sql/nas_list.php3');
 ?>
 <html>
 <?php
@@ -97,7 +98,7 @@ if ($acct_attrs['fl'][8] != '') echo "<th>" . $acct_attrs['fl'][8] . "</th>\n";
 if ($acct_attrs['fl'][9] != '') echo "<th>" . $acct_attrs['fl'][9] . "</th>\n";
 $sql_extra_query = '';
 if ($config[sql_accounting_extra_query] != '')
-       $sql_extra_query = sql_xlat($config[sql_accounting_extra_query],$login,$config);
+       $sql_extra_query = xlat($config[sql_accounting_extra_query],$login,$config);
 ?>
        </tr>
 
@@ -200,6 +201,8 @@ EOM;
 <?php
 foreach ($nas_list as $nas){
        $name = $nas[name];
+       if ($nas[ip] == '')
+               continue;
        $servers[$name] = $nas[ip];
 }
 ksort($servers);
index f3e90c889ef20feb557d9ee7806e4416e439d15e..94c6ed6e1914810383be7c65198cd8df3726d72c 100644 (file)
@@ -76,8 +76,9 @@ Search Criteria
 <?php
 echo <<<EOM
 <select name="search_IN" editable onChange="this.form.submit();">
+<option $selected[username] value="username">User Name
 <option $selected[name]  value="name">User Full Name
-<option $selected[ou] value="ou">User Department
+<option $selected[department] value="department">User Department
 <option $selected[radius] value="radius">User Radius Attribute
 EOM;
 ?>
index 3378ff65e7930aad021c859728a7ab175905560f..84d9318c66409db9ba6dd5403315e237d18a0092 100644 (file)
@@ -16,6 +16,23 @@ else{
 EOM;
        exit();
 }
+if ($config[general_restrict_nasadmin_access == 'yes'){
+       $auth_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"];
+       if ($auth_user == '' || $mappings[$auth_user][nasadmin] != 'yes'){
+               echo <<<EOM
+<title>NAS Administration Page</title>
+<link rel="stylesheet" href="style.css">
+</head>
+<body bgcolor="#80a040" background="images/greenlines1.gif" link="black" alink="black">
+<center>
+<b>Access is not allowed to this username.</b>
+</body>
+</html>
+EOM;
+               exit();
+       }
+}
+
 
 if ($clear_fields == 1)
        $selected_nas = $readonly = '';
@@ -84,21 +101,21 @@ if ($link){
        "SELECT * FROM $config[sql_nas_table] ORDER BY nasname;");
        if ($search){
                $num = 0;
-               unset($nas_list);
+               unset($my_nas_list);
                while($row = @da_sql_fetch_array($search,$config)){
                        $my_nas_name = $row['nasname'];
                        if ($my_nas_name != ''){
                                $num++;
                                if ($clear_fields == 0 && $selected_nas == $my_nas_name)
                                        $selected[$my_nas_name] = 'selected';
-                               $nas_list[$my_nas_name]['name'] = $my_nas_name;
-                               $nas_list[$my_nas_name]['shortname'] = $row['shortname'];
-                               $nas_list[$my_nas_name]['type'] = $row['type'];
-                               $selected[$nas_list[$my_nas_name]['type']] = 'selected';
-                               $nas_list[$my_nas_name]['ports'] = $row['ports'];
-                               $nas_list[$my_nas_name]['secret'] = $row['secret'];
-                               $nas_list[$my_nas_name]['community'] = $row['community'];
-                               $nas_list[$my_nas_name]['description'] = $row['description'];
+                               $my_nas_list[$my_nas_name]['name'] = $my_nas_name;
+                               $my_nas_list[$my_nas_name]['shortname'] = $row['shortname'];
+                               $my_nas_list[$my_nas_name]['type'] = $row['type'];
+                               $selected[$my_nas_list[$my_nas_name]['type']] = 'selected';
+                               $my_nas_list[$my_nas_name]['ports'] = $row['ports'];
+                               $my_nas_list[$my_nas_name]['secret'] = $row['secret'];
+                               $my_nas_list[$my_nas_name]['community'] = $row['community'];
+                               $my_nas_list[$my_nas_name]['description'] = $row['description'];
                        }
                }
        }
@@ -152,7 +169,7 @@ NAS List
 <td>
 <select name=selected_nas size=5 OnChange="this.form.select_nas.value=1;this.form.submit()"> 
 <?php
-foreach ($nas_list as $member){
+foreach ($my_nas_list as $member){
        $name = $member[name];
        echo "<option $selected[$name] value=\"$name\">$name\n";
 }
@@ -161,7 +178,7 @@ foreach ($nas_list as $member){
 </td>
 </tr>
 <?php
-$array = $nas_list[$selected_nas];
+$array = $my_nas_list[$selected_nas];
 echo <<<EOM
 <tr>
 <td align=right bgcolor="#d0ddb0">
index bade4921735f58295b949e4ae470c45538a08a97..b45c02403c76ccde38d5f37ea96686d1113a1dc8 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 require('../conf/config.php3');
+require('../lib/sql/nas_list.php3');
 ?>
 <html>
 <head>
@@ -81,6 +82,8 @@ $i = 1;
 $servers[all] = 'all';
 foreach ($nas_list as $nas){
        $name = $nas[name];
+       if ($nas[ip] == '')
+               continue;
        $servers[$name] = $nas[ip];
        $i++;
 }
@@ -91,7 +94,7 @@ if ($server != 'all' && $server != ''){
 }
 $sql_extra_query = '';
 if ($config[sql_accounting_extra_query] != '')
-       $sql_extra_query = sql_xlat($config[sql_accounting_extra_query],$login,$config);
+       $sql_extra_query = xlat($config[sql_accounting_extra_query],$login,$config);
 
 $link = @da_sql_pconnect($config);
 if ($link){
index 74399f54f43eeb8d5aac586f6ed2547f49690045..7e52a97fd51ab3342abc1de400bc05ac0b892d15 100644 (file)
@@ -90,7 +90,7 @@ for($i=1;$i<=9;$i++){
 }
 $sql_extra_query = '';
 if ($config[sql_accounting_extra_query] != '')
-       $sql_extra_query = sql_xlat($config[sql_accounting_extra_query],$login,$config);
+       $sql_extra_query = xlat($config[sql_accounting_extra_query],$login,$config);
 ?>
        </tr>
 
index a79021d1406ba06ae93c5dfd5b2fa58eb5bd1323..2439111a971f861b2e154951b8078919e99add6e 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 require('../conf/config.php3');
 require('../lib/attrshow.php3');
+require('../lib/sql/nas_list.php3');
 if (!isset($usage_summary)){
        echo <<<EOM
 <html>
@@ -41,7 +42,7 @@ $date = strftime('%A, %e %B %Y, %T %Z');
 
 $sql_extra_query = '';
 if ($config[sql_accounting_extra_query] != '')
-       $sql_extra_query = sql_xlat($config[sql_accounting_extra_query],$login,$config);
+       $sql_extra_query = xlat($config[sql_accounting_extra_query],$login,$config);
 
 $link = @da_sql_pconnect($config);
 $link2 = connect2db($config);
@@ -60,6 +61,8 @@ if ($link){
                }
                else
                        $servers_num++;
+               if ($nas[ip] == '')
+                       continue;
                $name_data = $nas[ip];
                $community_data = $nas[community];
                $server_name[$servers_num] = $nas[name];
index ecd7285a0564e17fa9cbd3a5c25885b4d08325a3..f736d72a625fbd959e8ca4a36526bf2788cd9eeb 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 require('../conf/config.php3');
 require('../lib/functions.php3');
+require('../lib/sql/nas_list.php3');
 ?>
 <html>
 <?php
@@ -53,7 +54,7 @@ $selected[$sortby] = 'selected';
 
 $sql_extra_query = '';
 if ($config[sql_accounting_extra_query] != '')
-       $sql_extra_query = sql_xlat($config[sql_accounting_extra_query],$login,$config);
+       $sql_extra_query = xlat($config[sql_accounting_extra_query],$login,$config);
 
 ?>
 
@@ -194,6 +195,8 @@ EOM;
 <?php
 foreach ($nas_list as $nas){
        $name = $nas[name];
+       if ($nas[ip] == '')
+               continue;
        $servers[$name] = $nas[ip];
 }
 ksort($servers);
index 358309854119d720f61dd5c06da553cb95dd9d64..9db4af2aa7bae54e3b05c276cbf7201c02f42f29 100644 (file)
@@ -28,7 +28,7 @@ if ($config[ldap_default_dn] != ''){
                if ($regular_profile_attr != ''){
                        $get_attrs = array("$regular_profile_attr");
                        if ($config[ldap_filter] != '')
-                               $filter = ldap_xlat($config[ldap_filter],$login,$config);
+                               $filter = xlat($config[ldap_filter],$login,$config);
                        else
                                $filter = 'uid=' . $login;
                        if ($config[ldap_debug] == 'true')
index 6cb3ad57f6fa71f23fa15cb34b7752e7e8a32ede..910d1f283bac1754b5740bd9189db5e5d6bfe903 100644 (file)
@@ -1,16 +1,5 @@
 <?php
-function ldap_xlat($filter,$login,$config)
-{
-       $string = $filter;
-       if ($filter != ''){
-               $string = preg_replace('/%u/',$login,$string);
-               $string = preg_replace('/%U/',$HTTP_SERVER_VARS["PHP_AUTH_USER"],$string);
-               $string = preg_replace('/%ma/',$mappings[$http_user][accounting],$string);
-               $string = preg_replace('/%mu/',$mappings[$http_user][userdb],$string);
-       }
-
-       return $string;
-}
+require('../lib/xlat.php3');
 
 function da_ldap_bind($ds,$config)
 {
@@ -66,12 +55,12 @@ function get_user_info($ds,$user,$config,$decode_normal,$k)
                $attrs = array('cn');
                if ($config[ldap_userdn] == ''){
                        if ($config[ldap_filter] != '')
-                               $filter = ldap_xlat($config[ldap_filter],$login,$config);
+                               $filter = xlat($config[ldap_filter],$login,$config);
                        else
                                $filter = 'uid=' . $login;
                }
                else
-                       $filter = ldap_xlat($config[ldap_userdn],$login,$config);
+                       $filter = xlat($config[ldap_userdn],$login,$config);
                if ($config[ldap_debug] == 'true'){
                        if ($config[ldap_userdn] == '')
        print "<b>DEBUG(LDAP): Search Query: BASE='$config[ldap_base]',FILTER='$filter'</b><br>\n";
@@ -98,12 +87,12 @@ function get_user_dn($ds,$user,$config)
                $attrs = array('dn');
                if ($config[ldap_userdn] == ''){
                        if ($config[ldap_filter] != '')
-                               $filter = ldap_xlat($config[ldap_filter],$login,$config);
+                               $filter = xlat($config[ldap_filter],$login,$config);
                        else
                                $filter = 'uid=' . $login;
                }
                else
-                       $filter = ldap_xlat($config[ldap_userdn],$login,$config);
+                       $filter = xlat($config[ldap_userdn],$login,$config);
                if ($config[ldap_debug] == 'true'){
                        if ($config[ldap_userdn] == '')
        print "<b>DEBUG(LDAP): Search Query: BASE='$config[ldap_base]',FILTER='$filter'</b><br>\n";
index 45116b8b2540a918f1fd0a50c048be661f9e851c..b38061dad5f17249dccc81ec0222c15c6705e470 100644 (file)
@@ -32,12 +32,12 @@ if ($ds) {
        $r=@da_ldap_bind($ds,$config);
        if ($config[ldap_userdn] == ''){
                if ($config[ldap_filter] != '')
-                       $filter = ldap_xlat($config[ldap_filter],$login,$config);
+                       $filter = xlat($config[ldap_filter],$login,$config);
                else
                        $filter = 'uid=' . $login;
        }
        else
-               $filter = ldap_xlat($config[ldap_userdn],$login,$config);
+               $filter = xlat($config[ldap_userdn],$login,$config);
        if ($config[ldap_debug] == 'true'){
                if ($config[ldap_userdn] == '')
                        print "<b>DEBUG(LDAP): Search Query: BASE='$config[ldap_base]',FILTER='$filter'</b><br>\n";
index a4a700a26112927001aa88c6e36d8bf2b67889f3..7080adcc6e42c507609be6372facb321e1f35123 100644 (file)
@@ -11,11 +11,11 @@ if ($link){
        $search = da_sql_escape_string($search);
        if (!is_int($max_results))
                $max_results = 10;
-       if (($search_IN == 'name' || $search_IN == 'ou') && $config[sql_use_user_info_table] == 'true'){
-               $attr = ($search_IN == 'name') ? 'name' : 'department';
+       if (($search_IN == 'name' || $search_IN == 'department' || $search_IN == 'username) && 
+                       $config[sql_use_user_info_table] == 'true'){
                $res = @da_sql_query($link,$config,
                "SELECT username FROM $config[sql_user_info_table] WHERE
-               lower($attr) LIKE '%$search%' LIMIT $max_results;");
+               lower($search_IN) LIKE '%$search%' LIMIT $max_results;");
                if ($res){
                        while(($row = @da_sql_fetch_array($res,$config)))
                                $found_users[] = $row[username];
index 98fdc665290936605dc41a551c06ab1fd1e147a7..d42a6ebbecb2fdc46e20c46b1d338425f1ed6b87 100644 (file)
@@ -5,6 +5,7 @@ else{
        echo "<b>Could not include SQL library</b><br>\n";
        exit();
 }
+require('../lib/xlat.php3');
 
 function connect2db($config)
 {
@@ -31,16 +32,4 @@ function closedb($link,$config)
 {
        return 1;
 }
-function sql_xlat($filter,$login,$config)
-{
-       $string = $filter;
-       $http_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"];
-       if ($filter != ''){
-               $string = preg_replace('/%u/',$login,$string);
-               $string = preg_replace('/%U/',$http_user,$string);
-               $string = preg_replace('/%m/',$mappings[$http_user],$string);
-       }
-
-       return $string;
-}
 ?>
diff --git a/lib/sql/nas_list.php3 b/lib/sql/nas_list.php3
new file mode 100644 (file)
index 0000000..2d689ec
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+require('../conf/config.php3');
+
+if ($config[sql_nas_table] != ''){
+
+       if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php3"))
+               include_once("../lib/sql/drivers/$config[sql_type]/functions.php3");
+       else{
+               echo "<b>Could not include SQL library</b><br>\n";
+               exit();
+       }
+       $link = @da_sql_pconnect($config);
+       if ($link){
+               $auth_user = HTTP_SERVER_VARS["PHP_AUTH_USER"];
+               $extra = '';
+               if (isset($mappings[$auth_user][nasdb]){
+                       $NAS_ARR = array();
+                       $NAS_ARR = split(',',$mappings[$auth_user][nasdb]);
+                       $extra = 'WHERE nasname IN (';
+                       foreach ($NAS_ARR as $nas)
+                               $extra .= "'$nasname',";        
+                       unset($NAS_ARR);
+                       $extra = rtrim($extra,",");
+                       $extra .= ')';  
+               }
+               $search = @da_sql_query($link,$config,
+               "SELECT * FROM $config[sql_nas_table] $extra;");
+               if ($search){
+                       while($row = @da_sql_fetch_array($search,$config)){
+                               $num = 0;
+                               $my_nas_name = $row['nasname'];
+                               if ($my_nas_name != ''){
+                                       $nas_list[$my_nas_name]['name'] = $my_nas_name;
+                                       $nas_server = $da_name_cache[$my_nas_name];
+                                       if (!isset($nas_server)){
+                                               $nas_server = @gethostbyname($nas_server);
+                                               if (!isset($da_name_cache) && $config[general_use_session] == 'yes'){
+                                                       $da_name_cache[$my_nas_name] = $nas_server;
+                                                       session_register('da_name_cache');
+                                               }
+                                       }
+                                       if ($nas_server != $my_nas_name)
+                                               $nas_list[$my_nas_name]['ip'] = $nas_server;
+                                       $nas_list[$my_nas_name]['port_num'] = $row['ports'];
+                                       $nas_list[$my_nas_name]['community'] = $row['community'];
+                                       $nas_list[$my_nas_name]['model'] = $row['description'];
+                               }
+                       }
+               }
+       }
+       else
+               echo "<b>Could not connect to SQL database</b><br>\n";
+}
+
+?>
diff --git a/lib/xlat.php3 b/lib/xlat.php3
new file mode 100644 (file)
index 0000000..ff5c2f9
--- /dev/null
@@ -0,0 +1,16 @@
+<?php
+function xlat($filter,$login,$config)
+{
+       $string = $filter;
+       if ($filter != ''){
+               $string = preg_replace('/%u/',$login,$string);
+               $string = preg_replace('/%U/',$HTTP_SERVER_VARS["PHP_AUTH_USER"],$string);
+               $string = preg_replace('/%ma/',$mappings[$http_user][accounting],$string);
+               $string = preg_replace('/%mu/',$mappings[$http_user][userdb],$string);
+               $string = preg_replace('/%mn/',$mappings[$http_user][nasdb],$string);
+               $string = preg_replace('/%mN/',$mappings[$http_user][nasadmin],$string);
+       }
+
+       return $string;
+}
+?>