]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
don't save exit / quit / secret / etc. in history file
authorAlan T. DeKok <aland@freeradius.org>
Tue, 3 Sep 2019 17:57:16 +0000 (13:57 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 3 Sep 2019 19:44:31 +0000 (15:44 -0400)
src/modules/proto_control/radmin.c

index f095ed9c33e6a99e7b074054e43956260ed68f42..ecc1691a696938cad2de33fda11b91953ae4292f 100644 (file)
@@ -995,11 +995,6 @@ int main(int argc, char **argv)
 
                if (!*line) goto next;
 
-               if (!quiet) {
-                       add_history(line);
-                       write_history(history_file);
-               }
-
                if (strcmp(line, "reconnect") == 0) {
                        if (do_connect(&sockfd, file, server) < 0) exit(EXIT_FAILURE);
                        goto next;
@@ -1049,6 +1044,20 @@ int main(int argc, char **argv)
                } else if (len == FR_CONDUIT_FAIL) {
                        fprintf(stderr, "Failed running command\n");
                        exit_status = EXIT_FAILURE;
+
+               } else if (len == FR_CONDUIT_PARTIAL) {
+                       fprintf(stdout, "WARNING: Ignoring partial command.\n");
+
+               } else {
+                       /*
+                        *      Add only successful commands to the history.
+                        *
+                        *      Don't add exit / quit / secret / etc.
+                        */
+                       if (!quiet) {
+                               add_history(line);
+                               write_history(history_file);
+                       }
                }
 
                /*