]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Revert "remove unused dynamic client code"
authorAlan T. DeKok <aland@freeradius.org>
Wed, 15 Feb 2023 17:43:16 +0000 (12:43 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 15 Feb 2023 17:43:25 +0000 (12:43 -0500)
This reverts commit fc7fac717e9188259f613f57624294b2f6c4de48.

src/listen/tacacs/proto_tacacs.c

index f40649fcbf66951eb318b98e95f0c794f1b0ec16..80ce2451f98f61e46829040d3dd32a95daacb401 100644 (file)
@@ -379,6 +379,38 @@ static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buf
                return 1;
        }
 
+       client = address->radclient;
+       fr_assert(client);
+
+       /*
+        *      Dynamic client stuff
+        */
+       if (client->dynamic && !client->active) {
+               RADCLIENT *new_client;
+
+               fr_assert(buffer_len >= sizeof(client));
+
+               /*
+                *      Allocate the client.  If that fails, send back a NAK.
+                *
+                *      @todo - deal with NUMA zones?  Or just deal with this
+                *      client being in different memory.
+                *
+                *      Maybe we should create a CONF_SECTION from the client,
+                *      and pass *that* back to mod_write(), which can then
+                *      parse it to create the actual client....
+                */
+               new_client = client_afrom_request(NULL, request);
+               if (!new_client) {
+                       PERROR("Failed creating new client");
+                       buffer[0] = true;
+                       return 1;
+               }
+
+               memcpy(buffer, &new_client, sizeof(new_client));
+               return sizeof(new_client);
+       }
+
        /*
         *      If the app_io encodes the packet, then we don't need
         *      to do that.
@@ -388,9 +420,6 @@ static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buf
                if (data_len > 0) return data_len;
        }
 
-       client = address->radclient;
-       fr_assert(client);
-
        secret = client->secret;
        if (secret) secretlen = talloc_array_length(client->secret) - 1;