From: Alan T. DeKok Date: Wed, 15 Feb 2023 17:43:16 +0000 (-0500) Subject: Revert "remove unused dynamic client code" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=932c20809ba529e78c4ba61ec4449cacd13af782;p=thirdparty%2Ffreeradius-server.git Revert "remove unused dynamic client code" This reverts commit fc7fac717e9188259f613f57624294b2f6c4de48. --- diff --git a/src/listen/tacacs/proto_tacacs.c b/src/listen/tacacs/proto_tacacs.c index f40649fcbf6..80ce2451f98 100644 --- a/src/listen/tacacs/proto_tacacs.c +++ b/src/listen/tacacs/proto_tacacs.c @@ -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;