Delete trailing whitespace.
authornbk <nbk>
Mon, 14 May 2007 22:26:57 +0000 (22:26 +0000)
committernbk <nbk>
Mon, 14 May 2007 22:26:57 +0000 (22:26 +0000)
169 files changed:
Make.inc.in
dialup_admin/bin/clearsession
dialup_admin/bin/log_badlogins
dialup_admin/bin/showmodem
dialup_admin/bin/sqlrelay_query
dialup_admin/htdocs/accounting.php3
dialup_admin/htdocs/buttons.php3
dialup_admin/htdocs/clear_opensessions.php3
dialup_admin/htdocs/find.php3
dialup_admin/htdocs/group_admin.php3
dialup_admin/htdocs/group_new.php3
dialup_admin/htdocs/login_time_create.php3
dialup_admin/htdocs/nas_admin.php3
dialup_admin/htdocs/password.php3
dialup_admin/htdocs/stats.php3
dialup_admin/htdocs/user_admin.php3
dialup_admin/htdocs/user_delete.php3
dialup_admin/htdocs/user_edit.php3
dialup_admin/htdocs/user_info.php3
dialup_admin/htdocs/user_new.php3
dialup_admin/htdocs/user_test.php3
dialup_admin/html/stats.html.php3
dialup_admin/html/user_admin.html.php3
dialup_admin/html/user_admin_userinfo.html.php3
dialup_admin/lib/ldap/change_attrs.php3
dialup_admin/lib/ldap/change_info.php3
dialup_admin/lib/ldap/functions.php3
dialup_admin/lib/operators.php3
dialup_admin/lib/sql/change_attrs.php3
dialup_admin/lib/sql/change_info.php3
dialup_admin/lib/sql/change_passwd.php3
dialup_admin/lib/sql/create_user.php3
dialup_admin/lib/sql/defaults.php3
dialup_admin/lib/sql/drivers/dbx/functions.php3
dialup_admin/lib/sql/drivers/oracle/functions.php3
dialup_admin/lib/sql/drivers/pg/functions.php3
dialup_admin/lib/sql/drivers/sqlrelay/functions.php3
dialup_admin/lib/sql/find.php3
dialup_admin/lib/sql/functions.php3
dialup_admin/lib/sql/group_admin.php3
dialup_admin/lib/sql/group_info.php3
dialup_admin/lib/sql/nas_list.php3
dialup_admin/lib/sql/user_info.php3
doc/examples/postgresql_update_radacct_group_trigger.sql
scripts/check-radiusd-config.in
scripts/clients.pl
scripts/create-users.pl
scripts/min-includes.pl
scripts/radiusd2ldif.pl
scripts/users2mysql.pl
share/dictionary.asn
share/dictionary.hp
share/dictionary.patton
share/format.pl
src/billing/cisco_h323_db_sample_functions-postgres.sql
src/billing/cisco_h323_db_schema-postgres.sql
src/billing/clarent2db.pl
src/billing/h323detail2db.pl
src/include/realms.h
src/lib/dict.c
src/lib/event.c
src/lib/fifo.c
src/lib/filters.c
src/lib/getaddrinfo.c
src/lib/hash.c
src/lib/misc.c
src/lib/missing.c
src/lib/packet.c
src/lib/print.c
src/lib/radius.c
src/lib/rbtree.c
src/lib/valuepair.c
src/main/auth.c
src/main/checkrad.pl.in
src/main/client.c
src/main/conffile.c
src/main/event.c
src/main/listen.c
src/main/log.c
src/main/mainconfig.c
src/main/modcall.c
src/main/modules.c
src/main/radclient.c
src/main/radius_snmp.c
src/main/radiusd.c
src/main/radwho.c
src/main/realms.c
src/main/threads.c
src/main/util.c
src/main/valuepair.c
src/main/xlat.c
src/modules/rlm_acctlog/configure.in
src/modules/rlm_acctlog/rlm_acctlog.c
src/modules/rlm_attr_filter/rlm_attr_filter.c
src/modules/rlm_attr_rewrite/configure.in
src/modules/rlm_attr_rewrite/rlm_attr_rewrite.c
src/modules/rlm_caching/rlm_caching.c
src/modules/rlm_checkval/configure.in
src/modules/rlm_counter/configure.in
src/modules/rlm_counter/rad_counter.pl
src/modules/rlm_counter/rlm_counter.c
src/modules/rlm_dbm/configure.in
src/modules/rlm_dbm/rlm_dbm_parser.c
src/modules/rlm_detail/rlm_detail.c
src/modules/rlm_digest/rlm_digest.c
src/modules/rlm_eap/configure.in
src/modules/rlm_eap/eap.c
src/modules/rlm_eap/libeap/eap_sim.h
src/modules/rlm_eap/libeap/eap_tls.h
src/modules/rlm_eap/mem.c
src/modules/rlm_eap/rlm_eap.c
src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c
src/modules/rlm_eap/types/rlm_eap_peap/peap.c
src/modules/rlm_eap/types/rlm_eap_peap/rlm_eap_peap.c
src/modules/rlm_eap/types/rlm_eap_psk/SOBMMO.cpp
src/modules/rlm_eap/types/rlm_eap_psk/eap_psk.cpp
src/modules/rlm_eap/types/rlm_eap_psk/eap_psk.h
src/modules/rlm_eap/types/rlm_eap_psk/eap_psk_ssm.cpp
src/modules/rlm_eap/types/rlm_eap_psk/eap_psk_ssm.h
src/modules/rlm_eap/types/rlm_eap_psk/rlm_eap_psk.cpp
src/modules/rlm_eap/types/rlm_eap_psk/userinfo.c
src/modules/rlm_eap/types/rlm_eap_psk/userinfo.h
src/modules/rlm_eap/types/rlm_eap_psk/users.psk
src/modules/rlm_eap/types/rlm_eap_tls/rlm_eap_tls.c
src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c
src/modules/rlm_example/configure.in
src/modules/rlm_exec/rlm_exec.c
src/modules/rlm_expiration/rlm_expiration.c
src/modules/rlm_expr/paircmp.c
src/modules/rlm_ippool/configure.in
src/modules/rlm_ippool/rlm_ippool.c
src/modules/rlm_ippool/rlm_ippool_tool.c
src/modules/rlm_krb5/configure.in
src/modules/rlm_ldap/edir_ldapext.c
src/modules/rlm_ldap/rlm_ldap.c
src/modules/rlm_linelog/rlm_linelog.c
src/modules/rlm_logintime/rlm_logintime.c
src/modules/rlm_mschap/rlm_mschap.c
src/modules/rlm_mschap/smbdes.c
src/modules/rlm_otp/otp_pw_valid.c
src/modules/rlm_pam/configure.in
src/modules/rlm_pam/rlm_pam.c
src/modules/rlm_pap/rlm_pap.c
src/modules/rlm_perl/configure.in
src/modules/rlm_perl/example.pl
src/modules/rlm_perl/rlm_perl.c
src/modules/rlm_policy/evaluate.c
src/modules/rlm_policy/parse.c
src/modules/rlm_policy/rlm_policy.c
src/modules/rlm_preprocess/rlm_preprocess.c
src/modules/rlm_protocol_filter/rlm_protocol_filter.c
src/modules/rlm_python/configure.in
src/modules/rlm_radutmp/rlm_radutmp.c
src/modules/rlm_radutmp/rlm_radutmp2.c
src/modules/rlm_smb/configure.in
src/modules/rlm_sql/configure.in
src/modules/rlm_sql/drivers/rlm_sql_db2/configure.in
src/modules/rlm_sql/drivers/rlm_sql_firebird/configure.in
src/modules/rlm_sql/drivers/rlm_sql_iodbc/configure.in
src/modules/rlm_sql/drivers/rlm_sql_postgresql/configure.in
src/modules/rlm_sql/drivers/rlm_sql_postgresql/sql_postgresql.c
src/modules/rlm_sql/drivers/rlm_sql_postgresql/sql_postgresql.h
src/modules/rlm_sql/drivers/rlm_sql_unixodbc/configure.in
src/modules/rlm_sql/drivers/rlm_sql_unixodbc/sql_unixodbc.c
src/modules/rlm_sqlcounter/configure.in
src/modules/rlm_sqlhpwippool/configure.in
src/modules/rlm_sqlippool/rlm_sqlippool.c
src/modules/rlm_unix/configure.in
src/modules/rlm_unix/rlm_unix.c

index 110f925..e3cd090 100644 (file)
@@ -26,11 +26,11 @@ top_srcdir  = @abs_top_srcdir@
 MAKE           = @MAKE@
 CC             = @CC@
 RANLIB         = @RANLIB@
-INCLUDE                = 
+INCLUDE                =
 CFLAGS         = $(INCLUDE) @CFLAGS@
 CPPFLAGS       = @CPPFLAGS@
 LIBPREFIX      = @LIBPREFIX@
-EXEEXT         = @EXEEXT@ 
+EXEEXT         = @EXEEXT@
 
 LIBTOOL                = @LIBTOOL@
 ACLOCAL                = @ACLOCAL@
index f7436ff..35060d7 100755 (executable)
@@ -32,7 +32,7 @@ if ($nastype eq 'cisco' && $type eq 'telnet'){
                my $session = Net::Telnet::Cisco->new(Host => $host);
                $session->login($login, $passwd);
 
-               if ($port >= 20000){  
+               if ($port >= 20000){
                        my @output = $session->cmd("sh caller user $username");
                        foreach $line (@output){
                                if ($line =~ /User: $username, line (Vi\d+),/){
index f0d3130..402b28b 100755 (executable)
@@ -9,7 +9,7 @@
 #
 # Defaults:
 # radius.log: none
-# admin.conf: /usr/local/dialup_admin/conf/admin.conf 
+# admin.conf: /usr/local/dialup_admin/conf/admin.conf
 # all:        no. Go to the end of the file. Don't read it all.
 
 use Date::Manip qw(ParseDate UnixDate);
@@ -120,7 +120,7 @@ seek LOG, 0, 2 if ($all_file eq 'no');
 for(;;){
        while(<LOG>){
                if ($verbose > 1) { print STDOUT "DEBUG: Reading $file\n" }
-               $do=0;  
+               $do=0;
                chomp;
                next if ($regexp ne '' && !/$regexp/);
                if ($_ ne ''){
index 08c73e5..5804057 100755 (executable)
@@ -53,7 +53,7 @@ if ($snmp_type = 'net') {
        "v90",
        "v27ter",
 );
-                 
+
 @Protocol = (
        "error",
        "normal",
@@ -66,7 +66,7 @@ if ($snmp_type = 'net') {
        "ara20",
        "unknown",
 );
-#DEBUG#print "$snmpwalkcmd enterprises.9.2.9.2.1.18 | grep $user\n";            
+#DEBUG#print "$snmpwalkcmd enterprises.9.2.9.2.1.18 | grep $user\n";
 $modem=`$snmpwalkcmd enterprises.9.2.9.2.1.18 | grep $user`;
 if($modem=~/enterprises\.9\.2\.9\.2\.1\.18\.(\d+) =/){
   $modem=$1;
@@ -74,32 +74,32 @@ if($modem=~/enterprises\.9\.2\.9\.2\.1\.18\.(\d+) =/){
   $port=$modem%120-1;
   $modem="$slot.$port";
 
-#DEBUG#print "$snmpgetcmd enterprises.9.9.47.1.3.1.1.9.$modem\n";               
+#DEBUG#print "$snmpgetcmd enterprises.9.9.47.1.3.1.1.9.$modem\n";
   $duration=`$snmpgetcmd enterprises.9.9.47.1.3.1.1.9.$modem` or die "No MIB\n";
   $duration=~/\) (.*)\./;
   $duration=$1;
 
-#DEBUG#print "$snmpgetcmd enterprises.9.9.47.1.3.1.1.12.$modem\n";              
+#DEBUG#print "$snmpgetcmd enterprises.9.9.47.1.3.1.1.12.$modem\n";
   $modulation=`$snmpgetcmd enterprises.9.9.47.1.3.1.1.12.$modem` or die "No MIB\n";
   $modulation=~/ \= (\d+)/;
   $modulation=$ModulationScheme[$1];
 
-#DEBUG#print "$snmpgetcmd enterprises.9.9.47.1.3.1.1.13.$modem\n";              
+#DEBUG#print "$snmpgetcmd enterprises.9.9.47.1.3.1.1.13.$modem\n";
   $protocol=`$snmpgetcmd enterprises.9.9.47.1.3.1.1.13.$modem` or die "No MIB\n";
   $protocol=~/ \= (\d+)/;
   $protocol=$Protocol[$1];
 
-#DEBUG#print "$snmpgetcmd enterprises.9.9.47.1.3.1.1.14.$modem\n";              
+#DEBUG#print "$snmpgetcmd enterprises.9.9.47.1.3.1.1.14.$modem\n";
   $txrate=`$snmpgetcmd enterprises.9.9.47.1.3.1.1.14.$modem` or die "No MIB\n";
   $txrate=~/Gauge32\: (\d+)/;
   $txrate=$1;
 
-#DEBUG#print "$snmpgetcmd enterprises.9.9.47.1.3.1.1.15.$modem\n";              
+#DEBUG#print "$snmpgetcmd enterprises.9.9.47.1.3.1.1.15.$modem\n";
   $rxrate=`$snmpgetcmd enterprises.9.9.47.1.3.1.1.15.$modem` or die "No MIB\n";
   $rxrate=~/Gauge32\: (\d+)/;
   $rxrate=$1;
 
-#DEBUG#print "$snmpgetcmd enterprises.9.9.47.1.3.1.1.17.$modem\n";              
+#DEBUG#print "$snmpgetcmd enterprises.9.9.47.1.3.1.1.17.$modem\n";
   $rxsignal=`$snmpgetcmd enterprises.9.9.47.1.3.1.1.17.$modem` or die "No MIB\n";
 #  $rxsignal=~ s/INTEGER\://;
   $rxsignal=~/ \= (.*)\n/;
index 65e96b5..20704e7 100755 (executable)
@@ -8,7 +8,7 @@ $passwd=shift;
 while(<>){
        chomp;
        `$sqlrelay '$host' '$port' '$socket' '$user' '$passwd' '$_'`;
-       $exit = $? >> 8;       
+       $exit = $? >> 8;
        if ($exit != 0){
                exit $exit;
        }
index 0c6a357..46cd26e 100644 (file)
@@ -59,7 +59,7 @@ class Qi {
                                $this->item=$item;
                                $this->operator=$operator;
        }
-                                               
+
        function show() {       global $operators;
                                global $items;
                $nam = $this->item;
@@ -87,7 +87,7 @@ EOM;
        </td></tr>
 EOM;
        }
-       
+
        function get($designator) {     global ${"item_of_$designator"};
                        global ${"value_of_$designator"};
                        global ${"operator_of_$designator"};
@@ -96,7 +96,7 @@ EOM;
                                $this->operator=${"operator_of_$designator"};
                                $this->item=${"item_of_$designator"};
                        }
-               }                       
+               }
        function query(){
                global $operators;
                global $items;
@@ -175,14 +175,14 @@ $offset=0;
 while (${"item_of_w$number"}) {
        if(${"delete_w$number"}==1) {$offset=1;$number++;}
                else {
-               $designator=$number-$offset;                    
+               $designator=$number-$offset;
                ${"w$designator"} = new Qi("w$designator","","");
                ${"w$designator"}->get("w$number");
                ${"w$designator"}->show();
                $number++;
                }
        }
-if($add==1) {  
+if($add==1) {
        ${"w$number"} = new Qi("w$number","$item_name","$operators[0]");
        ${"w$number"}->show();
        }
index 6a16eef..5f29500 100644 (file)
@@ -8,7 +8,7 @@ if ($auth_user){
                        include("../html/buttons/default/buttons.html.php3");
        }
 }
-else{  
+else{
        if (is_file("../html/buttons/default/buttons.html.php3"))
                include("../html/buttons/default/buttons.html.php3");
 }
index 62d0d1a..9900ac7 100644 (file)
@@ -64,7 +64,7 @@ print <<<EOM
        <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
        <tr><td>
 EOM;
+
 if ($drop_conns == 1){
        $method = 'snmp';
        $nastype = 'cisco';
index f83ac7e..0c363c6 100644 (file)
@@ -100,7 +100,7 @@ RADIUS Attribute
 <select name="radius_attr" editable>
 EOM;
        foreach($show_attrs as $key => $desc)
-               echo "<option $selected[$key] value=\"$key\">$desc\n";          
+               echo "<option $selected[$key] value=\"$key\">$desc\n";
        echo <<<EOM
 </select>
 </td>
index 41bb7e8..49e7a17 100644 (file)
@@ -86,8 +86,8 @@ if ($do_changes == 1){
                include("../lib/$config[general_lib_type]/group_info.php3");
 }
 ?>
-       
-   
+
+
    <form method=post>
       <input type=hidden name=login value=<?php echo $login ?>>
       <input type=hidden name=do_changes value=0>
@@ -98,7 +98,7 @@ if ($do_changes == 1){
 Group Members (Check to Delete)
 </td>
 <td>
-<select name=del_members[] multiple size=5> 
+<select name=del_members[] multiple size=5>
 <?php
 foreach ($group_members as $member){
        echo "<option value=\"$member\">$member\n";
index 2c63a80..ed953e6 100644 (file)
@@ -62,7 +62,7 @@ if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){
 <tr bgcolor="black" valign=top><td colspan=2>
        <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
        <tr><td>
-   
+
 <?php
 if (is_file("../lib/$config[general_lib_type]/group_info.php3"))
        include("../lib/$config[general_lib_type]/group_info.php3");
@@ -94,7 +94,7 @@ EOM;
                if (!isset($existing_groups))
                        echo "<b>No groups available</b>\n";
                else{
-                       echo "<select name=\"existing_groups\">\n";     
+                       echo "<select name=\"existing_groups\">\n";
                        foreach ($existing_groups as $group => $count)
                                echo "<option value=\"$group\">$group\n";
                        echo "</select>\n";
@@ -116,7 +116,7 @@ EOM;
                <textarea name=members cols="15" wrap="PHYSICAL" rows=5></textarea>
                </td>
        </tr>
-               
+
 EOM;
        foreach($show_attrs as $key => $desc){
                $name = $attrmap["$key"];
index 6461a7d..11d06c5 100644 (file)
@@ -144,7 +144,7 @@ foreach ($rules as $rule){
                $rulestr = "$rule";
        else
                $rulestr .= ",$rule";
-} 
+}
 if ($update == 1 && $val != '')
        echo <<<EOM
 <script language="JavaScript1.1" type="text/javascript">
@@ -247,7 +247,7 @@ if (!empty($rules)){
        echo "</select>\n";
 }
 else
-       echo "<i>No rules available</i><br>\n"; 
+       echo "<i>No rules available</i><br>\n";
 ?>
 </td></tr>
 <tr><td colspan=5 align=center><?php echo $err_msg ?></td></tr>
index c4b3cfc..622b2dd 100644 (file)
@@ -185,7 +185,7 @@ else
 NAS List
 </td>
 <td>
-<select name=selected_nas size=5 OnChange="this.form.select_nas.value=1;this.form.submit()"> 
+<select name=selected_nas size=5 OnChange="this.form.select_nas.value=1;this.form.submit()">
 <?php
 foreach ($my_nas_list as $member){
        $name = $member[name];
@@ -200,7 +200,7 @@ $array = $my_nas_list[$selected_nas];
 echo <<<EOM
 <tr>
 <td align=right bgcolor="#d0ddb0">
-NAS Name 
+NAS Name
 </td>
 <td>
 <input type=text name=nasname size=40 value="$array[name]" $readonly>
index 85f7381..1d2f664 100644 (file)
@@ -16,7 +16,7 @@
        <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
        <tr><td>
        <table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
-       <tr><td align=center bgcolor="#d0ddb0">Password</td><td><input type="password" name="passwd" value="">&nbsp;<input type="submit" class=button value="check"></td></tr>  
+       <tr><td align=center bgcolor="#d0ddb0">Password</td><td><input type="password" name="passwd" value="">&nbsp;<input type="submit" class=button value="check"></td></tr>
        </table>
        </table>
 </table>
index ca48d91..65925b9 100644 (file)
@@ -40,7 +40,7 @@ $days[0] = $after;
 $counter = $after_time + 86400;
 $i = 1;
 while($counter < $before_time){
-       $days[$i++] = date($config[sql_date_format],$counter);  
+       $days[$i++] = date($config[sql_date_format],$counter);
        $counter += 86400;
 }
 $days[$i] = $before;
@@ -109,7 +109,7 @@ if ($link){
                else
                        $search = @da_sql_query($link,$config,
                        "SELECT $res[1],$res[2],$res[3] FROM $config[sql_accounting_table]
-                       $sql_val[user] AND acctstoptime >= '$day 00:00:00' 
+                       $sql_val[user] AND acctstoptime >= '$day 00:00:00'
                        AND acctstoptime <= '$day 23:59:59' $s $sql_extra_query;");
                if ($search){
                        $row = @da_sql_fetch_array($search,$config);
index 3c4e7ff..e29f644 100644 (file)
@@ -229,11 +229,11 @@ if ($link){
                                $remaining = $remaining - $lastlog_session_time;
                                if ($remaining < 0)
                                        $remaining = 0;
-                               $log_color = ($remaining) ? 'green' : 'red'; 
+                               $log_color = ($remaining) ? 'green' : 'red';
                        }
                        $lastlog_session_time_jvs = 1000 * $lastlog_session_time;
                        $lastlog_session_time = time2strclock($lastlog_session_time);
-                       $lastlog_client_ip = $row['framedipaddress'];   
+                       $lastlog_client_ip = $row['framedipaddress'];
                        $lastlog_server_name = @gethostbyaddr($lastlog_server_ip);
                        $lastlog_client_name = @gethostbyaddr($lastlog_client_ip);
                        $lastlog_callerid = $row['callingstationid'];
@@ -265,7 +265,7 @@ if ($link){
                                $lastlog_server_ip = $row['nasipaddress'];
                                $lastlog_server_port = $row['nasportid'];
                                $lastlog_session_time = time2str($row['acctsessiontime']);
-                               $lastlog_client_ip = $row['framedipaddress'];   
+                               $lastlog_client_ip = $row['framedipaddress'];
                $lastlog_server_name = ($lastlog_server_ip != '') ? @gethostbyaddr($lastlog_server_ip) : '-';
                $lastlog_client_name = ($lastlog_client_ip != '') ? @gethostbyaddr($lastlog_client_ip) : '-';
                                $lastlog_callerid = $row['callingstationid'];
index 6edd647..35f2128 100644 (file)
@@ -58,7 +58,7 @@ print <<<EOM
        <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
        <tr><td>
 EOM;
-   
+
 if ($delete_user == 1){
        if ($user_type != 'group'){
                if (is_file("../lib/$config[general_lib_type]/delete_user.php3"))
index edd044b..bdb32a9 100644 (file)
@@ -57,7 +57,7 @@ else
 if ($user_type != 'group')
        include("../html/user_toolbar.html.php3");
 else
-       include("../html/group_toolbar.html.php3");     
+       include("../html/group_toolbar.html.php3");
 
 print <<<EOM
 </table>
@@ -77,12 +77,12 @@ print <<<EOM
        <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
        <tr><td>
 EOM;
-   
+
 if ($change == 1){
        if (is_file("../lib/$config[general_lib_type]/change_attrs.php3"))
                include("../lib/$config[general_lib_type]/change_attrs.php3");
        if ($user_type != 'group'){
-               if ($config[general_show_user_password] != 'no' && $passwd != '' 
+               if ($config[general_show_user_password] != 'no' && $passwd != ''
                        && is_file("../lib/$config[general_lib_type]/change_passwd.php3"))
                        include("../lib/$config[general_lib_type]/change_passwd.php3");
                if (is_file("../lib/$config[general_lib_type]/user_info.php3"))
@@ -101,7 +101,7 @@ else if ($badusers == 1){
        if (is_file("../lib/add_badusers.php3"))
                include("../lib/add_badusers.php3");
 }
-       
+
 ?>
    <form name="edituser" method=post>
       <input type=hidden name=login value=<?php print $login ?>>
@@ -171,7 +171,7 @@ EOM;
                                $vals[] = $default_vals["$key"][$i];
                                $ops[] = $default_vals["$key"][operator][$i];
                        }
-               }       
+               }
                if ($add && $name == $add_attr){
                        $vals[] = $default_vals["$key"][0];
                        $ops[] = ($default_vals["$key"][operator][0] != '') ? $default_vals["$key"][operator][0] : '=';
index f5868cb..18cb42b 100644 (file)
@@ -49,7 +49,7 @@ if (is_file("../lib/$config[general_lib_type]/user_info.php3"))
 <tr bgcolor="black" valign=top><td colspan=2>
        <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
        <tr><td>
-   
+
    <form method=post>
       <input type=hidden name=login value="<?php echo $login?>">
       <input type=hidden name=change value="0">
index b40c0eb..5ac54de 100644 (file)
@@ -50,7 +50,7 @@ include("password_generator.jsc");
 <tr bgcolor="black" valign=top><td colspan=2>
        <table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
        <tr><td>
-   
+
 <?php
 if ($create == 1){
        if (is_file("../lib/$config[general_lib_type]/user_info.php3"))
index 60c3519..9630521 100644 (file)
@@ -70,7 +70,7 @@ if ($test_user == 1){
        $req=file($config[general_auth_request_file]);
        if ($config[general_ld_library_path] != '')
                putenv("LD_LIBRARY_PATH=$config[general_ld_library_path]");
-       $comm = $config[general_radclient_bin] . " $server:$port" . ' auth ' . $config[general_radius_server_secret] 
+       $comm = $config[general_radclient_bin] . " $server:$port" . ' auth ' . $config[general_radius_server_secret]
                . ' >' . $tmp_file;
        $fp = popen("$comm","w");
        if ($fp){
index ce1809e..a793531 100644 (file)
@@ -61,7 +61,7 @@ EOM;
        <tr>
                <td colspan=2>
                <center>
-               statistics for 
+               statistics for
 <?php
 if ($login == '')
        echo <<<EOM
@@ -84,7 +84,7 @@ EOM;
        <tr>    <td colspan=2><hr size=1 noshade>
                </td>
                </tr>
-               
+
        </table>
        </td>
        </tr>
index 6309eed..e600369 100644 (file)
@@ -13,8 +13,8 @@ if ($logged_now)
 <!--
        var start;
        var our_time;
-       
-       function startcounter() 
+
+       function startcounter()
        {
                var start_date = new Date();
                start = start_date.getTime();
@@ -26,21 +26,21 @@ if ($logged_now)
        {
                var now_date = new Date();
                var diff = now_date.getTime() - start + our_time;
-                       
+
                var hours = parseInt(diff / 3600000);
                if(isNaN(hours)) hours = 0;
-                       
+
                var minutes = parseInt((diff % 3600000) / 60000);
                if(isNaN(minutes)) minutes = 0;
-                       
+
                var seconds = parseInt(((diff % 3600000) % 60000) / 1000);
                if(isNaN(seconds)) seconds = 0;
-                       
+
                var timeValue = " " ;
                timeValue += ((hours < 10) ? "0" : "") + hours;
                timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
                timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
-               
+
                document.online.status.value = timeValue;
                setTimeout("showcounter()", 1000);
        }
@@ -92,7 +92,7 @@ if ($logged_now){
        </td></tr>
        <tr><td align=center bgcolor="#d0ddb0">
        Connection Duration
-       </td><td>       
+       </td><td>
        <input type="text" name="status" size=10 value="$lastlog_session_time">
        </form>
        </td></tr>
@@ -207,7 +207,7 @@ lign=top>
        <tr><td align=center bgcolor="#d0ddb0">Average Upload</td><td>
        $avg_input</td></tr></td></tr>
        <tr><td align=center bgcolor="#d0ddb0">Average Download</td><td>
-       $avg_output</td></tr></td></tr> 
+       $avg_output</td></tr></td></tr>
        </table>
        </table>
 </table>
index c2a533b..b2e0a87 100644 (file)
@@ -2,7 +2,7 @@
 echo <<<EOM
        <tr><td align=center bgcolor="#d0ddb0">
        Server
-       </td><td>       
+       </td><td>
        <b>$lastlog_server_name</b> ($lastlog_server_ip)
        </td></tr>
        <tr><td align=center bgcolor="#d0ddb0">
index 60b2f57..1ac4f1a 100644 (file)
@@ -15,7 +15,7 @@ require_once('../lib/ldap/functions.php3');
                                $i = 0;
                                $j = -1;
                                $name = $attrmap["$key"] . $i;
-               
+
                                while (isset($$name)){
                                        $val = $$name;
                                        $i++;
@@ -36,7 +36,7 @@ require_once('../lib/ldap/functions.php3');
 //     if values is the same as the default or if the value is null and the ldap attribute exists
 //     then delete them
 //
-                                       if ((check_defaults($val,'',$default_vals["$key"]) || $val == '') && 
+                                       if ((check_defaults($val,'',$default_vals["$key"]) || $val == '') &&
                                                isset($item_vals["$key"][$j]))
                                                $del[$attrmap["$key"]][] = $item_vals["$key"][$j];
 //
index 4e37504..492ab14 100644 (file)
@@ -23,7 +23,7 @@ require_once('../lib/ldap/functions.php3');
                        $mod['givenname'] = ($decode_normal) ? encode_string($mod['givenname'],$k) : $mod['givenname'];
                                $mod['sn'] = $sn;
                                $mod['sn'] = ($decode_normal) ? encode_string($mod['sn'],$k) : $mod['sn'];
-                               
+
                        }
                        if ($Fmail != '' && $Fmail != '-' && $Fmail != $mail)
                                $mod['mail'] = $Fmail;
index e09f699..72592dd 100644 (file)
@@ -123,7 +123,7 @@ function check_user_passwd($dn,$passwd,$config)
                return FALSE;
 
        return FALSE;
-}      
+}
 
 function closedb($ds,$config)
 {
index 95525cb..20cb6e0 100644 (file)
@@ -22,7 +22,7 @@ $op_nexst = '!*';
 function check_operator($op,$type)
 {
        switch($op){
-               case '=': 
+               case '=':
                case ':=':
                case '+=':
                        return 0;
index a71e706..04f99f6 100644 (file)
@@ -76,7 +76,7 @@ if ($link){
                                if (!$res || !@da_sql_affected_rows($link,$res,$config))
                                        echo "<b>Delete failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n";
                        }
-       //      if value is null or equals the default value then don't add it 
+       //      if value is null or equals the default value then don't add it
                        else if ($val == '' || check_defaults($val,$op_val,$default_vals["$key"]))
                                continue;
        //      if value differs from the sql value then update
index 5485b3f..c519a1f 100644 (file)
@@ -50,7 +50,7 @@ if ($link){
        }
        else
                echo "<b>Cannot use the user info table. Check the sql_use_user_info_table directive in admin.conf</b><br>\n";
-       
+
 }
 else
        echo "<b>Could not connect to SQL database</b><br>\n";
index 35fa1dc..e80a827 100644 (file)
@@ -31,7 +31,7 @@ if ($link){
                                "UPDATE $config[sql_check_table] SET value = '$passwd' $text3 WHERE
                                attribute = '$config[sql_password_attribute]' AND username = '$login';");
                                if (!$res || !@da_sql_affected_rows($link,$res,$config))
-                                       echo "<b>Error while changing password: " . da_sql_error($link,$config) . "</b><br>\n"; 
+                                       echo "<b>Error while changing password: " . da_sql_error($link,$config) . "</b><br>\n";
                        }
                        else{
                                $res = @da_sql_query($link,$config,
index 1f3e876..6896081 100644 (file)
@@ -37,7 +37,7 @@ if ($link){
                                        $Fou = da_sql_escape_string($Fou);
                                        $Fhomephone = da_sql_escape_string($Fhomephone);
                                        $Fworkphone = da_sql_escape_string($Fworkphone);
-                                       $Fmobile = da_sql_escape_string($Fmobile);      
+                                       $Fmobile = da_sql_escape_string($Fmobile);
                                        $res = @da_sql_query($link,$config,
                                        "INSERT INTO $config[sql_user_info_table]
                                        (username,name,mail,department,homephone,workphone,mobile) VALUES
index 8ade8a1..21ea439 100644 (file)
@@ -39,7 +39,7 @@ if ($login != '' && $user_type != 'group'){
                                foreach ($member_groups as $group)
                                        $in .= "'$group',";
                                $in = substr($in,0,-1);
-                               $in .= ')';     
+                               $in .= ')';
                                $res = @da_sql_query($link,$config,
                                "SELECT attribute,value $op FROM $config[sql_groupcheck_table]
                                WHERE groupname IN $in;");
index a968fd8..11890d0 100644 (file)
@@ -114,7 +114,7 @@ function da_sql_affected_rows($link,$result,$config)
 
 function da_sql_list_fields($table,$link,$config)
 {
-       $res = @dbx_query($link,"SELECT * FROM ".$table." LIMIT 1 ;"); 
+       $res = @dbx_query($link,"SELECT * FROM ".$table." LIMIT 1 ;");
        if ($res){
                $fields[num] = $res->cols;
        }
index 1fabc3d..194266f 100644 (file)
@@ -84,13 +84,13 @@ function da_sql_query($link,$config,$query)
 function da_sql_num_rows($statement,$config)
 {
        // Unfortunately we need to fetch the statement as ocirowcount doesn't work on SELECTs
-       $rows = OCIFetchStatement($statement,$res); 
+       $rows = OCIFetchStatement($statement,$res);
 
         if ($config[sql_debug] == 'true'){
                 print "<b>DEBUG(SQL,OCI DRIVER): Query Result: Num rows:: " . $rows . "</b><br>\n";
         }
        // Unfortunately we need to re-execute because the statement cursor is reset after OCIFetchStatement :-(
-       OCIExecute($statement); 
+       OCIExecute($statement);
         return $rows;
 }
 
index 68ad17c..4f85653 100644 (file)
@@ -141,7 +141,7 @@ function da_sql_num_fields($fields,$config)
 function da_sql_field_name($fields,$num,$config)
 {
        if ($fields){
-               $row = @pg_fetch_row($fields[res],$num);        
+               $row = @pg_fetch_row($fields[res],$num);
                if ($row)
                        return $row[0];
        }
index 8c5fd9d..9f76451 100644 (file)
@@ -8,7 +8,7 @@ function da_sql_limit($limit,$point,$config)
                        return '';
                case 2:
                        return "LIMIT $limit";
-       }       
+       }
 }
 
 function da_sql_host_connect($server,$config)
index 9bbd8b1..d5b280a 100644 (file)
@@ -15,7 +15,7 @@ if ($link){
                $max = 10;
        if ($max > 500)
                $max = 10;
-       if (($search_IN == 'name' || $search_IN == 'department' || $search_IN == 'username') && 
+       if (($search_IN == 'name' || $search_IN == 'department' || $search_IN == 'username') &&
                        $config[sql_use_user_info_table] == 'true'){
                $res = @da_sql_query($link,$config,
                "SELECT " . da_sql_limit($max,0,$config) . " username FROM $config[sql_user_info_table] WHERE
index 7d6b613..d7178c0 100644 (file)
@@ -24,7 +24,7 @@ function get_user_info($link,$user,$config)
                        $row = @da_sql_fetch_array($res,$config);
                        if ($row)
                                return $row[name];
-               }       
+               }
        }
 }
 
index 6eecd65..c5492ce 100644 (file)
@@ -27,7 +27,7 @@ if ($link){
                                if ($res){
                                        if (@da_sql_num_rows($res,$config))
                                                echo "<b>User $new_member already is a member of the group</b><br>\n";
-                                       else{   
+                                       else{
                                                $res = @da_sql_query($link,$config,
                                                "INSERT INTO $config[sql_usergroup_table] (groupname,username)
                                                VALUES ('$login','$new_member');");
index 58d2261..edb450d 100644 (file)
@@ -81,7 +81,7 @@ if ($link){
                                        $member = $row[username];
                                        $group_members[] = "$member";
                                }
-                       }       
+                       }
                        else
                                echo "<b>Database query failed partially: " . da_sql_error($link,$config) . "</b><br>\n";
                        if (isset($tmp)){
index a7aa428..aee4f08 100644 (file)
@@ -22,10 +22,10 @@ if ($config[sql_nas_table] != ''){
                        $NAS_ARR = split(',',$mappings[$auth_user][nasdb]);
                        $extra = 'WHERE nasname IN (';
                        foreach ($NAS_ARR as $nas)
-                               $extra .= "'$nasname',";        
+                               $extra .= "'$nasname',";
                        unset($NAS_ARR);
                        $extra = rtrim($extra,",");
-                       $extra .= ')';  
+                       $extra .= ')';
                }
                $search = @da_sql_query($link,$config,
                "SELECT * FROM $config[sql_nas_table] $extra;");
index 4c56a29..0be9587 100644 (file)
@@ -78,7 +78,7 @@ if ($link){
                                                $user_exists = 'yes';
                                                $user_info = 1;
                                        }
-                                       if (($row = @da_sql_fetch_array($res,$config))){        
+                                       if (($row = @da_sql_fetch_array($res,$config))){
                                                $cn = ($row[name] != '') ? $row[name] : '-';
                                                $telephonenumber = ($row[workphone] != '') ? $row[workphone] : '-';
                                                $homephone = ($row[homephone] != '') ? $row[homephone] : '-';
@@ -86,7 +86,7 @@ if ($link){
                                                $mail = ($row[mail] != '') ? $row[mail] : '-';
                                                $mobile = ($row[mobile] != '') ? $row[mobile] : '-';
                                        }
-                               }                       
+                               }
                                else
                                        echo "<b>Database query failed partially: " . da_sql_error($link,$config) . "</b><br>\n";
                        }
index b2f6967..ca01d60 100644 (file)
@@ -6,7 +6,7 @@
  * This trigger updates fills in the groupname field (which doesnt come in Accounting packets)
  * by querying the radusergroup table.
  * This makes it easier to do group summary reports, however note that it does add some extra
- * database load to 50% of your SQL accounting queries. If you dont care about group summary 
+ * database load to 50% of your SQL accounting queries. If you dont care about group summary
  * reports then you dont need to install this.
  *
  */
index 2fc9460..753013d 100755 (executable)
@@ -3,7 +3,7 @@
 #  Check the RADIUS server configuration files.
 #
 #  If everything is OK, this script exits without an error.
-#  
+#
 #  If there was an error parsing the configuration files, this script
 #  prints the errors to the screen, and exits with an error.
 #
index 14cd029..819887c 100755 (executable)
@@ -42,7 +42,7 @@ if (defined $naslist) {
     while (<OLD>) {
        next if (/^\s*\#/);
        next if (/^\s*$/);
-       
+
        split;
 
        if (!defined $clients{$_[0]}) {
index c316e26..1faa406 100755 (executable)
@@ -37,8 +37,8 @@ for ($num=0; $num<$numusers; $num++) {
                $num--;
                next;
        }
-       $userlist{$username} = 1;       
-       
+       $userlist{$username} = 1;
+
        # generate password
        $password = "";
        for($i=0; $i<rand($passlen)+2; $i++) {
@@ -51,8 +51,8 @@ for ($num=0; $num<$numusers; $num++) {
        printf RAD  "User-Name=$username, User-Password=$password,NAS-IP-Address=127.0.0.1,NAS-Port-Id=0\n\n";
        print NOCRYPT "$username:$password\n";
        print USERS "$username  Auth-Type:=Local, User-Password==\"$password\"\n\tClass=\"0x$num\"\n\n";
-} 
-       
+}
+
 close(PASS);
 close(SHAD);
 close(RAD);
index 769c01c..eff8b1b 100755 (executable)
@@ -50,13 +50,13 @@ sub process($) {
     $processed{$file}++;
 
     open FILE, "<$file" or die "Failed to open $file: $!\n";
-    
+
     $line = 0;
     while (<FILE>) {
        $line++;
-       
+
        next if (!/^\s*\#\s*include\s+/);
-       
+
        if (/^\s*\#\s*include\s+"(.+?)"/) {
            $refs{$file}{$1} = $line;
 
@@ -70,14 +70,14 @@ sub process($) {
            $include{$1}++;
        }
     }
-    
+
     close FILE;
 }
 
 #
 #  Where include files are located.
 #
-#  FIXME: 
+#  FIXME:
 #
 @directories = ("src/lib", "src");
 $do_it = 0;
@@ -203,7 +203,7 @@ if ($debug > 0) {
 if (!$do_it) {
     foreach $file (sort keys %duplicate) {
        print $file, "\n";
-       
+
        foreach $inc (sort keys %{$duplicate{$file}}) {
            print "\t[", $refs{$file}{$inc}, "] ", $inc, " (", $duplicate{$file}{$inc}, " at ", $refs{$file}{$duplicate{$file}{$inc}}, ")\n";
        }
@@ -212,7 +212,7 @@ if (!$do_it) {
     foreach $file (sort keys %duplicate) {
        open FILE, "<$file" or die "Failed to open $file: $!\n";
        open OUTPUT, ">$file.tmp" or die "Failed to create $file.tmp: $!\n";
-       
+
        $line = 0;
        while (<FILE>) {
            $line++;
index 5644bc3..4dbd04f 100755 (executable)
@@ -60,7 +60,7 @@
 # -----------------------------------------------------------------------
 
 
-# TODO: 
+# TODO:
 # currently does not encrypt passwords (takes them from outside file)
 
 # Command line options
@@ -72,7 +72,7 @@ use Getopt::Std;
 getopts('dpmf:');
 $debug = $opt_d;
 
-%passwords; 
+%passwords;
 # This might or might not be necessary depending if your LDAP server
 # when importing from ldif introduces crypted passwords in the LDAP db
 # (not necessary for Netscape's Directory Server)
@@ -144,14 +144,14 @@ $addgroup = $addgroup."\ncn: $groupname";
 #        { "radiusLoginLATPort", "Login-LAT-Port" },
 # You can change to the mappings below like this
 # cat radius2ldif.pl | grep ^# | \
-# perl -ne 'if ( /\{ \"(.*?)\", \"(.*?)\" \}/ ) \ 
+# perl -ne 'if ( /\{ \"(.*?)\", \"(.*?)\" \}/ ) \
 # { $attr=lc $2; print "\$mapping{\"$attr\"} = \"$1\";\n" ; } '
 
 
 # Warning: sometimes password must be encrypted before sent to the LDAP
 # Which Perl libraries are available? Only way I find is through
-# Netscape's NDS getpwenc. 
-# However NDS does the cyphering even if sending plain passwords 
+# Netscape's NDS getpwenc.
+# However NDS does the cyphering even if sending plain passwords
 # (do all LDAP's do this?)
 # TODO: test with OpenLDAP
 $mapping{'password'} = "userpassword";
@@ -211,7 +211,7 @@ while ($line=<STDIN>) {
        }
        # Start line is hardcoded must be uid followed by password
        # this could be changed to use any other parameter however
-       if ( $line =~ /^(\w+)\s*\t*(?:User-)?Password=(\w+)/ ) { 
+       if ( $line =~ /^(\w+)\s*\t*(?:User-)?Password=(\w+)/ ) {
                $uid = $1;
                $password= $2;
                $password = $passwords{$password} if $opt_f;
@@ -220,7 +220,7 @@ while ($line=<STDIN>) {
                $dn=$predn.$uid.$basedn; # Start of LDIF entry
                $header = "$dn\n";
                push @userlist, $dn;
-               if ( $opt_m ) { 
+               if ( $opt_m ) {
                        $header= $header."changetype: modify\n";
                } else {
                        for (my $i=0; $i < $#objectClass+1; $i++) {
@@ -255,7 +255,7 @@ while ($line=<STDIN>) {
                                }
                } # of if line
        } # of if startentry
-               
+
 } # of while
 
 
index 4aeac6c..abaa9c0 100644 (file)
@@ -42,15 +42,15 @@ sub check_attribs {
                print "undefined parameter!\n";
                return undef;
        };
-       
+
        $attr = $_[0];
        $val  =  $_[1];
-       
+
        if ($attr !~ /Password|Framed-IP-Address|Framed-IP-Netmask|Framed-IP-Routing|Framed-Routing|Framed-IP-Route|Password|Simultaneous-Use|Idle-Timeout|Auth-Type|Service-Type|Netmask|Framed-Protocol/ ) {
                print "unrecognized attribute: $attr\n" if $debug>1;
                return undef;
        };
-       
+
        return undef if (       (! defined($val) ) or
                ( ($attr =~ /Simultaneous\-Use/i) && ( $val !~ /^[0-9]*$/ ) )
                );
@@ -75,10 +75,10 @@ sub user_attribute {
        $duser=$_[1];
        $dattrib=$_[2];
        $dval=$_[3];
-       
+
        print "inserting \"$dattrib\", \"$dval\" for \"$duser\" in rad$dtable\n" if ( $dtable !~ /group/ and $debug>2);
        print "inserting \"$duser\" into usergroup table as member of \"$dattrib\"\n" if ( $dtable =~ /group/ and $debug>2);
-       
+
        if ( $dtable =~ /group/ ) {
                $table = "usergroup";
        } elsif ( $dtable =~ /check/ ) {
@@ -88,7 +88,7 @@ sub user_attribute {
        } else {
                die "argh! what table is $dtable?\n";
        };
-       
+
 
        if ( $table =~ /usergroup/ ) {
                if ( $dattrib =~ /static/ ) {
@@ -96,7 +96,7 @@ sub user_attribute {
                        $return = $database->do ("DELETE FROM `$table` WHERE `UserName`='$duser' LIMIT 1");
                };
                $return = $database->do ("INSERT INTO `$table` SET `UserName`='$duser',`GroupName`='$dattrib'");
-               
+
        } else {
                $return = $database->do ("INSERT INTO `$table` SET `UserName`='$duser',`Attribute`='$dattrib',`Value`='$dval', `op`=':='");
        };
@@ -111,7 +111,7 @@ while (<USERS>) {
        next if ( /^\#/ );
        next if ( /^$/ );
        next if ( /^\s*$/ );
-       
+
        if ( /^[a-zA-Z0-9]+/ ) {
                print "located a user entry: $_\n" if $debug>6;
                ($user,$rest) = split /\s/, $_, 2;
@@ -123,7 +123,7 @@ while (<USERS>) {
                # Already found the user, now finding attributes...
                @attribs = $_;
        };
-       
+
        foreach $attr (@attribs) {
                ($attrib,$value) = split /=/, $attr, 2;
                #TODO: insert sanity checks here!
@@ -134,13 +134,13 @@ while (<USERS>) {
                        next;
                };
                print "attrib: $attrib has value: $value\n" if $debug>8;
-       
+
                if ( $attrib =~ /Framed-IP-Address/ ) {
                        #user is a static IP user...
                        $static{$user} = 1;
                        user_attribute("group",$user,"static","");
                };
-       
+
                if ( $attrib =~ /Password|Simultaneous-Use/ ) {
                        #This is an individual check attribute, so we'll pass it along...
                        user_attribute("check",$user,$attrib,$value);
@@ -150,7 +150,7 @@ while (<USERS>) {
                        user_attribute("reply",$user,$attrib,$value);
                };
        };
-       
+
 };
 
 close USERS;
index 7bef948..8a64e4d 100755 (executable)
@@ -75,8 +75,8 @@ VALUE ASN-Webfilter-Mode              Allow                   2
 #         query string of %u, but note for convenience
 #         without the leading "/".
 #    %t - matched destination group or "unknown"
-#    %u - requested URL                  
-#    %% - single '%'                          
+#    %u - requested URL
+#    %% - single '%'
 #
 ATTRIBUTE      ASN-Webfilter-Redirect                  114     string
 
index 5723fa4..f6b18e2 100644 (file)
@@ -7,7 +7,7 @@
 #
 ##############################################################################
 
-VENDOR         HP                              11 
+VENDOR         HP                              11
 
 # Management authorization
 BEGIN-VENDOR   HP
index 9f75423..740f6b5 100644 (file)
@@ -1,5 +1,5 @@
-# 
-# dictionary.patton 
+#
+# dictionary.patton
 #               Dictionary for Patton IADs.
 #               Written by Pawel Pierscionek <pawel@voiceworks.pl>
 #               based on specifications available from vendor
@@ -7,21 +7,21 @@
 # Version:      @(#)dictionary.patton  1.00  urtho  08-Sep-2006
 #  $Id$
 
-VENDOR         Patton                          1768    
+VENDOR         Patton                          1768
 
 BEGIN-VENDOR   Patton
 
-ATTRIBUTE      Patton-Setup-Time                               32      string  
-ATTRIBUTE      Patton-Connect-Time                             33      string  
+ATTRIBUTE      Patton-Setup-Time                               32      string
+ATTRIBUTE      Patton-Connect-Time                             33      string
 ATTRIBUTE      Patton-Disconnect-Time                          34      string
 ATTRIBUTE      Patton-Disconnect-Cause                         35      integer
 ATTRIBUTE      Patton-Disconnect-Source                        36      string
-ATTRIBUTE      Patton-Called-Unique-Id                         48      string  
+ATTRIBUTE      Patton-Called-Unique-Id                         48      string
 ATTRIBUTE      Patton-Called-IP-Address                        49      ipaddr
 ATTRIBUTE      Patton-Called-Numbering-Plan                    50      string
 ATTRIBUTE      Patton-Called-Type-Of-Number                    51      string
 ATTRIBUTE      Patton-Calling-Unique-Id                        80      string
-ATTRIBUTE      Patton-Calling-IP-Address                       81      ipaddr  
+ATTRIBUTE      Patton-Calling-IP-Address                       81      ipaddr
 ATTRIBUTE      Patton-Calling-Numbering-Plan                   82      string
 ATTRIBUTE      Patton-Calling-Type-Of-Number                   83      string
 ATTRIBUTE      Patton-Calling-Presentation-Indicator           88      string
index 7228a65..cad3ded 100755 (executable)
@@ -19,11 +19,11 @@ $blank = 0;
 
 while (@ARGV) {
     $filename = shift;
-    
+
     open FILE, "<$filename" or die "Failed to open $filename: $!\n";
-    
+
     @output = ();
-    
+
     while (<FILE>) {
        #
        #  Clear out trailing whitespace
@@ -66,7 +66,7 @@ while (@ARGV) {
            next;
        }
 
-       #  
+       #
        #  Remember if we did begin-vendor.
        #
        if (/^BEGIN-VENDOR\s+([\w-]+)/) {
index 935ee1b..c954c93 100644 (file)
@@ -130,7 +130,7 @@ SELECT RadAcctId AS ID, NASIPAddress AS GWIP, AcctSessionTime AS Call_Seconds, c
 FROM StopTelephony;
 
 CREATE OR REPLACE VIEW calls AS
-SELECT Date, Time, Length, Number, cust_ip, gw_ip 
+SELECT Date, Time, Length, Number, cust_ip, gw_ip
 FROM call_history
 WHERE Length > 0
 ORDER BY Date, Time, Number, Length, cust_ip ASC;
@@ -174,7 +174,7 @@ END;
 CREATE OR REPLACE FUNCTION TelephonyInsertRecord(StopTelephony.UserName%TYPE, StopTelephony.NASIPAddress%TYPE, StopTelephony.AcctSessionTime%TYPE,
     StopTelephony.AcctInputOctets%TYPE, StopTelephony.AcctOutputOctets%TYPE, StopTelephony.CalledStationId%TYPE, StopTelephony.CallingStationId%TYPE,
     StopTelephony.AcctDelayTime%TYPE, StopTelephony.CiscoNASPort%TYPE, StopTelephony.h323CallOrigin%TYPE, StopTelephony.h323SetupTime%TYPE,
-    StopTelephony.h323ConnectTime%TYPE, StopTelephony.h323DisconnectTime%TYPE, StopTelephony.h323DisconnectCause%TYPE, 
+    StopTelephony.h323ConnectTime%TYPE, StopTelephony.h323DisconnectTime%TYPE, StopTelephony.h323DisconnectCause%TYPE,
     StopTelephony.H323VoiceQuality%TYPE, StopTelephony.CallID%TYPE) RETURNS BOOLEAN AS '
 DECLARE
 BEGIN
index 0da9eb5..f5ec30b 100644 (file)
@@ -136,7 +136,7 @@ CREATE TABLE gateways (
 
 /*
  * Table structure for 'customers'
- * 
+ *
  * This table should list your Customers names and company
  * This can be used to make more useful reports.
  */
@@ -149,7 +149,7 @@ CREATE TABLE customers (
 
 /*
  * Table structure for 'cust_gw'
- * 
+ *
  * This table should list the IP addresses and Customer IDs of all your Customers gateways
  * This can be used to make more useful reports.
  */
index 8d3050a..6076509 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 #
-# syslog2db - Extract Clarent VoIP CDRs from billing_record files and 
-# insert them into a Postgresql database. 
+# syslog2db - Extract Clarent VoIP CDRs from billing_record files and
+# insert them into a Postgresql database.
 #
 # Author:       Peter Nixon <codemonkey@peternixon.net>
 # Date:         2003-05-07
@@ -56,7 +56,7 @@ my $password    = "";
 # Defaults
 my $defaulttimezone = "UTC";
 my $defaultyear = 2003;
-my $dbh; 
+my $dbh;
 
 my %working_record = ();
 
@@ -170,7 +170,7 @@ sub record_match($) {
                if ($verbose > 1) { print "DEBUG: Clean Record: @callrecord\n"; }
                $recordno++; %working_record = ();
                $working_record{local_setuptime} = clarent2normaltime($callrecord[0]);
-                $working_record{start_time} = $callrecord[3];  # This is in Unix timetamp format, relative to the originating gateway. 
+                $working_record{start_time} = $callrecord[3];  # This is in Unix timetamp format, relative to the originating gateway.
                                                                # It is therefore useless unless ALL gateways are set with the same timezone,
                                                                # so I don't bother to convert it to datetime format.
                 $working_record{duration} = $callrecord[4];
@@ -287,14 +287,14 @@ sub main {
                        $file = @ARGV[0];
                                &file_read($file);
                }
-               if ($verbose >= 0) { 
+               if ($verbose >= 0) {
                        my $runtime = (time() - $starttime);
                        if ($runtime < 1) { $runtime = 0.5; }           # Prevent divide-by-zero errors
                        my $speed = ($recordno / $runtime);
-                       if ($fileno > 1) { 
-                               print "\n$recordno records from $lineno lines in $fileno files were processed in ~$runtime seconds (~$speed records/sec)\n"; 
+                       if ($fileno > 1) {
+                               print "\n$recordno records from $lineno lines in $fileno files were processed in ~$runtime seconds (~$speed records/sec)\n";
                        } else {
-                               print "\n$recordno records from $lineno lines in $file were processed in ~$runtime seconds (~$speed records/sec)\n"; 
+                               print "\n$recordno records from $lineno lines in $file were processed in ~$runtime seconds (~$speed records/sec)\n";
                        }
                }
 
index 79b9753..28ff402 100755 (executable)
@@ -27,7 +27,7 @@ require DBI;
 require Getopt::Long;
 
 ## Program and File locations
-# gzcat - 'cat for .gz / gzip files' 
+# gzcat - 'cat for .gz / gzip files'
 # If you don't have gzcat and do have gzip then use: ln gzip gzcat
 $GZCAT = "/usr/bin/zcat";
 # zcat - 'cat for .Z / compressed files'
@@ -87,7 +87,7 @@ sub process_duplicates {
 
 sub procedure_insert {         # FIXME: Does not work with current SQL schema. Use standard method
        if ($verbose > 0) { print "Record: $passno) Conf ID: $h323_conf_id   Setup Time: $h323_setup_time  Call Length: $AcctSessionTime   "; }
-       if ($h323_call_type eq 'VoIP') { 
+       if ($h323_call_type eq 'VoIP') {
         $sth2 = $dbh->prepare("SELECT VoIPInsertRecord('$UserName', '$NasIPAddress', '$AcctSessionTime', '$AcctInputOctets', '$AcctOutputOctets',
                '$Called_Station_Id', '$Calling_Station_Id', '$AcctDelayTime', '$h323_call_origin', '$h323_setup_time',
                '$h323_connect_time','$h323_disconnect_time', '$h323_disconnect_cause', (NULLIF('$h323_remote_address', '')::inet), '$h323_voice_quality', '$h323_conf_id')");
@@ -104,7 +104,7 @@ sub procedure_insert {              # FIXME: Does not work with current SQL schema. Use stan
 }
 
 sub db_insert {
-       if ($h323_call_type eq 'VoIP') { 
+       if ($h323_call_type eq 'VoIP') {
         $sth2 = $dbh->prepare("INSERT into StopVoIP (
                AcctTime, UserName, NASIPAddress, AcctSessionTime, AcctInputOctets, AcctOutputOctets,
                CalledStationId, CallingStationId, AcctDelayTime, H323RemoteAddress, h323gwid, h323callorigin,
@@ -125,7 +125,7 @@ sub db_insert {
                 values(($Timestamp)::abstime, '$UserName', '$NasIPAddress', '$AcctSessionTime', '$AcctInputOctets', '$AcctOutputOctets',
                 '$Called_Station_Id', '$Calling_Station_Id', '$AcctDelayTime', '$Cisco_NAS_Port', '$h323_call_origin', '$h323_conf_id',
                '$h323_connect_time', '$h323_disconnect_cause', '$h323_disconnect_time', '$h323_setup_time', '$h323_voice_quality')");
-       } else { 
+       } else {
                if ($h323_call_type) { print "ERROR: Unsupported h323calltype: \"$h323_call_type\"\n"; }
                else { print "ERROR: Missing \"h323calltype\". This doesn't appear to be a VoIP record."; }
                return;         # Not a VoIP record. Bailout
@@ -138,7 +138,7 @@ sub db_insert {
 
 ## This sub can be used to update data in an existing database if you have some fields not in the Database.
 sub db_update {
-       my $sth2= $dbh->prepare("UPDATE radacct SET CalledStationId = '$Called_Station_Id', 
+       my $sth2= $dbh->prepare("UPDATE radacct SET CalledStationId = '$Called_Station_Id',
                AcctTerminateCause = '$AcctTerminateCause', H323RemoteAddress = '$h323_remote_address',
                AcctStatusType = '$AcctStatusType', callid = '$h323_conf_id', h323calltype = '$h323_call_type',
                CiscoNASPort = '$Cisco_NAS_Port', h323disconnectcause = '$h323_disconnect_cause',
@@ -305,7 +305,7 @@ sub process_record {
 
        # If its a valid record continue onto the database functions
        # FIXME: More checks needed here.
-       if ($h323_call_type) { 
+       if ($h323_call_type) {
                $passno++;
                #@duplicate_records{$passno} += @record;
                if (&procedure_get()) { &procedure_insert; }
@@ -354,7 +354,7 @@ sub read_detailfile {
        }
        my $file_runtime = (time() - $file_starttime);
        if ($file_runtime < 1) { $file_runtime = 1; }
-       my $file_speed = ($record_no / $file_runtime); 
+       my $file_speed = ($record_no / $file_runtime);
         if ($verbose >= 0) { print "\n $record_no total records read from $filename were processed in $file_runtime seconds ($file_speed records/sec) \n"; }
 }
 
@@ -420,12 +420,12 @@ sub main {
                exit(SUCCESS);
        }
 
-       if ($opt_x) { 
-               print "DEBUG: Debug mode is enabled.\n"; 
+       if ($opt_x) {
+               print "DEBUG: Debug mode is enabled.\n";
                $verbose = 2;
        } elsif ($quiet) { $verbose -= $quiet; }
        &procedure_set($opt_p);
-       if ($opt_d) { 
+       if ($opt_d) {
                if ($verbose > 0) { print "Using database \"$opt_d\" instead of default database \"$database\"\n"; }
                $database = $opt_d;
        }
@@ -445,7 +445,7 @@ sub main {
 
                my $runtime = (time() - $starttime);
                if ($runtime < 1) { $runtime = 1; }
-               my $speed = ($passno / $runtime); 
+               my $speed = ($passno / $runtime);
                if ($verbose >= 0) { print "\n $passno valid records were processed in $runtime seconds ($speed records/sec) \n"; }
        } else {
                print "ERROR: Please specify one or more detail file(s) to import.\n";
index 7831017..9a11eb9 100644 (file)
@@ -30,7 +30,7 @@ typedef struct home_server {
 
        lrad_ipaddr_t   ipaddr;
 
-       
+
        int             port;
        int             type;           /* auth/acct */
 
@@ -42,11 +42,11 @@ typedef struct home_server {
 
        lrad_event_t    *ev;
        struct timeval  when;
-       
+
        int             response_window;
        int             max_outstanding; /* don't overload it */
        int             currently_outstanding;
-       
+
        struct timeval  zombie_period_start;
        int             zombie_period; /* unresponsive for T, mark it dead */
 
index eaf867f..eb2923d 100644 (file)
@@ -113,7 +113,7 @@ static uint32_t dict_hashname(const char *name)
                hash *= FNV_MAGIC_PRIME;
                hash ^= (uint32_t ) (c & 0xff);
        }
-       
+
        return hash;
 }
 
@@ -347,7 +347,7 @@ int dict_addvendor(const char *name, int value)
                librad_log("dict_addvendor: vendor name too long");
                return -1;
        }
-       
+
        if ((dv = malloc(sizeof(*dv) + length)) == NULL) {
                librad_log("dict_addvendor: out of memory");
                return -1;
@@ -614,7 +614,7 @@ int dict_addvalue(const char *namestr, const char *attrstr, int value)
                dattr->flags.has_value = 1;
        } else {
                value_fixup_t *fixup;
-               
+
                fixup = (value_fixup_t *) malloc(sizeof(*fixup));
                if (!fixup) {
                        librad_log("dict_addvalue: out of memory");
@@ -624,7 +624,7 @@ int dict_addvalue(const char *namestr, const char *attrstr, int value)
 
                strlcpy(fixup->attrstr, attrstr, sizeof(fixup->attrstr));
                fixup->dval = dval;
-               
+
                /*
                 *      Insert to the head of the list.
                 */
@@ -640,7 +640,7 @@ int dict_addvalue(const char *namestr, const char *attrstr, int value)
        if (!lrad_hash_table_insert(values_byname, dval)) {
                if (dattr) {
                        DICT_VALUE *old;
-                       
+
                        /*
                         *      Suppress duplicates with the same
                         *      name and value.  There are lots in
@@ -724,7 +724,7 @@ static int process_attribute(const char* fn, const int line,
                                /* Boolean flag, means this is a
                                   tagged attribute */
                                flags.has_tag = 1;
-                               
+
                        } else if (strncmp(s, "encrypt=", 8) == 0) {
                                /* Encryption method, defaults to 0 (none).
                                   Currently valid is just type 2,
@@ -747,7 +747,7 @@ static int process_attribute(const char* fn, const int line,
                                        case PW_TYPE_INTEGER:
                                        case PW_TYPE_DATE:
                                                break;
-                                       
+
                                        default:
                                                librad_log( "dict_init: %s[%d] Only IP addresses can have the \"array\" flag set.",
                                                            fn, line);
@@ -765,7 +765,7 @@ static int process_attribute(const char* fn, const int line,
                                        /* New format */
                                        s += 7;
                                }
-                               
+
                                vendor = dict_vendorbyname(s);
                                if (!vendor) {
                                        librad_log( "dict_init: %s[%d]: unknown vendor \"%s\"",
@@ -803,7 +803,7 @@ static int process_attribute(const char* fn, const int line,
                                   fn, line,
                                   lrad_int2str(type_table, type, "?Unknown?"));
                        return -1;
-                       
+
                }
        }
 
@@ -1003,7 +1003,7 @@ static int process_vendor(const char* fn, const int line, char **argv,
                }
 
                p = format + 7;
-               if ((strlen(p) != 3) || 
+               if ((strlen(p) != 3) ||
                    !isdigit((int) p[0]) ||
                    (p[1] != ',') ||
                    !isdigit((int) p[2])) {
@@ -1134,7 +1134,7 @@ static int my_dict_init(const char *dir, const char *fn,
                fclose(fp);
                librad_log("dict_init: Dictionary \"%s\" is not a regular file",
                           fn);
-               return -1;        
+               return -1;
        }
 
        /*
@@ -1438,7 +1438,7 @@ int dict_init(const char *dir, const char *fn)
                                librad_log("dict_addvalue: Duplicate value name %s for attribute %s", this->dval->name, a->name);
                                return -1;
                        }
-                       
+
                        /*
                         *      Allow them to use the old name, but
                         *      prefer the new name when printing
@@ -1468,7 +1468,7 @@ int dict_init(const char *dir, const char *fn)
 
        lrad_hash_table_walk(attributes_byname, null_callback, NULL);
        lrad_hash_table_walk(attributes_byvalue, null_callback, NULL);
-       
+
        lrad_hash_table_walk(values_byvalue, null_callback, NULL);
        lrad_hash_table_walk(values_byname, null_callback, NULL);
 
@@ -1525,7 +1525,7 @@ DICT_VALUE *dict_valbyattr(int attr, int value)
        if (dv) dval.attr = dv->value;
 
        dval.value = value;
-       
+
        return lrad_hash_table_finddata(values_byvalue, &dval);
 }
 
@@ -1569,7 +1569,7 @@ int dict_vendorbyname(const char *name)
 
        dv = (DICT_VENDOR *) buffer;
        strlcpy(dv->name, name, DICT_VENDOR_MAX_NAME_LEN);
-       
+
        dv = lrad_hash_table_finddata(vendors_byname, dv);
        if (!dv) return 0;
 
index 305de2e..9690bd8 100644 (file)
@@ -125,7 +125,7 @@ int lrad_event_delete(lrad_event_list_t *el, lrad_event_t **ev_p)
        return 1;
 }
 
-                     
+
 int lrad_event_insert(lrad_event_list_t *el,
                      lrad_event_callback_t callback,
                      void *ctx, struct timeval *when,
@@ -176,7 +176,7 @@ int lrad_event_insert(lrad_event_list_t *el,
                                *ev_p = ev;
                                return 1;
                        }
-                               
+
                }
                free(ev);
                return 0;
@@ -209,7 +209,7 @@ static int lrad_event_find_earliest(void *ctx, void *data)
        }
 
        w->ev = ev;
-       return 1;       
+       return 1;
 }
 
 
@@ -317,10 +317,10 @@ int main(int argc, char **argv)
 
        el = lrad_event_list_create();
        if (!el) exit(1);
-       
+
        memset(&rand_pool, 0, sizeof(rand_pool));
        rand_pool.randrsl[1] = time(NULL);
-       
+
        lrad_randinit(&rand_pool, 1);
        rand_pool.randcnt = 0;
 
@@ -335,7 +335,7 @@ int main(int argc, char **argv)
                }
                lrad_event_insert(el, print_time, &array[i], &array[i]);
        }
-       
+
        while (lrad_event_list_num_elements(el)) {
                gettimeofday(&now, NULL);
                when = now;
index 8ae7f19..a783f72 100644 (file)
@@ -187,7 +187,7 @@ int main(int argc, char **argv)
 
        fi = lrad_fifo_create(MAX, NULL);
        if (!fi) exit(1);
-       
+
        for (i = 0; i < MAX; i++) {
                array[i] = i;
 
index d107e0d..ab984bb 100644 (file)
@@ -712,7 +712,7 @@ static int ascend_parse_port(uint16_t *port, char *compare, char *str)
 #define DONE_FLAGS     (IP_SRC_ADDR_FLAG | IP_DEST_ADDR_FLAG | \
                        IP_SRC_PORT_FLAG | IP_DEST_PORT_FLAG | \
                        IP_PROTO_FLAG | IP_EST_FLAG)
-       
+
 /*
  *     ascend_parse_ip:
  *
index 576bda2..9171bb7 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * These functions are defined and used only if the configure 
+ * These functions are defined and used only if the configure
  * cannot detect the standard getaddrinfo(), freeaddrinfo(),
  * gai_strerror() and getnameinfo(). This avoids sprinkling of ifdefs.
  *
- * FIXME: getaddrinfo() & getnameinfo() should 
+ * FIXME: getaddrinfo() & getnameinfo() should
  *        return all IPv4 addresses provided by DNS lookup.
  */
 
@@ -30,7 +30,7 @@ static pthread_mutex_t lrad_hodtbyaddr_mutex;
 #endif
 
 #undef LOCAL_GETHOSTBYNAMERSTYLE
-#ifndef GETHOSTBYNAMERSTYLE 
+#ifndef GETHOSTBYNAMERSTYLE
 #define LOCAL_GETHOSTBYNAMERSTYLE 1
 #elif (GETHOSTBYNAMERSTYLE != SYSVSTYLE) && (GETHOSTBYNAMERSTYLE != GNUSTYLE)
 #define LOCAL_GETHOSTBYNAMERSTYLE 1
@@ -69,7 +69,7 @@ int copy_hostent(struct hostent *from, struct hostent *to,
 {
     int i, len;
     char *ptr = buffer;
-    
+
     *error = 0;
     to->h_addrtype = from->h_addrtype;
     to->h_length = from->h_length;
@@ -102,7 +102,7 @@ int copy_hostent(struct hostent *from, struct hostent *to,
     to->h_addr_list = (char**)ptr;
     for(i = 0; (int *)from->h_addr_list[i] != 0; i++);
     ptr += (i+1) * sizeof(int *);
-     
+
     for(i = 0; (int *)from->h_addr_list[i] != 0; i++) {
        len = sizeof(int);
        if ((ptr-buffer)+len < buflen) {
@@ -121,7 +121,7 @@ int copy_hostent(struct hostent *from, struct hostent *to,
 
 #ifdef LOCAL_GETHOSTBYNAMERSTYLE
 static struct hostent *
-gethostbyname_r(const char *hostname, struct hostent *result, 
+gethostbyname_r(const char *hostname, struct hostent *result,
            char *buffer, int buflen, int *error)
 {
     struct hostent *hp;
@@ -328,7 +328,7 @@ getaddrinfo(const char *hostname, const char *servname,
 #if GETHOSTBYNAMERSTYLE == SYSVSTYLE
     hp = gethostbyname_r(hostname, &result, buffer, sizeof(buffer), &error);
 #elif GETHOSTBYNAMERSTYLE == GNUSTYLE
-    if (gethostbyname_r(hostname, &result, buffer, 
+    if (gethostbyname_r(hostname, &result, buffer,
          sizeof(buffer), &hp, &error) != 0) {
                hp = NULL;
        }
@@ -368,9 +368,9 @@ getaddrinfo(const char *hostname, const char *servname,
 
 #ifndef HAVE_GETNAMEINFO
 int
-getnameinfo(const struct sockaddr *sa, socklen_t salen, 
-               char *host, size_t hostlen, 
-               char *serv, size_t servlen, 
+getnameinfo(const struct sockaddr *sa, socklen_t salen,
+               char *host, size_t hostlen,
+               char *serv, size_t servlen,
                unsigned int flags)
 {
     struct sockaddr_in *sin = (struct sockaddr_in *)sa;
@@ -379,7 +379,7 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen,
     char tmpserv[16];
     char buffer[2048];
     int error;
-  
+
     if (serv) {
         snprintf(tmpserv, sizeof(tmpserv), "%d", ntohs(sin->sin_port));
         if (strlen(tmpserv) > servlen)
@@ -414,7 +414,7 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen,
             }
 #else
             hp = gethostbyaddr_r((char *)&sin->sin_addr,
-                               sizeof(struct in_addr), AF_INET, 
+                               sizeof(struct in_addr), AF_INET,
                               &result, buffer, sizeof(buffer), &error);
 #endif
 #else
index 909571f..71aeeca 100644 (file)
@@ -173,7 +173,7 @@ static uint32_t parent_of(uint32_t key)
 
        if (key > 0x000000ff)
                return (key & 0x000000ff) | (parent_byte[key >> 8] << 8);
-       
+
        return parent_byte[key];
 }
 
@@ -328,7 +328,7 @@ static void lrad_hash_table_fixup(lrad_hash_table_t *ht, uint32_t entry)
 
        if (!ht->buckets[parent_entry]) {
                lrad_hash_table_fixup(ht, parent_entry);
-       }       
+       }
 
        /*
         *      Keep walking down cur, trying to find entries that
@@ -337,7 +337,7 @@ static void lrad_hash_table_fixup(lrad_hash_table_t *ht, uint32_t entry)
         */
        last = &ht->buckets[parent_entry];
        this = parent_entry;
-       
+
        for (cur = *last; cur != &ht->null; cur = cur->next) {
                uint32_t real_entry;
 
@@ -369,7 +369,7 @@ static void lrad_hash_table_fixup(lrad_hash_table_t *ht, uint32_t entry)
 static void lrad_hash_table_grow(lrad_hash_table_t *ht)
 {
        lrad_hash_entry_t **buckets;
-       
+
        buckets = malloc(sizeof(*buckets) * GROW_FACTOR * ht->num_buckets);
        if (!buckets) return;
 
@@ -377,10 +377,10 @@ static void lrad_hash_table_grow(lrad_hash_table_t *ht)
               sizeof(*buckets) * ht->num_buckets);
        memset(&buckets[ht->num_buckets], 0,
               sizeof(*buckets) * ht->num_buckets);
-       
+
        free(ht->buckets);
        ht->buckets = buckets;
-       ht->num_buckets *= GROW_FACTOR; 
+       ht->num_buckets *= GROW_FACTOR;
        ht->next_grow *= GROW_FACTOR;
        ht->mask = ht->num_buckets - 1;
 #ifdef TESTING
@@ -562,9 +562,9 @@ void lrad_hash_table_free(lrad_hash_table_t *ht)
                                         node != &ht->null;
                                         node = next) {
                        next = node->next;
-                       
+
                        if (!node->data) continue; /* dummy entry */
-                       
+
                        if (ht->free) ht->free(node->data);
                        free(node);
                }
@@ -854,7 +854,7 @@ int main(int argc, char **argv)
                                fprintf(stderr, "Failed finding %d\n", i);
                                exit(1);
                        }
-                       
+
 #if 0
                        if (!lrad_hash_table_delete(ht, &i)) {
                                fprintf(stderr, "Failed deleting %d\n", i);
index 6cf54cd..2eed575 100644 (file)
@@ -188,7 +188,7 @@ static int inet_pton4(const char *src, struct in_addr *dst)
        const char *p, *off;
        uint8_t tmp[4];
        static const char digits[] = "0123456789";
-       
+
        octet = 0;
        p = src;
        while (1) {
@@ -196,13 +196,13 @@ static int inet_pton4(const char *src, struct in_addr *dst)
                while (*p && ((off = strchr(digits, *p)) != NULL)) {
                        num *= 10;
                        num += (off - digits);
-                       
+
                        if (num > 255) return 0;
-                       
+
                        p++;
                }
                if (!*p) break;
-               
+
                /*
                 *      Not a digit, MUST be a dot, else we
                 *      die.
@@ -214,7 +214,7 @@ static int inet_pton4(const char *src, struct in_addr *dst)
                tmp[octet++] = num;
                p++;
        }
-       
+
        /*
         *      End of the string.  At the fourth
         *      octet is OK, anything else is an
@@ -224,7 +224,7 @@ static int inet_pton4(const char *src, struct in_addr *dst)
                return 0;
        }
        tmp[3] = num;
-       
+
        memcpy(dst, &tmp, sizeof(tmp));
        return 1;
 }
@@ -357,7 +357,7 @@ const char *inet_ntop(int af, const void *src, char *dst, size_t cnt)
                const uint8_t *ipaddr = src;
 
                if (cnt <= INET_ADDRSTRLEN) return NULL;
-               
+
                snprintf(dst, cnt, "%d.%d.%d.%d",
                         ipaddr[0], ipaddr[1],
                         ipaddr[2], ipaddr[3]);
@@ -370,7 +370,7 @@ const char *inet_ntop(int af, const void *src, char *dst, size_t cnt)
         */
        if (af == AF_INET6) {
                const struct in6_addr *ipaddr = src;
-               
+
                if (cnt <= INET6_ADDRSTRLEN) return NULL;
 
                snprintf(dst, cnt, "%x:%x:%x:%x:%x:%x:%x:%x",
@@ -423,18 +423,18 @@ int ip_hton(const char *src, int af, lrad_ipaddr_t *dst)
        switch (ai->ai_family) {
        case AF_INET :
                dst->af = AF_INET;
-               memcpy(&dst->ipaddr, 
-                      &((struct sockaddr_in*)ai->ai_addr)->sin_addr, 
+               memcpy(&dst->ipaddr,
+                      &((struct sockaddr_in*)ai->ai_addr)->sin_addr,
                       sizeof(struct in_addr));
                break;
-               
+
        case AF_INET6 :
                dst->af = AF_INET6;
-               memcpy(&dst->ipaddr, 
-                      &((struct sockaddr_in6*)ai->ai_addr)->sin6_addr, 
+               memcpy(&dst->ipaddr,
+                      &((struct sockaddr_in6*)ai->ai_addr)->sin6_addr,
                       sizeof(struct in6_addr));
                break;
-               
+
                /* Flow should never reach here */
        case AF_UNSPEC :
        default :
@@ -442,7 +442,7 @@ int ip_hton(const char *src, int af, lrad_ipaddr_t *dst)
                freeaddrinfo(ai);
                return -1;
        }
-       
+
        freeaddrinfo(ai);
        return 0;
 }
index 653ad0c..9c0c580 100644 (file)
@@ -209,7 +209,7 @@ struct tm *gmtime_r(const time_t *l_clock, struct tm *result)
 static uint64_t filetime_to_unix_epoch (const FILETIME *ft)
 {
        uint64_t res = (uint64_t) ft->dwHighDateTime << 32;
-       
+
        res |= ft->dwLowDateTime;
        res /= 10;                   /* from 100 nano-sec periods to usec */
        res -= DELTA_EPOCH_IN_USEC;  /* from Win epoch to Unix epoch */
@@ -220,7 +220,7 @@ int gettimeofday (struct timeval *tv, UNUSED void *tz)
 {
        FILETIME  ft;
        uint64_t tim;
-       
+
        if (!tv) {
                errno = EINVAL;
                return (-1);
index d095e4c..fca143a 100644 (file)
@@ -87,7 +87,7 @@ uint32_t lrad_request_packet_hash(const RADIUS_PACKET *packet)
 uint32_t lrad_reply_packet_hash(const RADIUS_PACKET *packet)
 {
        uint32_t hash;
-       
+
        hash = lrad_hash(&packet->sockfd, sizeof(packet->sockfd));
        hash = lrad_hash_update(&packet->id, sizeof(packet->id), hash);
        hash = lrad_hash_update(&packet->src_port, sizeof(packet->src_port),
@@ -201,17 +201,17 @@ int lrad_socket(lrad_ipaddr_t *ipaddr, int port)
        memset(&salocal, 0, sizeof(salocal));
        if (ipaddr->af == AF_INET) {
                struct sockaddr_in *sa;
-               
+
                sa = (struct sockaddr_in *) &salocal;
                sa->sin_family = AF_INET;
                sa->sin_addr = ipaddr->ipaddr.ip4addr;
                sa->sin_port = htons((uint16_t) port);
                salen = sizeof(*sa);
-               
+
 #ifdef HAVE_STRUCT_SOCKADDR_IN6
        } else if (ipaddr->af == AF_INET6) {
                struct sockaddr_in6 *sa;
-               
+
                sa = (struct sockaddr_in6 *) &salocal;
                sa->sin6_family = AF_INET6;
                sa->sin6_addr = ipaddr->ipaddr.ip6addr;
@@ -229,7 +229,7 @@ int lrad_socket(lrad_ipaddr_t *ipaddr, int port)
 
                if (IN6_IS_ADDR_UNSPECIFIED(&ipaddr->ipaddr.ip6addr)) {
                        int on = 1;
-                       
+
                        setsockopt(sockfd, IPPROTO_IPV6, IPV6_V6ONLY,
                                   (char *)&on, sizeof(on));
                }
@@ -448,7 +448,7 @@ static uint32_t packet_dst2id_hash(const void *data)
        const lrad_packet_dst2id_t *pd = data;
 
        hash = lrad_hash(&pd->dst_port, sizeof(pd->dst_port));
-       
+
        switch (pd->dst_ipaddr.af) {
        case AF_INET:
                hash = lrad_hash_update(&pd->dst_ipaddr.ipaddr.ip4addr,
@@ -591,7 +591,7 @@ RADIUS_PACKET **lrad_packet_list_find_byreply(lrad_packet_list_t *pl,
        my_request.dst_ipaddr = reply->src_ipaddr;
        my_request.dst_port = reply->src_port;
        my_request.hash = 0;
-       
+
        request = &my_request;
 
        return lrad_hash_table_finddata(pl->ht, &request);
@@ -634,12 +634,12 @@ int lrad_packet_list_id_alloc(lrad_packet_list_t *pl,
        uint32_t free_mask;
        lrad_packet_dst2id_t my_pd, *pd;
        lrad_packet_socket_t *ps;
-       
+
        if (!pl || !pl->alloc_id || !request) return 0;
 
        my_pd.dst_ipaddr = request->dst_ipaddr;
        my_pd.dst_port = request->dst_port;
-       
+
        pd = lrad_hash_table_finddata(pl->dst2id_ht, &my_pd);
        if (!pd) {
                pd = malloc(sizeof(*pd) + 255 * sizeof(pd->id[0]));
@@ -655,7 +655,7 @@ int lrad_packet_list_id_alloc(lrad_packet_list_t *pl,
                        return 0;
                }
        }
-       
+
        /*
         *      FIXME: Go to an LRU system.  This prevents ID re-use
         *      for as long as possible.  The main problem with that
@@ -724,7 +724,7 @@ int lrad_packet_list_id_free(lrad_packet_list_t *pl,
 
        my_pd.dst_ipaddr = request->dst_ipaddr;
        my_pd.dst_port = request->dst_port;
-       
+
        pd = lrad_hash_table_finddata(pl->dst2id_ht, &my_pd);
        if (!pd) return 0;
 
index 422a39c..611bf02 100644 (file)
@@ -183,7 +183,7 @@ int vp_prints_value(char * out, int outlen, VALUE_PAIR *vp, int delimitst)
                        if (outlen <= (2 * (vp->length + 1))) return 0;
 
                        strcpy(buf, "0x");
-                       
+
                        lrad_bin2hex(vp->vp_octets, buf + 2, vp->length);
                        a = buf;
                  break;
index 6711a07..ea1f025 100644 (file)
@@ -174,7 +174,7 @@ static int rad_sendto(int sockfd, void *data, size_t data_len, int flags,
 
                s6 = (struct sockaddr_in6 *)&dst;
                sizeof_dst = sizeof(struct sockaddr_in6);
-               
+
                s6->sin6_family = AF_INET6;
                s6->sin6_addr = dst_ipaddr->ipaddr.ip6addr;
                s6->sin6_port = htons(dst_port);
@@ -202,7 +202,7 @@ static int rad_sendto(int sockfd, void *data, size_t data_len, int flags,
        if ((dst_ipaddr->af == AF_INET) ||
            (src_ipaddr->af != AF_UNSPEC)) {
                return sendfromto(sockfd, data, data_len, flags,
-                                 (struct sockaddr *)&src, sizeof_src, 
+                                 (struct sockaddr *)&src, sizeof_src,
                                  (struct sockaddr *)&dst, sizeof_dst);
        }
 #else
@@ -212,7 +212,7 @@ static int rad_sendto(int sockfd, void *data, size_t data_len, int flags,
        /*
         *      No udpfromto, OR an IPv6 socket, fail gracefully.
         */
-       return sendto(sockfd, data, data_len, flags, 
+       return sendto(sockfd, data, data_len, flags,
                      (struct sockaddr *)&dst, sizeof_dst);
 }
 
@@ -268,7 +268,7 @@ ssize_t rad_recv_header(int sockfd, lrad_ipaddr_t *src_ipaddr, int *src_port,
                         *      Anything after 4k will be discarded.
                         */
                } else if (packet_len > MAX_PACKET_LEN) {
-                       recvfrom(sockfd, header, sizeof(header), 0, 
+                       recvfrom(sockfd, header, sizeof(header), 0,
                                 (struct sockaddr *)&src, &sizeof_src);
                        return 1;
                }
@@ -293,7 +293,7 @@ ssize_t rad_recv_header(int sockfd, lrad_ipaddr_t *src_ipaddr, int *src_port,
 
 #endif
        } else {
-               recvfrom(sockfd, header, sizeof(header), 0, 
+               recvfrom(sockfd, header, sizeof(header), 0,
                         (struct sockaddr *)&src, &sizeof_src);
                return 1;
        }
@@ -351,7 +351,7 @@ static ssize_t rad_recvfrom(int sockfd, uint8_t **pbuf, int flags,
         *      Too little data is available, discard the packet.
         */
        if (data_len < 4) {
-               recvfrom(sockfd, header, sizeof(header), flags, 
+               recvfrom(sockfd, header, sizeof(header), flags,
                         (struct sockaddr *)&src, &sizeof_src);
                return 0;
 
@@ -366,7 +366,7 @@ static ssize_t rad_recvfrom(int sockfd, uint8_t **pbuf, int flags,
                 *      a RADIUS header length: discard it.
                 */
                if (len < AUTH_HDR_LEN) {
-                       recvfrom(sockfd, header, sizeof(header), flags, 
+                       recvfrom(sockfd, header, sizeof(header), flags,
                                 (struct sockaddr *)&src, &sizeof_src);
                        return 0;
 
@@ -375,7 +375,7 @@ static ssize_t rad_recvfrom(int sockfd, uint8_t **pbuf, int flags,
                         *      Anything after 4k will be discarded.
                         */
                } else if (len > MAX_PACKET_LEN) {
-                       recvfrom(sockfd, header, sizeof(header), flags, 
+                       recvfrom(sockfd, header, sizeof(header), flags,
                                 (struct sockaddr *)&src, &sizeof_src);
                        return len;
                }
@@ -391,14 +391,14 @@ static ssize_t rad_recvfrom(int sockfd, uint8_t **pbuf, int flags,
 #ifdef WITH_UDPFROMTO
        if (dst.ss_family == AF_INET) {
                data_len = recvfromto(sockfd, buf, len, flags,
-                                     (struct sockaddr *)&src, &sizeof_src, 
+                                     (struct sockaddr *)&src, &sizeof_src,
                                      (struct sockaddr *)&dst, &sizeof_dst);
        } else
 #endif
                /*
                 *      No udpfromto, OR an IPv6 socket.  Fail gracefully.
                 */
-               data_len = recvfrom(sockfd, buf, len, flags, 
+               data_len = recvfrom(sockfd, buf, len, flags,
                                    (struct sockaddr *)&src, &sizeof_src);
        if (data_len < 0) {
                free(buf);
@@ -439,7 +439,7 @@ static ssize_t rad_recvfrom(int sockfd, uint8_t **pbuf, int flags,
                free(buf);
                return -1;      /* Unknown address family, Die Die Die! */
        }
-       
+
        /*
         *      Different address families should never happen.
         */
@@ -737,7 +737,7 @@ int rad_vp2attr(const RADIUS_PACKET *packet, const RADIUS_PACKET *original,
                if (TAG_VALID(vp->flags.tag)) {
                        ptr[0] = vp->flags.tag & 0xff;
                        offset = 1;
-           
+
                } else if (vp->flags.encrypt == FLAG_ENCRYPT_TUNNEL_PASSWORD) {
                        /*
                         *      Tunnel passwords REQUIRE a tag, even
@@ -747,7 +747,7 @@ int rad_vp2attr(const RADIUS_PACKET *packet, const RADIUS_PACKET *original,
                        offset = 1;
                } /* else don't write a tag */
        } /* else the attribute doesn't have a tag */
-       
+
        /*
         *      Set up the default sources for the data.
         */
@@ -763,14 +763,14 @@ int rad_vp2attr(const RADIUS_PACKET *packet, const RADIUS_PACKET *original,
        case PW_TYPE_ABINARY:
                /* nothing more to do */
                break;
-                       
+
        case PW_TYPE_BYTE:
                len = 1;        /* just in case */
                array[0] = vp->vp_integer & 0xff;
                data = array;
                offset = 0;
                break;
-                       
+
 
        case PW_TYPE_SHORT:
                len = 2;        /* just in case */
@@ -791,7 +791,7 @@ int rad_vp2attr(const RADIUS_PACKET *packet, const RADIUS_PACKET *original,
                data = &array[offset];
                len -= offset;
                break;
-                       
+
        case PW_TYPE_IPADDR:
                data = (const uint8_t *) &vp->vp_ipaddr;
                len = 4;        /* just in case */
@@ -816,7 +816,7 @@ int rad_vp2attr(const RADIUS_PACKET *packet, const RADIUS_PACKET *original,
         */
        if (len + offset + total_length > 255) {
                len = 255 - offset - total_length;
-       }       
+       }
 
        /*
         *      Encrypt the various password styles
@@ -830,7 +830,7 @@ int rad_vp2attr(const RADIUS_PACKET *packet, const RADIUS_PACKET *original,
                            data, len,
                            secret, packet->vector);
                break;
-               
+
        case FLAG_ENCRYPT_TUNNEL_PASSWORD:
                if (!original) {
                        librad_log("ERROR: No request packet, cannot encrypt %s attribute in the vp.", vp->name);
@@ -863,7 +863,7 @@ int rad_vp2attr(const RADIUS_PACKET *packet, const RADIUS_PACKET *original,
                len = AUTH_VECTOR_LEN;
                break;
 
-               
+
        default:
                /*
                 *      Just copy the data over
@@ -908,7 +908,7 @@ int rad_encode(RADIUS_PACKET *packet, const RADIUS_PACKET *original,
        VALUE_PAIR      *reply;
        const char      *what;
        char            ip_buffer[128];
-       
+
        /*
         *      For simplicity in the following logic, we allow
         *      the attributes to "overflow" the 4k maximum
@@ -943,7 +943,7 @@ int rad_encode(RADIUS_PACKET *packet, const RADIUS_PACKET *original,
                        return -1;
                }
                break;
-               
+
                /*
                 *      These packet vectors start off as all zero.
                 */
@@ -952,27 +952,27 @@ int rad_encode(RADIUS_PACKET *packet, const RADIUS_PACKET *original,
        case PW_COA_REQUEST:
                memset(packet->vector, 0, sizeof(packet->vector));
                break;
-               
+
        default:
                break;
        }
-               
+
        /*
         *      Use memory on the stack, until we know how
         *      large the packet will be.
         */
        hdr = (radius_packet_t *) data;
-       
+
        /*
         *      Build standard header
         */
        hdr->code = packet->code;
        hdr->id = packet->id;
-       
+
        memcpy(hdr->vector, packet->vector, sizeof(hdr->vector));
 
        total_length = AUTH_HDR_LEN;
-       
+
        /*
         *      Load up the configuration values for the user
         */
@@ -987,7 +987,7 @@ int rad_encode(RADIUS_PACKET *packet, const RADIUS_PACKET *original,
         *      Hmm... this may be slower than just doing a small
         *      memcpy.
         */
-       
+
        /*
         *      Loop over the reply attributes for the packet.
         */
@@ -999,7 +999,7 @@ int rad_encode(RADIUS_PACKET *packet, const RADIUS_PACKET *original,
                    ((reply->attribute & 0xFFFF) > 0xff)) {
                        continue;
                }
-               
+
                /*
                 *      Set the Message-Authenticator to the correct
                 *      length and initial value.
@@ -1021,7 +1021,7 @@ int rad_encode(RADIUS_PACKET *packet, const RADIUS_PACKET *original,
                 *      them out BEFORE they're encrypted.
                 */
                debug_pair(reply);
-               
+
                len = rad_vp2attr(packet, original, secret, reply, ptr);
 
                if (len < 0) return -1;
@@ -1041,7 +1041,7 @@ int rad_encode(RADIUS_PACKET *packet, const RADIUS_PACKET *original,
                ptr += len;
                total_length += len;
        } /* done looping over all attributes */
-       
+
        /*
         *      Fill in the rest of the fields, and copy the data over
         *      from the local stack to the newly allocated memory.
@@ -1059,7 +1059,7 @@ int rad_encode(RADIUS_PACKET *packet, const RADIUS_PACKET *original,
 
        memcpy(packet->data, data, packet->data_len);
        hdr = (radius_packet_t *) packet->data;
-       
+
        total_length = htons(total_length);
        memcpy(hdr->length, &total_length, sizeof(total_length));
 
@@ -1095,7 +1095,7 @@ int rad_sign(RADIUS_PACKET *packet, const RADIUS_PACKET *original,
         */
        if (packet->offset > 0) {
                uint8_t calc_auth_vector[AUTH_VECTOR_LEN];
-               
+
                switch (packet->code) {
                case PW_ACCOUNTING_REQUEST:
                case PW_ACCOUNTING_RESPONSE:
@@ -1121,9 +1121,9 @@ int rad_sign(RADIUS_PACKET *packet, const RADIUS_PACKET *original,
 
                default:        /* others have vector already set to zero */
                        break;
-                       
+
                }
-               
+
                /*
                 *      Set the authentication vector to zero,
                 *      calculate the signature, and put it
@@ -1135,14 +1135,14 @@ int rad_sign(RADIUS_PACKET *packet, const RADIUS_PACKET *original,
                              calc_auth_vector);
                memcpy(packet->data + packet->offset + 2,
                       calc_auth_vector, AUTH_VECTOR_LEN);
-               
+
                /*
                 *      Copy the original request vector back
                 *      to the raw packet.
                 */
                memcpy(hdr->vector, packet->vector, AUTH_VECTOR_LEN);
        }
-       
+
        /*
         *      Switch over the packet code, deciding how to
         *      sign the packet.
@@ -1155,7 +1155,7 @@ int rad_sign(RADIUS_PACKET *packet, const RADIUS_PACKET *original,
        case PW_AUTHENTICATION_REQUEST:
        case PW_STATUS_SERVER:
                break;
-               
+
                /*
                 *      Reply packets are signed with the
                 *      authentication vector of the request.
@@ -1163,13 +1163,13 @@ int rad_sign(RADIUS_PACKET *packet, const RADIUS_PACKET *original,
        default:
                {
                        uint8_t digest[16];
-                       
+
                        MD5_CTX context;
                        MD5Init(&context);
                        MD5Update(&context, packet->data, packet->data_len);
                        MD5Update(&context, secret, strlen(secret));
                        MD5Final(digest, &context);
-                       
+
                        memcpy(hdr->vector, digest, AUTH_VECTOR_LEN);
                        memcpy(packet->vector, digest, AUTH_VECTOR_LEN);
                        break;
@@ -1213,7 +1213,7 @@ int rad_send(RADIUS_PACKET *packet, const RADIUS_PACKET *original,
                if (rad_encode(packet, original, secret) < 0) {
                        return -1;
                }
-               
+
                /*
                 *      Re-sign it, including updating the
                 *      Message-Authenticator.
@@ -1532,7 +1532,7 @@ int rad_packet_ok(RADIUS_PACKET *packet)
                                           attr[1] - 2);
                                return 0;
                        }
-                       seen_ma = 1;                    
+                       seen_ma = 1;
                        break;
                }
 
@@ -1890,7 +1890,7 @@ VALUE_PAIR *rad_attr2vp(const RADIUS_PACKET *packet, const RADIUS_PACKET *origin
        if ((vp = paircreate(attribute, PW_TYPE_OCTETS)) == NULL) {
                return NULL;
        }
-       
+
        /*
         *      If length is greater than 253, something is SERIOUSLY
         *      wrong.
@@ -1945,20 +1945,20 @@ VALUE_PAIR *rad_attr2vp(const RADIUS_PACKET *packet, const RADIUS_PACKET *origin
                        vp->length = strlen(vp->vp_strvalue);
                }
                break;
-               
+
                /*
                 *      Tunnel-Password's may go ONLY
                 *      in response packets.
                 */
        case FLAG_ENCRYPT_TUNNEL_PASSWORD:
                if (!original) goto raw;
-               
+
                if (rad_tunnel_pwdecode(vp->vp_octets, &vp->length,
                                        secret, original->vector) < 0) {
                        goto raw;
                }
                break;
-               
+
                /*
                 *  Ascend-Send-Secret
                 *  Ascend-Receive-Secret
@@ -2047,7 +2047,7 @@ VALUE_PAIR *rad_attr2vp(const RADIUS_PACKET *packet, const RADIUS_PACKET *origin
                if (vp->length != 8) goto raw;
                /* vp->vp_ifid == vp->vp_octets */
                break;
-               
+
                /*
                 *      IPv6 addresses are 16 octets long
                 */
@@ -2055,7 +2055,7 @@ VALUE_PAIR *rad_attr2vp(const RADIUS_PACKET *packet, const RADIUS_PACKET *origin
                if (vp->length != 16) goto raw;
                /* vp->vp_ipv6addr == vp->vp_octets */
                break;
-               
+
                /*
                 *      IPv6 prefixes are 2 to 18 octets long.
                 *
@@ -2084,7 +2084,7 @@ VALUE_PAIR *rad_attr2vp(const RADIUS_PACKET *packet, const RADIUS_PACKET *origin
                vp->type = PW_TYPE_OCTETS;
                vp->length = length;
                memcpy(vp->vp_octets, data, length);
-               
+
 
                /*
                 *      Ensure there's no encryption or tag stuff,
@@ -2169,7 +2169,7 @@ int rad_decode(RADIUS_PACKET *packet, RADIUS_PACKET *original,
                        packet_length  -= 2;
 
                        if (attribute != PW_VENDOR_SPECIFIC) goto create_pair;
-                       
+
                        /*
                         *      No vendor code, or ONLY vendor code.
                         */
@@ -2177,7 +2177,7 @@ int rad_decode(RADIUS_PACKET *packet, RADIUS_PACKET *original,
 
                        vendorlen = 0;
                }
-               
+
                /*
                 *      Handle Vendor-Specific
                 */
@@ -2185,7 +2185,7 @@ int rad_decode(RADIUS_PACKET *packet, RADIUS_PACKET *original,
                        uint8_t *subptr;
                        int sublen;
                        int myvendor;
-                       
+
                        /*
                         *      attrlen was checked above.
                         */
@@ -2196,7 +2196,7 @@ int rad_decode(RADIUS_PACKET *packet, RADIUS_PACKET *original,
                         *      Zero isn't allowed.
                         */
                        if (myvendor == 0) goto create_pair;
-                       
+
                        /*
                         *      This is an implementation issue.
                         *      We currently pack vendor into the upper
@@ -2205,14 +2205,14 @@ int rad_decode(RADIUS_PACKET *packet, RADIUS_PACKET *original,
                         *      than 16 bits.
                         */
                        if (myvendor > 65535) goto create_pair;
-                       
+
                        vsa_tlen = vsa_llen = 1;
                        dv = dict_vendorbyvalue(myvendor);
                        if (dv) {
                                vsa_tlen = dv->type;
                                vsa_llen = dv->length;
                        }
-                       
+
                        /*
                         *      Sweep through the list of VSA's,
                         *      seeing if they exactly fill the
@@ -2233,7 +2233,7 @@ int rad_decode(RADIUS_PACKET *packet, RADIUS_PACKET *original,
                                 *      Don't have a type, it's bad.
                                 */
                                if (sublen < vsa_tlen) goto create_pair;
-                               
+
                                /*
                                 *      Ensure that the attribute number
                                 *      is OK.
@@ -2242,25 +2242,25 @@ int rad_decode(RADIUS_PACKET *packet, RADIUS_PACKET *original,
                                case 1:
                                        myattr = subptr[0];
                                        break;
-                                       
+
                                case 2:
                                        myattr = (subptr[0] << 8) | subptr[1];
                                        break;
-                                       
+
                                case 4:
                                        if ((subptr[0] != 0) ||
                                            (subptr[1] != 0)) goto create_pair;
-                                       
+
                                        myattr = (subptr[2] << 8) | subptr[3];
                                        break;
-                                       
+
                                        /*
                                         *      Our dictionary is broken.
                                         */
                                default:
                                        goto create_pair;
                                }
-                               
+
                                /*
                                 *      Not enough room for one more
                                 *      attribute.  Die!
@@ -2319,7 +2319,7 @@ int rad_decode(RADIUS_PACKET *packet, RADIUS_PACKET *original,
                case 1:
                        attribute = ptr[0];
                        break;
-                       
+
                case 2:
                        attribute = (ptr[0] << 8) | ptr[1];
                        break;
@@ -2334,7 +2334,7 @@ int rad_decode(RADIUS_PACKET *packet, RADIUS_PACKET *original,
                case 1:
                        attrlen = ptr[0] - (vsa_tlen + vsa_llen);
                        break;
-                       
+
                case 2:
                        attrlen = ptr[1] - (vsa_tlen + vsa_llen);
                        break;
@@ -2398,7 +2398,7 @@ int rad_decode(RADIUS_PACKET *packet, RADIUS_PACKET *original,
         *      random pool.
         */
        lrad_rand_seed(packet->data, AUTH_HDR_LEN);
-         
+
        return 0;
 }
 
@@ -2447,7 +2447,7 @@ int rad_pwencode(char *passwd, int *pwlen, const char *secret,
         *      Use the secret to setup the decryption digest
         */
        secretlen = strlen(secret);
-       
+
        lrad_MD5Init(&context);
        lrad_MD5Update(&context, secret, secretlen);
        old = context;          /* save intermediate work */
@@ -2467,7 +2467,7 @@ int rad_pwencode(char *passwd, int *pwlen, const char *secret,
                                         AUTH_PASS_LEN);
                        lrad_MD5Final(digest, &context);
                }
-               
+
                for (i = 0; i < AUTH_PASS_LEN; i++) {
                        passwd[i + n] ^= digest[i];
                }
@@ -2502,7 +2502,7 @@ int rad_pwdecode(char *passwd, int pwlen, const char *secret,
         *      Use the secret to setup the decryption digest
         */
        secretlen = strlen(secret);
-       
+
        lrad_MD5Init(&context);
        lrad_MD5Update(&context, secret, secretlen);
        old = context;          /* save intermediate work */
@@ -2523,7 +2523,7 @@ int rad_pwdecode(char *passwd, int pwlen, const char *secret,
                        context = old;
                        if (pwlen > (n + AUTH_PASS_LEN)) lrad_MD5Update(&context, passwd + n, AUTH_PASS_LEN);
                }
-               
+
                for (i = 0; i < AUTH_PASS_LEN; i++) {
                        passwd[i + n] ^= digest[i];
                }
@@ -2798,7 +2798,7 @@ void lrad_rand_seed(const void *data, size_t size)
         */
        if (!lrad_rand_initialized) {
                int fd;
-               
+
                memset(&lrad_rand_pool, 0, sizeof(lrad_rand_pool));
 
                fd = open("/dev/urandom", O_RDONLY);
@@ -2833,7 +2833,7 @@ void lrad_rand_seed(const void *data, size_t size)
        hash = lrad_rand();
        if (!hash) hash = lrad_rand();
        hash = lrad_hash_update(data, size, hash);
-       
+
        lrad_rand_pool.randmem[lrad_rand_pool.randcnt] ^= hash;
 }
 
index 1fb6ab5..595299c 100644 (file)
@@ -416,7 +416,7 @@ void rbtree_delete(rbtree_t *tree, rbnode_t *Z)
 
                if (Y->Color == Black && X != NIL)
                        DeleteFixup(tree, X, Parent);
-               
+
                /*
                 *      The user structure in Y->Data MAY include a
                 *      pointer to Y.  In that case, we CANNOT delete
@@ -434,15 +434,15 @@ void rbtree_delete(rbtree_t *tree, rbnode_t *Z)
                }
                if (Y->Left->Parent == Z) Y->Left->Parent = Y;
                if (Y->Right->Parent == Z) Y->Right->Parent = Y;
-               
+
                free(Z);
 
        } else {
                if (tree->freeNode) tree->freeNode(Y->Data);
-               
+
                if (Y->Color == Black && X != NIL)
                        DeleteFixup(tree, X, Parent);
-               
+
                free(Y);
        }
 
@@ -456,7 +456,7 @@ void rbtree_delete(rbtree_t *tree, rbnode_t *Z)
 int rbtree_deletebydata(rbtree_t *tree, const void *data)
 {
        rbnode_t *node = rbtree_find(tree, data);
-       
+
        if (!node) return 0;    /* false */
 
        rbtree_delete(tree, node);
index 823b465..d27525e 100644 (file)
@@ -55,7 +55,7 @@ static VALUE_PAIR *pairalloc(DICT_ATTR *da)
                vp->flags = da->flags;
        } else {
                vp->attribute = 0;
-               vp->vendor = 0; 
+               vp->vendor = 0;
                vp->type = PW_TYPE_OCTETS;
                vp->name[0] = '\0';
                memset(&vp->flags, 0, sizeof(vp->flags));
@@ -121,7 +121,7 @@ VALUE_PAIR *paircreate(int attr, int type)
 
                } else {
                        DICT_VENDOR *v;
-                       
+
                        v = dict_vendorbyvalue(VENDOR(attr));
                        if (v) {
                                sprintf(vp->name, "%s-Attr-%u",
@@ -798,7 +798,7 @@ VALUE_PAIR *pairparsevalue(VALUE_PAIR *vp, const char *value)
                                p = NULL;
                                cs = value;
                        }
-                       
+
                        {
                                lrad_ipaddr_t ipaddr;
 
@@ -936,8 +936,8 @@ VALUE_PAIR *pairparsevalue(VALUE_PAIR *vp, const char *value)
                                        librad_log("Hex string is not an even length string.");
                                        return NULL;
                                }
-                               
-                               
+
+
                                while (*cp &&
                                       (vp->length < MAX_STRING_LEN)) {
                                        unsigned int tmp;
@@ -985,16 +985,16 @@ VALUE_PAIR *pairparsevalue(VALUE_PAIR *vp, const char *value)
                        } else {
                                unsigned int prefix;
                                char buffer[256], *eptr;
-                               
+
                                memcpy(buffer, value, p - value);
                                buffer[p - value] = '\0';
-                               
+
                                if (inet_pton(AF_INET6, buffer, vp->vp_strvalue + 2) <= 0) {
                                        librad_log("failed to parse IPv6 address "
                                                   "string \"%s\"", value);
                                        return NULL;
                                }
-                               
+
                                prefix = strtoul(p + 1, &eptr, 10);
                                if ((prefix > 128) || *eptr) {
                                        librad_log("failed to parse IPv6 address "
@@ -1596,7 +1596,7 @@ int paircmp(VALUE_PAIR *one, VALUE_PAIR *two)
                {
                        regex_t reg;
                        char buffer[MAX_STRING_LEN * 4 + 1];
-                       
+
                        compare = regcomp(&reg, one->vp_strvalue,
                                          REG_EXTENDED);
                        if (compare != 0) {
@@ -1623,7 +1623,7 @@ int paircmp(VALUE_PAIR *one, VALUE_PAIR *two)
        default:                /* we're OK */
                break;
        }
-               
+
        /*
         *      After doing the previous check for special comparisons,
         *      do the per-type comparison here.
@@ -1640,7 +1640,7 @@ int paircmp(VALUE_PAIR *one, VALUE_PAIR *two)
                } else {
                        length = two->length;
                }
-               
+
                p = two->vp_octets;
                q = one->vp_octets;
                while (length) {
@@ -1667,7 +1667,7 @@ int paircmp(VALUE_PAIR *one, VALUE_PAIR *two)
                                         one->vp_strvalue);
                }
                break;
-               
+
        case PW_TYPE_BYTE:
        case PW_TYPE_SHORT:
        case PW_TYPE_INTEGER:
@@ -1683,7 +1683,7 @@ int paircmp(VALUE_PAIR *one, VALUE_PAIR *two)
                compare = memcmp(&two->vp_ipv6addr, &one->vp_ipv6addr,
                                 sizeof(two->vp_ipv6addr));
                break;
-               
+
        case PW_TYPE_IPV6PREFIX:
                compare = memcmp(&two->vp_ipv6prefix, &one->vp_ipv6prefix,
                                 sizeof(two->vp_ipv6prefix));
@@ -1705,13 +1705,13 @@ int paircmp(VALUE_PAIR *one, VALUE_PAIR *two)
        switch (one->operator) {
        case T_OP_CMP_EQ:
                return (compare == 0);
-               
+
        case T_OP_NE:
                return (compare != 0);
-               
+
        case T_OP_LT:
                return (compare < 0);
-               
+
        case T_OP_GT:
                return (compare > 0);
 
index 90438ad..1a9b418 100644 (file)
@@ -282,7 +282,7 @@ static int rad_check_password(REQUEST *request)
                         *      authentication fails.
                         */
                        auth_item = request->password;
-                       if (!auth_item) 
+                       if (!auth_item)
                                auth_item = pairfind(request->packet->vps,
                                                     PW_CHAP_PASSWORD);
                        if (!auth_item) {
index c156436..9f8573b 100644 (file)
@@ -60,7 +60,7 @@ $snmp_version = "2c";
 $rusers                = "@RUSERS@";
 $naspass       = "$raddbdir/naspasswd";
 
-# Community string. Change this if yours isn't "public". 
+# Community string. Change this if yours isn't "public".
 $cmmty_string  = "public";
 # path to finger command
 $finger = "/usr/bin/finger";
@@ -121,10 +121,10 @@ sub naspasswd {
        close NFD;
        if ($password eq "" && !$emptyok) {
                print LOG "checkrad: password for $ARGV[1] is null; " .
-                       "possible match for $ARGV[3] on " . 
+                       "possible match for $ARGV[3] on " .
                        "port $ARGV[2]\n" if ($debug);
                print STDERR "checkrad: password for $ARGV[1] is null; " .
-                       "possible match for $ARGV[3] on port $ARGV[2]\n"; 
+                       "possible match for $ARGV[3] on port $ARGV[2]\n";
        }
        ($login, $password);
 }
@@ -262,7 +262,7 @@ sub snmpget {
 
 #
 #      Strip domains, prefixes and suffixes from username
-#      
+#
 #      Known prefixes: (P)PP, (S)LIP e (C)SLIP
 #      Known suffixes: .ppp, .slip e .cslip
 #
@@ -603,7 +603,7 @@ sub portslave_finger {
 #      (this routine by Alexis C. Villalon <alexisv@compass.com.ph>).
 #      You must have the Net::Telnet module from CPAN for this to work.
 #      You must also have your /etc/raddb/naspasswd made up.
-# 
+#
 sub tc_tccheck {
        #
        #       Localize all variables first.
@@ -680,7 +680,7 @@ sub tc_tccheck {
                $user =~ s/^[PSC]//;
                $user =~ s/\.(ppp|slip|cslip)$//;
                $port =~ s/^S//;
-               #               
+               #
                #       HACK: because "show sessions" shows max. 15 characters
                #       we only compare up to the length of $user if the
                #       unstripped name had 15 chars.
@@ -718,7 +718,7 @@ sub cyclades_telnet {
        #
        my ($pr, $pr_login, $pr_passwd, $pr_prompt, $endlist, @list, $port, $user);
        #
-       #       This variable must match PathRAS' command prompt 
+       #       This variable must match PathRAS' command prompt
        #       string as entered in menu option 6.2.
        #       The value below matches the default command prompt.
        #
@@ -735,7 +735,7 @@ sub cyclades_telnet {
        return 2 unless (check_net_telnet());
 
        #
-       #       Get login name and password for NAS 
+       #       Get login name and password for NAS
        #       from $naspass file.
        #
        ($pr_login, $pr_passwd) = naspasswd($ARGV[1], 1);
@@ -761,18 +761,18 @@ sub cyclades_telnet {
        #
        if ($pr->waitfor(Match => '/login : $/i') == 1) {
                $pr->print($pr_login);
-       } else { 
+       } else {
                print LOG " Error: sending login name to PathRAS\n" if ($debug);
                $pr->close;
-               return 2;       
+               return 2;
        }
 
        if ($pr->waitfor(Match => '/password : $/i') == 1) {
                $pr->print($pr_passwd);
-       } else { 
+       } else {
                print LOG " Error: sending password to PathRAS.\n" if ($debug);
                $pr->close;
-               return 2;       
+               return 2;
        }
 
        $pr->print();
@@ -782,7 +782,7 @@ sub cyclades_telnet {
        #
        if ($pr->waitfor(Match => $pr_prompt) == 1) {
                $pr->print('6');
-       } else { 
+       } else {
                print LOG "  Error: acessing menu option '6'.\n" if ($debug);
                $pr->close;
                return 2;
@@ -792,13 +792,13 @@ sub cyclades_telnet {
        #
        if ($pr->waitfor(Match => $pr_prompt) == 1) {
                @list = $pr->cmd(String => '8', Prompt => $endlist);
-       } else { 
+       } else {
                print LOG "  Error: acessing menu option '8'.\n" if ($debug);
                $pr->close;
                return 2;
        }
        #
-       #       Since we got the info we want, let's close 
+       #       Since we got the info we want, let's close
        #       the telnet session
        #
        $pr->close;
@@ -843,9 +843,9 @@ sub patton_snmp {
    $oid = '.1.3.6.1.4.1.1768.5.100.1.56.' . hex $ARGV[4];
    #
    # Check if the session still active
-   # 
+   #
    if (snmpget($ARGV[1], "monitor", "$oid") == 0) {
-      print LOG "  Session $ARGV[4] still active on NAS " . 
+      print LOG "  Session $ARGV[4] still active on NAS " .
        "$ARGV[1], port $ARGV[2], for user $ARGV[3].\n" if ($debug);
       return 1;
    }
@@ -886,7 +886,7 @@ sub digitro_rusers {
 sub cyclades_snmp {
    my ($oid, $ret);
    local $_;
-   
+
    $oid = ".1.3.6.1.4.1.2925.3.3.6.1.1.2";
 
    $_ = snmpwalk($ARGV[1],"$cmmty_string",$oid);
@@ -898,7 +898,7 @@ sub cyclades_snmp {
 #      3Com/USR HiPer Arc Total Control.
 #      This works with HiPer Arc 4.0.30
 #      (this routine by Igor Brezac <igor@ipass.net>)
-# 
+#
 
 #       This routine modified by Dan Halverson <danh@tbc.net>
 #       to suport additional versions of Hiper Arc
@@ -920,7 +920,7 @@ sub usrhiper_snmp {
 # If password is defined in naspasswd file, use it as community, otherwise use $cmmty_string
                if ($password eq '') {
                    $password = "$cmmty_string";
-               }       
+               }
        }
        my ($ver) = get_hiper_ver(usrm=>$usrm, target=>$ARGV[1], community=>$password);
        $oidext = get_oidext(ver=>$ver, tty=>$ARGV[2]);
@@ -948,7 +948,7 @@ sub get_hiper_ver {
     return($ver);
 }
 
-#     
+#
 #   Add additional OID checks below before the else.
 #   Else is for 4.0.30
 #
@@ -990,8 +990,8 @@ sub usrnet_telnet {
 
        #
        #       Communicate with Netserver using Net::Telnet, then access
-       #       list connectionsto see who are logged in. 
-       # 
+       #       list connectionsto see who are logged in.
+       #
        $telnet = new Net::Telnet (Timeout => 5,
                                   Prompt => '/\>/');
        $telnet->open($terminalserver);
@@ -1022,7 +1022,7 @@ sub usrnet_telnet {
                if ( /mod\:/ ) {
                        ($port, $user, $dummy) = split;
                        #
-                       # Strip out any prefixes and suffixes 
+                       # Strip out any prefixes and suffixes
                        # from the username
                        #
                        # uncomment this if you use the standard
@@ -1039,7 +1039,7 @@ sub usrnet_telnet {
                        };
                };
        };
-       print LOG 
+       print LOG
        "  $ARGV[3] not found on Netserver logged users list " if ($debug);
        0;
 }
@@ -1049,16 +1049,16 @@ sub usrnet_telnet {
 #
 #      ___ versanet_snmp 1.0 by support@versanetcomm.com ___ July 1999
 #      Versanet Enterprise MIB Base: 1.3.6.1.4.1.2180
-#   
+#
 #      VN2001/2002 use slot/port number to locate modems. To use snmp get we
 #      have to translate the original port number into a slot/port pair.
 #
 $vsm     = '.iso.org.dod.internet.private.enterprises.2180';
 sub versanet_snmp {
-        
+
        print LOG "argv[2] = $ARGV[2] " if ($debug);
        $port = $ARGV[2]%8;
-       $port = 8 if ($port eq 0);        
+       $port = 8 if ($port eq 0);
        print LOG "port = $port " if ($debug);
        $slot = (($ARGV[2]-$port)/8)+1;
        print LOG "slot = $slot" if ($debug);
@@ -1067,12 +1067,12 @@ sub versanet_snmp {
 #      Note: the "$cmmty_string" string above could be replaced by the public
 #            community string defined in Versanet VN2001/VN2002.
 #
-         print LOG "  user at slot $slot port $port: $loginname\n" if ($debug);          ($loginname eq $ARGV[3]) ? 1 : 0;     
+         print LOG "  user at slot $slot port $port: $loginname\n" if ($debug);          ($loginname eq $ARGV[3]) ? 1 : 0;
 }
 
 
 # 1999/08/24 Chris Shenton <chris@shenton.org>
-# Check Bay8000 NAS (aka: Annex) using finger. 
+# Check Bay8000 NAS (aka: Annex) using finger.
 # Returns from "finger @bay" like:
 #   Port  What User         Location         When          Idle  Address
 #   asy2  PPP  bill         ---              9:33am         :08  192.168.1.194
@@ -1160,7 +1160,7 @@ sub mikrotik_snmp {
   # Set SNMP version
   # MikroTik only supports version 1
   $snmp_version = "1";
+
   # Look up community string in naspasswd file.
   ($login, $password) = naspasswd($ARGV[1], 1);
   if ($login && $login ne 'SNMP') {
@@ -1168,14 +1168,14 @@ sub mikrotik_snmp {
       print LOG "Error: Need SNMP community string for $ARGV[1]\n";
     }
     return 2;
-  } else { 
+  } else {
   # If password is defined in naspasswd file, use it as community,
   # otherwise use $cmmty_string
     if ($password eq '') {
       $password = "$cmmty_string";
     }
   }
+
   # We want interface descriptions
   $oid = "ifDescr";
 
@@ -1224,7 +1224,7 @@ sub mikrotik_telnet {
 
   # Dont just exit when there is error
   $t->errmode('return');
-                       
+
   # Telnet to terminal server
   $t->open($terminalserver) or return 2;
 
@@ -1286,7 +1286,7 @@ sub mikrotik_telnet {
 
   if( $output =~ /name="$user"/ ) {
     $username_seen++;
-  } 
+  }
 
   #lets return something
   if ($username_seen > 0) {
@@ -1311,30 +1311,30 @@ sub redback_telnet {
        print LOG " Error: No context defined\n" if ($debug);
        return 2;
     }
-    
+
     # Get loggin information
     ($root, $password) = naspasswd($terminalserver, 1);
     return 2 if ($password eq "");
-    
+
     $operprompt = '/\[.*\].*>$/';
     $adminprompt = '/\[.*\].*#$/';
-    
+
     # Logging to the RedBack NAS
     $t = new Net::Telnet (Timeout => 5, Prompt => $operprompt);
     $t->input_log("./debug");
     $t->open($terminalserver);
     $t->login($root, $password);
-    
+
     #Enable us
     $t->print('ena');
     $t->waitfor('/Password/');
     $t->print($password);
     $t->waitfor($adminprompt);
     $t->prompt($adminprompt);
-    
+
     #Switch context
     $t->cmd(String => "context $context");
-    
+
     #Ask the question
     @lines = $t->cmd(String => "show subscribers active
 $user\@$context");
index c675c3e..4ca6013 100644 (file)
@@ -186,11 +186,11 @@ int client_add(RADCLIENT_LIST *clients, RADCLIENT *client)
        /*
         *      Allow clients to be NULL if mainconfig.clients is NULL.
         */
-        
+
        if (!client || (!clients && (mainconfig.clients != NULL))) {
                return 0;
        }
-       
+
        if (!clients) {
                clients = clients_init();
                if (!clients) return 0;
@@ -269,9 +269,9 @@ RADCLIENT *client_findbynumber(const RADCLIENT_LIST *clients,
 
        if (tree_num) {
                RADCLIENT myclient;
-               
+
                myclient.number = number;
-               
+
                return rbtree_finddata(tree_num, &myclient);
        }
 #endif
@@ -311,7 +311,7 @@ RADCLIENT *client_find(const RADCLIENT_LIST *clients,
                client_sane(&myclient); /* clean up the ipaddress */
 
                if (!clients->trees[i]) continue;
-               
+
                data = rbtree_finddata(clients->trees[i], &myclient);
                if (data) {
                        return data;
@@ -367,15 +367,15 @@ const char *client_name_old(const lrad_ipaddr_t *ipaddr)
 }
 
 static const CONF_PARSER client_config[] = {
-       { "secret",  PW_TYPE_STRING_PTR, 
+       { "secret",  PW_TYPE_STRING_PTR,
          offsetof(RADCLIENT, secret), 0, NULL },
-       { "shortname",  PW_TYPE_STRING_PTR, 
+       { "shortname",  PW_TYPE_STRING_PTR,
          offsetof(RADCLIENT, shortname), 0, NULL },
-       { "nastype",  PW_TYPE_STRING_PTR, 
+       { "nastype",  PW_TYPE_STRING_PTR,
          offsetof(RADCLIENT, nastype), 0, NULL },
-       { "login",  PW_TYPE_STRING_PTR, 
+       { "login",  PW_TYPE_STRING_PTR,
          offsetof(RADCLIENT, login), 0, NULL },
-       { "password",  PW_TYPE_STRING_PTR, 
+       { "password",  PW_TYPE_STRING_PTR,
          offsetof(RADCLIENT, password), 0, NULL },
 
        { NULL, -1, 0, NULL, NULL }
index 0e3e49b..7104d37 100644 (file)
@@ -333,7 +333,7 @@ void cf_section_free(CONF_SECTION **cs)
                        break;
 
                case CONF_ITEM_SECTION: {
-                               
+
                                CONF_SECTION *section = cf_itemtosection(ci);
                                cf_section_free(&section);
                        }
@@ -394,7 +394,7 @@ static CONF_SECTION *cf_section_alloc(const char *name1, const char *name2,
                cf_section_free(&cs);
                return NULL;
        }
-       
+
        if (name2 && *name2) {
                cs->name2 = strdup(name2);
                if (!cs->name2) {
@@ -450,24 +450,24 @@ static void cf_item_add(CONF_SECTION *cs, CONF_ITEM *ci)
                        case CONF_ITEM_PAIR:
                                rbtree_insert(cs->pair_tree, ci);
                                break;
-                               
+
                        case CONF_ITEM_SECTION: {
                                const CONF_SECTION *cs_new = cf_itemtosection(ci);
-                               
+
                                if (!cs->section_tree) {
                                        cs->section_tree = rbtree_create(section_cmp, NULL, 0);
                                        /* ignore any errors */
                                }
-                               
+
                                if (cs->section_tree) {
                                        rbtree_insert(cs->section_tree, cs_new);                                }
-                               
+
                                /*
                                 *      Two names: find the named instance.
                                 */
                                if (cs_new->name2) {
                                        CONF_SECTION *old_cs;
-                                       
+
                                        /*
                                         *      Find the FIRST
                                         *      CONF_SECTION having
@@ -477,7 +477,7 @@ static void cf_item_add(CONF_SECTION *cs, CONF_ITEM *ci)
                                         */
                                        old_cs = rbtree_finddata(cs->section_tree, cs_new);
                                        if (!old_cs) return; /* this is a bad error! */
-                                       
+
                                        if (!old_cs->name2_tree) {
                                                old_cs->name2_tree = rbtree_create(name2_cmp,
                                                                                   NULL, 0);
@@ -761,18 +761,18 @@ int cf_item_parse(CONF_SECTION *cs, const char *name,
                }
                DEBUG2("\t%s = %s", name, value);
                break;
-               
+
        case PW_TYPE_INTEGER:
                *(int *)data = strtol(value, 0, 0);
                DEBUG2("\t%s = %d", name, *(int *)data);
                break;
-               
+
        case PW_TYPE_STRING_PTR:
                q = (char **) data;
                if (*q != NULL) {
                        free(*q);
                }
-               
+
                /*
                 *      Expand variables which haven't already been
                 *      expanded automagically when the configuration
@@ -791,11 +791,11 @@ int cf_item_parse(CONF_SECTION *cs, const char *name,
                                                    cs, buffer, value);
                        if (!value) return -1;
                }
-               
+
                DEBUG2("\t%s = \"%s\"", name, value ? value : "(null)");
                *q = value ? strdup(value) : NULL;
                break;
-               
+
                /*
                 *      This is the same as PW_TYPE_STRING_PTR,
                 *      except that we also "stat" the file, and
@@ -806,7 +806,7 @@ int cf_item_parse(CONF_SECTION *cs, const char *name,
                if (*q != NULL) {
                        free(*q);
                }
-               
+
                /*
                 *      Expand variables which haven't already been
                 *      expanded automagically when the configuration
@@ -825,7 +825,7 @@ int cf_item_parse(CONF_SECTION *cs, const char *name,
                                                    cs, buffer, value);
                        if (!value) return -1;
                }
-               
+
                DEBUG2("\t%s = \"%s\"", name, value ? value : "(null)");
                *q = value ? strdup(value) : NULL;
 
@@ -864,7 +864,7 @@ int cf_item_parse(CONF_SECTION *cs, const char *name,
                               ip_ntoh(&ipaddr, ipbuf, sizeof(ipbuf)));
                *(uint32_t *) data = ipaddr.ipaddr.ip4addr.s_addr;
                break;
-               
+
        case PW_TYPE_IPV6ADDR:
                if (ip_hton(value, AF_INET6, &ipaddr) < 0) {
                        radlog(L_ERR, "Can't find IPv6 address for host %s", value);
@@ -875,13 +875,13 @@ int cf_item_parse(CONF_SECTION *cs, const char *name,
                memcpy(data, &ipaddr.ipaddr.ip6addr,
                       sizeof(ipaddr.ipaddr.ip6addr));
                break;
-               
+
        default:
                radlog(L_ERR, "type %d not supported yet", type);
                return -1;
                break;
        } /* switch over variable type */
-       
+
        return rcode;
 }
 
@@ -914,7 +914,7 @@ int cf_section_parse(CONF_SECTION *cs, void *base,
                if (variables[i].type == PW_TYPE_SUBSECTION) {
                        const CONF_SECTION *subcs;
                        subcs = cf_section_sub_find(cs, variables[i].name);
-                       
+
                        /*
                         *      If the configuration section is NOT there,
                         *      then ignore it.
@@ -928,14 +928,14 @@ int cf_section_parse(CONF_SECTION *cs, void *base,
                                DEBUG2("Internal sanity check 1 failed in cf_section_parse");
                                goto error;
                        }
-                       
+
                        if (cf_section_parse(subcs, base,
                                             (const CONF_PARSER *) variables[i].dflt) < 0) {
                                goto error;
                        }
                        continue;
                } /* else it's a CONF_PAIR */
-               
+
                if (variables[i].data) {
                        data = variables[i].data; /* prefer this. */
                } else if (base) {
@@ -1054,7 +1054,7 @@ static int cf_section_read(const char *file, int *lineno, FILE *fp,
                               radlog(L_ERR, "%s[%d]: Too many closing braces",
                                      file, *lineno);
                               return -1;
-                              
+
                       }
                       this = this->item.parent;
                       continue;
@@ -1473,10 +1473,10 @@ CONF_SECTION *cf_section_sub_find_name2(const CONF_SECTION *cs,
 
        if (name1 && (cs->section_tree)) {
                CONF_SECTION mycs, *master_cs;
-               
+
                mycs.name1 = name1;
                mycs.name2 = name2;
-               
+
                master_cs = rbtree_finddata(cs->section_tree, &mycs);
                if (master_cs) {
                        return rbtree_finddata(master_cs->name2_tree, &mycs);
@@ -1605,7 +1605,7 @@ static void *cf_data_find_internal(CONF_SECTION *cs, const char *name,
                                   int flag)
 {
        if (!cs || !name) return NULL;
-       
+
        /*
         *      Find the name in the tree, for speed.
         */
@@ -1670,7 +1670,7 @@ int cf_data_add(CONF_SECTION *cs, const char *name,
  */
 static void cf_section_copy_data(CONF_SECTION *s, CONF_SECTION *d)
 {
-       
+
        CONF_ITEM *cd, *next, **last;
 
        /*
@@ -1681,7 +1681,7 @@ static void cf_section_copy_data(CONF_SECTION *s, CONF_SECTION *d)
        rad_assert(d->data_tree == NULL);
        d->data_tree = s->data_tree;
        s->data_tree = NULL;
-       
+
        /*
         *      Walk through src, moving CONF_ITEM_DATA
         *      to dst, by hand.
@@ -1689,13 +1689,13 @@ static void cf_section_copy_data(CONF_SECTION *s, CONF_SECTION *d)
        last = &(s->children);
        for (cd = s->children; cd != NULL; cd = next) {
                next = cd->next;
-               
+
                /*
                 *      Recursively copy data from child sections.
                 */
                if (cd->type == CONF_ITEM_SECTION) {
                        CONF_SECTION *s1, *d1;
-                       
+
                        s1 = cf_itemtosection(cd);
                        d1 = cf_section_sub_find_name2(d, s1->name1, s1->name2);
                        if (d1) {
@@ -1712,13 +1712,13 @@ static void cf_section_copy_data(CONF_SECTION *s, CONF_SECTION *d)
                        last = &(cd->next);
                        continue;
                }
-               
+
                /*
                 *      Remove it from the src list
                 */
                *last = cd->next;
                cd->next = NULL;
-               
+
                /*
                 *      Add it to the dst list
                 */
@@ -1810,7 +1810,7 @@ static int cf_section_cmp(CONF_SECTION *a, CONF_SECTION *b)
                 */
                if ((strcmp(pa->attr, pb->attr) != 0) ||
                    (strcmp(pa->value, pb->value) != 0)) return 0;
-               
+
 
                /*
                 *      And go to the next element.
index 031425d..818b5c3 100644 (file)
@@ -125,13 +125,13 @@ static void snmp_inc_counters(REQUEST *request)
                rad_snmp.auth.total_access_rejects++;
                if (request->client) request->client->auth->rejects++;
                break;
-               
+
        case PW_ACCESS_CHALLENGE:
                rad_snmp.auth.total_responses++;
                rad_snmp.auth.total_access_challenges++;
                if (request->client) request->client->auth->challenges++;
                break;
-               
+
        case PW_ACCOUNTING_RESPONSE:
                rad_snmp.acct.total_responses++;
                if (request->client) request->client->auth->responses++;
@@ -147,7 +147,7 @@ static void snmp_inc_counters(REQUEST *request)
                        if (request->client) request->client->auth->bad_authenticators++;
                }
                break;
-               
+
        default:
                break;
        }
@@ -184,7 +184,7 @@ static REQUEST *lookup_in_proxy_hash(RADIUS_PACKET *reply)
        }
 
        request = lrad_packet2myptr(REQUEST, proxy, proxy_p);
-               
+
        if (!request) {
                PTHREAD_MUTEX_UNLOCK(&proxy_mutex);
                return NULL;
@@ -297,9 +297,9 @@ static int insert_into_proxy_hash(REQUEST *request)
                        PTHREAD_MUTEX_UNLOCK(&proxy_mutex);
                        DEBUG2("ERROR: Failed to create a new socket for proxying requests.");
                        return 0; /* leak proxy_listener */
-                       
+
                }
-                   
+
                if (!lrad_packet_list_id_alloc(proxy_list, request->proxy)) {
                        PTHREAD_MUTEX_UNLOCK(&proxy_mutex);
                        DEBUG2("ERROR: Failed to create a new socket for proxying requests.");
@@ -336,7 +336,7 @@ static int insert_into_proxy_hash(REQUEST *request)
                DEBUG2("ERROR: Failed to insert entry into proxy list");
                return 0;
        }
-       
+
        PTHREAD_MUTEX_UNLOCK(&proxy_mutex);
 
        DEBUG3(" proxy: allocating destination %s port %d - Id %d",
@@ -344,7 +344,7 @@ static int insert_into_proxy_hash(REQUEST *request)
                         &request->proxy->dst_ipaddr.ipaddr, buf, sizeof(buf)),
               request->proxy->dst_port,
               request->proxy->id);
-       
+
        request->in_proxy_hash = TRUE;
 
        return 1;
@@ -397,13 +397,13 @@ static void wait_for_child_to_die(void *ctx)
            (request->child_state == REQUEST_RUNNING)) {
                request->delay += (request->delay >> 1);
                tv_add(&request->when, request->delay);
-               
+
                DEBUG2("Child is still stuck for request %d", request->number);
 
                INSERT_EVENT(wait_for_child_to_die, request);
                return;
        }
-       
+
        DEBUG2("Child is finally responsive for request %d", request->number);
        remove_from_request_hash(request);
 
@@ -436,7 +436,7 @@ static void cleanup_delay(void *ctx)
               (unsigned int) (request->timestamp - start_time));
 
        lrad_event_delete(el, &request->ev);
-       request_free(&request); 
+       request_free(&request);
 }
 
 
@@ -483,7 +483,7 @@ static void no_response_to_ping(void *ctx)
                         buffer, sizeof(buffer)),
               request->proxy->dst_port);
 
-       wait_for_proxy_id_to_expire(request);   
+       wait_for_proxy_id_to_expire(request);
 }
 
 
@@ -662,7 +662,7 @@ static void check_for_zombie_home_server(REQUEST *request)
        home->state = HOME_STATE_IS_DEAD;
        home->num_received_pings = 0;
        home->when = request->when;
-       
+
        if (home->ping_check != HOME_PING_CHECK_NONE) {
                rad_assert((home->ping_check == HOME_PING_CHECK_STATUS_SERVER) ||
                           (home->ping_user_name != NULL));
@@ -733,7 +733,7 @@ static void post_proxy_fail_handler(REQUEST *request)
                 *      Re-queue the request.
                 */
                request->child_state = REQUEST_QUEUED;
-                               
+
                wait_a_bit(request);
 
                /*
@@ -757,7 +757,7 @@ static void no_response_to_proxied_request(void *ctx)
        REQUEST *request = ctx;
        home_server *home;
        char buffer[128];
-       
+
        rad_assert(request->magic == REQUEST_MAGIC);
        rad_assert(request->child_state == REQUEST_PROXIED);
 
@@ -822,7 +822,7 @@ static void wait_a_bit(void *ctx)
                        radlog(L_ERR, "WARNING: Unresponsive child (id %lu) for request %d, in module %s component %s",
                               (unsigned long)request->child_pid, request->number,
                               request->module ? request->module : "<server core>",
-                              request->component ? request->component : "<server core>");             
+                              request->component ? request->component : "<server core>");
 
                        request->master_state = REQUEST_STOP_PROCESSING;
 
@@ -919,7 +919,7 @@ static int request_pre_handler(REQUEST *request)
                 *      Delete any reply we had accumulated until now.
                 */
                pairfree(&request->reply->vps);
-               
+
                /*
                 *      Run the packet through the post-proxy stage,
                 *      BEFORE playing games with the attributes.
@@ -930,7 +930,7 @@ static int request_pre_handler(REQUEST *request)
                        post_proxy_type = vp->vp_integer;
                }
                rcode = module_post_proxy(post_proxy_type, request);
-               
+
                /*
                 *      There may NOT be a proxy reply, as we may be
                 *      running Post-Proxy-Type = Fail.
@@ -942,14 +942,14 @@ static int request_pre_handler(REQUEST *request)
                         *      attributes from us and remote server.
                         */
                        pairdelete(&request->proxy_reply->vps, PW_PROXY_STATE);
-               
+
                        /*
                         *      Add the attributes left in the proxy
                         *      reply to the reply list.
                         */
                        pairadd(&request->reply->vps, request->proxy_reply->vps);
                        request->proxy_reply->vps = NULL;
-               
+
                        /*
                         *      Free proxy request pairs.
                         */
@@ -1126,7 +1126,7 @@ static int successfully_proxied_request(REQUEST *request)
                 *      Do NOT delete Stripped-User-Name.
                 */
        }
-       
+
        /*
         *      If there is no PW_CHAP_CHALLENGE attribute but
         *      there is a PW_CHAP_PASSWORD we need to add it
@@ -1208,7 +1208,7 @@ static int successfully_proxied_request(REQUEST *request)
                request->home_server = NULL;
                return 1;
        }
-       
+
        if (!insert_into_proxy_hash(request)) {
                DEBUG("ERROR: Failed to proxy request %d", request->number);
                return -1;
@@ -1218,14 +1218,14 @@ static int successfully_proxied_request(REQUEST *request)
 
        when = request->received;
        when.tv_sec += mainconfig.max_request_time;
-       
+
        gettimeofday(&request->proxy_when, NULL);
 
        request->next_when = request->proxy_when;
        request->next_when.tv_sec += home->response_window;
 
        rad_assert(home->response_window > 0);
-       
+
        if (timercmp(&when, &request->next_when, <)) {
                request->next_when = when;
        }
@@ -1237,7 +1237,7 @@ static int successfully_proxied_request(REQUEST *request)
                         &request->proxy->dst_ipaddr.ipaddr,
                         buffer, sizeof(buffer)),
               request->proxy->dst_port);
-       
+
        /*
         *      Note that we set proxied BEFORE sending the packet.
         *
@@ -1330,13 +1330,13 @@ static void request_post_handler(REQUEST *request)
         */
        if (request->packet->code == PW_AUTHENTICATION_REQUEST) {
                gettimeofday(&request->next_when, NULL);
-         
+
                if (request->reply->code == 0) {
                        DEBUG2("There was no response configured: rejecting request %d",
                               request->number);
                        request->reply->code = PW_AUTHENTICATION_REJECT;
                }
-               
+
                /*
                 *      Run rejected packets through
                 *
@@ -1358,7 +1358,7 @@ static void request_post_handler(REQUEST *request)
                         */
                        when = request->received;
                        when.tv_sec += mainconfig.reject_delay;
-                       
+
                        if (timercmp(&when, &request->next_when, >)) {
                                DEBUG2("Delaying reject of request %d for %d seconds",
                                       request->number,
@@ -1495,7 +1495,7 @@ static void received_retransmit(REQUEST *request, const RADCLIENT *client)
                                post_proxy_fail_handler(request);
                                return;
                        }
-                       
+
                        request->proxy->code = request->packet->code;
                        request->proxy->dst_ipaddr = home->ipaddr;
                        request->proxy->dst_port = home->port;
@@ -1519,7 +1519,7 @@ static void received_retransmit(REQUEST *request, const RADCLIENT *client)
                                         &request->proxy->dst_ipaddr.ipaddr,
                                         buffer, sizeof(buffer)),
                               request->proxy->dst_port);
-                       
+
                        /*
                         *      Restart timers.  Note that we leave
                         *      the old timeout in place, as that is a
@@ -1609,7 +1609,7 @@ static int can_handle_new_request(RADIUS_PACKET *packet,
         */
        if (mainconfig.max_requests) {
                int request_count = lrad_packet_list_num_elements(pl);
-               
+
                /*
                 *      This is a new request.  Let's see if
                 *      it makes us go over our configured
@@ -1633,7 +1633,7 @@ static int can_handle_new_request(RADIUS_PACKET *packet,
         *      We increment the counters here, and decrement them
         *      when the response is sent... somewhere in this file.
         */
-       
+
        /*
         *      FUTURE: Add checks for system load.  If the system is
         *      busy, start dropping requests...
@@ -1642,7 +1642,7 @@ static int can_handle_new_request(RADIUS_PACKET *packet,
         *      there are more requests coming in than we can handle,
         *      start dropping some.
         */
-       
+
        return 1;
 }
 
@@ -1698,7 +1698,7 @@ int received_request(rad_listen_t *listener,
         *      Create and initialize the new request.
         */
        request = request_alloc(); /* never fails */
-       
+
        if ((request->reply = rad_alloc(0)) == NULL) {
                radlog(L_ERR, "No memory");
                exit(1);
@@ -1710,7 +1710,7 @@ int received_request(rad_listen_t *listener,
        request->packet->timestamp = request->timestamp;
        request->number = request_num_counter++;
        request->priority = listener->type;
-       
+
        /*
         *      Remember the request in the list.
         */
@@ -1720,7 +1720,7 @@ int received_request(rad_listen_t *listener,
                return 0;
        }
        request->in_request_hash = TRUE;
-       
+
        /*
         *      The request passes many of our sanity checks.
         *      From here on in, if anything goes wrong, we
@@ -1851,7 +1851,7 @@ REQUEST *received_proxy_response(RADIUS_PACKET *packet)
                /* assert that there's an event queued for request? */
                rad_free(&packet);
                return NULL;
-               
+
        case REQUEST_PROXIED:
                break;
        }
@@ -1948,14 +1948,14 @@ int radius_event_init(int spawn_flag)
        if (mainconfig.proxy_requests) {
                int i;
                rad_listen_t *listener;
-                       
+
                /*
                 *      Create the tree for managing proxied requests and
                 *      responses.
                 */
                proxy_list = lrad_packet_list_create(1);
                if (!proxy_list) return 0;
-               
+
 #ifdef HAVE_PTHREAD_H
                if (pthread_mutex_init(&proxy_mutex, NULL) != 0) {
                        radlog(L_ERR, "FATAL: Failed to initialize proxy mutex: %s",
@@ -1968,7 +1968,7 @@ int radius_event_init(int spawn_flag)
                 *      Mark the Fd's as unused.
                 */
                for (i = 0; i < 32; i++) proxy_fds[i] = -1;
-               
+
                i = -1;
 
                for (listener = mainconfig.listen;
@@ -2087,7 +2087,7 @@ int radius_event_process(struct timeval **pptv)
                        return 1;
                }
                rad_panic("Internal sanity check failed");
-               
+
        } else if (timercmp(&now, &when, >)) {
                DEBUG3("Event in the past... compensating");
                when.tv_sec = 0;
@@ -2112,12 +2112,12 @@ void radius_handle_request(REQUEST *request, RAD_REQUEST_FUNP fun)
                DEBUG2("Going to the next request");
                return;
        }
-       
+
        rad_assert(fun != NULL);
        rad_assert(request != NULL);
-       
+
        fun(request);
-       
+
        request_post_handler(request);
        DEBUG2("Going to the next request");
        return;
index 90e1e37..377d117 100644 (file)
@@ -84,7 +84,7 @@ typedef struct listen_detail_t {
        int             delay_time;
        struct timeval  last_packet;
 } listen_detail_t;
-                              
+
 
 /*
  *     Find a per-socket client.
@@ -104,7 +104,7 @@ static RADCLIENT *client_listener_find(const rad_listen_t *listener,
        if (!clients) clients = mainconfig.clients;
 
        rad_assert(clients != NULL);
-       
+
        return client_find(clients, ipaddr);
 }
 
@@ -214,15 +214,15 @@ static int common_socket_parse(const char *filename, int lineno,
        rcode = cf_item_parse(cs, "ipaddr", PW_TYPE_IPADDR,
                              &ipaddr.ipaddr.ip4addr, NULL);
        if (rcode < 0) return -1;
-       
+
        if (rcode == 0) { /* successfully parsed IPv4 */
                ipaddr.af = AF_INET;
-               
+
        } else {        /* maybe IPv6? */
                rcode = cf_item_parse(cs, "ipv6addr", PW_TYPE_IPV6ADDR,
                                      &ipaddr.ipaddr.ip6addr, NULL);
                if (rcode < 0) return -1;
-               
+
                if (rcode == 1) {
                        radlog(L_ERR, "%s[%d]: No address specified in listen section",
                               filename, lineno);
@@ -230,11 +230,11 @@ static int common_socket_parse(const char *filename, int lineno,
                }
                ipaddr.af = AF_INET6;
        }
-       
+
        rcode = cf_item_parse(cs, "port", PW_TYPE_INTEGER,
                              &listen_port, "0");
        if (rcode < 0) return -1;
-       
+
        sock->ipaddr = ipaddr;
        sock->port = listen_port;
 
@@ -267,9 +267,9 @@ static int common_socket_parse(const char *filename, int lineno,
                rad_assert(cp != NULL);
                value = cf_pair_value(cp);
                rad_assert(value != NULL);
-               
+
                strcpy(ifreq.ifr_name, value);
-       
+
                if (setsockopt(this->fd, SOL_SOCKET, SO_BINDTODEVICE,
                               (char *)&ifreq, sizeof(ifreq)) < 0) {
                        radlog(L_CONS|L_ERR, "%s[%d]: Failed binding to interface %s: %s",
@@ -390,7 +390,7 @@ static int auth_socket_recv(rad_listen_t *listener,
                                           &src_ipaddr)) == NULL) {
                rad_recv_discard(listener->fd);
                RAD_SNMP_TYPE_INC(listener, total_invalid_requests);
-               
+
                /*
                 *      This is debugging rather than logging, so that
                 *      DoS attacks don't affect us.
@@ -409,7 +409,7 @@ static int auth_socket_recv(rad_listen_t *listener,
                RAD_SNMP_CLIENT_INC(listener, client, requests);
                fun = rad_authenticate;
                break;
-               
+
        case PW_STATUS_SERVER:
                if (!mainconfig.status_server) {
                        rad_recv_discard(listener->fd);
@@ -425,13 +425,13 @@ static int auth_socket_recv(rad_listen_t *listener,
                rad_recv_discard(listener->fd);
                RAD_SNMP_INC(rad_snmp.auth.total_unknown_types);
                RAD_SNMP_CLIENT_INC(listener, client, unknown_types);
-               
+
                DEBUG("Invalid packet code %d sent to authentication port from client %s port %d : IGNORED",
                      code, client->shortname, src_port);
                return 0;
                break;
        } /* switch over packet types */
-       
+
        /*
         *      Now that we've sanity checked everything, receive the
         *      packet.
@@ -442,7 +442,7 @@ static int auth_socket_recv(rad_listen_t *listener,
                radlog(L_ERR, "%s", librad_errstr);
                return 0;
        }
-       
+
        if (!received_request(listener, packet, prequest, client)) {
                RAD_SNMP_TYPE_INC(listener, total_packets_dropped);
                RAD_SNMP_CLIENT_INC(listener, client, packets_dropped);
@@ -468,7 +468,7 @@ static int acct_socket_recv(rad_listen_t *listener,
        char            buffer[128];
        RADCLIENT       *client;
        lrad_ipaddr_t   src_ipaddr;
-       
+
        rcode = rad_recv_header(listener->fd, &src_ipaddr, &src_port, &code);
        if (rcode < 0) return 0;
 
@@ -483,7 +483,7 @@ static int acct_socket_recv(rad_listen_t *listener,
                                           &src_ipaddr)) == NULL) {
                rad_recv_discard(listener->fd);
                RAD_SNMP_TYPE_INC(listener, total_invalid_requests);
-               
+
                /*
                 *      This is debugging rather than logging, so that
                 *      DoS attacks don't affect us.
@@ -502,7 +502,7 @@ static int acct_socket_recv(rad_listen_t *listener,
                RAD_SNMP_CLIENT_INC(listener, client, requests);
                fun = rad_accounting;
                break;
-               
+
        case PW_STATUS_SERVER:
                if (!mainconfig.status_server) {
                        rad_recv_discard(listener->fd);
@@ -535,7 +535,7 @@ static int acct_socket_recv(rad_listen_t *listener,
                radlog(L_ERR, "%s", librad_errstr);
                return 0;
        }
-       
+
        /*
         *      There can be no duplicate accounting packets.
         */
@@ -561,7 +561,7 @@ static int proxy_socket_recv(rad_listen_t *listener,
        RADIUS_PACKET   *packet;
        RAD_REQUEST_FUNP fun = NULL;
        char            buffer[128];
-       
+
        packet = rad_recv(listener->fd);
        if (!packet) {
                radlog(L_ERR, "%s", librad_errstr);
@@ -577,11 +577,11 @@ static int proxy_socket_recv(rad_listen_t *listener,
        case PW_AUTHENTICATION_REJECT:
                fun = rad_authenticate;
                break;
-               
+
        case PW_ACCOUNTING_RESPONSE:
                fun = rad_accounting;
                break;
-               
+
        default:
                /*
                 *      FIXME: Update MIB for packet types?
@@ -727,21 +727,21 @@ static int detail_send(rad_listen_t *listener, REQUEST *request)
                data->has_rtt = TRUE;
                data->srtt = rtt;
                data->rttvar = rtt / 2;
-               
+
        } else {
                data->rttvar -= data->rttvar >> 2;
                data->rttvar += (data->srtt - rtt);
                data->srtt -= data->srtt >> 3;
                data->srtt += rtt >> 3;
        }
-       
+
        /*
         *      Calculate the time we wait before sending the next
         *      packet.
         *
         *      rtt / (rtt + delay) = load_factor / 100
         */
-       data->delay_time = (data->srtt * (100 - data->load_factor)) / (data->load_factor);      
+       data->delay_time = (data->srtt * (100 - data->load_factor)) / (data->load_factor);
 
        /*
         *      FIXME: Push this delay to the event handler!
@@ -791,7 +791,7 @@ static int detail_open(rad_listen_t *this)
 
        rad_assert(data->state == STATE_UNOPENED);
        snprintf(buffer, sizeof(buffer), "%s.work", data->filename);
-       
+
        /*
         *      Open detail.work first, so we don't lose
         *      accounting packets.  It's probably better to
@@ -815,7 +815,7 @@ static int detail_open(rad_listen_t *this)
                if (stat(data->filename, &st) < 0) {
                        return 0;
                }
-               
+
                /*
                 *      Open it BEFORE we rename it, just to
                 *      be safe...
@@ -826,7 +826,7 @@ static int detail_open(rad_listen_t *this)
                               data->filename, strerror(errno));
                        return 0;
                }
-               
+
                /*
                 *      Rename detail to detail.work
                 */
@@ -836,9 +836,9 @@ static int detail_open(rad_listen_t *this)
                        return 0;
                }
        } /* else detail.work existed, and we opened it */
-       
+
        rad_assert(data->vps == NULL);
-       
+
        rad_assert(data->fp == NULL);
        data->fp = fdopen(this->fd, "r");
        if (!data->fp) {
@@ -851,7 +851,7 @@ static int detail_open(rad_listen_t *this)
 
        data->client_ip.af = AF_UNSPEC;
        data->timestamp = 0;
-       
+
        return 1;
 }
 
@@ -1018,7 +1018,7 @@ static int detail_recv(rad_listen_t *listener,
                 */
                if (data->state == STATE_HEADER) {
                        int y;
-                       
+
                        if (sscanf(buffer, "%*s %*s %*d %*d:%*d:%*d %d", &y)) {
                                data->state = STATE_READING;
                        }
@@ -1072,7 +1072,7 @@ static int detail_recv(rad_listen_t *listener,
                    (vp != NULL)) {
                        *tail = vp;
                        tail = &(vp->next);
-               }               
+               }
        }
 
        /*
@@ -1291,13 +1291,13 @@ static int detail_parse(const char *filename, int lineno,
                       filename, lineno);
                return -1;
        }
-       
+
        if ((data->load_factor < 1) || (data->load_factor > 100)) {
                radlog(L_ERR, "%s[%d]: Load factor must be between 1 and 100",
                       filename, lineno);
                return -1;
        }
-       
+
        data->vps = NULL;
        data->fp = NULL;
        data->state = STATE_UNOPENED;
@@ -1318,7 +1318,7 @@ static int radius_snmp_recv(rad_listen_t *listener,
            (rad_snmp.smux_event == SMUX_READ)) {
                smux_read();
        }
-       
+
        /*
         *  If we've got to re-connect, then do so now,
         *  before calling select again.
@@ -1449,14 +1449,14 @@ static int listen_bind(rad_listen_t *this)
 
 #if 0
 #ifdef O_NONBLOCK
-       if ((flags = fcntl(this->fd, F_GETFL, NULL)) < 0)  { 
-               radlog(L_ERR, "Failure in fcntl: %s)\n", strerror(errno)); 
+       if ((flags = fcntl(this->fd, F_GETFL, NULL)) < 0)  {
+               radlog(L_ERR, "Failure in fcntl: %s)\n", strerror(errno));
                return -1;
        }
 
-       flags |= O_NONBLOCK; 
-       if( fcntl(this->fd, F_SETFL, flags) < 0) { 
-               radlog(L_ERR, "Failure in fcntl: %s)\n", strerror(errno)); 
+       flags |= O_NONBLOCK;
+       if( fcntl(this->fd, F_SETFL, flags) < 0) {
+               radlog(L_ERR, "Failure in fcntl: %s)\n", strerror(errno));
                return -1;
        }
 #endif
@@ -1494,7 +1494,7 @@ static rad_listen_t *listen_alloc(RAD_LISTEN_TYPE type)
        case RAD_LISTEN_DETAIL:
                this->data = rad_malloc(sizeof(listen_detail_t));
                memset(this->data, 0, sizeof(listen_detail_t));
-               
+
        default:
                break;
        }
@@ -1594,7 +1594,7 @@ int listen_init(const char *filename, rad_listen_t **head)
         *      We shouldn't be called with a pre-existing list.
         */
        rad_assert(head && (*head == NULL));
-       
+
        last = head;
        server_ipaddr.af = AF_UNSPEC;
 
@@ -1632,7 +1632,7 @@ int listen_init(const char *filename, rad_listen_t **head)
                              PW_TYPE_IPADDR,
                              &server_ipaddr.ipaddr.ip4addr, NULL);
        if (rcode < 0) return -1; /* error parsing it */
-       
+
        if (rcode == 0) { /* successfully parsed IPv4 */
                listen_socket_t *sock;
                server_ipaddr.af = AF_INET;
@@ -1645,7 +1645,7 @@ int listen_init(const char *filename, rad_listen_t **head)
 
                sock->ipaddr = server_ipaddr;
                sock->port = auth_port;
-               
+
                if (listen_bind(this) < 0) {
                        listen_free(&this);
                        listen_free(head);
@@ -1655,7 +1655,7 @@ int listen_init(const char *filename, rad_listen_t **head)
                auth_port = sock->port; /* may have been updated in listen_bind */
                *last = this;
                last = &(this->next);
-               
+
                /*
                 *      Open Accounting Socket.
                 *
@@ -1664,7 +1664,7 @@ int listen_init(const char *filename, rad_listen_t **head)
                 */
                this = listen_alloc(RAD_LISTEN_ACCT);
                sock = this->data;
-               
+
                /*
                 *      Create the accounting socket.
                 *
@@ -1673,7 +1673,7 @@ int listen_init(const char *filename, rad_listen_t **head)
                 */
                sock->ipaddr = server_ipaddr;
                sock->port = auth_port + 1;
-               
+
                if (listen_bind(this) < 0) {
                        listen_free(&this);
                        listen_free(head);
@@ -1707,7 +1707,7 @@ int listen_init(const char *filename, rad_listen_t **head)
                int             lineno = cf_section_lineno(cs);
 
                listen_type = identity = NULL;
-               
+
                DEBUG2(" listen {");
 
                rcode = cf_item_parse(cs, "type", PW_TYPE_STRING_PTR,
@@ -1748,7 +1748,7 @@ int listen_init(const char *filename, rad_listen_t **head)
                this = listen_alloc(type);
                this->identity = identity;
                this->fd = -1;
-               
+
                /*
                 *      Call per-type parser.
                 */
@@ -1762,7 +1762,7 @@ int listen_init(const char *filename, rad_listen_t **head)
                DEBUG2(" }");
 
                *last = this;
-               last = &(this->next);   
+               last = &(this->next);
        }
 
        /*
@@ -1860,7 +1860,7 @@ int listen_init(const char *filename, rad_listen_t **head)
                        return -1;
                }
        }
-       
+
  do_snmp:
 #ifdef WITH_SNMP
        if (mainconfig.do_snmp) {
@@ -1878,10 +1878,10 @@ int listen_init(const char *filename, rad_listen_t **head)
 
                this = rad_malloc(sizeof(*this));
                memset(this, 0, sizeof(*this));
-               
+
                this->type = RAD_LISTEN_SNMP;
                this->fd = rad_snmp.smux_fd;
-               
+
                this->recv = radius_snmp_recv;
                this->print = radius_snmp_print;
 
@@ -1906,7 +1906,7 @@ void listen_free(rad_listen_t **head)
        this = *head;
        while (this) {
                rad_listen_t *next = this->next;
-               
+
                free(this->identity);
 
                /*
@@ -1919,7 +1919,7 @@ void listen_free(rad_listen_t **head)
                }
                free(this->data);
                free(this);
-               
+
                this = next;
        }
 
index 7d9a68e..128c099 100644 (file)
@@ -75,7 +75,7 @@ int vradlog(int lvl, const char *fmt, va_list ap)
        if (mainconfig.radlog_dest == RADLOG_NULL) {
                return 0;
        }
-       
+
        /*
         *      Don't print timestamps to syslog, it does that for us.
         *      Don't print timestamps for low levels of debugging.
@@ -126,7 +126,7 @@ int vradlog(int lvl, const char *fmt, va_list ap)
        } else if ((fp = fopen(mainconfig.log_file, "a")) == NULL) {
                fprintf(stderr, "%s: Couldn't open %s for logging: %s\n",
                        progname, mainconfig.log_file, strerror(errno));
-               
+
                fprintf(stderr, "  (");
                vfprintf(stderr, fmt, ap);  /* the message that caused the log */
                fprintf(stderr, ")\n");
index cf27d54..5599c85 100644 (file)
@@ -68,7 +68,7 @@ static char *syslog_facility = NULL;
 static const LRAD_NAME_NUMBER str2fac[] = {
 #ifdef LOG_KERN
        { "kern", LOG_KERN },
-#endif 
+#endif
 #ifdef LOG_USER
        { "user", LOG_USER },
 #endif
@@ -237,17 +237,17 @@ static int xlat_config(void *instance, REQUEST *request,
         *      Copied from exec.c
         */
        from = fmt;
-       to = myfmt; 
+       to = myfmt;
        argc = 0;
        while (*from) {
                int flag, length;
-               
+
                flag = 0;
                argv[argc] = to;
                argc++;
-               
+
                if (argc >= (MAX_ARGV - 1)) break;
-               
+
                /*
                 *      Copy the argv over to our buffer.
                 */
@@ -260,7 +260,7 @@ static int xlat_config(void *instance, REQUEST *request,
                        case '%':
                                if (from[1] == '{') {
                                        *(to++) = *(from++);
-                                       
+
                                        length = rad_copy_variable(to, from);
                                        if (length < 0) {
                                                return -1;
@@ -341,7 +341,7 @@ static int xlat_config(void *instance, REQUEST *request,
                         */
                        sublen = 0;
                }
-               
+
                argv[i] = to;
                to += sublen;
                *(to++) = '\0';
@@ -735,7 +735,7 @@ int read_mainconfig(int reload)
                                      PW_TYPE_STRING_PTR, &radlog_dest,
                                      "files");
                if (rcode < 0) return -1;
-       
+
                mainconfig.radlog_dest = lrad_str2int(str2dest, radlog_dest, RADLOG_NUM_DEST);
                if (mainconfig.radlog_dest == RADLOG_NUM_DEST) {
                        fprintf(stderr, "radiusd: Error: Unknown log_destination %s\n",
@@ -744,7 +744,7 @@ int read_mainconfig(int reload)
                        cf_section_free(&cs);
                        return -1;
                }
-               
+
                if (mainconfig.radlog_dest == RADLOG_SYSLOG) {
                        static const CONF_PARSER syslog_config[] = {
                                { "log", PW_TYPE_SUBSECTION, 0, NULL,  (const void *) log_config},
@@ -857,7 +857,7 @@ int read_mainconfig(int reload)
                }
 
        } else if (debug_flag == 0) {
-               
+
                /*
                 *      Starting the server, WITHOUT "-x" on the
                 *      command-line: use whatever's in the config
index 55704a8..9231e7f 100644 (file)
@@ -152,7 +152,7 @@ static int compile_action(modcallable *c, const char *attr, const char *value,
 
        else if (strspn(value, "0123456789")==strlen(value)) {
                action = atoi(value);
-               
+
                /*
                 *      Don't allow priority zero, for future use.
                 */
@@ -374,7 +374,7 @@ int modcall(int component, modcallable *c, REQUEST *request)
                        int count = 1;
                        modcallable *p, *q;
                        modgroup *g = mod_callabletogroup(child);
-                       
+
                        stack.pointer++;
 
                        /*
@@ -398,7 +398,7 @@ int modcall(int component, modcallable *c, REQUEST *request)
                        case MOD_GROUP:
                                stack.children[stack.pointer] = g->children;
                                break;
-                               
+
                                /*
                                 *      See the "camel book" for why
                                 *      this works.
@@ -417,22 +417,22 @@ int modcall(int component, modcallable *c, REQUEST *request)
                                                count = 1;
                                                continue;
                                        }
-                                       
+
                                        count++;
-                                       
+
                                        if ((count * (lrad_rand() & 0xffff)) < (uint32_t) 0x10000) {
                                                q = p;
                                        }
                                }
                                stack.children[stack.pointer] = q;
                                break;
-                               
+
                        default:
                                exit(1); /* internal sanity check failure */
                                break;
                        }
-                       
-                       
+
+
                        stack.start[stack.pointer] = stack.children[stack.pointer];
 
                        DEBUG2("%.*s- entering %s %s",
@@ -468,7 +468,7 @@ int modcall(int component, modcallable *c, REQUEST *request)
                 *      to dealing with it's parent.
                 */
                sp = mod_callabletosingle(child);
-               
+
                myresult = call_modsingle(component, sp, request,
                                          default_component_results[component]);
                DEBUG2("%.*s[%s] returns %s",
@@ -509,7 +509,7 @@ int modcall(int component, modcallable *c, REQUEST *request)
                        stack.children[stack.pointer] = NULL;
                        goto do_return;
                }
-       
+
                /*
                 *      If "reject", break out of the loop and return
                 *      reject.
@@ -562,14 +562,14 @@ int modcall(int component, modcallable *c, REQUEST *request)
                                        stack.children[stack.pointer] = child->next;
                                } else {
                                        modgroup *g = mod_callabletogroup(parent);
-                                       
+
                                        stack.children[stack.pointer] = g->children;
                                }
                                if (stack.children[stack.pointer] == stack.start[stack.pointer]) {
                                        stack.children[stack.pointer] = NULL;
                                }
                                break;
-                       default:        
+                       default:
                                exit(1);
                }
 
@@ -1204,7 +1204,7 @@ static modcallable *do_compile_modsingle(modcallable *parent,
                                /*
                                 *      As it's sole configuration, the
                                 *      virtual module takes a section which
-                                *      contains the 
+                                *      contains the
                                 */
                                return do_compile_modsingle(parent,
                                                            component,
@@ -1447,7 +1447,7 @@ void add_to_modcallable(modcallable **parent, modcallable *this,
                        int component, const char *name)
 {
        modgroup *g;
-       
+
        rad_assert(this != NULL);
 
        if (*parent == NULL) {
index eff51d6..95a44de 100644 (file)
@@ -218,7 +218,7 @@ static module_entry_t *linkto_module(const char *module_name,
                radlog(L_ERR|L_CONS, "%s[%d] Invalid version in module '%s'",
                       cffilename, cflineno, module_name);
                return NULL;
-               
+
        }
 
        /* make room for the module type */
@@ -450,7 +450,7 @@ static int load_subcomponent_section(modcallable *parent,
        ml = compile_modgroup(parent, comp, cs, filename);
        if (!ml) {
                return 0;
-       }       
+       }
 
        /*
         *      We must assign a numeric index to this subcomponent.
@@ -933,7 +933,7 @@ int setup_modules(int reload)
                if (cf_item_find_next(cs, NULL) == NULL) {
                        continue; /* section is empty */
                }
-               
+
                DEBUG2(" Module: Instantiating section %s", section_type_value[comp].section);
 
                if (load_component_section(NULL, cs, comp, mainconfig.radiusd_conf) < 0) {
index 18b479e..fb8cd40 100644 (file)
@@ -421,7 +421,7 @@ static void print_hex(RADIUS_PACKET *packet)
                printf("%02x", packet->data[i]);
        }
        printf("\n");
-       
+
        if (packet->data_len > 20) {
                int total;
                const uint8_t *ptr;
@@ -565,7 +565,7 @@ static int send_one_packet(radclient_t *radclient)
                if (!lrad_packet_list_insert(pl, &radclient->request)) {
                        assert(0 == 1);
                }
-               
+
 
        } else {                /* radclient->request->id >= 0 */
                time_t now = time(NULL);
@@ -598,7 +598,7 @@ static int send_one_packet(radclient_t *radclient)
                 */
                if (radclient->tries == retries) {
                        assert(radclient->request->id >= 0);
-                       
+
                        /*
                         *      Delete the request from the tree of
                         *      outstanding requests.
@@ -607,7 +607,7 @@ static int send_one_packet(radclient_t *radclient)
 
                        fprintf(stderr, "radclient: no response from server for ID %d socket %d\n", radclient->request->id, radclient->request->sockfd);
                        deallocate_id(radclient);
-                       
+
                        /*
                         *      Normally we mark it "done" when we've received
                         *      the response, but this is a special case.
@@ -910,7 +910,7 @@ int main(int argc, char **argv)
                        if ((p - argv[1]) >= sizeof(buffer)) {
                                usage();
                        }
-                       
+
                        memcpy(buffer, argv[1] + 1, p - argv[1] - 1);
                        buffer[p - argv[1] - 1] = '\0';
 
@@ -1128,7 +1128,7 @@ int main(int argc, char **argv)
                                                tv.tv_sec = 0;
                                                tv.tv_usec = 1000000/persec;
                                        }
-                                       
+
                                        /*
                                         *      Sleep for milliseconds,
                                         *      portably.
index a25066b..20d64b0 100644 (file)
@@ -563,10 +563,10 @@ radius_snmp_init (void) {
                 *  Initialize the RADIUS SNMP data structure.
                 */
                memset(&rad_snmp, 0, sizeof(rad_snmp));
-               
+
                rad_snmp.auth.ident = radiusd_version;
                rad_snmp.acct.ident = radiusd_version;
-               
+
                rad_snmp.smux_event = SMUX_NONE;
                rad_snmp.smux_password = NULL;
                rad_snmp.snmp_write_access = FALSE;
index 283f95f..06b7888 100644 (file)
@@ -532,7 +532,7 @@ int main(int argc, char *argv[])
                        /* do nothing */
                }
 #endif
-               
+
                /*
                 *      Before doing anything else, check the self pipe.
                 */
@@ -543,16 +543,16 @@ int main(int argc, char *argv[])
                        for (i = 1; i < rcode; i++) {
                                buffer[0] |= buffer[i];
                        }
-                       
+
                        if ((buffer[0] & (RADIUS_SIGNAL_SELF_EXIT | RADIUS_SIGNAL_SELF_TERM)) != 0) {
                                DEBUG("Exiting...");
-                               
+
                                /*
                                 *      Ignore the TERM signal: we're
                                 *      about to die.
                                 */
                                signal(SIGTERM, SIG_IGN);
-                                       
+
                                /*
                                 *      Send a TERM signal to all
                                 *      associated processes
@@ -560,17 +560,17 @@ int main(int argc, char *argv[])
                                 *      ignored.)
                                 */
                                kill(-radius_pid, SIGTERM);
-                               
+
                                /*
                                 *      FIXME: Kill child threads, and
                                 *      clean up?
                                 */
-                               
+
                                /*
                                 *      FIXME: clean up any active REQUEST
                                 *      handles.
                                 */
-                               
+
                                /*
                                 *      We're exiting, so we can delete the PID
                                 *      file.  (If it doesn't exist, we can ignore
@@ -579,21 +579,21 @@ int main(int argc, char *argv[])
                                if (dont_fork == FALSE) {
                                        unlink(mainconfig.pid_file);
                                }
-                               
+
                                radius_event_free();
-                               
+
                                /*
                                 *      Free the configuration items.
                                 */
                                free_mainconfig();
-                               
+
                                /*
                                 *      Detach any modules.
                                 */
                                detach_modules();
-                               
+
                                free(radius_dir);
-                               
+
                                /*
                                 *      SIGTERM gets do_exit=0,
                                 *      and we want to exit cleanly.
@@ -691,7 +691,7 @@ int main(int argc, char *argv[])
                        if (!listener->recv(listener, &fun, &request)) {
                                continue;
                        }
-                       
+
                        /*
                         *      Drop the request into the thread pool,
                         *      and let the thread pool take care of
@@ -724,7 +724,7 @@ int main(int argc, char *argv[])
 
                /*
                 *      Only clean the thread pool if we're spawning
-                *      child threads. 
+                *      child threads.
                 *
                 *      FIXME: Move this to the event handler!
                 */
index 80b352a..3b8549d 100644 (file)
@@ -390,7 +390,7 @@ int main(int argc, char **argv)
                printf("Acct-Delay-Time = 0\n");
                exit(0);        /* don't bother printing anything else */
        }
-       
+
        /*
         *      Initialize mainconfig
         */
@@ -503,10 +503,10 @@ int main(int argc, char **argv)
                if (nas_ip_address != INADDR_NONE) {
                        if (rt.nas_address != nas_ip_address) continue;
                }
-               
+
                memcpy(session_id, rt.session_id, sizeof(rt.session_id));
                session_id[sizeof(rt.session_id)] = 0;
-               
+
                if (!rawoutput && rt.nas_port > (showname ? 999 : 99999)) {
                        portind = ">";
                        portno = (showname ? 999 : 99999);
@@ -555,7 +555,7 @@ int main(int argc, char **argv)
                                       hostname(buffer, sizeof(buffer),
                                                rt.framed_address));
                        }
-                       
+
                        /*
                         *      Some sanity checks on the time
                         */
@@ -569,7 +569,7 @@ int main(int argc, char **argv)
                                memcpy(nasname, rt.caller_id,
                                       sizeof(rt.caller_id));
                                nasname[sizeof(rt.caller_id)] = '\0';
-                               
+
                                librad_safeprint(nasname, -1, buffer,
                                                 sizeof(buffer));
                                printf("Calling-Station-Id = \"%s\"\n", buffer);
index a2dd7b8..4dd9f48 100644 (file)
@@ -186,7 +186,7 @@ static CONF_PARSER home_server_config[] = {
          offsetof(home_server,ping_user_name), NULL,  NULL},
        { "password",  PW_TYPE_STRING_PTR,
          offsetof(home_server,ping_user_password), NULL,  NULL},
-       
+
        { NULL, -1, 0, NULL, NULL }             /* end the list */
 
 };
@@ -215,7 +215,7 @@ static int home_server_add(const char *filename, CONF_SECTION *cs)
        memset(home, 0, sizeof(*home));
 
        home->name = name2;
-       
+
        memset(&hs_ip4addr, 0, sizeof(hs_ip4addr));
        memset(&hs_ip6addr, 0, sizeof(hs_ip6addr));
        cf_section_parse(cs, home, home_server_config);
@@ -334,8 +334,8 @@ static int home_server_add(const char *filename, CONF_SECTION *cs)
                        return 0;
                }
 
-               if ((home->type == HOME_TYPE_AUTH) && 
-                   !home->ping_user_password) {        
+               if ((home->type == HOME_TYPE_AUTH) &&
+                   !home->ping_user_password) {
                        radlog(L_INFO, "%s[%d]: You must supply a password to enable ping checks",
                               filename, cf_section_lineno(cs));
                        free(home);
@@ -446,7 +446,7 @@ static int server_pool_add(const char *filename, CONF_SECTION *cs)
                               filename, cf_pair_lineno(cp), value);
                        return 0;
                }
-                       
+
                if (!home_server_add(filename, server_cs)) {
                        return 0;
                }
@@ -549,7 +549,7 @@ static int server_pool_add(const char *filename, CONF_SECTION *cs)
        DEBUG2(" }");
 
        rad_assert(pool->server_type != 0);
-       
+
        return 1;
 
  error:
@@ -606,7 +606,7 @@ static int old_server_add(const char *filename, int lineno, const char *realm,
                        radlog(L_ERR, "%s[%d]: Inconsistent type for home server \"%s\"", filename, lineno, name);
                        return 0;
                }
-               
+
                /*
                 *      See if the home server is already listed
                 *      in the pool.  If so, do nothing else.
@@ -646,7 +646,7 @@ static int old_server_add(const char *filename, int lineno, const char *realm,
        /*
         *      No home server, allocate one.
         */
-       if (!home) {         
+       if (!home) {
                const char *p;
                char *q;
 
@@ -724,7 +724,7 @@ static int old_server_add(const char *filename, int lineno, const char *realm,
                        free(home);
                        return 0;
                }
-               
+
                if (!rbtree_insert(home_servers_byaddr, home)) {
                        rbtree_deletebydata(home_servers_byname, home);
                        radlog(L_ERR, "%s[%d]: Internal error adding home server %s.",
@@ -841,7 +841,7 @@ static int old_realm_config(const char *filename, CONF_SECTION *cs, REALM *r)
        if (secret) DEBUG2("\tsecret = %s", secret);
 
        return 1;
-       
+
 }
 
 
@@ -867,7 +867,7 @@ static int add_pool_to_realm(const char *filename, int lineno,
                if (!server_pool_add(filename, pool_cs)) {
                        return 0;
                }
-               
+
                pool = rbtree_finddata(home_pools_byname, &mypool);
                if (!pool) {
                        rad_assert("Internal sanity check failed");
@@ -967,7 +967,7 @@ int realm_add(const char *filename, CONF_SECTION *cs)
 
        if (auth_pool_name) DEBUG2("\tauth_pool = %s", auth_pool_name);
        if (acct_pool_name) DEBUG2("\tacct_pool = %s", acct_pool_name);
-       
+
        if ((cf_section_value_find(cs, "nostrip")) != NULL) {
                r->striprealm = 0;
                DEBUG2("\tnostrip", name2);
@@ -1193,7 +1193,7 @@ home_server *home_server_ldb(const char *realmname,
                pool = NULL;
                if (request->packet->code == PW_AUTHENTICATION_REQUEST) {
                        pool = rd->auth_pool;
-                       
+
                } else if (request->packet->code == PW_ACCOUNTING_REQUEST) {
                        pool = rd->acct_pool;
                }
index 01306e6..4d31078 100644 (file)
@@ -256,7 +256,7 @@ static void reap_children(void)
                mytf.pid = pid;
                tf = lrad_hash_table_finddata(thread_pool.waiters, &mytf);
                if (!tf) continue;
-               
+
                tf->status = status;
                tf->exited = 1;
        } while (lrad_hash_table_num_elements(thread_pool.waiters) > 0);
@@ -281,7 +281,7 @@ static int request_enqueue(REQUEST *request, RAD_REQUEST_FUNP fun)
 
        if (thread_pool.num_queued >= thread_pool.max_queue_size) {
                pthread_mutex_unlock(&thread_pool.queue_mutex);
-               
+
                /*
                 *      Mark the request as done.
                 */
@@ -732,8 +732,8 @@ int thread_pool_init(int spawn_flag)
                        radlog(L_ERR, "FATAL: Failed to initialize wait mutex: %s",
                               strerror(errno));
                        exit(1);
-               }               
-               
+               }
+
                /*
                 *      Create the hash table of child PID's
                 */
@@ -833,7 +833,7 @@ int thread_pool_addrequest(REQUEST *request, RAD_REQUEST_FUNP fun)
         */
        if (!thread_pool.spawn_flag) {
                radius_handle_request(request, fun);
-               
+
                /*
                 *      Requests that care about child process exit
                 *      codes have already either called
@@ -1057,7 +1057,7 @@ pid_t rad_fork(void)
 
                tf = rad_malloc(sizeof(*tf));
                memset(tf, 0, sizeof(*tf));
-               
+
                tf->pid = child_pid;
 
                pthread_mutex_lock(&thread_pool.wait_mutex);
@@ -1096,10 +1096,10 @@ pid_t rad_waitpid(pid_t pid, int *status)
        pthread_mutex_unlock(&thread_pool.wait_mutex);
 
        if (!tf) return -1;
-       
+
        for (i = 0; i < 100; i++) {
                reap_children();
-               
+
                if (tf->exited) {
                        *status = tf->status;
 
@@ -1110,7 +1110,7 @@ pid_t rad_waitpid(pid_t pid, int *status)
                }
                usleep(100000); /* sleep for 1/10 of a second */
        }
-       
+
        /*
         *      10 seconds have passed, give up on the child.
         */
index 721e847..17e4ca1 100644 (file)
@@ -483,7 +483,7 @@ int rad_copy_variable(char *to, const char *from)
                        if (from[1] == '{') {
                                *(to++) = *(from++);
                                length++;
-                               
+
                                sublen = rad_copy_variable(to, from);
                                if (sublen < 0) return sublen;
                                from += sublen;
index a233147..c632847 100644 (file)
@@ -85,7 +85,7 @@ int radius_compare_vps(REQUEST *request, VALUE_PAIR *check, VALUE_PAIR *vp)
                compare = regexec(&reg, value,  REQUEST_MAX_REGEX + 1,
                                  rxmatch, 0);
                regfree(&reg);
-               
+
                /*
                 *      Add %{0}, %{1}, etc.
                 */
@@ -105,21 +105,21 @@ int radius_compare_vps(REQUEST *request, VALUE_PAIR *check, VALUE_PAIR *vp)
                                        free(p);
                                        continue;
                                }
-                               
+
                                /*
                                 *      No previous match
                                 *      to delete, stop.
                                 */
                                break;
                        }
-                       
+
                        /*
                         *      Copy substring into buffer.
                         */
                        memcpy(buffer, value + rxmatch[i].rm_so,
                               rxmatch[i].rm_eo - rxmatch[i].rm_so);
                        buffer[rxmatch[i].rm_eo - rxmatch[i].rm_so] = '\0';
-                       
+
                        /*
                         *      Copy substring, and add it to
                         *      the request.
@@ -155,7 +155,7 @@ int radius_compare_vps(REQUEST *request, VALUE_PAIR *check, VALUE_PAIR *vp)
                compare = regexec(&reg, value,  REQUEST_MAX_REGEX + 1,
                                  rxmatch, 0);
                regfree(&reg);
-               
+
                if (compare != 0) return 0;
                return -1;
 
@@ -205,12 +205,12 @@ int radius_compare_vps(REQUEST *request, VALUE_PAIR *check, VALUE_PAIR *vp)
                        ret = memcmp(&vp->vp_ipv6addr, &check->vp_ipv6addr,
                                     sizeof(vp->vp_ipv6addr));
                        break;
-                       
+
                case PW_TYPE_IPV6PREFIX:
                        ret = memcmp(&vp->vp_ipv6prefix, &check->vp_ipv6prefix,
                                     sizeof(vp->vp_ipv6prefix));
                        break;
-               
+
                case PW_TYPE_IFID:
                        ret = memcmp(&vp->vp_ifid, &check->vp_ifid,
                                     sizeof(vp->vp_ifid));
index 3c101b1..f2528ed 100644 (file)
@@ -169,7 +169,7 @@ static int xlat_packet(void *instance, REQUEST *request,
                /*
                 *      %{Attribute-Name[*]} returns ALL of the
                 *      the attributes, separated by a newline.
-                */             
+                */
                if ((p[1] == '*') && (p[2] == ']')) {
                        int total = 0;
 
@@ -181,7 +181,7 @@ static int xlat_packet(void *instance, REQUEST *request,
                                total += count + 1;
                                outlen -= (count + 1);
                                out += count;
-                               
+
                                *(out++) = '\n';
 
                                if (outlen == 0) break;
@@ -189,7 +189,7 @@ static int xlat_packet(void *instance, REQUEST *request,
 
                        return total;
                }
-               
+
                count = atoi(p + 1);
 
                /*
@@ -238,7 +238,7 @@ static int xlat_packet(void *instance, REQUEST *request,
                        case PW_PACKET_TYPE:
                        {
                                DICT_VALUE *dval;
-                               
+
                                dval = dict_valbyattr(da->attr, packet->code);
                                if (dval) {
                                        snprintf(out, outlen, "%s", dval->name);
@@ -257,7 +257,7 @@ static int xlat_packet(void *instance, REQUEST *request,
                                localvp.attribute = da->attr;
                                localvp.vp_ipaddr = packet->src_ipaddr.ipaddr.ip4addr.s_addr;
                                break;
-                       
+
                        case PW_PACKET_DST_IP_ADDRESS:
                                if (packet->dst_ipaddr.af != AF_INET) {
                                        return 0;
@@ -265,12 +265,12 @@ static int xlat_packet(void *instance, REQUEST *request,
                                localvp.attribute = da->attr;
                                localvp.vp_ipaddr = packet->dst_ipaddr.ipaddr.ip4addr.s_addr;
                                break;
-                       
+
                        case PW_PACKET_SRC_PORT:
                                localvp.attribute = da->attr;
                                localvp.vp_integer = packet->src_port;
                                break;
-                       
+
                        case PW_PACKET_DST_PORT:
                                localvp.attribute = da->attr;
                                localvp.vp_integer = packet->dst_port;
@@ -293,7 +293,7 @@ static int xlat_packet(void *instance, REQUEST *request,
                                        strlcpy(out, "server_core", outlen);
                                }
                                return strlen(out);
-                       
+
                        case PW_PACKET_SRC_IPV6_ADDRESS:
                                if (packet->src_ipaddr.af != AF_INET6) {
                                        return 0;
@@ -303,7 +303,7 @@ static int xlat_packet(void *instance, REQUEST *request,
                                       &packet->src_ipaddr.ipaddr.ip6addr,
                                       sizeof(packet->src_ipaddr.ipaddr.ip6addr));
                                break;
-                       
+
                        case PW_PACKET_DST_IPV6_ADDRESS:
                                if (packet->dst_ipaddr.af != AF_INET6) {
                                        return 0;
@@ -313,14 +313,14 @@ static int xlat_packet(void *instance, REQUEST *request,
                                       &packet->dst_ipaddr.ipaddr.ip6addr,
                                       sizeof(packet->dst_ipaddr.ipaddr.ip6addr));
                                break;
-                       
+
                        case PW_SERVER_IDENTITY:
                                if (!request->listener || !request->listener->identity) return 0;
 
                                snprintf(out, outlen, "%s", request->listener->identity);
                                return strlen(out);
                                break;
-                       
+
                        default:
                                return 0; /* not found */
                                break;
@@ -361,7 +361,7 @@ static int xlat_regex(void *instance, REQUEST *request,
         */
        fmt = fmt;              /* -Wunused */
        func = func;            /* -Wunused FIXME: do escaping? */
-       
+
        regex = request_data_reference(request, request,
                                 REQUEST_DATA_REGEX | *(int *)instance);
        if (!regex) return 0;
@@ -617,7 +617,7 @@ static void decode_attribute(const char **from, char **to, int freespace,
                p += 2;
                xlat_string = xlat_name;
                goto do_xlat;
-               
+
        } else {      /* module name, followed by per-module string */
                int stop = 0;
                int delimitbrace = *open_p;
@@ -635,11 +635,11 @@ static void decode_attribute(const char **from, char **to, int freespace,
                        openbraces++;
                        p++;
                }
-               
+
                xlat_string = rad_malloc(strlen(p) + 1); /* always returns */
                free_xlat_string = TRUE;
                pa = xlat_string;
-               
+
                /*
                 *  Copy over the rest of the string, which is per-module
                 *  data.
@@ -682,7 +682,7 @@ static void decode_attribute(const char **from, char **to, int freespace,
                                        *pa++ = *p++;
                                }
                                break;
-                               
+
                        case ' ':
                        case '\t':
                                spaces = TRUE;
@@ -705,7 +705,7 @@ static void decode_attribute(const char **from, char **to, int freespace,
                                p += 2;
                        }
                }
-               
+
                /*
                 *      Look up almost everything in the new tree of xlat
                 *      functions.  This makes it a little quicker...
@@ -770,7 +770,7 @@ static void decode_attribute(const char **from, char **to, int freespace,
                        p++;    /* skip the character */
                }
        }
-       
+
        done:
        if (free_xlat_string) free(xlat_string);
 
index 7b182cd..fc92aaa 100644 (file)
@@ -1,7 +1,7 @@
 AC_PREREQ([2.53])
 AC_INIT(rlm_acctlog.c)
 AC_REVISION(0.1)
-AC_DEFUN(modname,[rlm_acctlog]) 
+AC_DEFUN(modname,[rlm_acctlog])
 
 if test x$with_[]modname != xno; then
 
@@ -13,10 +13,10 @@ if test x$with_[]modname != xno; then
                [ fail=$fail" stdio.h" ]
        )
 
-       targetname=modname     
+       targetname=modname
 else
-       targetname=            
-       echo \*\*\* module modname is disabled.  
+       targetname=
+       echo \*\*\* module modname is disabled.
 fi
 
 dnl  Don't change this section.
@@ -25,15 +25,15 @@ if test x"$fail" != x""; then
                AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
        else
                AC_MSG_WARN([silently not building ]modname[.])
-               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); 
+               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]);
                targetname=""
        fi
 fi
 
 
-AC_SUBST(acctlog_cflags)  
+AC_SUBST(acctlog_cflags)
 AC_SUBST(acctlog_ldflags)
 
 
-AC_SUBST(targetname) 
-AC_OUTPUT(Makefile) 
+AC_SUBST(targetname)
+AC_OUTPUT(Makefile)
index 59b8c26..cb84d6f 100644 (file)
@@ -48,10 +48,10 @@ static const CONF_PARSER module_config[] = {
 
 
 static int acctlog_detach(void *instance)
-{   
+{
     rlm_acctlog_t *inst = instance;
-       
-       
+
+
     free(inst);
     return 0;
 }
@@ -109,7 +109,7 @@ static int do_acctlog_acct(void *instance, REQUEST *request)
                case PW_STATUS_ACCOUNTING_OFF:
                        radius_xlat(logstr, sizeof(logstr), inst->acctoff, request, NULL);
                break;
-               
+
        }
 
        if (strlen(logstr))
index f68c4f7..c1189ed 100644 (file)
@@ -78,7 +78,7 @@ static int mypairappend(REQUEST *request, VALUE_PAIR *item, VALUE_PAIR **to)
 {
        VALUE_PAIR *tmp;
        tmp = radius_paircreate(request, to, item->attribute, item->type);
-       
+
        /*
         *      Copy EVERYTHING.
         */
@@ -269,7 +269,7 @@ static int attr_filter_common(void *instance, REQUEST *request,
                for (vp = *input; vp != NULL; vp = vp->next ) {
                        /* reset the pass,fail vars for each reply item */
                        pass = fail = 0;
-                       
+
                        /*
                         *      reset the check_item pointer to
                         *      beginning of the list
@@ -294,7 +294,7 @@ static int attr_filter_common(void *instance, REQUEST *request,
                                                   &pass, &fail);
                                }
                        }
-                       
+
                        /* only move attribute if it passed all rules */
                        if (fail == 0 && pass > 0) {
                                if (mypairappend(request, vp, output_tail) < 0) {
@@ -304,7 +304,7 @@ static int attr_filter_common(void *instance, REQUEST *request,
                                output_tail = &((*output_tail)->next);
                        }
                }
-               
+
                /* If we shouldn't fall through, break */
                if (!fall_through)
                        break;
index b65a9d5..09a80ef 100644 (file)
@@ -13,7 +13,7 @@ if test x$with_[]modname != xno; then
        if test "$ac_cv_header_regex_h" != "yes"; then
                AC_MSG_RESULT(no regex.h)
                [ fail=$fail" regex.h" ]
-       fi      
+       fi
 
        targetname=modname
 else
@@ -27,7 +27,7 @@ if test x"$fail" != x""; then
                AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
        else
                AC_MSG_WARN([silently not building ]modname[.])
-               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); 
+               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]);
                targetname=""
        fi
 fi
index c1797c1..eb55588 100644 (file)
@@ -282,7 +282,7 @@ do_again:
                        DEBUG2("rlm_attr_rewrite: regcomp() returned error: %s",err_msg);
                        return ret;
                }
-               
+
                if ((attr_vp->type == PW_TYPE_IPADDR) &&
                    (attr_vp->vp_strvalue[0] == '\0')) {
                        inet_ntop(AF_INET, &(attr_vp->vp_ipaddr),
index 3af9e98..2f446c4 100644 (file)
@@ -63,7 +63,7 @@ RCSID("$Id$")
 typedef struct rlm_caching_t {
        char *filename;         /* name of the database file */
        char *key;              /* An xlated string to use as key for the records */
-       char *post_auth;        /* If set and we find a cached entry, set Post-Auth to this value */    
+       char *post_auth;        /* If set and we find a cached entry, set Post-Auth to this value */
        char *cache_ttl_str;    /* The string represantation of the TTL */
        int cache_ttl;          /* The cache TTL */
        int hit_ratio;          /* Show cache hit ratio every so many queries */
@@ -259,7 +259,7 @@ static int caching_postauth(void *instance, REQUEST *request)
        VALUE_PAIR *auth_type;
        rlm_caching_data cache_data;
        int count = 0;
-       int ret = 0;    
+       int ret = 0;
        int size = 0;
        int rcode = 0;
 
@@ -403,7 +403,7 @@ static int caching_authorize(void *instance, REQUEST *request)
                }
                if (delete_cache){
                        DEBUG("rlm_caching: Deleting record");
-                       
+
                        pthread_mutex_lock(&data->mutex);
                        gdbm_delete(data->gdbm, key_datum);
                        pthread_mutex_unlock(&data->mutex);
@@ -426,7 +426,7 @@ static int caching_authorize(void *instance, REQUEST *request)
                else{
                        DEBUG("rlm_caching: No reply items found. Returning NOOP");
                        return RLM_MODULE_NOOP;
-               }               
+               }
                if (cache_data.auth_type){
                        DEBUG("rlm_caching: Adding Auth-Type '%s'",cache_data.auth_type);
 
index 37aea46..3363ff5 100644 (file)
@@ -20,7 +20,7 @@ if test x"$fail" != x""; then
                AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
        else
                AC_MSG_WARN([silently not building ]modname[.])
-               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); 
+               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]);
                targetname=""
        fi
 fi
index a81bff9..d513474 100644 (file)
@@ -24,7 +24,7 @@ if test x$with_[]modname != xno; then
        not found.  this version must use sync by default.
 #endif
                        ], [
-                       AC_DEFINE(NEED_GDBM_SYNC, yes, [do we need GDBM_SYNC]) 
+                       AC_DEFINE(NEED_GDBM_SYNC, yes, [do we need GDBM_SYNC])
                        AC_MSG_RESULT(needs it.)
                        ], [
                        AC_MSG_RESULT(SYNCs by default.)
@@ -52,7 +52,7 @@ if test x"$fail" != x""; then
                AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
        else
                AC_MSG_WARN([silently not building ]modname[.])
-               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); 
+               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]);
                targetname=""
        fi
 fi
index b50649c..b0f9ab8 100755 (executable)
@@ -68,7 +68,7 @@ if ($user ne '') {
             print $user, "\t\t", "Counter reset to ", $reset * $divisor, "\n";
         }
     }else{
-        print $user, "\t\t", "Not found\n"; 
+        print $user, "\t\t", "Not found\n";
     }
 
     undef $db;
index 39b0031..45c70f6 100644 (file)
@@ -401,7 +401,7 @@ static int counter_instantiate(CONF_SECTION *conf, void **instance)
                }
                data->reply_attr = dattr->attr;
        }
-       
+
 
        /*
         *  Create a new attribute for the counter.
index 08eb109..45f1f17 100644 (file)
@@ -84,7 +84,7 @@ else
 fi
 
 if test x"$fail" != x""; then
-       AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); 
+       AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]);
        if test x"${enable_strict_dependencies}" = x"yes"; then
                AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
        else
index 7c7cfd3..2bed25a 100644 (file)
@@ -77,7 +77,7 @@ int dumplist(VALUE_PAIR *vp)
        char buffer[1024];
        while (vp != NULL) {
                vp_prints(buffer, sizeof(buffer), vp);
-       
+
                printf("\t%s\n", buffer);
                vp = vp -> next;
        }
index 21911c4..f4eec15 100644 (file)
@@ -155,7 +155,7 @@ static int detail_instantiate(CONF_SECTION *conf, void **instance)
                        DICT_ATTR       *da;
 
                        if (!cf_item_is_pair(ci)) continue;
-                                               
+
                        attr = cf_pair_attr(cf_itemtopair(ci));
                        if (!attr) continue; /* pair-anoia */
 
@@ -382,12 +382,12 @@ static int do_detail(void *instance, REQUEST *request, RADIUS_PACKET *packet,
                        dst_vp.vp_ipaddr = packet->dst_ipaddr.ipaddr.ip4addr.s_addr;
                        break;
                case AF_INET6:
-                       src_vp.type = PW_TYPE_IPV6ADDR; 
+                       src_vp.type = PW_TYPE_IPV6ADDR;
                        src_vp.attribute = PW_PACKET_SRC_IPV6_ADDRESS;
                        memcpy(src_vp.vp_strvalue,
                               &packet->src_ipaddr.ipaddr.ip6addr,
                               sizeof(packet->src_ipaddr.ipaddr.ip6addr));
-                       dst_vp.type = PW_TYPE_IPV6ADDR; 
+                       dst_vp.type = PW_TYPE_IPV6ADDR;
                        dst_vp.attribute = PW_PACKET_DST_IPV6_ADDRESS;
                        memcpy(dst_vp.vp_strvalue,
                               &packet->dst_ipaddr.ipaddr.ip6addr,
index 7f948b0..794b7ab 100644 (file)
@@ -237,7 +237,7 @@ static int digest_authenticate(void *instance, REQUEST *request)
         *      Assume MD5 if no Digest-Algorithm attribute received
         */
        algo = pairfind(request->packet->vps, PW_DIGEST_ALGORITHM);
-       if ((algo == NULL) || 
+       if ((algo == NULL) ||
            (strcasecmp(algo->vp_strvalue, "MD5") == 0)) {
                /*
                 *      Set A1 to Digest-HA1 if no User-Password found
@@ -373,7 +373,7 @@ static int digest_authenticate(void *instance, REQUEST *request)
         *     Compute MD5 if Digest-Algorithm == "MD5-Sess",
         *     or if we found a User-Password.
         */
-       if (((algo != NULL) && 
+       if (((algo != NULL) &&
             (strcasecmp(algo->vp_strvalue, "MD5-Sess") == 0)) ||
            (passwd->attribute == PW_CLEARTEXT_PASSWORD)) {
                a1[a1_len] = '\0';
index 06a7cb2..eed6432 100644 (file)
@@ -26,9 +26,9 @@ if test x$with_[]modname != xno; then
        AC_CONFIG_SUBDIRS($eapsubdirs)
        rm install-sh
 
-       dnl # 
+       dnl #
        dnl # Don't bother looking for errors in the child directories
-       dnl # 
+       dnl #
 
        targetname=modname
 else
@@ -43,10 +43,10 @@ if test x"$fail" != x""; then
                AC_MSG_WARN([silently not building ]modname[.])
                AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.])
                if test x"$headersuggestion" != x; then
-                       AC_MSG_WARN([$headersuggestion]) 
+                       AC_MSG_WARN([$headersuggestion])
                fi
                if test x"$libsuggestion" != x; then
-                       AC_MSG_WARN([$libsuggestion]) 
+                       AC_MSG_WARN([$libsuggestion])
                fi
                targetname=""
            eapsubdirs=""
index ff26c8f..411f695 100644 (file)
@@ -677,13 +677,13 @@ int eap_start(rlm_eap_t *inst, REQUEST *request)
                        DEBUG2("  rlm_eap: Request is supposed to be proxied to Realm %s.  Not doing EAP.", proxy->vp_strvalue);
                        return EAP_NOOP;
                }
-               
+
                DEBUG2("  rlm_eap: Got EAP_START message");
                if ((eap_ds = eap_ds_alloc()) == NULL) {
                        DEBUG2("  rlm_eap: EAP Start failed in allocation");
                        return EAP_FAIL;
                }
-               
+
                /*
                 *      It's an EAP-Start packet.  Tell them to stop wasting
                 *      our time, and give us an EAP-Identity packet.
@@ -693,7 +693,7 @@ int eap_start(rlm_eap_t *inst, REQUEST *request)
                 */
                eap_ds->request->code = PW_EAP_REQUEST;
                eap_ds->request->type.type = PW_EAP_IDENTITY;
-               
+
                /*
                 *      We don't have a handler, but eap_compose needs one,
                 *      (for various reasons), so we fake it out here.
@@ -701,9 +701,9 @@ int eap_start(rlm_eap_t *inst, REQUEST *request)
                memset(&handler, 0, sizeof(handler));
                handler.request = request;
                handler.eap_ds = eap_ds;
-               
+
                eap_compose(&handler);
-               
+
                eap_ds_free(&eap_ds);
                return EAP_FOUND;
        } /* end of handling EAP-Start */
@@ -786,7 +786,7 @@ int eap_start(rlm_eap_t *inst, REQUEST *request)
                DEBUG2("  rlm_eap:  Ignoring Unknown EAP type");
                return EAP_NOOP;
        }
-               
+
        /*
         *      They're NAKing the EAP type we wanted to use, and
         *      asking for one which we don't support.
index 84503c5..3f577af 100644 (file)
@@ -38,17 +38,17 @@ RCSIDH(eap_sim_h, "$Id$")
 #define ATTRIBUTE_EAP_SIM_RAND1         1201
 #define ATTRIBUTE_EAP_SIM_RAND2         1202
 #define ATTRIBUTE_EAP_SIM_RAND3         1203
-                                       
+
 #define ATTRIBUTE_EAP_SIM_SRES1         1204
 #define ATTRIBUTE_EAP_SIM_SRES2         1205
 #define ATTRIBUTE_EAP_SIM_SRES3         1206
-                                       
+
 #define ATTRIBUTE_EAP_SIM_STATE         1207
 #define ATTRIBUTE_EAP_SIM_IMSI          1208
 #define ATTRIBUTE_EAP_SIM_HMAC          1209
 #define ATTRIBUTE_EAP_SIM_KEY           1210
 #define ATTRIBUTE_EAP_SIM_EXTRA         1211
-                                       
+
 #define ATTRIBUTE_EAP_SIM_KC1           1212
 #define ATTRIBUTE_EAP_SIM_KC2           1213
 #define ATTRIBUTE_EAP_SIM_KC3           1214
index 339ec4f..1a00043 100644 (file)
@@ -155,7 +155,7 @@ typedef struct _tls_session_t {
                                       unsigned int size);
        unsigned int    (*record_minus)(record_t *buf, void *ptr,
                                        unsigned int size);
-       
+
 
        /*
         * Framed-MTU attribute in RADIUS,
index 231aea9..ec528a2 100644 (file)
@@ -175,7 +175,7 @@ int eaplist_add(rlm_eap_t *inst, EAP_HANDLER *handler)
 {
        int             status;
        VALUE_PAIR      *state;
-       
+
        rad_assert(handler != NULL);
        rad_assert(handler->request != NULL);
 
@@ -301,7 +301,7 @@ EAP_HANDLER *eaplist_find(rlm_eap_t *inst, REQUEST *request,
                        node = rbtree_find(inst->session_tree, handler);
                        rad_assert(node != NULL);
                        rbtree_delete(inst->session_tree, node);
-                       
+
                        inst->session_head = handler->next;
                        if (handler->next) handler->next->prev = NULL;
                        eap_handler_free(handler);
@@ -374,6 +374,6 @@ EAP_HANDLER *eaplist_find(rlm_eap_t *inst, REQUEST *request,
        eap_ds_free(&(handler->prev_eapds));
        handler->prev_eapds = handler->eap_ds;
        handler->eap_ds = NULL;
-       
+
        return handler;
 }
index 912b98c..e2ee0f9 100644 (file)
@@ -346,7 +346,7 @@ static int eap_authenticate(void *instance, REQUEST *request)
                                pairadd(&(request->proxy->vps), vp);
                        }
                }
-                       
+
                /*
                 *      Delete the "proxied to" attribute, as it's
                 *      set to 127.0.0.1 for tunneled requests, and
index 511ed84..62838f9 100644 (file)
@@ -439,10 +439,10 @@ static int mschapv2_authenticate(void *arg, EAP_HANDLER *handler)
                 *      The MS-Length field is 5 + value_size + length
                 *      of name, which is put after the response.
                 */
-               if (((eap_ds->response->type.data[2] << 8) | 
+               if (((eap_ds->response->type.data[2] << 8) |
                     eap_ds->response->type.data[3]) < (5 + 49)) {
                        radlog(L_ERR, "rlm_eap_mschapv2: Response contains contradictory length %d %d",
-                             (eap_ds->response->type.data[2] << 8) | 
+                             (eap_ds->response->type.data[2] << 8) |
                               eap_ds->response->type.data[3], 5 + 49);
                        return 0;
                }
@@ -522,16 +522,16 @@ static int mschapv2_authenticate(void *arg, EAP_HANDLER *handler)
                char *username = NULL;
                eap_tunnel_data_t *tunnel;
                rlm_eap_mschapv2_t *inst = (rlm_eap_mschapv2_t *) arg;
-               
+
                /*
                 *      Set up the callbacks for the tunnel
                 */
                tunnel = rad_malloc(sizeof(*tunnel));
                memset(tunnel, 0, sizeof(*tunnel));
-               
+
                tunnel->tls_session = arg;
                tunnel->callback = mschap_postproxy;
-               
+
                /*
                 *      Associate the callback with the request.
                 */
index c5832ca..08e01d7 100644 (file)
@@ -55,7 +55,7 @@ static int eappeap_failure(EAP_HANDLER *handler, tls_session_t *tls_session)
         *      FIXME: Check the return code.
         */
        tls_handshake_send(tls_session);
-       
+
        return 1;
 }
 
@@ -269,7 +269,7 @@ static int process_reply(EAP_HANDLER *handler, tls_session_t *tls_session,
        if (debug_flag > 0) {
                printf("  PEAP: Processing from tunneled session code %p %d\n",
                       reply, reply->code);
-               
+
                for (vp = reply->vps; vp != NULL; vp = vp->next) {
                        putchar('\t');vp_print(stdout, vp);putchar('\n');
                }
@@ -346,7 +346,7 @@ static int process_reply(EAP_HANDLER *handler, tls_session_t *tls_session,
                         */
                        pairdelete(&reply->vps, PW_PROXY_STATE);
                        pairdelete(&reply->vps, PW_MESSAGE_AUTHENTICATOR);
-                       
+
                        t->accept_vps = reply->vps;
                        reply->vps = NULL;
                }
@@ -391,7 +391,7 @@ static int eappeap_postproxy(EAP_HANDLER *handler, void *data)
        fake = (REQUEST *) request_data_get(handler->request,
                                            handler->request->proxy,
                                            REQUEST_DATA_EAP_MSCHAP_TUNNEL_CALLBACK);
-       
+
        /*
         *      Do the callback, if it exists, and if it was a success.
         */
@@ -434,7 +434,7 @@ static int eappeap_postproxy(EAP_HANDLER *handler, void *data)
                if (debug_flag > 0) {
                        printf("  PEAP: Final reply from tunneled session code %d\n",
                               fake->reply->code);
-                       
+
                        for (vp = fake->reply->vps; vp != NULL; vp = vp->next) {
                                putchar('\t');vp_print(stdout, vp);putchar('\n');
                        }
@@ -459,12 +459,12 @@ static int eappeap_postproxy(EAP_HANDLER *handler, void *data)
                        eaptls_fail(handler->eap_ds, 0);
                        return 0;
                        break;
-                       
+
                 default:  /* Don't Do Anything */
                        DEBUG2(" PEAP: Got reply %d",
                               request->proxy_reply->code);
                        break;
-               }       
+               }
        }
        request_free(&fake);    /* robust if fake == NULL */
 
@@ -942,7 +942,7 @@ int eappeap_process(EAP_HANDLER *handler, tls_session_t *tls_session)
                                                         REQUEST_DATA_EAP_MSCHAP_TUNNEL_CALLBACK,
                                                         fake, my_request_free);
                                rad_assert(rcode == 0);
-                               
+
                                /*
                                 *      Do NOT free the fake request!
                                 */
index 5aab06a..9eeb822 100644 (file)
@@ -191,7 +191,7 @@ static int eappeap_authenticate(void *arg, EAP_HANDLER *handler)
 
                        (tls_session->record_plus)(&tls_session->clean_in,
                                                  &eap_packet, sizeof(eap_packet));
-                       
+
                        tls_handshake_send(tls_session);
                        (tls_session->record_init)(&tls_session->clean_in);
                }
index 93afbb5..36ab6a8 100644 (file)
@@ -1,7 +1,7 @@
 /**
  *@memo        Implementation of the modified counter mode
- *@doc          
- *@author      A. MAGNIEZ (FT R&D - DTL/SSR) 
+ *@doc
+ *@author      A. MAGNIEZ (FT R&D - DTL/SSR)
  *
  * Copyright 2006 The FreeRADIUS server project
  */
@@ -42,71 +42,71 @@ int SOBMMO::initialize(const byte* K, BlockCipher* E,const byte* inputBlock,int
   int i; // iterator
   char hexstr[1024];
   byte buf[16];
-  
+
   sizeBlock=E->blockSize();
   nbOutputBlocks=nb;
 
-  
+
   // allocate memory for the output blocks
   outputBlocks=(byte *)malloc(sizeBlock*nbOutputBlocks);
   if(outputBlocks==NULL){
     return 0;
   }
-  
+
   // debug traces
   pskConvertHex((char *)K, (char *)&hexstr, sizeBlock);
   DEBUG2("SOBMMO::initialize: K=");
   DEBUG2((char *)&hexstr);
-  
+
   pskConvertHex((char *)inputBlock, (char *)&hexstr, sizeBlock);
   DEBUG2("SOBMMO::initialize: inputBlock=");
   DEBUG2((char *)&hexstr);
-  
+
   pskConvertHex((char *)counterValues, (char *)&hexstr, sizeBlock*nbOutputBlocks);
   DEBUG2("SOBMMO::initialize: counterValues=");
   DEBUG2((char *)&hexstr);
-  
+
   E->makeKey(K,sizeBlock,DIR_ENCRYPT);
   E->encrypt(inputBlock,outputBlocks);
-  
+
   // duplicate the first result
   for(i=1;i<nbOutputBlocks;i++)
     {
       memcpy(outputBlocks+i*sizeBlock,outputBlocks,sizeBlock);
     }
-  
+
   pskConvertHex((char *)outputBlocks, (char *)&hexstr, nbOutputBlocks*sizeBlock);
   DEBUG2("SOBMMO::initialize: outputBlocks before XOR=");
   DEBUG2((char *)&hexstr);
-  
+
   // XOR counter values
   for(i=0;i<(nbOutputBlocks*sizeBlock);i++)
     {
       *(outputBlocks+i)=(*(outputBlocks+i))^(*(counterValues+i));
     }
-  
+
   pskConvertHex((char *)outputBlocks, (char *)&hexstr, nbOutputBlocks*sizeBlock);
   DEBUG2("SOBMMO::initialize: outputBlocks after XOR=");
   DEBUG2((char *)&hexstr);
-  
+
   // in order to check that AES(K,M) is valid
   E->encrypt(outputBlocks,buf);
   pskConvertHex((char *)buf, (char *)&hexstr, 16);
   DEBUG2("SOBMMO::initialize: buf=");
   DEBUG2((char *)&hexstr);
-  
+
   // produce each output block
   for(i=0;i<nbOutputBlocks;i++)
     {
       E->encrypt(outputBlocks+i*sizeBlock,outputBlocks+i*sizeBlock); // Be careful, pt=ct !!! TBTested
     }
-  
+
   pskConvertHex((char *)outputBlocks, (char *)&hexstr, nbOutputBlocks*sizeBlock);
   DEBUG2("SOBMMO::initialize: produced output blocks=");
   DEBUG2((char *)&hexstr);
-  
+
   return 1;
-  
+
 }
 
 
@@ -116,11 +116,11 @@ int SOBMMO::initialize(const byte* K, BlockCipher* E,const byte* inputBlock,int
  */
 byte* SOBMMO::getOutputBlock(int id){
   byte* output=NULL;
-  
+
   if(id<1 || id>nbOutputBlocks) {
     return NULL;
   }
-  
+
   output=(byte*)malloc(sizeBlock);
   if(output==NULL){
     return NULL;
index 46f9379..d02c8e1 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Implementation of the EAP-PSK packet management
  *
- * 
+ *
  * Copyright (C) France Télécom R&D (DR&D/MAPS/NSS)
  *
  * This program is free software; you can redistribute it and/or
@@ -17,7 +17,7 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -37,7 +37,7 @@ RCSID("$Id$")
 
 /*
  *
- *  PSK Packet Format in EAP 
+ *  PSK Packet Format in EAP
  *  --- ------ ------ -- ---
  * 0                   1                   2                   3
  * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
@@ -106,18 +106,18 @@ int pskHex2Bin(const char *hex, unsigned char *bin, int numbytes) {
 int pskGetRandomBytes(void *buf, int nbytes){
   FILE *fptr=NULL;
   int written=0;
-  
+
   if((fptr = fopen("/dev/urandom","r")) == NULL) {
     radlog(L_ERR,"pskGetRandomBytes: urandom device not accessible");
     return 0;
   }
-  
+
   if((written = fread(buf,1,nbytes,fptr)) != nbytes) {
     radlog(L_ERR,"pskGetRandomBytes: number not generated");
     return 0;
-  }     
-  
+  }
+
   fclose(fptr);
-  
+
   return 1;
 }
index 5f5a654..07b0cf7 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Implementation of the EAP-PSK packet management
  *
- * 
+ *
  * Copyright (C) France Télécom R&D (DR&D/MAPS/NSS)
  *
  * This program is free software; you can redistribute it and/or
@@ -17,7 +17,7 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -81,7 +81,7 @@ typedef struct eap_psk_conf {
   unsigned int   maxDelay;                // the maximum interval in seconds between two correct responses
 } PSK_CONF;
 
-  
+
 // data format of the first EAP-PSK message
 typedef struct psk_message_1 {
   unsigned char rand_s[PSK_RANDOM_NUMBER_SIZE];
@@ -114,7 +114,7 @@ typedef struct psk_message_4 {
 }psk_message_4;
 
 
-/** 
+/**
  *@memo                this function converts a string into hexa
  *@param    inbytes, pointer to a string
  *@param    outstr, pointer to the hexa conversion
@@ -134,14 +134,14 @@ int pskConvertHex(char *inbytes, char *outstr, int numbytes);
 int pskHex2Bin(const char *hex, unsigned char *bin, int numbytes);
 
 
-/** 
+/**
  *@memo                this function delivers random bytes
  *@param    buf, pointer to the buffer to fill
  *@param    nbytes, number of bytes to generate
  *@return   0 if an error has occured
  */
 int pskGetRandomBytes(void *buf, int nbytes);
-  
+
 
 #if defined(__cplusplus)
 }
index c06636e..02bd03c 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Implementation of the Server State Machine (SSM)
  *
- * 
+ *
  * Copyright (C) France Télécom R&D (DR&D/MAPS/NSS)
  *
  * This program is free software; you can redistribute it and/or
@@ -17,7 +17,7 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -55,14 +55,14 @@ RCSID("$Id$")
 #include "userinfo.h"
 
 
-/*  PSK Packet Format in EAP 
+/*  PSK Packet Format in EAP
  *  --- ------ ------ -- ---
  * 0                   1                   2                   3
  * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  * |     Code      |   Identifier  |            Length             |
  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |     Type      |   Data 
+ * |     Type      |   Data
  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-
  */
 
@@ -75,19 +75,19 @@ int pskProcess(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EAP
       radlog(L_ERR,"rlm_eap_psk: Cannot authenticate without EAP-PSK configuration and session information");
       return 0;
     }
-  
+
   if(recvPacket && (recvPacket->code!=PW_EAP_RESPONSE || recvPacket->type.type!=EAPPSK_TYPE))
     {
       radlog(L_ERR,"pskProcess: EAP-PSK Response expected");
       return 0;
-    }  
+    }
 
   switch(session->state)
     {
     case INIT: return pskInit(conf,session,sentPacket);
     case RANDSENT:
                if(recvPacket) return pskRandSent(conf,session, recvPacket,sentPacket);
-    case PCHANNEL: 
+    case PCHANNEL:
                if(recvPacket) return pskPChannel(conf,session,recvPacket,sentPacket);
     default:
       radlog(L_ERR,"pskProcess: Impossible to process the EAP-PSK authentication");
@@ -100,50 +100,50 @@ int pskProcess(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EAP
 int pskInit(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *sentPacket){
 
   char hexstr[1024];
-  
+
   session->nbRetry=0;
   session->pChannelReplayCounter=0;
   session->authStatus=PSK_STATUS_CONT;
   session->isSupportedExt=1;
   session->extType=0;
-  
+
   sentPacket->code=PW_EAP_REQUEST;
   sentPacket->length=PSK_RANDOM_NUMBER_SIZE+EAP_HEADER_SIZE;
   sentPacket->type.type=EAPPSK_TYPE;
   sentPacket->type.length=PSK_RANDOM_NUMBER_SIZE;
   sentPacket->type.data=NULL;
   sentPacket->type.data=(unsigned char*)malloc(PSK_RANDOM_NUMBER_SIZE);
-  
+
   if(sentPacket->type.data==NULL)
     {
       radlog(L_ERR,"pskInit: Out of memory");
       return 0;
     }
-  
+
   // generate a 128-bit random value and put this value in session->rand_s
   if(!pskGetRandomBytes(sentPacket->type.data,PSK_RANDOM_NUMBER_SIZE)) {
     radlog(L_ERR,"pskInit: problem during random number generation");
     return 0;
   }
-  
+
   pskConvertHex((char *)sentPacket->type.data, (char *)hexstr,PSK_RANDOM_NUMBER_SIZE);
   DEBUG2("pskInit: random number RA :");
   DEBUG2((char *)hexstr);
-  
+
   // save this value in session information
   memcpy(session->rand_s,sentPacket->type.data,PSK_RANDOM_NUMBER_SIZE);
-  
+
   session->state=RANDSENT;
+
   return 1;
-  
+
 }
 
 
 int pskRandSent(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EAP_PACKET *sentPacket){
-  
+
   /* the received packet is shown below
-   * 
+   *
    * 0                   1                   2                   3
    * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -179,15 +179,15 @@ int pskRandSent(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
   psk_message_3 *psk_msg_3;
   int identitySize;
   char hexstr[1024];
+
   unsigned char buffer[PSK_MAC_SIZE];
   unsigned char *data;
   unsigned char *ptr;
   unsigned char buftmp[PSK_AK_SIZE+PSK_KDK_SIZE];
-  
+
   //user profile
   userinfo_t*    uinfo = NULL;
-  
+
   char **psk_vals;
   char *psk_val;
   int i=0;
@@ -197,12 +197,12 @@ int pskRandSent(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
   // for the mac calculation
   OMAC om;
   AES c;
-  
+
   // for the key derivation
   SOBMMO sob;
   unsigned char *block;
   // counter values
-  unsigned char counterValues[]={      
+  unsigned char counterValues[]={
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,
@@ -212,7 +212,7 @@ int pskRandSent(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09};
-  
+
 
   // for the pchannel
   unsigned char nn[PSK_RANDOM_NUMBER_SIZE];
@@ -226,10 +226,10 @@ int pskRandSent(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
       // the packet is malformed
       DEBUG2("pskPChannel: the packet is malformed: the authentication must fail");
       sentPacket->code=PW_EAP_FAILURE;
-      
+
       return 1;
     }
-  
+
   // retrieve the identity of the peer, ID_P
   identitySize=recvPacket->length-(EAP_HEADER_SIZE+PSK_RANDOM_NUMBER_SIZE+PSK_MAC_SIZE);
   session->id_p=(unsigned char *)malloc(identitySize+1);
@@ -240,37 +240,37 @@ int pskRandSent(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
     }
   psk_msg_2=(psk_message_2*)recvPacket->type.data;
   memcpy(session->id_p,&(psk_msg_2->id_p),identitySize);
-  session->id_p[identitySize]='\0'; 
+  session->id_p[identitySize]='\0';
 
   // search the peer identity in the user file whose path is conf->usersFilePath
-  
+
   uinfo = pskGetUserInfo((char*)conf->usersFilePath, (char*)session->id_p);
   if (uinfo)
     {
-      
+
       DEBUG2("pskRandSent: identity successfully checked");
       DEBUG2("pskRandSent: saving peer information");
-      
-      // save keys                                                    
+
+      // save keys
       memcpy(session->ak,uinfo->AK,PSK_AK_SIZE);
       memcpy(session->kdk,uinfo->KDK,PSK_KDK_SIZE);
-      
+
       DEBUG2("pskRandSent: found user %s in %s",session->id_p, conf->usersFilePath);
-      
+
       free(uinfo);
-      
+
     } else {
-      
+
       // the peer identity wasn't found
       DEBUG2("pskRandSent: the peer identity isn't valid");
       DEBUG2("pskRandSent: the authentication must fail");
       sentPacket->code=PW_EAP_FAILURE;
-      
-      return 1;  
+
+      return 1;
     }
-  
+
   // calculate the following MAC: MAC(session->ak, ID_P || conf->id_s || session->rand_s || RAND_P)
-  
+
   // making the formula
   data=(unsigned char *)malloc(strlen((char*)session->id_p)+strlen((char*)conf->id_s)+2*PSK_RANDOM_NUMBER_SIZE);
   if(data==NULL) {
@@ -285,11 +285,11 @@ int pskRandSent(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
   memcpy(ptr,session->rand_s,PSK_RANDOM_NUMBER_SIZE);
   ptr+=PSK_RANDOM_NUMBER_SIZE;
   memcpy(ptr,psk_msg_2->rand_p,PSK_RANDOM_NUMBER_SIZE);
-  
+
   pskConvertHex((char *)data, (char *)hexstr,strlen((char*)session->id_p)+strlen((char*)conf->id_s)+2*PSK_RANDOM_NUMBER_SIZE);
   DEBUG2("pskRandSent: [B||A||RA||RB] :");
   DEBUG2((char *)hexstr);
-  
+
   pskConvertHex((char *)(session->ak), (char *)hexstr,PSK_AK_SIZE);
   DEBUG2("pskRandSent: AK :");
   DEBUG2((char *)hexstr);
@@ -302,11 +302,11 @@ int pskRandSent(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
   om.update(data,strlen((char*)session->id_p)+strlen((char*)conf->id_s)+2*PSK_RANDOM_NUMBER_SIZE);
   om.final(buffer);
   free(data);
-  
+
   pskConvertHex((char *)buffer, (char *)hexstr,PSK_MAC_SIZE);
   DEBUG2("pskRandSent: MAC of [B||A||RA||RB] :");
   DEBUG2((char *)hexstr);
-  
+
 
   if(memcmp(buffer,psk_msg_2->mac_p,PSK_MAC_SIZE))
     {
@@ -314,27 +314,27 @@ int pskRandSent(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
       DEBUG2("pskRandSent: the received MAC attribute isn't correct");
       DEBUG2("pskRandSent: the authentication must fail");
       sentPacket->code=PW_EAP_FAILURE;
-      
+
       return 1;
     }
 
-  
+
   DEBUG2("pskRandSent: the received MAC attribute is correct");
-  
+
   // KEY DERIVATION
-  
+
   // initialize the sobmmo
   sob.initialize(session->kdk,&c,psk_msg_2->rand_p,9,counterValues);
-  
+
   // get the TEK
   block=sob.getOutputBlock(1);
   memcpy(session->tek,block,PSK_TEK_SIZE);
   free(block);
-  
+
   pskConvertHex((char *)session->tek, (char *)hexstr, PSK_TEK_SIZE);
   DEBUG2("pskRandSent: TEK :");
   DEBUG2((char *)hexstr);
-  
+
   // get the MSK
   for(int i=0;i<4;i++)
     {
@@ -342,11 +342,11 @@ int pskRandSent(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
       memcpy(&session->msk[i*16],block,16);
       free(block);
     }
-                              
+
   pskConvertHex((char *)session->msk, (char *)hexstr, PSK_MSK_SIZE);
   DEBUG2("pskRandSent: MSK :");
   DEBUG2((char *)hexstr);
-  
+
   // get the EMSK
   for(int i=0;i<4;i++)
     {
@@ -354,12 +354,12 @@ int pskRandSent(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
       memcpy(&session->emsk[i*16],block,16);
       free(block);
     }
-  
+
   pskConvertHex((char *)session->emsk, (char *)hexstr, PSK_EMSK_SIZE);
   DEBUG2("pskRandSent: EMSK :");
   DEBUG2((char *)hexstr);
-                              
-                              
+
+
   // obtain the mac of [A||RB]
   data=(unsigned char *)malloc(strlen((char*)conf->id_s)+PSK_RANDOM_NUMBER_SIZE);
   if(data==NULL) {
@@ -368,33 +368,33 @@ int pskRandSent(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
   }
   memcpy(data,conf->id_s,strlen((char*)conf->id_s));
   memcpy(data+strlen((char*)conf->id_s),psk_msg_2->rand_p,PSK_RANDOM_NUMBER_SIZE);
-  
+
   pskConvertHex((char *)data, (char *)hexstr,strlen((char*)conf->id_s)+PSK_RANDOM_NUMBER_SIZE);
   DEBUG2("pskRandSent: [A||RB] :");
   DEBUG2((char *)hexstr);
-  
+
   c.makeKey(session->ak,PSK_AK_SIZE,DIR_ENCRYPT);
   om.init(&c);
   om.update(data,strlen((char*)conf->id_s)+PSK_RANDOM_NUMBER_SIZE);
   om.final(buffer);
   free(data);
-  
+
   pskConvertHex((char *)&buffer, (char *)hexstr,16);
   DEBUG2("pskRandSent: MAC of [A||RB] :");
   DEBUG2((char *)hexstr);
-  
+
 
   if(session->extType==0)
     {
       // standard authentication
-      
+
       sentPacket->code=PW_EAP_REQUEST;
       sentPacket->length=EAP_HEADER_SIZE+2*PSK_MAC_SIZE+PSK_PCHANNEL_REPLAY_COUNTER_SIZE+1;
       sentPacket->type.type=EAPPSK_TYPE;
       sentPacket->type.length=2*PSK_MAC_SIZE+PSK_PCHANNEL_REPLAY_COUNTER_SIZE+1;
       sentPacket->type.data=NULL;
       sentPacket->type.data=(unsigned char*)malloc(2*PSK_MAC_SIZE+PSK_PCHANNEL_REPLAY_COUNTER_SIZE+1);
-      
+
       if(sentPacket->type.data==NULL)
        {
          radlog(L_ERR,"pskRandSent: Out of memory");
@@ -406,11 +406,11 @@ int pskRandSent(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
       // add to sentPacket the following MAC: MAC(session->AK, conf->id_s || RAND_P)
       memcpy(psk_msg_3->mac_s,buffer,PSK_MAC_SIZE);
 
-      // add to sentPacket the following information: 
+      // add to sentPacket the following information:
       // R = DONE_SUCCESS (the R flag is equal to session->authStatus)
       // E=0
       psk_msg_3->nonce=htonl(session->pChannelReplayCounter);
-      
+
       // calculate the EAP header
       eapHeader[0]=sentPacket->code;
       eapHeader[1]=(recvPacket->id)+1; // we suppose that the identifier is incremented by 1
@@ -424,7 +424,7 @@ int pskRandSent(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
       pskConvertHex((char *)eapHeader, (char *)hexstr,EAP_HEADER_SIZE);
       DEBUG2("pskRandSent: eapHeader :");
       DEBUG2((char *)hexstr);
-      
+
       // the replay counter is the least significant bytes of the nonce !
       memset(nn,0,PSK_RANDOM_NUMBER_SIZE);
       memcpy(&nn[PSK_RANDOM_NUMBER_SIZE-PSK_PCHANNEL_REPLAY_COUNTER_SIZE],&(psk_msg_3->nonce),PSK_PCHANNEL_REPLAY_COUNTER_SIZE);
@@ -436,21 +436,21 @@ int pskRandSent(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
       session->authStatus=PSK_STATUS_DONE_SUCCESS;
 
       // EAX encryption
-      
+
       eax.initialize(session->tek, PSK_TEK_SIZE, AES_BLOCKSIZE, &c);
 
       eax.provideNonce((byte*)nn,PSK_RANDOM_NUMBER_SIZE);
       eax.provideHeader((byte*)eapHeader,EAP_HEADER_SIZE);
       eax.computeCiphertext((byte*)&(session->authStatus),sizeof(session->authStatus),(byte*)&(psk_msg_3->flags));
       eax.computeTag((byte*)psk_msg_3->tag);
-       
-      // !!! BE CAREFUL !!! 
+
+      // !!! BE CAREFUL !!!
       // the authorization isn't taken into account in this implementation
       // that's why R=DONE_SUCCESS
-      
+
     } else {
       // extended authentication
-      
+
 
       // !!!!! NOT IMPLEMENTED !!!!!!
       return 0;
@@ -471,24 +471,24 @@ int pskRandSent(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
          // the sentPacket must be a EAP_Failure packet
          return 1;
        }
-      
+
       // add to sentPacket the following information:
       // R = CONT or DONE_FAILURE or DONE_SUCCESS thanks to session->authStatus
       // E = 1
       // EXT_Type=session->extType
       // EXT_payload=payloadOut
-      
+
       */
-      
-    }   
+
+    }
 
   session->pChannelReplayCounter++;
 
   session->state=PCHANNEL;
-  
+
 
   return 1;
-  
+
 }
 
 
@@ -534,21 +534,21 @@ int pskPChannel(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
   AES c;
   bool st;
   unsigned char flags;
-  
+
   if(recvPacket->length<(EAP_HEADER_SIZE+PSK_PCHANNEL_REPLAY_COUNTER_SIZE+PSK_MAC_SIZE+1))
-    {  
+    {
       // the packet is malformed
       // the session->nbRetry isn't incremented
       // sentPacket must be the previous request sent by the server ###### PB TIMER ########
-      
+
       DEBUG2("pskPChannel: receiving a invalid EAP-PSK packet: the packet is malformed");
       DEBUG2("pskPChannel: the authentication must fail");
       sentPacket->code=PW_EAP_FAILURE;
-      
-      return 1;  
+
+      return 1;
     }
-  
-  
+
+
   psk_msg_4=(psk_message_4*)recvPacket->type.data;
 
 
@@ -561,48 +561,48 @@ int pskPChannel(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
       DEBUG2("pskPChannel: receiving a invalid EAP-PSK packet: the replay counter isn't valid");
       DEBUG2("pskPChannel: the authentication must fail");
       sentPacket->code=PW_EAP_FAILURE;
-      
-      return 1;  
+
+      return 1;
     }
-  
+
   // decrypt the received packet with the EAX mode and check the EAP header
 
    // calculate the EAP header
   eapHeader[0]=recvPacket->code;
   eapHeader[1]=recvPacket->id;
-  
+
   recvPacket->length=htons(recvPacket->length);
   memcpy(&(eapHeader[2]),&(recvPacket->length),2);
   recvPacket->length=ntohs(recvPacket->length);
-  
+
   eapHeader[4]=recvPacket->type.type;
-  
+
   // the replay counter is the least significant bytes of the nonce !
   memset(nn,0,PSK_RANDOM_NUMBER_SIZE);
   memcpy(&nn[PSK_RANDOM_NUMBER_SIZE-PSK_PCHANNEL_REPLAY_COUNTER_SIZE],&(psk_msg_4->nonce),PSK_PCHANNEL_REPLAY_COUNTER_SIZE);
 
   // EAX encryption
-  
+
   eax.initialize(session->tek, PSK_TEK_SIZE, AES_BLOCKSIZE, &c);
-    
+
   eax.provideNonce((byte*)nn,PSK_RANDOM_NUMBER_SIZE);
   eax.provideHeader((byte*)eapHeader,EAP_HEADER_SIZE);
   eax.provideCiphertext((byte*)&(psk_msg_4->flags),sizeof(psk_msg_4->flags));
   st=eax.checkTag((byte*)psk_msg_4->tag);
-  
+
   if(!st){
     // the decryption ends by a failure
-    
+
     DEBUG2("pskPChannel: receiving a invalid EAP-PSK packet: the decryption fails");
     DEBUG2("pskPChannel: the authentication must fail");
     sentPacket->code=PW_EAP_FAILURE;
-    
-    return 1;      
+
+    return 1;
   }
 
-  
+
   eax.computePlaintext((byte*)&(psk_msg_4->flags),sizeof(psk_msg_4->flags),(byte*)&flags);
-  
+
   if((((flags & PSK_IS_EXT)==PSK_IS_EXT) && recvPacket->length<(EAP_HEADER_SIZE+PSK_PCHANNEL_REPLAY_COUNTER_SIZE+PSK_MAC_SIZE+2)) || (((flags & PSK_IS_EXT)==0) && recvPacket->length!=(EAP_HEADER_SIZE+PSK_PCHANNEL_REPLAY_COUNTER_SIZE+PSK_MAC_SIZE+1)))
     {
       // the packet is malformed
@@ -611,20 +611,20 @@ int pskPChannel(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
 
       DEBUG2("pskPChannel: the packet is malformed: the authentication must fail");
       sentPacket->code=PW_EAP_FAILURE;
-      
+
       return 1;
      }
-  
+
 
    if(session->extType==0 && ((flags & PSK_IS_EXT)==PSK_IS_EXT))
      {
        // error: standard authentication awaited
        // the authentication must fail
        // the sentPacket must be a EAP_Failure packet
-       
+
        DEBUG2("pskPChannel: the packet is malformed: the authentication must fail");
        sentPacket->code=PW_EAP_FAILURE;
-       
+
        return 1;
      }
 
@@ -643,7 +643,7 @@ int pskPChannel(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
    if((flags & PSK_IS_EXT)==0)
      {
        // standard authentication
-       
+
        if(((flags & PSK_STATUS_DONE_SUCCESS)==PSK_STATUS_DONE_SUCCESS) && session->authStatus==PSK_STATUS_DONE_SUCCESS)
         {
           // sentPacket must be an EAP_Success packet
@@ -659,7 +659,7 @@ int pskPChannel(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
           sentPacket->code=PW_EAP_FAILURE;
 
         }
-       
+
      } else {
        // extended authentication
 
@@ -668,10 +668,10 @@ int pskPChannel(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
        return 0;
 
 
-       /*              
+       /*
        if(session->isSupportedExt)
         {
-          
+
           if(recvPacket->data.EXT_Payload)
             {
 
@@ -681,8 +681,8 @@ int pskPChannel(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
               int sizePayloadOut=0;
               int sizePayloadIn=recvPacket->length-27; // (27=5+16+4+1+1)
               int resul;
-              resul=pskExtension(conf,session,recvPacket->data.R,recvPacket->data.EXT_Payload,sizePayloadIn,&payloadOut,&sizePayloadOut); 
-              
+              resul=pskExtension(conf,session,recvPacket->data.R,recvPacket->data.EXT_Payload,sizePayloadIn,&payloadOut,&sizePayloadOut);
+
               if(!resul || (sizePayloadOut<1) || (sizePayloadOut>EXT_PAYLOAD_MAX_LEN))
                 {
                   //the extension has failed
@@ -690,20 +690,20 @@ int pskPChannel(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
                   // the sentPacket must be a EAP_Failure packet
                   return 1;
                 }
-              
+
               if(recvPacket->data.R != CONT) {
                 // sentPacket must be an EAP_Success packet or an EAP_Failure packet thanks to the server policy and the received R flag
                 // indicate to the lower layer that the MSK and the EMSK are ready in case an EAP_Success packet must be sent
                 // the EAP-PSK authentication will end after sending sentPacket
                 return 1;
               }
-              
+
               // add to sentPacket the following information:
               // R = CONT or DONE_FAILURE or DONE_SUCCESS thanks to session->authStatus
               // E = 1
               // EXT_Type=session->extType
               // EXT_payload=payloadOut
-              
+
             } else {
               // the peer doesn't support the specified extension
 
@@ -715,15 +715,15 @@ int pskPChannel(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
                 // the EAP-PSK authentication will end after sending sentPacket
                 return 1;
               }
-              
+
               // add to sentPacket the following information:
               // R = DONE_FAILURE or DONE_SUCCESS thanks to the server policy
               // E = 1
               // EXT_Type=session->extType
             }
-          
+
         } else {
-          
+
            if(recvPacket->data.R != CONT && recvPacket->data.EXT_Payload==NULL) {
              // sentPacket must be an EAP_Success packet or an EAP_Failure packet thanks to the server policy and the received R flag
              // indicate to the lower layer that the MSK and the EMSK are ready in case of an EAP_Success packet must be sent
@@ -736,33 +736,33 @@ int pskPChannel(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EA
              // the sentPacket must be a EAP_Failure packet
              return 1;
            }
-             
+
         }
        */
-       
+
        session->pChannelReplayCounter++;
        // use the EAX mode to encrypt the EXT_Payload and protect the EAP header
-       
+
        // !!!! NOT IMPLEMENTED !!!!
        // only standard authentication supported
 
        session->pChannelReplayCounter++;
-       
+
      }
-   
+
    // stay in this state
    return 1;
-   
-}                      
+
+}
 
 
 
 int pskExtension(PSK_CONF *conf, PSK_SESSION *session, unsigned short receivedStatus, void *dataIn, int sizeDataIn, void **dataOut, int *sizeDataOut){
-  
+
   // this functionality makes it possible to do authorization, account refilling...
 
   // this function must update the session->authStatus variable thanks to its policy, the received R flag, i.e. the receivedStatus variable, and the received data
-  
+
   // !!! Be careful !!!
   // dataOut mustn't be NULL
 
@@ -773,28 +773,28 @@ int pskExtension(PSK_CONF *conf, PSK_SESSION *session, unsigned short receivedSt
 
 
 
-/** 
+/**
  *@memo                this function frees the session data
  *@param        opaque, pointer to a structure which contains information session
  */
 void pskFreeSession(void *opaque){
   PSK_SESSION *session;
-  
+
   DEBUG2("pskFreeSession:");
-  
+
   if(!opaque) return;
-  
+
   session=(PSK_SESSION *)opaque;
   if(!session) return;
-  
+
   if(session->id_p) {
     free(session->id_p);
   }
 
   free(session);
-  
+
   opaque=NULL;
-  
+
   DEBUG2("pskFreeSession: finished");
 
 }
index efe1c53..de886a4 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Implementation of the Server State Machine (SSM)
  *
- * 
+ *
  * Copyright (C) France Télécom R&D (DR&D/MAPS/NSS)
  *
  * This program is free software; you can redistribute it and/or
@@ -17,7 +17,7 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -45,7 +45,7 @@ extern "C"
 typedef enum {
   INIT,       // the server state machine starts in the INIT state
   RANDSENT,
-  PCHANNEL             
+  PCHANNEL
 }PSK_STATE;
 
 
@@ -67,7 +67,7 @@ typedef struct psk_session_t {
 }PSK_SESSION;
 
 
-/** 
+/**
  *@memo                this function is the entry point of the server state machine
  *@param        conf, pointer to the current configuration of EAP-PSK
  *@param        session, pointer to a structure which contains information session
@@ -78,7 +78,7 @@ typedef struct psk_session_t {
   int pskProcess(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EAP_PACKET *sentPacket);
 
 
-/** 
+/**
  *@memo                this function corresponds to the first state of the server state machine
  *@param        conf, pointer to the current configuration of EAP-PSK
  *@param        session, pointer to a structure which contains information session
@@ -88,7 +88,7 @@ typedef struct psk_session_t {
   int pskInit(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *sentPacket);
 
 
-/** 
+/**
  *@memo                this function corresponds to the second state of the server state machine
  *@param        conf, pointer to the current configuration of EAP-PSK
  *@param        session, pointer to a structure which contains information session
@@ -99,7 +99,7 @@ typedef struct psk_session_t {
   int pskRandSent(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EAP_PACKET *sentPacket);
 
 
-/** 
+/**
  *@memo                this function corresponds to the third state of the server state machine
  *@param        conf, pointer to the current configuration of EAP-PSK
  *@param        session, pointer to a structure which contains information session
@@ -107,10 +107,10 @@ typedef struct psk_session_t {
  *@param        sentPacket, pointer to the EAP_PACKET to send
  *@return       0 if no error has occured
  */
-  int pskPChannel(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EAP_PACKET *sentPacket);                       
+  int pskPChannel(PSK_CONF *conf, PSK_SESSION *session, EAP_PACKET *recvPacket, EAP_PACKET *sentPacket);
 
 
-/** 
+/**
  *@memo                this function contains the extension to EAP-PSK
  *@param        conf, pointer to the current configuration of EAP-PSK
  *@param        session, pointer to a structure which contains information session
@@ -124,12 +124,12 @@ typedef struct psk_session_t {
   int pskExtension(PSK_CONF *conf, PSK_SESSION *session, unsigned short receivedStatus, void *dataIn, int sizeDataIn, void **dataOut, int *sizeDataOut);
 
 
-/** 
+/**
  *@memo                this function frees an existing session from memory
  *@param        opaque, pointer to a structure which contains information session
  */
   void pskFreeSession(void *opaque);
-  
+
 
 
 #if defined(__cplusplus)
index a6678fd..72d054a 100644 (file)
@@ -3,10 +3,10 @@
 /*
  * rlm_eap_psk.cpp
  *
- * Implementation of the interface between the radius server and 
+ * Implementation of the interface between the radius server and
  * the eap-psk protocol
  *
- * 
+ *
  * Copyright (C) France Télécom R&D (DR&D/MAPS/NSS)
  *
  * This program is free software; you can redistribute it and/or
@@ -18,7 +18,7 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -60,17 +60,17 @@ static CONF_PARSER moduleConfig[] = {
 };
 
 
-/** 
+/**
  *@memo                this function add value pair to reply
  */
-static void addReply(VALUE_PAIR** vp, 
+static void addReply(VALUE_PAIR** vp,
                      const char* name, unsigned char* value, int len)
 {
        VALUE_PAIR *reply_attr;
        reply_attr = pairmake(name, "", T_OP_EQ);
        if (!reply_attr) {
                DEBUG("rlm_eap_psk: "
-                     "add_reply failed to create attribute %s: %s\n", 
+                     "add_reply failed to create attribute %s: %s\n",
                      name, librad_errstr);
                return;
        }
@@ -118,14 +118,14 @@ static int pskAttach(CONF_SECTION *cs, void **instance)
          pskDetach(inst);
          return -1;
        }
-       
+
        *instance = inst;
        return 0;
 }
 
 
 
-/** 
+/**
  *@memo                this function begins the conversation when the EAP-Identity response is received
  *              send an initial eap-psk request, ie IDREQ
  *@param        handler, pointer to specific information about the eap-psk protocol
@@ -161,18 +161,18 @@ static int pskInitiate(void *type_arg, EAP_HANDLER *handler)
   // initializing session information
   memset(session,0,sizeof(PSK_SESSION));
   session->state=INIT;
-   
+
   handler->stage=AUTHENTICATE;
 
   // initiate the eap-psk protocol
   return pskProcess(conf,session,NULL,handler->eap_ds->request);
-  
+
 }
 
 
 
 
-/** 
+/**
  *@memo                this function uses specific EAP-Type authentication mechanism to authenticate the user
  *              may be called many times
  *@param        handler, pointer to specific information about the eap-psk protocol
@@ -182,31 +182,31 @@ static int pskAuthenticate(void *arg, EAP_HANDLER *handler)
   PSK_SESSION *session;
   PSK_CONF *conf=(PSK_CONF*)arg;
   int resul;
-  
+
   if(conf==NULL)
     {
       radlog(L_ERR,"rlm_eap_psk: Cannot authenticate without having EAP-PSK configuration");
       return 0;
     }
-  
+
   if(!handler->opaque) {
     radlog(L_ERR,"rlm_eap_psk: Cannot authenticate without EAP-PSK session information");
     return 0;
   }
-  
+
   // find the session information
   session=(PSK_SESSION *)handler->opaque;
 
   resul=pskProcess(conf,session,handler->eap_ds->response,handler->eap_ds->request);
-  
+
   if(handler->eap_ds->request->code==PW_EAP_SUCCESS) {
     // sending keys
     addReply(&handler->request->reply->vps,"MS-MPPE-Recv-Key",session->msk,32);
     addReply(&handler->request->reply->vps,"MS-MPPE-Send-Key",&session->msk[32],32);
   }
-  
+
   return resul;
-  
+
 }
 
 
index 6b39f1a..1f8d99a 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Implementation of the user management
  *
- * 
+ *
  * Copyright (C) France Télécom R&D (DR&D/MAPS/NSS)
  *
  * This program is free software; you can redistribute it and/or
@@ -18,7 +18,7 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -45,7 +45,7 @@ RCSID("$Id$")
 userinfo_t*   pskGetUserInfo(char* path, char* peerID)
 {
     FILE*       fp;
-    char        buff[1024]; //FIXME: give the buffer a proper size 
+    char        buff[1024]; //FIXME: give the buffer a proper size
                             //when we know more about ID length
     userinfo_t* uinfo = NULL;
     int         found = 0;
@@ -59,8 +59,8 @@ userinfo_t*   pskGetUserInfo(char* path, char* peerID)
            radlog(L_ERR, "pskGetUserInfo: failed to open PSK users file");
            return NULL;
        }
-    
-    while (!found && fgets(buff, sizeof(buff), fp)) 
+
+    while (!found && fgets(buff, sizeof(buff), fp))
        {
          unsigned int     i = 0;
 
@@ -71,18 +71,18 @@ userinfo_t*   pskGetUserInfo(char* path, char* peerID)
            // read this login name
            while (! isspace(buff[i]))
                i++;
-           
+
            // is it the one we looking for?
-           if ((i != strlen(peerID)) 
+           if ((i != strlen(peerID))
                || (strncmp(peerID, buff, i) != 0))
                continue;
            else
                found = 1;
-           
-           // skip spaces 
+
+           // skip spaces
            while (isspace(buff[i]))
                i++;
-           
+
            // prepare to store user info
            uinfo = (userinfo_t*) malloc(sizeof(userinfo_t));
            if (uinfo == NULL)
@@ -91,7 +91,7 @@ userinfo_t*   pskGetUserInfo(char* path, char* peerID)
                    return NULL;
                }
 
-           //get AK  
+           //get AK
            AK = strndup(buff + i, PSK_AK_STRLEN);
             if (AK == NULL) {
                 radlog(L_ERR, "pskGetUserInfo: out of memory");
@@ -114,7 +114,7 @@ userinfo_t*   pskGetUserInfo(char* path, char* peerID)
                        free(AK);
                        return NULL;
                }
-                  
+
            //get KDK
            KDK = strndup(buff + i + PSK_AK_STRLEN, PSK_KDK_STRLEN);
            if (KDK == NULL) {
@@ -125,10 +125,10 @@ userinfo_t*   pskGetUserInfo(char* path, char* peerID)
            }
            //FIXME: shouldnt we check the key size?
            /*
-             else if (strlen(KDK) != 32) { 
+             else if (strlen(KDK) != 32) {
              log();
              return NULL;
-             }             
+             }
            */
            res=pskHex2Bin(KDK, &(uinfo->KDK),PSK_KDK_SIZE);
 
@@ -140,12 +140,12 @@ userinfo_t*   pskGetUserInfo(char* path, char* peerID)
                        free(KDK);
                        return NULL;
                }
-          
+
            free(AK);
            free(KDK);
        }
-   
-    
+
+
     // if user was not found, NULL is returned
     fclose(fp);
     return uinfo;
index 7eb5b37..7e9c1ad 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Implementation of the user management
  *
- * 
+ *
  * Copyright (C) France Télécom R&D (DR&D/MAPS/NSS)
  *
  * This program is free software; you can redistribute it and/or
@@ -18,7 +18,7 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
index e5e5c8b..abe2218 100644 (file)
@@ -1,5 +1,5 @@
 # usernames and keys are supposed to be on the same line, separated by
-# white spaces or tabs 
+# white spaces or tabs
 # reading stops after EOF or white line
 #
 
index e59f245..8df0f46 100644 (file)
@@ -240,7 +240,7 @@ static int cbtls_verify(int ok, X509_STORE_CTX *ctx)
                 *      against the specified value and fail
                 *      verification if they don't match.
                 */
-               if (conf->check_cert_issuer && 
+               if (conf->check_cert_issuer &&
                    (strcmp(issuer, conf->check_cert_issuer) != 0)) {
                        radlog(L_AUTH, "rlm_eap_tls: Certificate issuer (%s) does not match specified value (%s)!", issuer, conf->check_cert_issuer);
                        my_ok = 0;
@@ -385,7 +385,7 @@ static SSL_CTX *init_tls_ctx(EAP_TLS_CONF *conf)
         */
        ctx_options |= SSL_OP_SINGLE_DH_USE;
 
-       /*       
+       /*
         *      SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS to work around issues
         *      in Windows Vista client.
         *      http://www.openssl.org/~bodo/tls-cbc.txt
@@ -529,7 +529,7 @@ static int eaptls_attach(CONF_SECTION *cs, void **instance)
         */
        if (conf->make_cert_command && (debug_flag >= 2)) {
                struct stat buf;
-               
+
                if ((stat(conf->make_cert_command, &buf) == 0) &&
                    (stat(conf->certificate_file, &buf) < 0) &&
                    (errno == ENOENT) &&
index 889b113..1e2889d 100644 (file)
@@ -128,7 +128,7 @@ static int diameter_verify(const uint8_t *data, unsigned int data_len)
                        DEBUG2("  rlm_eap_ttls: Tunneled attribute %d is too long (%d) to pack into a RADIUS attribute.", attr, length);
                        return 0;
                }
-                   
+
                if (length > data_left) {
                        DEBUG2("  rlm_eap_ttls: Tunneled attribute %d is longer than room left in the packet (%d > %d).", attr, length, data_left);
                        return 0;
@@ -159,7 +159,7 @@ static int diameter_verify(const uint8_t *data, unsigned int data_len)
                        DEBUG2("  rlm_eap_ttls: ERROR! Diameter attribute overflows packet!");
                        return 0;
                }
-       
+
                /*
                 *      Check again for equality, now that we're padded
                 *      length to a multiple of 4 octets.
@@ -268,13 +268,13 @@ static VALUE_PAIR *diameter2vp(SSL *ssl,
                                return NULL;
                        }
                        memcpy(&vp->vp_integer, data, vp->length);
-                       
+
                        /*
                         *      Stored in host byte order: change it.
                         */
                        vp->vp_integer = ntohl(vp->vp_integer);
                        break;
-                       
+
                case PW_TYPE_IPADDR:
                        if (size != vp->length) {
                                DEBUG2("  rlm_eap_ttls: Invalid length attribute %d",
@@ -284,7 +284,7 @@ static VALUE_PAIR *diameter2vp(SSL *ssl,
                                return NULL;
                        }
                  memcpy(&vp->vp_ipaddr, data, vp->length);
-                 
+
                  /*
                   *    Stored in network byte order: don't change it.
                   */
@@ -617,7 +617,7 @@ static int process_reply(EAP_HANDLER *handler, tls_session_t *tls_session,
                        DEBUG2("  TTLS: Got MS-CHAP2-Success, tunneling it to the client in a challenge.");
                        rcode = RLM_MODULE_HANDLED;
                        t->authenticated = TRUE;
-                       
+
                        /*
                         *      Delete MPPE keys & encryption policy.  We don't
                         *      want these here.
@@ -626,7 +626,7 @@ static int process_reply(EAP_HANDLER *handler, tls_session_t *tls_session,
                        pairdelete(&reply->vps, ((311 << 16) | 8));
                        pairdelete(&reply->vps, ((311 << 16) | 16));
                        pairdelete(&reply->vps, ((311 << 16) | 17));
-                       
+
                        /*
                         *      Use the tunneled reply, but not now.
                         */
@@ -754,7 +754,7 @@ static int eapttls_postproxy(EAP_HANDLER *handler, void *data)
        fake = (REQUEST *) request_data_get(handler->request,
                                            handler->request->proxy,
                                            REQUEST_DATA_EAP_MSCHAP_TUNNEL_CALLBACK);
-       
+
        /*
         *      Do the callback, if it exists, and if it was a success.
         */
@@ -785,7 +785,7 @@ static int eapttls_postproxy(EAP_HANDLER *handler, void *data)
                if (debug_flag > 0) {
                        printf("  TTLS: Final reply from tunneled session code %d\n",
                               fake->reply->code);
-                       
+
                        for (vp = fake->reply->vps; vp != NULL; vp = vp->next) {
                                putchar('\t');vp_print(stdout, vp);putchar('\n');
                        }
@@ -810,12 +810,12 @@ static int eapttls_postproxy(EAP_HANDLER *handler, void *data)
                        eaptls_fail(handler->eap_ds, 0);
                        return 0;
                        break;
-                       
+
                 default:  /* Don't Do Anything */
                        DEBUG2(" TTLS: Got reply %d",
                               request->proxy_reply->code);
                        break;
-               }       
+               }
        }
        request_free(&fake);    /* robust if fake == NULL */
 
@@ -991,7 +991,7 @@ int eapttls_process(EAP_HANDLER *handler, tls_session_t *tls_session)
 #ifndef NDEBUG
        if (debug_flag > 0) {
                printf("  TTLS: Got tunneled request\n");
-               
+
                for (vp = fake->packet->vps; vp != NULL; vp = vp->next) {
                        putchar('\t');vp_print(stdout, vp);putchar('\n');
                }
@@ -1218,7 +1218,7 @@ int eapttls_process(EAP_HANDLER *handler, tls_session_t *tls_session)
                                                 REQUEST_DATA_EAP_TUNNEL_CALLBACK,
                                                 tunnel, free);
                        rad_assert(rcode == 0);
-                       
+
                        /*
                         *      rlm_eap.c has taken care of associating
                         *      the handler with the fake request.
@@ -1257,15 +1257,15 @@ int eapttls_process(EAP_HANDLER *handler, tls_session_t *tls_session)
                case RLM_MODULE_REJECT:
                        rcode = PW_AUTHENTICATION_REJECT;
                        break;
-                       
+
                case RLM_MODULE_HANDLED:
                        rcode = PW_ACCESS_CHALLENGE;
                        break;
-                       
+
                case RLM_MODULE_OK:
                        rcode = PW_AUTHENTICATION_ACK;
                        break;
-                       
+
                default:
                        rcode = PW_AUTHENTICATION_REJECT;
                        break;
index 4765543..cb2017c 100644 (file)
@@ -8,7 +8,7 @@ if test x$with_[]modname != xno; then
        AC_PROG_CC
        AC_PROG_CPP
 
-       dnl put configuration checks here.  
+       dnl put configuration checks here.
        dnl set $fail to what's missing, on fatal errors.
        dnl use AC_MSG_WARN() on important messages.
        AC_CHECK_LIB(c, printf,
@@ -36,7 +36,7 @@ if test x"$fail" != x""; then
                AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
        else
                AC_MSG_WARN([silently not building ]modname[.])
-               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); 
+               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]);
                targetname=""
        fi
 fi
index 0d6e9fd..adfecde 100644 (file)
@@ -383,7 +383,7 @@ static int exec_postauth(void *instance, REQUEST *request)
                 */
                tmp = pairmake("Reply-Message", "Access denied (external check failed)", T_OP_SET);
                pairadd(&request->reply->vps, tmp);
-               
+
                DEBUG2("Login incorrect (external check failed)");
 
                request->reply->code = PW_AUTHENTICATION_REJECT;
index 8bedc53..0464e18 100644 (file)
@@ -55,9 +55,9 @@ static const CONF_PARSER module_config[] = {
   { NULL, -1, 0, NULL, NULL }
 };
 
-/*              
+/*
  *      Check if account has expired, and if user may login now.
- */              
+ */
 static int expiration_authorize(void *instance, REQUEST *request)
 {
        rlm_expiration_t *data = (rlm_expiration_t *)instance;
@@ -130,7 +130,7 @@ static int expirecmp(void *instance, REQUEST *req,
        reply_pairs = reply_pairs;
 
        now = (req) ? req->timestamp : time(NULL);
-  
+
        if (now <= ((time_t) check->vp_date))
                return 0;
        return +1;
index 06fd20a..60ff75d 100644 (file)
@@ -212,9 +212,9 @@ static int genericcmp(void *instance UNUSED,
                char name[1024];
                char value[1024];
                VALUE_PAIR *vp;
-               
+
                snprintf(name, sizeof(name), "%%{%s}", check->name);
-               
+
                rcode = radius_xlat(value, sizeof(value), name, req, NULL);
                vp = pairmake(check->name, value, T_OP_EQ);
 
index a0c9df2..d12922f 100644 (file)
@@ -24,7 +24,7 @@ if test x$with_[]modname != xno; then
        not found.  this version must use sync by default.
 #endif
                        ], [
-                       AC_DEFINE(NEED_GDBM_SYNC, yes, [do we need GDBM_SYNC]) 
+                       AC_DEFINE(NEED_GDBM_SYNC, yes, [do we need GDBM_SYNC])
                        AC_MSG_RESULT(needs it.)
                        ], [
                        AC_MSG_RESULT(SYNCs by default.)
@@ -52,7 +52,7 @@ if test x"$fail" != x""; then
                AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
        else
                AC_MSG_WARN([silently not building ]modname[.])
-               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); 
+               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]);
                targetname=""
        fi
 fi
index 02efff3..a7a4baa 100644 (file)
@@ -621,7 +621,7 @@ static int ippool_postauth(void *instance, REQUEST *request)
                                 * Find an entry with active == 0
                                 * or an entry that has expired
                                 */
-                               if (entry.active == 0 || (entry.timestamp && ((entry.timeout && 
+                               if (entry.active == 0 || (entry.timestamp && ((entry.timeout &&
                                request->timestamp >= (entry.timestamp + entry.timeout)) ||
                                (data->max_timeout && request->timestamp >= (entry.timestamp + data->max_timeout))))){
                                        datum tmp;
@@ -730,7 +730,7 @@ static int ippool_postauth(void *instance, REQUEST *request)
                free(key_datum.dptr);
                entry.active = 1;
                entry.timestamp = request->timestamp;
-               if ((vp = pairfind(request->reply->vps, PW_SESSION_TIMEOUT)) != NULL)   
+               if ((vp = pairfind(request->reply->vps, PW_SESSION_TIMEOUT)) != NULL)
                        entry.timeout = (time_t) vp->vp_integer;
                else
                        entry.timeout = 0;
index 0b1497c..917d609 100755 (executable)
@@ -162,7 +162,7 @@ void addip(char *sessiondbname,char *indexdbname,char *ipaddress, char* NASname,
                key_datum.dptr = (char *) &key;
                key_datum.dsize = sizeof(ippool_key);
        }
-               
+
 
        data_datum = gdbm_fetch(sessiondb, key_datum);
        if (data_datum.dptr != NULL){
index 3206a85..bc9f21e 100644 (file)
@@ -71,7 +71,7 @@ if test x$with_[]modname != xno; then
 
        FR_SMART_CHECK_LIB(com_err, set_com_err_hook)
        if test "x$ac_cv_lib_com_err_set_com_err_hook" != "xyes"; then
-               AC_MSG_WARN([the comm_err library isn't found!]) 
+               AC_MSG_WARN([the comm_err library isn't found!])
        fi
 
        FR_SMART_CHECK_LIB(krb5, krb5_init_context)
@@ -90,7 +90,7 @@ if test x"$fail" != x""; then
                AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
        else
                AC_MSG_WARN([silently not building ]modname[.])
-               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); 
+               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]);
                targetname=""
        fi
 fi
index 5dfe0b5..8b4b7f5 100644 (file)
@@ -1,8 +1,8 @@
-/* 
+/*
  * Copyright (C) 2002-2004 Novell, Inc.
  *
  * edir_ldapext.c  LDAP extension for reading eDirectory universal password
- * 
+ *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as published
  * by the Free Software Foundation.
@@ -19,7 +19,7 @@
  * find current contact  information at www.novell.com.
  *
  * Copyright 2006 The FreeRADIUS Server Project.
- */ 
+ */
 
 #include <freeradius-devel/ident.h>
 RCSID("$Id$")
@@ -54,9 +54,9 @@ RCSID("$Id$")
 /* OID of LDAP extension call to perform NMAS authentication */
 #define RADAUTH_OID_NMAS_AUTH_REQUEST         "2.16.840.1.113719.1.510.100.1"
 #define RADAUTH_OID_NMAS_AUTH_REPLY           "2.16.840.1.113719.1.510.100.2"
-                                                                                                                             
+
 #define RADAUTH_LDAP_EXT_VERSION 1
-                                                                                                                             
+
 #define REQUEST_CHALLENGED 1
 
 
@@ -139,8 +139,8 @@ int berEncodePasswordData(
                err = 0;
        }
 
-       /* 
-        * Convert the BER we just built to a berval that we'll send with the extended request. 
+       /*
+        * Convert the BER we just built to a berval that we'll send with the extended request.
         */
        if(ber_flatten(requestBer, requestBV) == LBER_ERROR)
        {
@@ -206,7 +206,7 @@ int berDecodeLoginData(
                                memcpy(retData, retOctStr, retOctStrLen);
                        }
                        else if (!err)
-                       {       
+                       {
                                err = NMAS_E_BUFFER_OVERFLOW;
                        }
 
@@ -317,7 +317,7 @@ int nmasldap_get_password(
        /* Do we have a good returned berval? */
        if(!replyBV)
        {
-               /* 
+               /*
                 * No; returned berval means we experienced a rather drastic error.
                 * Return operations error.
                 */
@@ -401,7 +401,7 @@ int berEncodeAuthData(
 {
         int err = 0, rc=0;
         BerElement *requestBer = NULL;
-                                                                                                                             
+
         char    * utf8ObjPtr = NULL;
         int     utf8ObjSize = 0;
         char    * utf8PwdPtr = NULL;
@@ -413,29 +413,29 @@ int berEncodeAuthData(
         char    * utf8SeqPtr = NULL;
         int     utf8SeqSize = 0;
         int state_present = 0;
-                                                                                                                             
+
         utf8ObjSize = strlen(objectDN)+1;
         utf8ObjPtr = objectDN;
-                                                                                                                             
+
         utf8PwdSize = strlen(pwd);
         utf8PwdPtr = pwd;
-                                                                                                                             
+
         utf8SeqSize = strlen(sequence)+1;
         utf8SeqPtr = sequence;
-                                                                                                                             
+
         utf8NasIPSize = strlen(NasIP)+1;
         utf8NasIPPtr = NasIP;
-                                                                                                                             
+
         /* Allocate a BerElement for the request parameters.*/
         if((requestBer = ber_alloc()) == NULL)
         {
                 err = NMAS_E_FRAG_FAILURE;
                 goto Cleanup;
         }
-                                                                                                                             
+
         /* BER encode the NMAS Version, the objectDN, and the password */
         rc = ber_printf(requestBer, "{ioooo", RADAUTH_LDAP_EXT_VERSION, utf8ObjPtr, utf8ObjSize, utf8PwdPtr, utf8PwdSize, utf8SeqPtr, utf8SeqSize, utf8NasIPPtr, utf8NasIPSize);
-                                                                                                                             
+
         if( *auth_state == -2)
         {
                 utf8StateSize = strlen(state)+1;
@@ -447,7 +447,7 @@ int berEncodeAuthData(
         {
                 rc = ber_printf(requestBer, "i}", state_present);
         }
-                                                                                                                             
+
         if (rc < 0)
         {
                 err = NMAS_E_FRAG_FAILURE;
@@ -465,14 +465,14 @@ int berEncodeAuthData(
                 err = NMAS_E_FRAG_FAILURE;
                 goto Cleanup;
         }
-                                                                                                                             
+
 Cleanup:
-                                                                                                                             
+
         if(requestBer)
         {
                 ber_free(requestBer, 1);
         }
-                                                                                                                             
+
         return err;
 } /* End of berEncodeAuthData */
 
@@ -500,7 +500,7 @@ int berDecodeAuthData(
         int rc=0, err = 0;
         BerElement *replyBer = NULL;
         struct berval   challenge = {0};
-                                                                                                                             
+
         if((replyBer = ber_init(replyBV)) == NULL)
         {
                 err = NMAS_E_SYSTEM_RESOURCES; // fix err code
@@ -525,16 +525,16 @@ int berDecodeAuthData(
                         }
                 }
         }
-                                                                                                                             
+
 Cleanup:
         if(replyBer)
         {
                 ber_free(replyBer, 1);
         }
-                                                                                                                             
+
         return err;
 }/* End of berDecodeLoginData */
-                                                                                                                             
+
 /* -----------------------------------------------------------------------
  *      radLdapXtnNMASAuth()
  *      ==============================
@@ -555,34 +555,34 @@ int radLdapXtnNMASAuth(
 )
 {
         int err = 0;
-                                                                                                                             
+
         struct berval *requestBV = NULL;
         char *replyOID = NULL;
         struct berval *replyBV = NULL;
         int errCode;
         char *challenge;
         size_t challengesize;
-                                                                                                                             
+
         challengesize = *statesize;
         challenge = (char *)malloc(challengesize+2);
                 if(challenge == NULL)
                         {
                                 return NMAS_E_INSUFFICIENT_MEMORY;
                         }
-                                                                                                                             
+
          /* Validate char    parameters. */
         if(objectDN == NULL || (strlen(objectDN) == 0) || statesize == NULL || NasIPaddr == NULL || ld == NULL)
         {
                 return NMAS_E_INVALID_PARAMETER;
         }
-                                                                                                                             
+
         err = berEncodeAuthData(&requestBV, objectDN, pwd, sequence, NasIPaddr, state, auth_state);
-                                                                                                                             
+
         if(err)
         {
                 goto Cleanup;
         }
-                                                                                                                             
+
         /* Call the ldap_extended_operation (synchronously) */
         if((err = ldap_extended_operation_s(ld, RADAUTH_OID_NMAS_AUTH_REQUEST, requestBV, NULL, NULL, &replyOID, &replyBV))!=0)
         {
@@ -594,14 +594,14 @@ int radLdapXtnNMASAuth(
                 err = NMAS_E_NOT_SUPPORTED; // change error values
                 goto Cleanup;
         }
-                                                                                                                             
+
         /* Is this what we were expecting to get back. */
         if(strcmp(replyOID, RADAUTH_OID_NMAS_AUTH_REPLY))
         {
                 err = NMAS_E_NOT_SUPPORTED; // change return value
                 goto Cleanup;
         }
-                                                                                                                             
+
         /* Do we have a good returned berval? */
         if(!replyBV)
         {
@@ -613,7 +613,7 @@ int radLdapXtnNMASAuth(
                 goto Cleanup;
         }
         err = berDecodeAuthData(replyBV, &errCode, &challengesize, challenge, auth_state);
-                                                                                                                             
+
 /* errCode return error in case of AUTH-REJECT */
         if (!err && challengesize!= 0)
         {
@@ -624,35 +624,35 @@ int radLdapXtnNMASAuth(
                 }
                 *statesize = challengesize; /* does not include null termination */
         }
-                                                                                                                             
+
 Cleanup:
         /* Free memory allocated for challenge  */
         if(challenge)
         {
                 free(challenge);
         }
-                                                                                                                             
+
         if(replyBV)
         {
                 ber_bvfree(replyBV);
         }
-                                                                                                                             
+
         /* Free the return OID string if one was returned. */
         if(replyOID)
         {
                 ldap_memfree(replyOID);
         }
-                                                                                                                             
+
         /* Free memory allocated while building the request ber and berval. */
         if(requestBV)
         {
                 ber_bvfree(requestBV);
         }
-                                                                                                                             
+
 #ifdef  NOT_N_PLAT_NLM
         SetThreadGroupID(currentThreadGroupID);
 #endif
-                                                                                                                             
+
         /* Return the appropriate error/success code. */
         return err;
 }/* End of radLdapXtnNMASAuth */
index 0dd1b51..86385be 100644 (file)
@@ -24,7 +24,7 @@ RCSID("$Id$")
 #include <freeradius-devel/radiusd.h>
 #include <freeradius-devel/modules.h>
 #include       <freeradius-devel/rad_assert.h>
-     
+
 #include       <pwd.h>
 #include       <ctype.h>
 
@@ -92,14 +92,14 @@ int nmasldap_get_password(
 #endif
 
 #ifdef NOVELL
-                                                                                                                             
+
 #define REQUEST_ACCEPTED   0
 #define REQUEST_CHALLENGED 1
 #define REQUEST_REJECTED   2
 #define MAX_CHALLENGE_LEN  128
 
 int radLdapXtnNMASAuth( LDAP *, char *, char *, char *, char *, size_t *, char *, int * );
-                                                                                                                             
+
 #endif
 
 /* linked list of mappings between RADIUS attributes and LDAP attributes */
@@ -476,7 +476,7 @@ ldap_instantiate(CONF_SECTION * conf, void **instance)
        /*
         *      ('eDir-APC', '1') in config items list
         *      Do not perform eDirectory account policy check (APC)
-        *                                           
+        *
         *      ('eDir-APC', '2') in config items list
         *      Perform eDirectory APC
         *
@@ -695,7 +695,7 @@ read_mappings(ldap_instance* inst)
                        operator = T_OP_INVALID; /* use defaults */
                } else {
                        char *ptr;
-                       
+
                        ptr = opstring;
                        operator = gettoken(&ptr, buf, sizeof(buf));
                        if ((operator < T_OP_ADD) || (operator > T_OP_CMP_EQ)) {
@@ -1441,7 +1441,7 @@ static int ldap_authorize(void *instance, REQUEST * request)
                        char **passwd_vals;
                        char *value = NULL;
                        int i;
-                       
+
                        /*
                         *      Read the password from the DB, and
                         *      add it to the request.
@@ -1456,10 +1456,10 @@ static int ldap_authorize(void *instance, REQUEST * request)
                                              passwd_vals[i] != NULL;
                                              i++) {
                                int attr = PW_USER_PASSWORD;
-                               
+
                                if (strlen(passwd_vals[i]) == 0)
                                        continue;
-                               
+
                                value = passwd_vals[i];
 
                                if (inst->auto_header) {
@@ -1472,7 +1472,7 @@ static int ldap_authorize(void *instance, REQUEST * request)
                                                continue; /* paranoia */
                                        memcpy(autobuf, value, p - value + 1);
                                        autobuf[p - value + 1] = '\0';
-                               
+
                                        attr = lrad_str2int(header_names,
                                                            autobuf, 0);
                                        if (!attr) continue;
@@ -1490,7 +1490,7 @@ static int ldap_authorize(void *instance, REQUEST * request)
                                        }
                                }
                                if (!value) continue;
-                               
+
                        create_attr:
                                passwd_item = radius_paircreate(request,
                                                                &request->config_items,
@@ -1521,7 +1521,7 @@ static int ldap_authorize(void *instance, REQUEST * request)
                        res = 0;
 
                        if ((passwd_item = pairfind(request->config_items, PW_CLEARTEXT_PASSWORD)) == NULL){
-                       
+
                                universal_password = rad_malloc(universal_password_len);
                                memset(universal_password, 0, universal_password_len);
 
@@ -1595,7 +1595,7 @@ static int ldap_authorize(void *instance, REQUEST * request)
                                memset(universal_password, 0, universal_password_len);
                                free(universal_password);
                        }
-               }                       
+               }
 #endif
        }
 
@@ -2072,13 +2072,13 @@ static int ldap_postauth(void *instance, REQUEST * request)
                                        DEBUG("rlm_ldap: Attribute for user FDN not found in dictionary. Unable to proceed");
                                        return RLM_MODULE_FAIL;
                                }
-                               
+
                                vp_fdn = pairfind(request->packet->vps, da->attr);
                                if (vp_fdn == NULL) {
                                        DEBUG("rlm_ldap: User's FQDN not in config items list.");
                                        return RLM_MODULE_FAIL;
                                }
-                               
+
                                if ((conn_id = ldap_get_conn(inst->apc_conns, &conn, inst)) == -1){
                                        radlog(L_ERR, "rlm_ldap: All ldap connections are in use");
                                        return RLM_MODULE_FAIL;
@@ -2099,13 +2099,13 @@ static int ldap_postauth(void *instance, REQUEST * request)
                                        }
                                        if ((conn->ld = ldap_connect(instance, (char *)vp_fdn->vp_strvalue, password, 0, &res, &error_msg)) == NULL) {
                                                radlog(L_ERR, "rlm_ldap: eDirectory account policy check failed.");
-                                               
+
                                                if (error_msg != NULL) {
                                                        DEBUG("rlm_ldap: %s", error_msg);
                                                        pairadd(&request->reply->vps, pairmake("Reply-Message", error_msg, T_OP_EQ));
                                                        ldap_memfree((void *)error_msg);
                                                }
-                                               
+
                                                vp_apc->vp_strvalue[0] = '3';
                                                ldap_release_conn(conn_id, inst->apc_conns);
                                                return RLM_MODULE_REJECT;
@@ -2202,10 +2202,10 @@ static LDAP *ldap_connect(void *instance, const char *dn, const char *password,
                               "LDAP_OPT_X_TLS_CACERTFILE option to %s", inst->tls_cacertfile);
                }
        }
-       
+
        if (inst->tls_cacertdir != NULL) {
                DEBUG("rlm_ldap: setting TLS CACert Directory to %s", inst->tls_cacertdir);
-               
+
                if ( ldap_set_option( NULL, LDAP_OPT_X_TLS_CACERTDIR,
                                      (void *) inst->tls_cacertdir )
                     != LDAP_OPT_SUCCESS) {
@@ -2240,11 +2240,11 @@ static LDAP *ldap_connect(void *instance, const char *dn, const char *password,
                               inst->tls_certfile);
                }
        }
-       
+
        if (inst->tls_keyfile != NULL) {
                DEBUG("rlm_ldap: setting TLS Key File to %s",
                      inst->tls_keyfile);
-               
+
                if ( ldap_set_option( NULL, LDAP_OPT_X_TLS_KEYFILE,
                                      (void *) inst->tls_keyfile )
                     != LDAP_OPT_SUCCESS) {
@@ -2253,11 +2253,11 @@ static LDAP *ldap_connect(void *instance, const char *dn, const char *password,
                               inst->tls_keyfile);
                }
        }
-       
+
        if (inst->tls_randfile != NULL) {
                DEBUG("rlm_ldap: setting TLS Key File to %s",
                      inst->tls_randfile);
-               
+
                if (ldap_set_option(NULL, LDAP_OPT_X_TLS_RANDOM_FILE,
                                    (void *) inst->tls_randfile)
                    != LDAP_OPT_SUCCESS) {
@@ -2387,7 +2387,7 @@ ldap_detach(void *instance)
 
        if (inst->conns) {
                int i;
-               
+
                for (i = 0;i < inst->num_conns; i++) {
                        if (inst->conns[i].ld){
                                ldap_unbind_s(inst->conns[i].ld);
@@ -2398,7 +2398,7 @@ ldap_detach(void *instance)
        }
 
 #ifdef NOVELL
-       if (inst->apc_conns){ 
+       if (inst->apc_conns){
                int i;
 
                for (i = 0; i < inst->num_conns; i++) {
index 66fedf3..bdb9dfd 100755 (executable)
@@ -65,7 +65,7 @@ static int linelog_detach(void *instance)
 {
        rlm_linelog_t *inst = instance;
 
-       
+
        free(inst);
        return 0;
 }
@@ -186,7 +186,7 @@ static int do_linelog(void *instance, REQUEST *request)
        radius_xlat(line, sizeof(line) - 1, inst->line, request,
                    linelog_escape_func);
        strcat(line, "\n");
-       
+
        write(fd, line, strlen(line));
        close(fd);
 
index 68aa9a6..f0dfe2a 100644 (file)
@@ -37,7 +37,7 @@ RCSID("$Id$")
  *     be used as the instance handle.
  */
 typedef struct rlm_logintime_t {
-       char *msg;              /* The Reply-Message passed back to the user 
+       char *msg;              /* The Reply-Message passed back to the user
                                 * if the account is outside allowed timestamp */
        int min_time;
 } rlm_logintime_t;
@@ -52,7 +52,7 @@ typedef struct rlm_logintime_t {
  *     buffer over-flows.
  */
 static const CONF_PARSER module_config[] = {
-  { "reply-message", PW_TYPE_STRING_PTR, offsetof(rlm_logintime_t,msg), NULL, 
+  { "reply-message", PW_TYPE_STRING_PTR, offsetof(rlm_logintime_t,msg), NULL,
        "You are calling outside your allowed timespan\r\n"},
   { "minimum-timeout", PW_TYPE_INTEGER, offsetof(rlm_logintime_t,min_time), NULL, "60" },
   { NULL, -1, 0, NULL, NULL }
@@ -67,14 +67,14 @@ static int timecmp(void *instance,
                REQUEST *req,
                VALUE_PAIR *request, VALUE_PAIR *check,
                VALUE_PAIR *check_pairs, VALUE_PAIR **reply_pairs)
-{ 
+{
        instance = instance;
        request = request;      /* shut the compiler up */
        check_pairs = check_pairs;
        reply_pairs = reply_pairs;
-  
+
        /*
-        *      If there's a request, use that timestamp.       
+        *      If there's a request, use that timestamp.
         */
        if (timestr_match((char *)check->vp_strvalue,
        req ? req->timestamp : time(NULL)) >= 0)
@@ -106,7 +106,7 @@ static int time_of_day(void *instance,
         *      Must be called with a request pointer.
         */
        if (!req) return -1;
-  
+
        if (strspn(check->vp_strvalue, "0123456789: ") != strlen(check->vp_strvalue)) {
                DEBUG("rlm_logintime: Bad Time-Of-Day value \"%s\"",
                      check->vp_strvalue);
@@ -151,13 +151,13 @@ static int time_of_day(void *instance,
 
        fprintf(stderr, "returning %d - %d\n",
                hhmmss, when);
-       
+
        return hhmmss - when;
 }
 
-/*              
+/*
  *      Check if account has expired, and if user may login now.
- */              
+ */
 static int logintime_authorize(void *instance, REQUEST *request)
 {
        rlm_logintime_t *data = (rlm_logintime_t *)instance;
@@ -165,7 +165,7 @@ static int logintime_authorize(void *instance, REQUEST *request)
        int r;
 
        if ((check_item = pairfind(request->config_items, PW_LOGIN_TIME)) != NULL) {
+
                /*
                 *      Authentication is OK. Now see if this
                 *      user may login at this time of the day.
@@ -191,7 +191,7 @@ static int logintime_authorize(void *instance, REQUEST *request)
                        /*
                         *      User called outside allowed time interval.
                         */
-               
+
                        DEBUG("rlm_logintime: timestr returned reject");
                        if (data->msg && data->msg[0]){
                                char msg[MAX_STRING_LEN];
index 43fd5ce..a3232ad 100644 (file)
@@ -363,7 +363,7 @@ static int mschap_xlat(void *instance, REQUEST *request,
                        DEBUG2("  rlm_mschap: Invalid MS-CHAP challenge length");
                        return 0;
                }
-               
+
                /*
                 *      Get the MS-CHAPv1 response, or the MS-CHAPv2
                 *      response.
@@ -395,7 +395,7 @@ static int mschap_xlat(void *instance, REQUEST *request,
                 */
                data = response->vp_octets + 26;
                data_len = 24;
-               
+
                /*
                 *      LM-Response is deprecated, and exists only
                 *      in MS-CHAPv1, and not often there.
@@ -430,7 +430,7 @@ static int mschap_xlat(void *instance, REQUEST *request,
                        DEBUG2("  rlm_mschap: No User-Name was found in the request.");
                        return 0;
                }
-               
+
                /*
                 *      First check to see if this is a host/ style User-Name
                 *      (a la Kerberos host principal)
@@ -485,7 +485,7 @@ static int mschap_xlat(void *instance, REQUEST *request,
                        DEBUG2("  rlm_mschap: No User-Name was found in the request.");
                        return 0;
                }
-               
+
                /*
                 *      First check to see if this is a host/ style User-Name
                 *      (a la Kerberos host principal)
@@ -547,7 +547,7 @@ static int mschap_xlat(void *instance, REQUEST *request,
                p = fmt + 8;    /* 7 is the length of 'LM-Hash' */
                if ((p == '\0') || (outlen <= 32))
                        return 0;
-                       
+
                DEBUG("rlm_mschap: LM-Hash: %s",p);
                smbdes_lmpwdhash(p,buffer);
                lrad_bin2hex(buffer, out, 16);
@@ -578,13 +578,13 @@ static int mschap_xlat(void *instance, REQUEST *request,
        }
 
        /*
-        *      
+        *
         */
        for (i = 0; i < data_len; i++) {
                sprintf(out + (2 * i), "%02x", data[i]);
        }
        out[data_len * 2] = '\0';
-       
+
        return data_len * 2;
 }
 
@@ -769,12 +769,12 @@ static int do_mschap(rlm_mschap_t *inst,
                        DEBUG2("  rlm_mschap: FAILED: No NT/LM-Password.  Cannot perform authentication.");
                        return -1;
                }
-               
+
                smbdes_mschap(password->vp_strvalue, challenge, calculated);
                if (memcmp(response, calculated, 24) != 0) {
                        return -1;
                }
-               
+
                /*
                 *      If the password exists, and is an NT-Password,
                 *      then calculate the hash of the NT hash.  Doing this
@@ -792,7 +792,7 @@ static int do_mschap(rlm_mschap_t *inst,
                memset(nthashhash, 0, 16);
 
                /*
-                *      Run the program, and expect that we get 16 
+                *      Run the program, and expect that we get 16
                 */
                result = radius_exec_program(inst->ntlm_auth, request,
                                             TRUE, /* wait */
@@ -1244,7 +1244,7 @@ static int mschap_authenticate(void * instance, REQUEST *request)
                               challenge->vp_octets, /* our challenge */
                               username_string, /* user name */
                               mschapv1_challenge); /* resulting challenge */
-               
+
                DEBUG2("  rlm_mschap: Told to do MS-CHAPv2 for %s with NT-Password",
                       username_string);
 
@@ -1342,7 +1342,7 @@ static int mschap_authenticate(void * instance, REQUEST *request)
                        mppe_chap2_gen_keys128(nthashhash,
                                               response->vp_octets + 26,
                                               mppe_sendkey, mppe_recvkey);
-                       
+
                        mppe_add_reply(&request->reply->vps,
                                       "MS-MPPE-Recv-Key",
                                       mppe_recvkey, 16);
index b7614fe..7c6692d 100644 (file)
@@ -19,7 +19,7 @@
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
    Copyright 2006 The FreeRADIUS server project
 */
 
index 6e4498a..553c835 100644 (file)
@@ -304,7 +304,7 @@ otp_connect(const char *path)
   }
   sa.sun_family = AF_UNIX;
   (void) strcpy(sa.sun_path, path);
-    
+
   /* connect to otpd */
   if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) == -1) {
     (void) radlog(L_ERR, "rlm_otp: %s: socket: %s", __func__, strerror(errno));
index 3b773e1..d4572f2 100644 (file)
@@ -12,22 +12,22 @@ if test x$with_[]modname != xno; then
                [ pam_ldflags="-ldl" ]
        )
 
-       AC_CHECK_LIB(pam, pam_start, 
+       AC_CHECK_LIB(pam, pam_start,
                [ pam_ldflags="-lpam $pam_ldflags" ],
                [ fail=$fail" libpam" ],
                [ $pam_ldflags ]
        )
 
-dnl #  
+dnl #
 dnl #  Yes, these DO have to be on seperate lines,
 dnl #  otherwise autoheader won't pick them up.
-dnl #  
+dnl #
        AC_CHECK_HEADERS( \
                        security/pam_appl.h \
                        pam/pam_appl.h \
                        )
        pam_cflags="-I."
-       
+
        targetname=modname
 else
        targetname=
@@ -39,7 +39,7 @@ if test x"$fail" != x""; then
                AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
        else
                AC_MSG_WARN([silently not building ]modname[.])
-               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); 
+               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]);
                targetname=""
        fi
 fi
index ac1ea85..7f020fb 100644 (file)
@@ -289,7 +289,7 @@ module_t rlm_pam = {
        RLM_MODULE_INIT,
        "pam",
        RLM_TYPE_THREAD_UNSAFE, /* The PAM libraries are not thread-safe */
-       pam_instantiate,                /* instantiation */     
+       pam_instantiate,                /* instantiation */
        pam_detach,                     /* detach */
        {
                pam_auth,               /* authenticate */
index 4058230..a1184b6 100644 (file)
@@ -185,7 +185,7 @@ static int decode_it(const char *src, uint8_t *dst)
                        x = (x << 6) + (unsigned int)(src[i] - 'A' + 0);
                else if (src[i] >= 'a' && src[i] <= 'z')
                         x = (x << 6) + (unsigned int)(src[i] - 'a' + 26);
-               else if(src[i] >= '0' && src[i] <= '9') 
+               else if(src[i] >= '0' && src[i] <= '9')
                         x = (x << 6) + (unsigned int)(src[i] - '0' + 52);
                else if(src[i] == '+')
                        x = (x << 6) + 62;
@@ -195,11 +195,11 @@ static int decode_it(const char *src, uint8_t *dst)
                        x = (x << 6);
                else return 0;
        }
-       
+
        dst[2] = (unsigned char)(x & 255); x >>= 8;
        dst[1] = (unsigned char)(x & 255); x >>= 8;
        dst[0] = (unsigned char)(x & 255); x >>= 8;
-       
+
        return 1;
 }
 
@@ -219,7 +219,7 @@ static int base64_decode (const char *src, uint8_t *dst)
        while (src[length + equals] == '=') equals++;
 
        num = (length + equals) / 4;
-       
+
        for (i = 0; i < num - 1; i++) {
                if (!decode_it(src, dst)) return 0;
                src += 4;
@@ -242,7 +242,7 @@ static void normify(VALUE_PAIR *vp, int min_length)
 {
        int decoded;
        char buffer[64];
-       
+
        if ((size_t) min_length >= sizeof(buffer)) return; /* paranoia */
 
        /*
@@ -313,7 +313,7 @@ static int pap_authorize(void *instance, REQUEST *request)
                        uint8_t *p, *q;
                        char buffer[64];
                        VALUE_PAIR *new_vp;
-                       
+
                        found_pw = TRUE;
                        q = vp->vp_strvalue;
                        p = strchr(q + 1, '}');
@@ -326,18 +326,18 @@ static int pap_authorize(void *instance, REQUEST *request)
                                 */
                                break;
                        }
-                       
+
                        if ((size_t) (p - q) > sizeof(buffer)) break;
-                       
+
                        memcpy(buffer, q, p - q + 1);
                        buffer[p - q + 1] = '\0';
-                       
+
                        attr = lrad_str2int(header_names, buffer, 0);
                        if (!attr) {
                                DEBUG2("rlm_pap: Found unknown header {%s}: Not doing anything", buffer);
                                break;
                        }
-                       
+
                        new_vp = radius_paircreate(request,
                                                   &request->config_items,
                                                   attr, PW_TYPE_STRING);
@@ -402,7 +402,7 @@ static int pap_authorize(void *instance, REQUEST *request)
 
                default:
                        break;  /* ignore it */
-                       
+
                }
        }
 
@@ -423,7 +423,7 @@ static int pap_authorize(void *instance, REQUEST *request)
                 *      The TLS types don't need passwords.
                 */
                vp = pairfind(request->packet->vps, PW_EAP_TYPE);
-               if (vp && 
+               if (vp &&
                    ((vp->vp_integer == 13) || /* EAP-TLS */
                     (vp->vp_integer == 21) || /* EAP-TTLS */
                     (vp->vp_integer == 25))) { /* PEAP */
@@ -440,7 +440,7 @@ static int pap_authorize(void *instance, REQUEST *request)
        if (auth_type) {
                DEBUG2("rlm_pap: Found existing Auth-Type, not changing it.");
                return RLM_MODULE_NOOP;
-       }       
+       }
 
        /*
         *      Can't do PAP if there's no password.
@@ -521,16 +521,16 @@ static int pap_authenticate(void *instance, REQUEST *request)
                        case PW_USER_PASSWORD: /* deprecated */
                        case PW_CLEARTEXT_PASSWORD: /* preferred */
                                goto do_clear;
-                               
+
                        case PW_CRYPT_PASSWORD:
                                goto do_crypt;
-                               
+
                        case PW_MD5_PASSWORD:
                                goto do_md5;
-                               
+
                        case PW_SHA_PASSWORD:
                                goto do_sha;
-                               
+
                        case PW_NT_PASSWORD:
                                goto do_nt;
 
@@ -548,7 +548,7 @@ static int pap_authenticate(void *instance, REQUEST *request)
 
                        default:
                                break;  /* ignore it */
-                               
+
                        }
                }
 
@@ -558,7 +558,7 @@ static int pap_authenticate(void *instance, REQUEST *request)
 
        } else {
                vp = NULL;
-               
+
                if (inst->sch == PAP_ENC_CRYPT) {
                        vp = pairfind(request->config_items, PW_CRYPT_PASSWORD);
                }
@@ -588,7 +588,7 @@ static int pap_authenticate(void *instance, REQUEST *request)
                DEBUG("rlm_pap: User authenticated successfully");
                return RLM_MODULE_OK;
                break;
-               
+
        case PAP_ENC_CRYPT:
        do_crypt:
                DEBUG("rlm_pap: Using CRYPT encryption.");
@@ -599,7 +599,7 @@ static int pap_authenticate(void *instance, REQUEST *request)
                }
                goto done;
                break;
-               
+
        case PW_MD5_PASSWORD:
        do_md5:
                DEBUG("rlm_pap: Using MD5 encryption.");
@@ -610,7 +610,7 @@ static int pap_authenticate(void *instance, REQUEST *request)
                        snprintf(module_fmsg,sizeof(module_fmsg),"rlm_pap: Configured MD5 password has incorrect length");
                        goto make_msg;
                }
-               
+
                MD5Init(&md5_context);
                MD5Update(&md5_context, request->password->vp_strvalue,
                          request->password->length);
@@ -621,7 +621,7 @@ static int pap_authenticate(void *instance, REQUEST *request)
                }
                goto done;
                break;
-               
+
        case PW_SMD5_PASSWORD:
        do_smd5:
                DEBUG("rlm_pap: Using SMD5 encryption.");
@@ -632,7 +632,7 @@ static int pap_authenticate(void *instance, REQUEST *request)
                        snprintf(module_fmsg,sizeof(module_fmsg),"rlm_pap: Configured SMD5 password has incorrect length");
                        goto make_msg;
                }
-               
+
                MD5Init(&md5_context);
                MD5Update(&md5_context, request->password->vp_strvalue,
                          request->password->length);
@@ -648,18 +648,18 @@ static int pap_authenticate(void *instance, REQUEST *request)
                }
                goto done;
                break;
-               
+
        case PW_SHA_PASSWORD:
        do_sha:
                DEBUG("rlm_pap: Using SHA1 encryption.");
-               
+
                normify(vp, 20);
                if (vp->length != 20) {
                        DEBUG("rlm_pap: Configured SHA1 password has incorrect length");
                        snprintf(module_fmsg,sizeof(module_fmsg),"rlm_pap: Configured SHA1 password has incorrect length");
                        goto make_msg;
                }
-               
+
                SHA1Init(&sha1_context);
                SHA1Update(&sha1_context, request->password->vp_strvalue,
                           request->password->length);
@@ -670,11 +670,11 @@ static int pap_authenticate(void *instance, REQUEST *request)
                }
                goto done;
                break;
-               
+
        case PW_SSHA_PASSWORD:
        do_ssha:
                DEBUG("rlm_pap: Using SSHA encryption.");
-               
+
                normify(vp, 20);
                if (vp->length <= 20) {
                        DEBUG("rlm_pap: Configured SSHA password has incorrect length");
@@ -682,7 +682,7 @@ static int pap_authenticate(void *instance, REQUEST *request)
                        goto make_msg;
                }
 
-               
+
                SHA1Init(&sha1_context);
                SHA1Update(&sha1_context, request->password->vp_strvalue,
                           request->password->length);
@@ -694,7 +694,7 @@ static int pap_authenticate(void *instance, REQUEST *request)
                }
                goto done;
                break;
-               
+
        case PW_NT_PASSWORD:
        do_nt:
                DEBUG("rlm_pap: Using NT encryption.");
@@ -705,7 +705,7 @@ static int pap_authenticate(void *instance, REQUEST *request)
                        snprintf(module_fmsg,sizeof(module_fmsg),"rlm_pap: Configured NT-Password has incorrect length");
                        goto make_msg;
                }
-               
+
                sprintf(buff2,"%%{mschap:NT-Hash %s}",
                        request->password->vp_strvalue);
                if (!radius_xlat(digest,sizeof(digest),buff2,request,NULL)){
@@ -720,11 +720,11 @@ static int pap_authenticate(void *instance, REQUEST *request)
                }
                goto done;
                break;
-               
+
        case PW_LM_PASSWORD:
        do_lm:
                DEBUG("rlm_pap: Using LM encryption.");
-               
+
                normify(vp, 16);
                if (vp->length != 16) {
                        DEBUG("rlm_pap: Configured LM-Password has incorrect length");
index 7fa50e5..dfc9e62 100644 (file)
@@ -8,7 +8,7 @@ if test x$with_[]modname != xno; then
        AC_PROG_CC
        AC_PROG_CPP
 
-       dnl put configuration checks here.  
+       dnl put configuration checks here.
        dnl set $fail to what's missing, on fatal errors.
        dnl use AC_MSG_WARN() on important messages.
 
@@ -53,7 +53,7 @@ if test x"$fail" != x""; then
                AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
        else
                AC_MSG_WARN([silently not building ]modname[.])
-               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); 
+               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]);
                targetname=""
                perl_cflags=""
                perl_ldflags=""
index 8418f04..e5f584b 100644 (file)
@@ -3,19 +3,19 @@
 #  it under the terms of the GNU General Public License as published by
 #  the Free Software Foundation; either version 2 of the License, or
 #  (at your option) any later version.
-# 
+#
 #  This program is distributed in the hope that it will be useful,
 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 #  GNU General Public License for more details.
-# 
+#
 #  You should have received a copy of the GNU General Public License
 #  along with this program; if not, write to the Free Software
 #  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
-#  
+#
 #  Copyright 2002  The FreeRADIUS server project
 #  Copyright 2002  Boian Jordanov <bjordanov@orbitel.bg>
-#  
+#
 
 #
 # Example code for use with rlm_perl
@@ -37,7 +37,7 @@ use Data::Dumper;
 #my %RAD_CHECK;
 
 #
-# This the remapping of return values 
+# This the remapping of return values
 #
        use constant    RLM_MODULE_REJECT=>    0;#  /* immediately reject the request */
        use constant    RLM_MODULE_FAIL=>      1;#  /* module failed, don't reply */
@@ -82,7 +82,7 @@ sub authenticate {
 sub preacct {
        # For debugging purposes only
 #      &log_request_attributes;
-       
+
        return RLM_MODULE_OK;
 }
 
@@ -91,9 +91,9 @@ sub accounting {
        # For debugging purposes only
 #      &log_request_attributes;
 
-       # You can call another subroutine from here 
+       # You can call another subroutine from here
        &test_call;
-       
+
        return RLM_MODULE_OK;
 }
 
@@ -162,7 +162,7 @@ sub detach {
 #
 
 sub test_call {
-       # Some code goes here 
+       # Some code goes here
 }
 
 sub log_request_attributes {
index a69a754..280e200 100644 (file)
@@ -750,12 +750,12 @@ static int perl_instantiate(CONF_SECTION *conf, void **instance)
 
 #ifdef USE_ITHREADS
        inst->perl = interp;
-       
+
        if ((inst->perl = perl_alloc()) == NULL) {
                radlog(L_DBG, "rlm_perl: No memory for allocating new perl !");
                return (-1);
        }
-               
+
        perl_construct(inst->perl);
        PL_perl_destruct_level = 2;
 
@@ -989,7 +989,7 @@ static int rlmperl_call(void *instance, REQUEST *request, char *function_name)
        perl_store_vps(request->config_items, rad_check_hv);
        perl_store_vps(request->packet->vps, rad_request_hv);
        perl_store_vps(request->config_items, rad_config_hv);
-       
+
        if (request->proxy != NULL) {
                perl_store_vps(request->proxy->vps, rad_request_proxy_hv);
        } else {
@@ -1000,8 +1000,8 @@ static int rlmperl_call(void *instance, REQUEST *request, char *function_name)
                perl_store_vps(request->proxy_reply->vps, rad_request_proxy_reply_hv);
        } else {
                hv_undef(rad_request_proxy_reply_hv);
-       }       
-       
+       }
+
        PUSHMARK(SP);
        /*
        * This way %RAD_xx can be pushed onto stack as sub parameters.
@@ -1028,12 +1028,12 @@ static int rlmperl_call(void *instance, REQUEST *request, char *function_name)
                        exitstatus = RLM_MODULE_FAIL;
                }
        }
-       
+
 
        PUTBACK;
        FREETMPS;
        LEAVE;
-       
+
        vp = NULL;
        if ((get_hv_content(rad_request_hv, &vp)) > 0 ) {
                pairfree(&request->packet->vps);
@@ -1063,7 +1063,7 @@ static int rlmperl_call(void *instance, REQUEST *request, char *function_name)
                request->config_items = vp;
                vp = NULL;
        }
-       
+
        if (request->proxy &&
            (get_hv_content(rad_request_proxy_hv, &vp) > 0)) {
                pairfree(&request->proxy->vps);
index ed67ad4..d3f9cab 100644 (file)
@@ -42,21 +42,21 @@ static void policy_print(const policy_item_t *item, int indent)
                printf("[NULL]\n");
                return;
        }
-       
+
        while (item) {
                switch (item->type) {
                case POLICY_TYPE_BAD:
                        if (indent) printf("%*s", indent, " ");
                        printf("[BAD STATEMENT]");
                        break;
-                       
+
                case POLICY_TYPE_PRINT:
                        if (indent) printf("%*s", indent, " ");
                        {
                                const policy_print_t *this;
 
                                this = (const policy_print_t *) item;
-                               
+
                                if (this->rhs_type == POLICY_LEX_BARE_WORD) {
                                        printf("print %s\n", this->rhs);
                                } else {
@@ -64,11 +64,11 @@ static void policy_print(const policy_item_t *item, int indent)
                                }
                        }
                        break;
-                       
+
                case POLICY_TYPE_ASSIGNMENT:
                        {
                                const policy_assignment_t *assign;
-                               
+
                                assign = (const policy_assignment_t *) item;
                                if (indent) printf("%*s", indent, " ");
 
@@ -143,7 +143,7 @@ static void policy_print(const policy_item_t *item, int indent)
                                        printf("\"%s\"", condition->rhs);
                                }
                                printf(")");
-                               
+
                                if ((condition->child_condition != POLICY_LEX_BAD) &&
                                    (condition->child_condition != POLICY_LEX_BARE_WORD)) {
                                        printf(" %s ", lrad_int2str(rlm_policy_tokens, condition->child_condition, "?"));
@@ -249,7 +249,7 @@ static void policy_print(const policy_item_t *item, int indent)
                        if (indent) printf("%*s", indent, " ");
                        printf("[HUH?]\n");
                        break;
-                       
+
                }
 
                item = item->next;
@@ -528,7 +528,7 @@ static int evaluate_condition(policy_state_t *state, const policy_item_t *item)
                        }
                }
        }
-       
+
        switch (this->compare) {
        case POLICY_LEX_L_BRACKET: /* nested brackets are a special case */
                rcode = evaluate_condition(state, this->child);
@@ -608,7 +608,7 @@ static int evaluate_condition(policy_state_t *state, const policy_item_t *item)
                        compare = radius_callback_compare(state->request,
                                                          vp, myvp, NULL, NULL);
                        pairfree(&myvp);
-                       
+
                } else {
                        /*
                         *      FIXME: Do something for RHS type?
@@ -618,38 +618,38 @@ static int evaluate_condition(policy_state_t *state, const policy_item_t *item)
                }
 
                debug_evaluate("CONDITION COMPARE %d\n", compare);
-               
+
                switch (this->compare) {
                case POLICY_LEX_CMP_EQUALS:
                        rcode = (compare == 0);
                        break;
-                       
+
                case POLICY_LEX_CMP_NOT_EQUALS:
                        rcode = (compare != 0);
                        break;
-                       
+
                case POLICY_LEX_LT:
                        rcode = (compare < 0);
                        break;
-                       
+
                case POLICY_LEX_GT:
                        rcode = (compare > 0);
                        break;
-                       
+
                case POLICY_LEX_LE:
                        rcode =(compare <= 0);
                        break;
-                       
+
                case POLICY_LEX_GE:
                        rcode = (compare >= 0);
                        break;
-                       
+
 #ifdef HAVE_REGEX_H
                case POLICY_LEX_RX_EQUALS:
                { /* FIXME: copied from src/main/valuepair.c */
                        int i;
                        regmatch_t rxmatch[REQUEST_MAX_REGEX + 1];
-                       
+
                        /*
                         *      Include substring matches.
                         */
@@ -663,14 +663,14 @@ static int evaluate_condition(policy_state_t *state, const policy_item_t *item)
                                        rxmatch, 0);
                        rcode = (rcode == 0);
                        regfree(&reg);
-                       
+
                        /*
                         *      Add %{0}, %{1}, etc.
                         */
                        for (i = 0; i <= REQUEST_MAX_REGEX; i++) {
                                char *p;
                                char rxbuffer[256];
-                               
+
                                /*
                                 *      Didn't match: delete old
                                 *      match, if it existed.
@@ -683,14 +683,14 @@ static int evaluate_condition(policy_state_t *state, const policy_item_t *item)
                                                free(p);
                                                continue;
                                        }
-                                               
+
                                        /*
                                         *      No previous match
                                         *      to delete, stop.
                                         */
                                        break;
                                }
-                               
+
                                /*
                                 *      Copy substring into buffer.
                                 */
@@ -698,7 +698,7 @@ static int evaluate_condition(policy_state_t *state, const policy_item_t *item)
                                       data + rxmatch[i].rm_so,
                                       rxmatch[i].rm_eo - rxmatch[i].rm_so);
                                rxbuffer[rxmatch[i].rm_eo - rxmatch[i].rm_so] = '\0';
-                               
+
                                /*
                                 *      Copy substring, and add it to
                                 *      the request.
@@ -713,10 +713,10 @@ static int evaluate_condition(policy_state_t *state, const policy_item_t *item)
                                                 REQUEST_DATA_REGEX | i,
                                                 p, free);
                        }
-                       
+
                }
                break;
-               
+
                case POLICY_LEX_RX_NOT_EQUALS:
                        regcomp(&reg, this->rhs, REG_EXTENDED|REG_NOSUB);
                        rad_assert(data != NULL);
@@ -822,11 +822,11 @@ static VALUE_PAIR *assign2vp(REQUEST *request,
        case POLICY_LEX_SET_EQUALS:
                operator = T_OP_SET;
                break;
-       
+
        case POLICY_LEX_PLUS_EQUALS:
                operator = T_OP_ADD;
                break;
-       
+
        default:
                fprintf(stderr, "Expected '=' for operator, not '%s' at line %d\n",
                        lrad_int2str(rlm_policy_tokens,
@@ -834,7 +834,7 @@ static VALUE_PAIR *assign2vp(REQUEST *request,
                        assign->item.lineno);
                return NULL;
        }
-       
+
        vp = pairmake(assign->lhs, value, operator);
        if (!vp) {
                fprintf(stderr, "SHIT: %s %s\n", value, librad_errstr);
@@ -943,9 +943,9 @@ static int evaluate_call(policy_state_t *state, const policy_item_t *item)
 
        policy = rlm_policy_find(state->inst->policies, this->name);
        if (!policy) return 0;  /* not found... */
-       
+
        DEBUG2("rlm_policy: Evaluating policy %s", this->name);
-       
+
        rad_assert(policy->policy->type != POLICY_TYPE_BAD);
        rad_assert(policy->policy->type < POLICY_TYPE_NUM_TYPES);
 
@@ -982,7 +982,7 @@ static int evaluate_return(policy_state_t *state, const policy_item_t *item)
 
        this = (const policy_return_t *) item;
        state->rcode = this->rcode;
-       
+
        return 1;               /* we succeeded */
 }
 
@@ -1008,7 +1008,7 @@ static int evaluate_module(policy_state_t *state, const policy_item_t *item)
        DEBUG2("rlm_policy: begin nested call");
        state->rcode = modcall(this->component, this->mc, state->request);
        DEBUG2("rlm_policy: end nested call");
-       
+
        return 1;               /* we succeeded */
 }
 
@@ -1044,16 +1044,16 @@ static int policy_evaluate_name(policy_state_t *state, const char *name)
        int rcode;
        const policy_item_t *this;
        policy_named_t mypolicy, *policy;
-       
+
        mypolicy.name = name;
        policy = rbtree_finddata(state->inst->policies, &mypolicy);
        if (!policy) return RLM_MODULE_FAIL;
-       
+
        DEBUG2("rlm_policy: Evaluating policy %s", name);
-       
+
        rad_assert(policy->item.type != POLICY_TYPE_BAD);
        rad_assert(policy->item.type < POLICY_TYPE_NUM_TYPES);
-       
+
        rcode = policy_stack_push(state, policy->policy);
        if (!rcode) {
                return RLM_MODULE_FAIL;
@@ -1067,7 +1067,7 @@ static int policy_evaluate_name(policy_state_t *state, const char *name)
                rad_assert(this != NULL);
                rad_assert(this->type != POLICY_TYPE_BAD);
                rad_assert(this->type < POLICY_TYPE_NUM_TYPES);
-               
+
                debug_evaluate("Evaluating at line %d\n",
                               this->lineno);
                rcode = (*evaluate_functions[this->type])(state,
index 2d2406a..080af37 100644 (file)
@@ -135,12 +135,12 @@ static const char *policy_lex_string(const char *input,
        rad_assert(input != NULL);
 
        if (buffer) *buffer = '\0';
-       
+
        switch (*input) {
        case '\0':
                *token = POLICY_LEX_EOL;
                return NULL;    /* nothing more to do */
-               
+
        case ' ':
        case '\t':
        case '\r':
@@ -152,7 +152,7 @@ static const char *policy_lex_string(const char *input,
                while ((*input == ' ') || (*input == '\t') ||
                       (*input == '\r') || (*input == '\n')) input++;
                return input;   /* point to next non-whitespace character */
-               
+
        case '#':               /* ignore everything to the end of the line */
                *token = POLICY_LEX_EOL;
                return NULL;
@@ -160,19 +160,19 @@ static const char *policy_lex_string(const char *input,
        case '(':
                *token = POLICY_LEX_L_BRACKET;
                return input + 1;
-               
+
        case ')':
                *token = POLICY_LEX_R_BRACKET;
                return input + 1;
-               
+
        case '{':
                *token = POLICY_LEX_LC_BRACKET;
                return input + 1;
-               
+
        case '}':
                *token = POLICY_LEX_RC_BRACKET;
                return input + 1;
-               
+
        case ',':
                *token = POLICY_LEX_COMMA;
                return input + 1;
@@ -235,7 +235,7 @@ static const char *policy_lex_string(const char *input,
                        *token = POLICY_LEX_AND;
                }
                return input + 1;
-               
+
        case '|':
                switch (input[1]) {
                case '|':
@@ -252,7 +252,7 @@ static const char *policy_lex_string(const char *input,
                        *token = POLICY_LEX_OR;
                }
                return input + 1;
-               
+
        case '!':
                switch (input[1]) {
                case '=':
@@ -274,7 +274,7 @@ static const char *policy_lex_string(const char *input,
                        *token = POLICY_LEX_L_NOT;
                }
                return input + 1;
-               
+
        case '=':
                switch (input[1]) {
                case '=':
@@ -296,7 +296,7 @@ static const char *policy_lex_string(const char *input,
                        *token = POLICY_LEX_ASSIGN;
                }
                return input + 1;
-               
+
        case '<':
                if (input[1] == '=') {
                        input++;
@@ -305,7 +305,7 @@ static const char *policy_lex_string(const char *input,
                        *token = POLICY_LEX_LT;
                }
                return input + 1;
-               
+
        case '>':
                if (input[1] == '=') {
                        input++;
@@ -320,7 +320,7 @@ static const char *policy_lex_string(const char *input,
                        *token = POLICY_LEX_BAD;
                        return input + 1;
                }
-               
+
                input++;
                while (*input != '"') {
                        /*
@@ -335,7 +335,7 @@ static const char *policy_lex_string(const char *input,
                         */
                        *(buffer++) = *(input++);
                        buflen--;
-                       
+
                        /*
                         *      FIXME: Print more warnings?
                         */
@@ -344,7 +344,7 @@ static const char *policy_lex_string(const char *input,
                        }
                }
                *buffer = '\0';
-               
+
                *token = POLICY_LEX_DOUBLE_QUOTED_STRING;
                return input + 1; /* skip trailing '"' */
 
@@ -359,7 +359,7 @@ static const char *policy_lex_string(const char *input,
                *token = POLICY_LEX_BAD;
                return input + 1;
        }
-       
+
        /*
         *      Getting one character is stupid.
         */
@@ -367,7 +367,7 @@ static const char *policy_lex_string(const char *input,
                *token = POLICY_LEX_BAD;
                return input + 1;
        }
-       
+
        /*
         *      Bare words are [-a-zA-Z0-9.]+
         */
@@ -381,7 +381,7 @@ static const char *policy_lex_string(const char *input,
                }
                *(buffer++) = *(input++);
                buflen--;
-               
+
                /*
                 *      FIXME: Print more warnings?
                 */
@@ -390,7 +390,7 @@ static const char *policy_lex_string(const char *input,
                }
        }
        *buffer = '\0';
-       
+
        *token = POLICY_LEX_BARE_WORD;
        return input;
 }
@@ -444,7 +444,7 @@ static policy_lex_t policy_lex_file(policy_lex_file_t *lexer,
                lexer->parse = fgets(lexer->buffer,
                                     sizeof(lexer->buffer),
                                     lexer->fp);
-               
+
                if (!lexer->parse) {
                        return POLICY_LEX_EOF;
                }
@@ -601,7 +601,7 @@ static int parse_print(policy_lex_file_t *lexer, policy_item_t **tail)
        this->rhs = strdup(mystring);
 
        *tail = (policy_item_t *) this;
-       
+
        return 1;
 }
 
@@ -637,7 +637,7 @@ static int parse_condition(policy_lex_file_t *lexer, policy_item_t **tail)
                        rlm_policy_free_item((policy_item_t *) this);
                        return 0;
                }
-               
+
                this->compare = POLICY_LEX_L_BRACKET;
                this->child_condition = POLICY_LEX_L_BRACKET;
                rcode = parse_condition(lexer, &(this->child));
@@ -679,9 +679,9 @@ static int parse_condition(policy_lex_file_t *lexer, policy_item_t **tail)
                                        lhs);
                                rlm_policy_free_item((policy_item_t *) this);
                                return 0;
-                               
+
                        }
-                       
+
                        /*
                         *      this->lhs set up below, after "check"
                         */
@@ -697,7 +697,7 @@ static int parse_condition(policy_lex_file_t *lexer, policy_item_t **tail)
                                        lrad_int2str(rlm_policy_tokens, token, "?"));
                                return 0;
                        }
-                       
+
                        token = policy_lex_file(lexer, 0, NULL, 0);
                        if (token != POLICY_LEX_R_BRACKET) {
                                fprintf(stderr, "%s[%d]: Expected right bracket, got \"%s\"\n",
@@ -870,7 +870,7 @@ static int parse_if(policy_lex_file_t *lexer, policy_item_t **tail)
        }
 
        *tail = (policy_item_t *) this;
-       
+
        return 1;
 }
 
@@ -926,7 +926,7 @@ static int parse_attribute_block(policy_lex_file_t *lexer,
        policy_lex_t token;
        policy_attributes_t *this;
        char buffer[32];
-       
+
        token = policy_lex_file(lexer, 0, buffer, sizeof(buffer));
        switch (token) {
        case POLICY_LEX_ASSIGN:
@@ -940,7 +940,7 @@ static int parse_attribute_block(policy_lex_file_t *lexer,
                        lrad_int2str(rlm_policy_tokens, token, "?"));
                return 0;       /* unknown */
        }
-       
+
        this = rad_malloc(sizeof(*this));
        memset(this, 0, sizeof(*this));
 
@@ -1049,7 +1049,7 @@ static int parse_module(policy_lex_file_t *lexer, policy_item_t **tail)
                snprintf(buffer, sizeof(buffer), "%s/%s",
                         radius_dir, filename);
        }
-       
+
        /*
         *      Include section calling a module.
         */
@@ -1141,7 +1141,7 @@ static int parse_statement(policy_lex_file_t *lexer, policy_item_t **tail)
                        }
                        return 0;
                        break;
-                       
+
                case POLICY_RESERVED_CONTROL:
                case POLICY_RESERVED_REQUEST:
                case POLICY_RESERVED_REPLY:
@@ -1152,21 +1152,21 @@ static int parse_statement(policy_lex_file_t *lexer, policy_item_t **tail)
                                return 1;
                        return 0;
                        break;
-                       
+
                case POLICY_RESERVED_PRINT:
                        if (parse_print(lexer, tail)) {
                                return 1;
                        }
                        return 0;
                        break;
-                       
+
                case POLICY_RESERVED_RETURN:
                        if (parse_return(lexer, tail)) {
                                return 1;
                        }
                        return 0;
                        break;
-                       
+
                case POLICY_RESERVED_MODULE:
                        if (parse_module(lexer, tail)) {
                                return 1;
@@ -1187,11 +1187,11 @@ static int parse_statement(policy_lex_file_t *lexer, policy_item_t **tail)
 
                        {
                                const DICT_ATTR *dattr;
-                               
+
                                /*
                                 *      Bare words MUST be dictionary attributes
                                 */
-                               
+
                                dattr = dict_attrbyname(lhs);
                                if (!dattr) {
                                        fprintf(stderr, "%s[%d]: Expected attribute name, got \"%s\"\n",
@@ -1203,14 +1203,14 @@ static int parse_statement(policy_lex_file_t *lexer, policy_item_t **tail)
                                             lhs);
                        }
                        break;
-                       
+
                default:
                        fprintf(stderr, "%s[%d]: Unexpected reserved word \"%s\"\n",
                                lexer->filename, lexer->lineno, lhs);
                        return 0;
                } /* switch over reserved words */
                break;
-               
+
                /*
                 *      Return from nested blocks.
                 */
@@ -1479,12 +1479,12 @@ static int parse_include(policy_lex_file_t *lexer)
        if (p) {
                strlcpy(p + 1, filename, sizeof(buffer) - 1 - (p - buffer));
 
-#ifdef HAVE_DIRENT_H   
+#ifdef HAVE_DIRENT_H
                p = strrchr(p + 1, '/');
                if (p && !p[1]) {
                        DIR             *dir;
                        struct dirent   *dp;
-                       
+
                        p++;
 
                        dir = opendir(buffer);
@@ -1494,7 +1494,7 @@ static int parse_include(policy_lex_file_t *lexer)
                                        buffer, strerror(errno));
                                return 0;
                        }
-                       
+
                        /*
                         *      Read the directory, ignoring "." files.
                         */
@@ -1524,7 +1524,7 @@ static int parse_include(policy_lex_file_t *lexer)
                snprintf(buffer, sizeof(buffer), "%s/%s",
                         radius_dir, filename);
        }
-       
+
        /*
         *      Handle one include file.
         */
@@ -1577,19 +1577,19 @@ int rlm_policy_parse(rbtree_t *policies, const char *filename)
                                        return 0;
                                }
                                break;
-                               
+
                        case POLICY_RESERVED_INCLUDE:
                                if (!parse_include(lexer)) {
                                        return 0;
                                }
                                break;
-                               
+
                        case POLICY_RESERVED_DEBUG:
                                if (!parse_debug(lexer)) {
                                        return 0;
                                }
                                break;
-                       
+
                        default:
                                fprintf(stderr, "%s[%d]: Unexpected word \"%s\"\n",
                                        lexer->filename, lexer->lineno,
index b1cd0c8..f527116 100644 (file)
@@ -202,21 +202,21 @@ void rlm_policy_free_item(policy_item_t *item)
                default:
                case POLICY_TYPE_BAD:
                        break;
-                       
+
                case POLICY_TYPE_ASSIGNMENT:
                        {
                                policy_assignment_t *this;
-                               
+
                                this = (policy_assignment_t *) item;
                                if (this->lhs) free(this->lhs);
                                if (this->rhs) free(this->rhs);
                        }
                        break;
-                       
+
                case POLICY_TYPE_CONDITIONAL:
                        {
                                policy_condition_t *this;
-                               
+
                                this = (policy_condition_t *) item;
                                if (this->lhs) free(this->lhs);
                                if (this->rhs) free(this->rhs);
@@ -227,11 +227,11 @@ void rlm_policy_free_item(policy_item_t *item)
                                }
                        }
                        break;
-                       
+
                case POLICY_TYPE_IF:
                        {
                                policy_if_t *this;
-                               
+
                                this = (policy_if_t *) item;
                                if (this->condition) {
                                        rlm_policy_free_item(this->condition);
@@ -251,7 +251,7 @@ void rlm_policy_free_item(policy_item_t *item)
                case POLICY_TYPE_ATTRIBUTE_LIST:
                        {
                                policy_attributes_t *this;
-                               
+
                                this = (policy_attributes_t *) item;
                                rlm_policy_free_item(this->attributes);
                        }
@@ -260,7 +260,7 @@ void rlm_policy_free_item(policy_item_t *item)
                case POLICY_TYPE_NAMED_POLICY:
                        {
                                policy_named_t *this;
-                               
+
                                this = (policy_named_t *) item;
                                rad_assert(this->name != NULL);
                                free(this->name);
@@ -271,19 +271,19 @@ void rlm_policy_free_item(policy_item_t *item)
                case POLICY_TYPE_CALL:
                        {
                                policy_call_t *this;
-                               
+
                                this = (policy_call_t *) item;
                                if (this->name) free(this->name);
                        }
                        break;
-                       
+
                case POLICY_TYPE_RETURN:
                        break;  /* do nothing */
 
                case POLICY_TYPE_MODULE:
                        {
                                policy_module_t *this;
-                               
+
                                this = (policy_module_t *) item;
                                if (this->cs) cf_section_free(&this->cs);
                                if (this->mc) modcallable_free(&this->mc);
index c3aa2c6..39fd012 100644 (file)
@@ -635,7 +635,7 @@ static int preprocess_detach(void *instance)
 }
 
 /* globally exported name */
-module_t rlm_preprocess = {    
+module_t rlm_preprocess = {
        RLM_MODULE_INIT,
        "preprocess",
        0,                      /* type: reserved */
index 73dde37..b8b8790 100755 (executable)
@@ -53,7 +53,7 @@ static const CONF_PARSER module_config[] = {
 
        { "key",  PW_TYPE_STRING_PTR,
          offsetof(rlm_protocol_filter_t,key), NULL, "%{Realm:-DEFAULT}"},
-       
+
        { NULL, -1, 0, NULL, NULL }             /* end the list */
 };
 
@@ -135,16 +135,16 @@ static int apply_subsection(rlm_protocol_filter_t *inst, REQUEST *request,
        CONF_PAIR *cp;
        const char *value;
        char keybuf[256];
-       
+
        DEBUG2("  rlm_protocol_filter: Found subsection %s", name);
-       
+
        cp = cf_pair_find(cs, "key");
        if (!cp) {
                radlog(L_ERR, "rlm_protocol_filter: %s[%d]: No key defined in subsection %s",
                       inst->filename, cf_section_lineno(cs), name);
                return RLM_MODULE_FAIL;
        }
-       
+
        radius_xlat(keybuf, sizeof(keybuf),
                    cf_pair_value(cp), request, NULL);
        if (!*keybuf) {
@@ -155,7 +155,7 @@ static int apply_subsection(rlm_protocol_filter_t *inst, REQUEST *request,
 
        DEBUG2("  rlm_protocol_filter: %s[%d]: subsection %s, using key %s",
               inst->filename, cf_section_lineno(cs), name, keybuf);
-                       
+
        /*
         *      And repeat some of the above code.
         */
@@ -177,7 +177,7 @@ static int apply_subsection(rlm_protocol_filter_t *inst, REQUEST *request,
                       inst->filename, cf_section_lineno(cs), name);
                return RLM_MODULE_NOOP;
        }
-       
+
        value = cf_pair_value(cp);
        sense = str2sense(value);
        if (sense < 0) {
@@ -185,7 +185,7 @@ static int apply_subsection(rlm_protocol_filter_t *inst, REQUEST *request,
                       inst->filename, cf_pair_lineno(cp), value);
                return RLM_MODULE_FAIL;
        }
-       
+
        if (!sense) return RLM_MODULE_REJECT;
 
        return RLM_MODULE_OK;
index fc27948..ea34e0d 100644 (file)
@@ -105,7 +105,7 @@ if test x"$fail" != x""; then
                AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
        else
                AC_MSG_WARN([silently not building ]modname[.])
-               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); 
+               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]);
                targetname=""
        fi
 fi
index c798f4b..861f0c3 100644 (file)
@@ -324,7 +324,7 @@ static int radutmp_accounting(void *instance, REQUEST *request)
 
        } else if (request->packet->src_ipaddr.ipaddr.ip4addr.s_addr == nas_address) {          /* might be a client, might not be. */
                RADCLIENT *cl;
-               
+
                /*
                 *      Hack like 'client_name()', but with sane
                 *      fall-back.
index 0b87cba..6670c9e 100644 (file)
@@ -255,7 +255,7 @@ static int radutmp_instantiate(CONF_SECTION *conf, void **instance)
 static int cache_reset(rlm_radutmp_t *inst, radutmp_cache_t *cache)
 {
        NAS_PORT *this, *next;
-       
+
        /*
         *      Cache is already reset, do nothing.
         */
@@ -271,7 +271,7 @@ static int cache_reset(rlm_radutmp_t *inst, radutmp_cache_t *cache)
        rbtree_free(inst->user_tree);
 
        rbtree_free(cache->nas_ports);
-       
+
        for (this = cache->free_offsets;
             this != NULL;
             this = next) {
@@ -289,9 +289,9 @@ static int cache_reset(rlm_radutmp_t *inst, radutmp_cache_t *cache)
                radlog(L_ERR, "rlm_radutmp: No memory");
                return 0;
        }
-       
+
        cache->max_offset = 0;
-       
+
        cache->cached_file = 1;
 
        if (inst->case_sensitive) {
@@ -384,7 +384,7 @@ static int offset_walk(void *context, void *data)
        if (read(walk->fd, &utmp, sizeof(utmp)) != sizeof(utmp)) {
                rad_assert(0 == 1);
        }
-       
+
        /*
         *      If the entry in the file is NEWER than the reboot
         *      packet, don't re-write it, and don't delete it.
@@ -463,7 +463,7 @@ static int radutmp_zap(rlm_radutmp_t *inst,
                radlog(L_ERR, "rlm_radutmp: Out of memory");
                return 0;
        }
-       
+
        pthread_mutex_lock(&cache->mutex);
 
        /*
@@ -544,20 +544,20 @@ static int radutmp_zap(rlm_radutmp_t *inst,
         */
        if (rbtree_num_elements(cache->nas_ports) == 0) {
                NAS_PORT        *this, *next; /* too many copies of code */
-               
+
                for (this = inst->cache.free_offsets;
                     this != NULL;
                     this = next) {
                        next = this->next;
                        free(this);
                }
-               
+
                truncate(cache->filename, 0);
                rad_assert(rbtree_num_elements(inst->user_tree) == 0);
        }
 
        pthread_mutex_unlock(&cache->mutex);
-       
+
        return 1;
 }
 
@@ -647,7 +647,7 @@ static int cache_file(rlm_radutmp_t *inst, radutmp_cache_t *cache)
                        }
 
                        /*
-                        *      It's a login record, 
+                        *      It's a login record,
                         */
                        nas_port->nas_address = utmp.nas_address;
                        nas_port->nas_port = utmp.nas_port;
@@ -680,7 +680,7 @@ static int cache_file(rlm_radutmp_t *inst, radutmp_cache_t *cache)
                        }
                        continue;
                }
-               
+
                /*
                 *      We've read a partial record.  WTF?
                 */
@@ -1011,7 +1011,7 @@ static int radutmp_accounting(void *instance, REQUEST *request)
                if (errno == ENOENT) {
                        DEBUG2("  rlm_radutmp: File %s doesn't exist, creating it.", cache->filename);
                        if (!cache_reset(inst, cache)) return RLM_MODULE_FAIL;
-                       
+
                        /*
                         *      Try to create the file.
                         */
@@ -1123,7 +1123,7 @@ static int radutmp_accounting(void *instance, REQUEST *request)
                strlcpy(user->login, utmp.login,
                        sizeof(user->login));
                user->simul_count = 1;
-               
+
                if (!rbtree_insert(inst->user_tree, user)) {
                        rad_assert(0 == 1);
                }
@@ -1131,7 +1131,7 @@ static int radutmp_accounting(void *instance, REQUEST *request)
                pthread_mutex_unlock(&cache->mutex);
 
        }
-               
+
        /*
         *      Entry was found, or newly created in the cache.
         *      Seek to the place in the file.
@@ -1187,7 +1187,7 @@ static int radutmp_accounting(void *instance, REQUEST *request)
                        rad_assert(u.type == P_LOGIN);
                        rad_assert(u.nas_address == utmp.nas_address);
                        rad_assert(u.nas_port == utmp.nas_port);
-                       
+
                        /*
                         *      An update for the same session.
                         */
index 149e87c..7375da8 100644 (file)
@@ -67,7 +67,7 @@ if test x"$fail" != x""; then
                AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
        else
                AC_MSG_WARN([silently not building ]modname[.])
-               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); 
+               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]);
                targetname=""
        fi
 fi
index e76e93d..b5221aa 100644 (file)
@@ -55,9 +55,9 @@ if test x$with_[]modname != xno; then
        AC_CONFIG_SUBDIRS($mysubdirs)
        rm install-sh
 
-       dnl # 
+       dnl #
        dnl # Don't bother looking for errors in the child directories
-       dnl # 
+       dnl #
 
        targetname=modname
 else
@@ -72,10 +72,10 @@ if test x"$fail" != x""; then
                AC_MSG_WARN([silently not building ]modname[.])
                AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.])
                if test x"$headersuggestion" != x; then
-                       AC_MSG_WARN([$headersuggestion]) 
+                       AC_MSG_WARN([$headersuggestion])
                fi
                if test x"$libsuggestion" != x; then
-                       AC_MSG_WARN([$libsuggestion]) 
+                       AC_MSG_WARN([$libsuggestion])
                fi
                targetname=""
        fi
index 1817e7b..aa6b623 100644 (file)
@@ -56,7 +56,7 @@ if test x$with_[]modname != xno; then
        else
                sql_ibmdb2_cflags="${sql_ibmdb2_cflags} ${IBMDB2_INCLUDE}"
                AC_MSG_RESULT(yes)
-  
+
                AC_MSG_CHECKING([for SQLConnect in -ldb2])
 
                old_LIBS="$LIBS"
@@ -81,7 +81,7 @@ if test x$with_[]modname != xno; then
                        AC_MSG_WARN([ibmdb2 libraries not found.  Use --with-ibmdb2-lib-dir=<path>.])
                        targetname=   # disabled module
                else
-                       AC_MSG_RESULT(yes) 
+                       AC_MSG_RESULT(yes)
                        sql_ibmdb2_ldflags="$sql_ibmdb2_ldflags $IBMDB2_LIBS"
                fi
        fi
index c1679f9..9f46b01 100644 (file)
@@ -56,7 +56,7 @@ if test x$with_[]modname != xno; then
        else
                sql_firebird_cflags="${sql_firebird_cflags} ${FIREBIRD_INCLUDE}"
                AC_MSG_RESULT(yes)
-  
+
                AC_MSG_CHECKING([for isc_attach_database -l$GDS])
 
                old_LIBS="$LIBS"
@@ -81,7 +81,7 @@ if test x$with_[]modname != xno; then
                        AC_MSG_WARN([firebird libraries not found.  Use --with-firebird-lib-dir=<path>.])
                        targetname=   # disabled module
                else
-                       AC_MSG_RESULT(yes) 
+                       AC_MSG_RESULT(yes)
                        sql_firebird_ldflags="$sql_firebird_ldflags $FIREBIRD_LIBS"
                fi
        fi
index 4468084..d7949d0 100644 (file)
@@ -60,7 +60,7 @@ dnl           FR_LOCATE_DIR(iodbc_include_dir,[isql.h])
                AC_MSG_RESULT(yes)
                AC_DEFINE(HAVE_IODBC_H)
 
-  
+
                AC_MSG_CHECKING([for SQLConnect in -liodbc])
 
                old_LIBS="$LIBS"
@@ -88,7 +88,7 @@ dnl           FR_LOCATE_DIR(iodbc_lib_dir,[libodbc.a])
                        AC_MSG_WARN([iodbc libraries not found.  Use --with-iodbc-lib-dir=<path>.])
                        targetname=   # disabled module
                else
-                       AC_MSG_RESULT(yes) 
+                       AC_MSG_RESULT(yes)
                        sql_iodbc_ldflags="$sql_iodbc_ldflags $IODBC_LIBS"
                fi
        fi
index b24be0c..9a04671 100644 (file)
@@ -66,10 +66,10 @@ if test x"$fail" != x""; then
                AC_MSG_WARN([silently not building ]modname[.])
                AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.])
                if test x"$headersuggestion" != x; then
-                       AC_MSG_WARN([$headersuggestion]) 
+                       AC_MSG_WARN([$headersuggestion])
                fi
                if test x"$libsuggestion" != x; then
-                       AC_MSG_WARN([$libsuggestion]) 
+                       AC_MSG_WARN([$libsuggestion])
                fi
                targetname=""
        fi
index 8d85390..d795f35 100644 (file)
@@ -99,7 +99,7 @@ free_result_row(rlm_sql_postgres_sock * pg_sock)
 
 /*************************************************************************
 *      Function: check_fatal_error
-*      
+*
 *      Purpose:  Check error type and behave accordingly
 *
 *************************************************************************/
@@ -108,7 +108,7 @@ static int check_fatal_error (char *errorcode)
 {
        int x = 0;
 
-       /*      
+       /*
        Check the error code to see if we should reconnect or not
        Error Code table taken from
        http://www.postgresql.org/docs/8.1/interactive/errcodes-appendix.html
@@ -121,11 +121,11 @@ static int check_fatal_error (char *errorcode)
                                return SQL_DOWN;
                        else
                                return -1;
-               }       
+               }
                x++;
        }
 
-       radlog(L_DBG, "rlm_sql_postgresql: Postgresql Fatal Error: [%s] Occurred!!", errorcode);        
+       radlog(L_DBG, "rlm_sql_postgresql: Postgresql Fatal Error: [%s] Occurred!!", errorcode);
        /*      We don't seem to have a matching error class/code */
        return -1;
 }
@@ -196,7 +196,7 @@ static int sql_query(SQLSOCK * sqlsocket, SQL_CONFIG *config, char *querystr) {
 
        rlm_sql_postgres_sock *pg_sock = sqlsocket->conn;
        int numfields = 0;
-       char *errorcode; 
+       char *errorcode;
        char *errormsg;
 
        if (config->sqltrace)
@@ -231,14 +231,14 @@ static int sql_query(SQLSOCK * sqlsocket, SQL_CONFIG *config, char *querystr) {
 
                switch (status){
 
-                       case PGRES_COMMAND_OK: 
+                       case PGRES_COMMAND_OK:
                                /*Successful completion of a command returning no data.*/
 
-                               /*affected_rows function only returns 
-                               the number of affected rows of a command 
-                               returning no data...    
+                               /*affected_rows function only returns
+                               the number of affected rows of a command
+                               returning no data...
                                */
-                               pg_sock->affected_rows  = affected_rows(pg_sock->result); 
+                               pg_sock->affected_rows  = affected_rows(pg_sock->result);
                                radlog(L_DBG, "rlm_sql_postgresql: query affected rows = %i", pg_sock->affected_rows);
                                return 0;
 
@@ -289,11 +289,11 @@ static int sql_query(SQLSOCK * sqlsocket, SQL_CONFIG *config, char *querystr) {
                        break;
 
 
-               }       
-       
+               }
+
                /*
                        Note to self ... sql_store_result returns 0 anyway
-                       after setting the sqlsocket->affected_rows.. 
+                       after setting the sqlsocket->affected_rows..
                        sql_num_fields returns 0 at worst case which means the check below
                        has a really small chance to return false..
                        lets remove it then .. yuck!!
index d729d8d..e2ac369 100644 (file)
@@ -6,9 +6,9 @@
 #include <freeradius-devel/ident.h>
 RCSIDH(sql_postgresql_h, "$Id$")
 
-/************************************************** 
+/**************************************************
 * Error Codes and required information Lookup table
-* Does this shite ever needed? Lets c.. 
+* Does this shite ever needed? Lets c..
 ***************************************************/
 typedef struct pgsql_error{
        char *errorcode;
@@ -29,7 +29,7 @@ pgerror errorcodes[]=
 
        "2000", "NO DATA", 0,
        "2001", "NO ADDITIONAL DYNAMIC RESULT SETS RETURNED", 0,
-       
+
        "3000", "SQL STATEMENT NOT YET COMPLETE", 0,
 
        "8000", "CONNECTION EXCEPTION", 0,
@@ -123,9 +123,9 @@ pgerror errorcodes[]=
 
        "2B000", "DEPENDENT PRIVILEGE DESCRIPTORS STILL EXIST", 0,
        "2BP01", "DEPENDENT OBJECTS STILL EXIST", 0,
-       
+
        "2D000", "INVALID TRANSACTION TERMINATION", 0,
-       
+
        "2F000", "SQL ROUTINE EXCEPTION", 0,
        "2F005", "FUNCTION EXECUTED NO RETURN STATEMENT", 0,
        "2F002", "MODIFYING SQL DATA NOT PERMITTED", 0,
@@ -133,7 +133,7 @@ pgerror errorcodes[]=
        "2F004", "READING SQL DATA NOT PERMITTED", 0,
 
        "34000", "INVALID CURSOR NAME", 0,
-       
+
        "38000", "EXTERNAL ROUTINE EXCEPTION", 0,
        "38001", "CONTAINING SQL NOT PERMITTED", 0,
        "38002", "MODIFYING SQL DATA NOT PERMITTED", 0,
@@ -164,7 +164,7 @@ pgerror errorcodes[]=
        "53100", "DISK FULL", 0,
        "53200", "OUT OF MEMORY", 0,
        "53300", "TOO MANY CONNECTIONS", 0,
-       
+
        "54000", "PROGRAM LIMIT EXCEEDED", 0,
        "54001", "STATEMENT TOO COMPLEX", 0,
        "54011", "TOO MANY COLUMNS", 0,
@@ -172,9 +172,9 @@ pgerror errorcodes[]=
 
        "55000", "OBJECT NOT IN PREREQUISITE STATE", 0,
        "55006", "OBJECT IN USE", 0,
-       "55P02", "CANT CHANGE RUNTIME PARAM", 0,        
+       "55P02", "CANT CHANGE RUNTIME PARAM", 0,
        "55P03", "LOCK NOT AVAILABLE", 0,
-       
+
        "57000", "OPERATOR INTERVENTION", 1,
        "57014", "QUERY CANCELED", 1,
        "57P01", "ADMIN SHUTDOWN", 1,
@@ -208,7 +208,7 @@ pgerror errorcodes[]=
        "42P01", "UNDEFINED TABLE", 0,
        "42P02", "UNDEFINED PARAMETER", 0,
        "42704", "UNDEFINED OBJECT", 0,
-       "42701", "DUPLICATE COLUMN", 0, 
+       "42701", "DUPLICATE COLUMN", 0,
        "42P03", "DUPLICATE CURSOR", 0,
        "42P04", "DUPLICATE DATABASE", 0,
        "42723", "DUPLICATE FUNCTION", 0,
index 77619ea..e21c558 100644 (file)
@@ -56,7 +56,7 @@ if test x$with_[]modname != xno; then
        else
                sql_unixodbc_cflags="${sql_unixodbc_cflags} ${UNIXODBC_INCLUDE}"
                AC_MSG_RESULT(yes)
-  
+
                AC_MSG_CHECKING([for SQLConnect in -lodbc])
 
                old_LIBS="$LIBS"
@@ -81,7 +81,7 @@ if test x$with_[]modname != xno; then
                        AC_MSG_WARN([unixODBC libraries not found.  Use --with-unixODBC-lib-dir=<path>.])
                        targetname=   # disabled module
                else
-                       AC_MSG_RESULT(yes) 
+                       AC_MSG_RESULT(yes)
                        sql_unixodbc_ldflags="$sql_unixodbc_ldflags $UNIXODBC_LIBS"
                fi
        fi
index 7183dd8..9676997 100644 (file)
@@ -356,11 +356,11 @@ static char *sql_error(SQLSOCK *sqlsocket, SQL_CONFIG *config) {
     SQLINTEGER errornum = 0;
     SQLSMALLINT length = 255;
     static char result[1024];  /* NOT thread-safe! */
-                          
+
     rlm_sql_unixodbc_sock *unixodbc_sock = sqlsocket->conn;
 
     error[0] = state[0] = '\0';
-                              
+
     SQLError(
        unixodbc_sock->env_handle,
        unixodbc_sock->dbc_handle,
@@ -393,7 +393,7 @@ static int sql_state(long err_handle, SQLSOCK *sqlsocket, SQL_CONFIG *config) {
 
     rlm_sql_unixodbc_sock *unixodbc_sock = sqlsocket->conn;
 
-    if(SQL_SUCCEEDED(err_handle))      
+    if(SQL_SUCCEEDED(err_handle))
        return 0;               /* on success, just return 0 */
 
     error[0] = state[0] = '\0';
index aab39b3..fc66dd7 100644 (file)
@@ -19,7 +19,7 @@ if test x"$fail" != x""; then
                AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
        else
                AC_MSG_WARN([silently not building ]modname[.])
-               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); 
+               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]);
                targetname=""
        fi
 fi
index e05ce6c..d17ff20 100644 (file)
@@ -18,7 +18,7 @@ if test x"$fail" != x""; then
                AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
        else
                AC_MSG_WARN([silently not building ]modname[.])
-               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); 
+               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]);
                targetname=""
        fi
 fi
index 7422495..e6d3c21 100644 (file)
@@ -46,10 +46,10 @@ typedef struct rlm_sqlippool_t {
 
        char *pool_name;
 
-       /* We ended up removing the init 
+       /* We ended up removing the init
           queries so that its up to user
           to create the db structure and put the required
-          information in there                 
+          information in there
        */
                                /* Allocation sequence */
        char *allocate_begin;   /* SQL query to begin */
@@ -90,7 +90,7 @@ typedef struct rlm_sqlippool_t {
        char *off_clear;        /* SQL query to clear an entire NAS */
        char *off_commit;       /* SQL query to commit */
        char *off_rollback;     /* SQL query to rollback */
-       
+
                                /* Logging Section */
        char *log_exists;       /* There was an ip address already assigned */
        char *log_success;      /* We successfully allocated ip address from pool */
@@ -196,7 +196,7 @@ static int sqlippool_expand(char * out, int outlen, const char * fmt, void * ins
                        /*
                         * We check if we're inside an open brace.  If we are
                         * then we assume this brace is NOT literal, but is
-                        * a closing brace and apply it 
+                        * a closing brace and apply it
                         */
                        if((c == '}') && openbraces) {
                                openbraces--;
@@ -232,7 +232,7 @@ static int sqlippool_expand(char * out, int outlen, const char * fmt, void * ins
                                *q++ = *p;
                                break;
                        case 'P': /* pool name */
-                               strlcpy(q, data->pool_name, freespace); 
+                               strlcpy(q, data->pool_name, freespace);
                                q += strlen(q);
                                break;
                        case 'I': /* IP address */
@@ -249,7 +249,7 @@ static int sqlippool_expand(char * out, int outlen, const char * fmt, void * ins
                                break;
                        case 'J': /* lease duration */
                                sprintf(tmp, "%d", data->lease_duration);
-                               strlcpy(q, tmp, freespace); 
+                               strlcpy(q, tmp, freespace);
                                q += strlen(q);
                                break;
                        default:
@@ -482,12 +482,12 @@ static int sqlippool_instantiate(CONF_SECTION * conf, void ** instance)
 
 /*
  * if we have something to log, then we log it
- * otherwise we return the retcode as soon as possible 
+ * otherwise we return the retcode as soon as possible
  */
 static int do_logging(char *str, int retcode)
 {
        if (strlen(str))
-               radlog(L_INFO,"%s", str);       
+               radlog(L_INFO,"%s", str);
        return retcode;
 }
 
@@ -530,7 +530,7 @@ static int sqlippool_postauth(void *instance, REQUEST * request)
 
                return do_logging(logstr, RLM_MODULE_NOOP);
        }
-       
+
        if (pairfind(request->packet->vps, PW_NAS_IP_ADDRESS) == NULL) {
                DEBUG("rlm_sqlippool: unknown NAS-IP-Address");
                return RLM_MODULE_NOOP;
@@ -567,7 +567,7 @@ static int sqlippool_postauth(void *instance, REQUEST * request)
                                          (char *) NULL, 0);
 
        if (allocation_len == 0)
-       {       
+       {
                /*
                 * COMMIT
                 */
@@ -576,7 +576,7 @@ static int sqlippool_postauth(void *instance, REQUEST * request)
 
                /*
                 * Should we perform pool-check ?
-                */ 
+                */
                if (data->pool_check && *data->pool_check) {
 
                        /*
@@ -593,7 +593,7 @@ static int sqlippool_postauth(void *instance, REQUEST * request)
 
                                /*
                                 * Pool exists after all... So, the failure to allocate
-                                * the IP address was most likely due to the depletion 
+                                * the IP address was most likely due to the depletion
                                 * of the pool. In that case, we should return NOTFOUND
                                 */
                                DEBUG("rlm_sqlippool: IP address could not be allocated.");
@@ -602,15 +602,15 @@ static int sqlippool_postauth(void *instance, REQUEST * request)
 
                        }
                        /*
-                        * Pool doesn't exist in the table. It may be handled by some 
+                        * Pool doesn't exist in the table. It may be handled by some
                         * other instance of sqlippool, so we should just ignore
                         * this allocation failure and return NOOP
                         */
                        DEBUG("rlm_sqlippool: IP address could not be allocated as not pool exists with that name.");
                        return RLM_MODULE_NOOP;
-               
+
                }
-               
+
                sql_release_socket(data->sql_inst, sqlsocket);
 
                DEBUG("rlm_sqlippool: IP address could not be allocated.");
@@ -619,7 +619,7 @@ static int sqlippool_postauth(void *instance, REQUEST * request)
                return do_logging(logstr, RLM_MODULE_NOOP);
        }
 
-       
+
        /*
         *  FIXME: Make it work with the ipv6 addresses
         */
@@ -634,8 +634,8 @@ static int sqlippool_postauth(void *instance, REQUEST * request)
 
                DEBUG("rlm_sqlippool: Invalid IP number [%s] returned from database query.", allocation);
                sql_release_socket(data->sql_inst, sqlsocket);
-               radius_xlat(logstr, sizeof(logstr), data->log_failed, request, NULL);   
-               
+               radius_xlat(logstr, sizeof(logstr), data->log_failed, request, NULL);
+
                return do_logging(logstr, RLM_MODULE_NOOP);
        }
 
@@ -878,7 +878,7 @@ static int sqlippool_accounting_off(void * instance, REQUEST * request)
 
 /*
  *     Check for an Accounting-Stop
- *     If we find one and we have allocated an IP to this nas/port combination, deallocate it. 
+ *     If we find one and we have allocated an IP to this nas/port combination, deallocate it.
  */
 static int sqlippool_accounting(void * instance, REQUEST * request)
 {
@@ -931,7 +931,7 @@ static int sqlippool_detach(UNUSED void *instance)
  */
 module_t rlm_sqlippool = {
        RLM_MODULE_INIT,
-       "SQL IP Pool",  
+       "SQL IP Pool",
        RLM_TYPE_THREAD_SAFE,           /* type */
        sqlippool_instantiate,          /* instantiation */
        sqlippool_detach,               /* detach */
index 9248ec5..0e5248f 100644 (file)
@@ -35,12 +35,12 @@ if test x$with_[]modname != xno; then
        if test "$ac_cv_header_pwd_h" != "yes"; then
                AC_MSG_RESULT(no pwd.h)
                [ fail=$fail" pwd.h" ]
-       fi      
+       fi
 
-       AC_CHECK_LIB(shadow, getspnam, 
-               [ 
+       AC_CHECK_LIB(shadow, getspnam,
+               [
                        unix_ldflags="${unix_ldflags} -lshadow"
-                       AC_DEFINE(HAVE_GETSPNAM) 
+                       AC_DEFINE(HAVE_GETSPNAM)
                ]
        )
 
@@ -56,7 +56,7 @@ if test x"$fail" != x""; then
                AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
        else
                AC_MSG_WARN([silently not building ]modname[.])
-               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]); 
+               AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]);
                targetname=""
        fi
 fi
index 40a6401..89833f8 100644 (file)
@@ -516,12 +516,12 @@ static int unix_accounting(void *instance, REQUEST *request)
        if (nas_address == 0) {
                RADCLIENT *cl;
                nas_address = request->packet->src_ipaddr.ipaddr.ip4addr.s_addr;
-               
+
                if ((cl = client_find_old(&request->packet->src_ipaddr)) != NULL)
                        s = cl->shortname;
        }
        if (!s || s[0] == 0) s = uue(&(nas_address));
-       
+
 #ifdef __linux__
        /*
         *      Linux has a field for the client address.