]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
don't run blank commands
authorAlan T. DeKok <aland@freeradius.org>
Tue, 24 Dec 2019 19:14:37 +0000 (14:14 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 24 Dec 2019 19:17:23 +0000 (14:17 -0500)
src/modules/proto_control/radmin.c

index b9312c66c66f9cb639d4d1e3f637be37594b0bfe..301ccbd54518229e50dc5626cf74aff346651ee8 100644 (file)
@@ -328,6 +328,10 @@ static ssize_t run_command(int fd, char const *command,
                           char *buffer, size_t bufsize)
 {
        ssize_t r;
+       char const *p = command;
+
+       fr_skip_whitespace(p);
+       if (!*p) return FR_CONDUIT_SUCCESS;
 
        if (echo) {
                fprintf(stdout, "%s\n", command);
@@ -336,7 +340,7 @@ static ssize_t run_command(int fd, char const *command,
        /*
         *      Write the text to the socket.
         */
-       r = fr_conduit_write(fd, FR_CONDUIT_STDIN, command, strlen(command));
+       r = fr_conduit_write(fd, FR_CONDUIT_STDIN, p, strlen(p));
        if (r <= 0) return r;
 
        return flush_conduits(fd, buffer, bufsize);