]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
keep a copy of the entire input buffer
authorAlan T. DeKok <aland@freeradius.org>
Thu, 12 Jul 2018 17:28:35 +0000 (13:28 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 12 Jul 2018 17:28:56 +0000 (13:28 -0400)
src/main/radmin.c

index 27fb5a0f13a324b4fff2d5594b1e5e032a1ffcdd..b9f234998cf3dd32a6a0b48724844c2e2eaa442f 100644 (file)
@@ -129,6 +129,7 @@ static void add_history(UNUSED char *line)
 #endif
 
 static fr_cmd_t *radmin_cmd = NULL;
+static char *radmin_buffer = NULL;
 
 #define CMD_MAX_ARGV (32)
 #define CMD_MAX_EXPANSIONS (128)
@@ -200,6 +201,7 @@ static void *fr_radmin(UNUSED void *input_ctx)
        ctx = talloc_init("radmin");
 
        size = room = 8192;
+       radmin_buffer = talloc_array(ctx, char, size);
        argv_buffer = talloc_array(ctx, char, size);
        current_str = argv_buffer;
 
@@ -280,6 +282,15 @@ static void *fr_radmin(UNUSED void *input_ctx)
                 *      the current context.
                 */
                strlcpy(current_str, line, room);
+
+               /*
+                *      Keep a copy of the full string entered.
+                */
+               if (current_str > argv_buffer) {
+                       radmin_buffer[(current_str - argv_buffer) - 1] = ' ';
+               }
+               strlcpy(radmin_buffer + (current_str - argv_buffer), line, room);
+
                argc = fr_command_str_to_argv(radmin_cmd, info, current_str);
 
                /*
@@ -377,6 +388,7 @@ static void *fr_radmin(UNUSED void *input_ctx)
        }
 
        talloc_free(ctx);
+       radmin_buffer = NULL;
 
        return NULL;
 }