]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
exit with 0 only if we have a successful response
authorAlan T. DeKok <aland@freeradius.org>
Wed, 18 Mar 2009 19:28:39 +0000 (20:28 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 18 Mar 2009 19:30:09 +0000 (20:30 +0100)
src/main/radclient.c
src/main/radtest.in

index 17e8f1091905a801c575723bc74b7d8e75647179..0d2df850447190f12ec1f1bda6203aaf5dc77ea1 100644 (file)
@@ -37,8 +37,9 @@ RCSID("$Id$")
 
 #include <assert.h>
 
-static int retries = 10;
-static float timeout = 3;
+static int success = 0;
+static int retries = 3;
+static float timeout = 5;
 static const char *secret = NULL;
 static int do_output = 1;
 static int totalapp = 0;
@@ -724,7 +725,12 @@ static int recv_one_packet(int wait_time)
                       radclient->reply->data_len);
                vp_printlist(stdout, radclient->reply->vps);
        }
-       if (radclient->reply->code != PW_AUTHENTICATION_REJECT) {
+
+       if ((radclient->reply->code == PW_AUTHENTICATION_ACK) ||
+           (radclient->reply->code == PW_ACCOUNTING_RESPONSE) ||
+           (radclient->reply->code == PW_COA_ACK) ||
+           (radclient->reply->code == PW_DISCONNECT_ACK)) {
+               success = 1;            /* have a good response */
                totalapp++;
        } else {
                totaldeny++;
@@ -1186,5 +1192,7 @@ int main(int argc, char **argv)
                printf("\t       Total lost auths:  %d\n", totallost);
        }
 
-       return 0;
+       if (success) return 0;
+
+       return 1;
 }
index dc46cf00b71e2c24cdcedc94630b8db7d7f6f0b2..60248a55711dd0f5a53ee142f25bfd9735f92ec1 100644 (file)
@@ -52,3 +52,4 @@ fi
        fi
 ) | $radclient $DICTIONARY -x $3 auth $5
 
+exit $?