From: Alan T. DeKok Date: Wed, 18 Mar 2009 19:28:39 +0000 (+0100) Subject: exit with 0 only if we have a successful response X-Git-Tag: release_2_1_7~231 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8cfdedfd628e014ade5cbbf9a6f7984e67d5826d;p=thirdparty%2Ffreeradius-server.git exit with 0 only if we have a successful response --- diff --git a/src/main/radclient.c b/src/main/radclient.c index 17e8f109190..0d2df850447 100644 --- a/src/main/radclient.c +++ b/src/main/radclient.c @@ -37,8 +37,9 @@ RCSID("$Id$") #include -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; } diff --git a/src/main/radtest.in b/src/main/radtest.in index dc46cf00b71..60248a55711 100644 --- a/src/main/radtest.in +++ b/src/main/radtest.in @@ -52,3 +52,4 @@ fi fi ) | $radclient $DICTIONARY -x $3 auth $5 +exit $?