]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - src/misc-progs/syslogdctrl.c
wget: Update to 1.19.2
[ipfire-2.x.git] / src / misc-progs / syslogdctrl.c
index a470e47edbf50a61eb54d2348ebd8c1a72b739b3..52719023e445b8c05144b7f3a644383bcc967f53 100644 (file)
 #include <fcntl.h>
 #include <signal.h>
 #include <errno.h>
+
 #include "libsmooth.h"
 #include "setuid.h"
+#include "netutil.h"
 
 #define ERR_ANY 1
 #define ERR_SETTINGS 2    /* error in settings file */
 int main(void)
 {
    char buffer[STRING_SIZE], command[STRING_SIZE], hostname[STRING_SIZE];
-   char varmessages[STRING_SIZE], enable_asynclog[STRING_SIZE];
+   char varmessages[STRING_SIZE], asynclog[STRING_SIZE];
    int config_fd,rc,fd,pid;
    struct stat st;
    struct keyvalue *kv = NULL;
    memset(buffer, 0, STRING_SIZE);
    memset(hostname, 0, STRING_SIZE);
    memset(varmessages, 0, STRING_SIZE);
+   memset(asynclog, 0, STRING_SIZE);
 
    if (!(initsetuid()))
       exit(1);
@@ -64,19 +67,6 @@ int main(void)
       exit(ERR_SETTINGS);
    }
 
-   if (!findkey(kv, "ENABLE_ASYNCLOG", enable_asynclog))
-   {
-      fprintf(stderr, "Cannot read ENABLE_ASYNCLOG\n");
-      exit(ERR_SETTINGS);
-   }
-
-   
-   if (!findkey(kv, "VARMESSAGES", varmessages))
-   {
-      fprintf(stderr, "Cannot read VARMESSAGES\n");
-      exit(ERR_SETTINGS);
-   }
-
    if (strspn(hostname, VALID_FQDN) != strlen(hostname))
    {
       fprintf(stderr, "Bad REMOTELOG_ADDR: %s\n", hostname);
@@ -130,16 +120,6 @@ int main(void)
    }
    close(config_fd);
    
-   /* Replace the logging option*/
-     safe_system("grep -v '/var/log/messages' < /etc/syslog.conf.new > /etc/syslog.conf.tmp && mv /etc/syslog.conf.tmp /etc/syslog.conf.new");
-   
-   if (strcmp(enable_asynclog,"on"))
-     snprintf(command, STRING_SIZE-1, "printf '%s     -/var/log/messages' >> /etc/syslog.conf.new", varmessages );
-   else
-     snprintf(command, STRING_SIZE-1, "printf '%s     /var/log/messages' >> /etc/syslog.conf.new", varmessages );
-
-     safe_system(command);
-
    if (rename("/etc/syslog.conf.new", "/etc/syslog.conf") == -1)
    {
       perror("Unable to replace old config file");