From: Arran Cudbard-Bell Date: Tue, 3 Nov 2015 03:22:07 +0000 (-0500) Subject: Previous commit not quite right - Better to check for undefined filter code X-Git-Tag: release_3_0_11~183 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=56ffdec6605ec484f522d32a6aa0e73334ed3035;p=thirdparty%2Ffreeradius-server.git Previous commit not quite right - Better to check for undefined filter code So this still works: echo "Message-Authenticator = 0x00, User-Name = foo" | ./build/bin/radclient 127.0.0.1 status testing123 Sent Status-Server Id 187 from 0.0.0.0:52237 to 127.0.0.1:1812 length 43 Received Access-Accept Id 187 from 127.0.0.1:1812 to 0.0.0.0:0 length 20 shinyhead:freeradius-server-fork arr2036$ echo "Response-Packet-Type == Access-Reject, Message-Authenticator = 0x00, User-Name = foo" | ./build/bin/radclient 127.0.0.1 status testing123 Sent Status-Server Id 126 from 0.0.0.0:52293 to 127.0.0.1:1812 length 43 Received Access-Accept Id 126 from 127.0.0.1:1812 to 0.0.0.0:0 length 20 (0) -: Expected Access-Reject got Access-Accept --- diff --git a/src/main/radclient.c b/src/main/radclient.c index bd605e59ad7..7594ed4926e 100644 --- a/src/main/radclient.c +++ b/src/main/radclient.c @@ -635,7 +635,7 @@ static int radclient_init(TALLOC_CTX *ctx, rc_file_pair_t *files) break; default: - request->filter_code = PW_CODE_MAX; + request->filter_code = PW_CODE_UNDEFINED; break; } break; @@ -1111,12 +1111,8 @@ static int recv_one_packet(int wait_time) /* * If we had an expected response code, check to see if the * packet matched that. - * - * Except for Status-Server, where we don't care what the - * reply is. Just that we GOT a reply. */ - if ((request->packet->code != PW_CODE_STATUS_SERVER) && - (request->reply->code != request->filter_code)) { + if ((request->filter_code != PW_CODE_UNDEFINED) && (request->reply->code != request->filter_code)) { if (is_radius_code(request->reply->code)) { REDEBUG("%s: Expected %s got %s", request->name, fr_packet_codes[request->filter_code], fr_packet_codes[request->reply->code]);