Previous commit not quite right - Better to check for undefined filter code
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 3 Nov 2015 03:22:07 +0000 (22:22 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 3 Nov 2015 03:23:20 +0000 (22:23 -0500)
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

src/main/radclient.c

index bd605e5..7594ed4 100644 (file)
@@ -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]);