Pull downstream fixes from Debian package 1.0.5-2:
authornbk <nbk>
Wed, 21 Dec 2005 20:25:43 +0000 (20:25 +0000)
committernbk <nbk>
Wed, 21 Dec 2005 20:25:43 +0000 (20:25 +0000)
- Report correct data transfer statistics for users
- Lower-case sql column names to match creation scripts
- Fix creation of empty groups
- Put quote around usernames in HTML output
- Properly notice when we've got a blank password to SQL

Thanks to Arve Seljebu, Tobias and Paul Hampson.

dialup_admin/bin/tot_stats
dialup_admin/htdocs/badusers.php3
dialup_admin/htdocs/group_admin.php3
dialup_admin/htdocs/show_groups.php3
dialup_admin/htdocs/user_admin.php3
dialup_admin/htdocs/user_delete.php3
dialup_admin/htdocs/user_edit.php3
dialup_admin/lib/sql/create_group.php3

index f3a3e07..193364c 100755 (executable)
@@ -28,7 +28,7 @@ close CONF;
 die "sql_command directive is not set in admin.conf\n" if ($sqlcmd eq '');
 die "Could not find sql binary. Please make sure that the \$sqlcmd variable points to the right location\n" if (! -x $sqlcmd);
 
-$sql_password = ($sql_password == '') ? '' : "-p$sql_password";
+$sql_password = (!$sql_password) ? '' : "-p$sql_password";
 
 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime;
 $date_start = POSIX::strftime("%Y-%m-%d %T",0,0,0,($mday - 1),$mon,$year,$wday,$yday,$isdst);
index 0aeac02..55c7dab 100644 (file)
@@ -73,12 +73,12 @@ if ($do_delete == 1 && ($row_id != 0 && is_numeric($row_id))){
 $link = @da_sql_connect($config);
 if ($link){
        $search = @da_sql_query($link,$config,
-       "SELECT id,Admin FROM $config[sql_badusers_table]
+       "SELECT id,admin FROM $config[sql_badusers_table]
        WHERE id = '$row_id';");
        if ($search){
                $row = @da_sql_fetch_array($search,$config);
                if ($row[id] == $row_id){
-                       $admin = "$row[Admin]";
+                       $admin = "$row[admin]";
                        if (($admin != '-' && $HTTP_SERVER_VARS["PHP_AUTH_USER"] == $admin) || $admin == '-'){
                                $sql_servers = array();
                                if ($config[sql_extra_servers] != '')
@@ -140,7 +140,7 @@ EOM;
 $auth_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"];
 if ($config[general_restrict_badusers_access] == 'yes'){
        $auth_user = da_sql_escape_string($auth_user);
-       $extra_query = "AND Admin == '$auth_user'";
+       $extra_query = "AND admin == '$auth_user'";
 }
 $link = @da_sql_pconnect($config);
 if ($link){
@@ -152,10 +152,10 @@ if ($link){
                while( $row = @da_sql_fetch_array($search,$config) ){
                        $num++;
                        $id = $row[id];
-                       $user = "$row[UserName]";
-                       $date = "$row[Date]";
-                       $reason = "$row[Reason]";
-                       $admin = "$row[Admin]";
+                       $user = "$row[userName]";
+                       $date = "$row[date]";
+                       $reason = "$row[reason]";
+                       $admin = "$row[admin]";
                        if ($admin == $auth_user || $admin == '-')
        $action = "<td><input type=submit class=button value=\"Delete\" OnClick=\"this.form.do_delete.value=1;this.form.row_id.value=$id\"></td>";
                        else
index 535536d..bd51886 100644 (file)
@@ -88,7 +88,7 @@ if ($do_changes == 1){
        
    
    <form method=post>
-      <input type=hidden name=login value=<?php echo $login ?>>
+      <input type=hidden name=login value="<?php echo $login ?>">
       <input type=hidden name=do_changes value=0>
       <input type=hidden name=show value=0>
        <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
index eba5f5a..722f84e 100644 (file)
@@ -58,13 +58,14 @@ EOM;
 $link = @da_sql_pconnect($config);
 if ($link){
        $search = @da_sql_query($link,$config,
-       "SELECT COUNT(*) as counter,groupname FROM $config[sql_usergroup_table] GROUP BY groupname;");
+       "SELECT COUNT(*) as counter,groupname,MAX(username) AS usersample FROM $config[sql_usergroup_table] GROUP BY groupname;");
        if ($search){
                if (@da_sql_num_rows($search,$config)){
                        while( $row = @da_sql_fetch_array($search,$config) ){
                                $num++;
                                $group = $row[groupname];
                                $num_members = $row[counter];
+                               if ($row[usersample] == "") $num_members--;
                                echo <<<EOM
                <tr align=center>
                        <td>$num</td>
index 8c21348..9db3177 100644 (file)
@@ -246,7 +246,7 @@ if ($link){
                                $lastlog_input = 'not available';
                        $lastlog_output = $row['acctoutputoctets'];
                        if ($lastlog_output)
-                               $lastlog_input = bytes2str($lastlog_output);
+                               $lastlog_output = bytes2str($lastlog_output);
                        else
                                $lastlog_output = 'not available';
                }
index bf63795..f6da8e7 100644 (file)
@@ -80,7 +80,7 @@ EOM;
 }
 ?>
    <form method=post>
-      <input type=hidden name=login value=<?php print $login ?>>
+      <input type=hidden name=login value="<?php print $login ?>">
       <input type=hidden name=delete_user value="0">
        <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
 <tr>
index 9f3bde3..b98a314 100644 (file)
@@ -95,7 +95,7 @@ else if ($badusers == 1){
        
 ?>
    <form name="edituser" method=post>
-      <input type=hidden name=login value=<?php print $login ?>>
+      <input type=hidden name=login value="<?php print $login ?>">
       <input type=hidden name=user_type value=<?php print $user_type ?>>
       <input type=hidden name=change value="0">
       <input type=hidden name=add value="0">
index e37d7bb..c602d64 100644 (file)
@@ -26,6 +26,14 @@ if ($link){
                                $da_abort=1;
                        }
                }
+       } else {
+               $res = @da_sql_query($link,$config,
+               "INSERT INTO $config[sql_usergroup_table] (groupname)
+               VALUES ('$login');");
+               if (!$res || !@da_sql_affected_rows($link,$res,$config)){
+                       echo "<b>Unable to create group $login: " . da_sql_error($link,$config) . "</b><br>\n";
+                       $da_abort=1;
+               }
        }
        if (!$da_abort){
                foreach($show_attrs as $key => $attr){