Merge branch 'v3.0.x' into tr-integ
[freeradius.git] / src / main / process.c
index 1e057fe..ee10481 100644 (file)
@@ -2214,7 +2214,7 @@ static int process_proxy_reply(REQUEST *request, RADIUS_PACKET *reply)
        /*
         *      There may be a proxy reply, but it may be too late.
         */
-       if (!request->proxy_listener) return 0;
+       if (!request->home_server->server && !request->proxy_listener) return 0;
 
        /*
         *      Delete any reply we had accumulated until now.
@@ -2252,21 +2252,26 @@ static int process_proxy_reply(REQUEST *request, RADIUS_PACKET *reply)
 
        if (reply) {
                VERIFY_PACKET(reply);
-               /*
-                *      Decode the packet.
-                */
-               rcode = request->proxy_listener->decode(request->proxy_listener, request);
-               DEBUG_PACKET(request, reply, 0);
 
                /*
-                *      Pro-actively remove it from the proxy hash.
-                *      This is later than in 2.1.x, but it means that
-                *      the replies are authenticated before being
-                *      removed from the hash.
+                *      Decode the packet if required.
                 */
-               if ((rcode == 0) &&
-                   (request->num_proxied_requests <= request->num_proxied_responses)) {
-                       remove_from_proxy_hash(request);
+               if (request->proxy_listener) {
+                       rcode = request->proxy_listener->decode(request->proxy_listener, request);
+                       DEBUG_PACKET(request, reply, 0);
+
+                       /*
+                        *      Pro-actively remove it from the proxy hash.
+                        *      This is later than in 2.1.x, but it means that
+                        *      the replies are authenticated before being
+                        *      removed from the hash.
+                        */
+                       if ((rcode == 0) &&
+                           (request->num_proxied_requests <= request->num_proxied_responses)) {
+                               remove_from_proxy_hash(request);
+                       }
+               } else {
+                       rad_assert(!request->in_proxy_hash);
                }
        } else {
                remove_from_proxy_hash(request);
@@ -4272,6 +4277,7 @@ static int event_new_fd(rad_listen_t *this)
        if (this->status == RAD_LISTEN_STATUS_INIT) {
                listen_socket_t *sock = this->data;
 
+               rad_assert(sock != NULL);
                if (just_started) {
                        DEBUG("Listening on %s", buffer);
 
@@ -4320,6 +4326,8 @@ static int event_new_fd(rad_listen_t *this)
                 */
                case RAD_LISTEN_PROXY:
 #ifdef WITH_TCP
+                       rad_assert(sock->home != NULL);
+
                        /*
                         *      Add timers to outgoing child sockets, if necessary.
                         */