int main(void)
{
- char buffer[STRING_SIZE], hostname[STRING_SIZE], varmessages[STRING_SIZE];
+ char buffer[STRING_SIZE], command[STRING_SIZE], hostname[STRING_SIZE], varmessages[STRING_SIZE];
int config_fd,rc,fd,pid;
struct stat st;
struct keyvalue *kv = NULL;
snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e 's/^#\\?\\(\\*\\.\\*[[:blank:]]\\+@\\).\\+$/\\1%s/' /etc/syslog.conf >&%d", hostname, config_fd );
else
snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e 's/^#\\?\\(\\*\\.\\*[[:blank:]]\\+@.\\+\\)$/#\\1/' /etc/syslog.conf >&%d", config_fd );
-
- snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e 's#\\.\\*/var/log/messages\\.\\*#%s /var/log/messages#' /etc/syslog.conf >&%d", varmessages, config_fd );
- /* if the return code isn't 0 failsafe */
+ /* if the return code isn't 0 failsafe */
if ((rc = unpriv_system(buffer,99,99)) != 0)
{
fprintf(stderr, "sed returned bad exit code: %d\n", rc);
exit(ERR_CONFIG);
}
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");
+ 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");
&General::readhash("${General::swroot}/proxy/advanced/settings", \%proxysettings);
if ($proxysettings{'UPSTREAM_PROXY'}) {
- logger("DOWNLOAD INFO: Upstream proxy: \"$proxysettings{'UPSTREAM_PROXY'}\"") unless ($bfile =~ /^counter\?.*/);
+ logger("DOWNLOAD INFO: Upstream proxy: \"$proxysettings{'UPSTREAM_PROXY'}\"") unless ($bfile =~ /^counter.py\?.*/);
if ($proxysettings{'UPSTREAM_USER'}) {
$ua->proxy("http","http://$proxysettings{'UPSTREAM_USER'}:$proxysettings{'UPSTREAM_PASSWORD'}@"."$proxysettings{'UPSTREAM_PROXY'}/");
- logger("DOWNLOAD INFO: Logging in with: \"$proxysettings{'UPSTREAM_USER'}\" - \"$proxysettings{'UPSTREAM_PASSWORD'}\"") unless ($bfile =~ /^counter\?.*/);
+ logger("DOWNLOAD INFO: Logging in with: \"$proxysettings{'UPSTREAM_USER'}\" - \"$proxysettings{'UPSTREAM_PASSWORD'}\"") unless ($bfile =~ /^counter.py\?.*/);
} else {
$ua->proxy("http","http://$proxysettings{'UPSTREAM_PROXY'}/");
}
my $url = "http://$host/$file";
my $response;
- unless ($bfile =~ /^counter\?.*/) {
+ unless ($bfile =~ /^counter.py\?.*/) {
my $result = $ua->head($url);
my $remote_headers = $result->headers;
$total_size = $remote_headers->content_length;
}
if ($response->is_success) {
- unless ($bfile =~ /^counter\?.*/) {
+ unless ($bfile =~ /^counter.py\?.*/) {
if (open(FILE, ">$Conf::tmpdir/$bfile")) {
print FILE $final_data;
close(FILE);
my $return = system("cd $Conf::tmpdir && NAME=$pak ./install.sh >> $Conf::logdir/install-$pak.log 2>&1");
$return %= 255;
if ($pakfiresettings{'UUID'} ne "off") {
- fetchfile("cgi-bin/counter?ver=$Conf::version&uuid=$Conf::uuid&ipak=$pak&return=$return", "$Conf::mainserver");
+ fetchfile("counter.py?ver=$Conf::version&uuid=$Conf::uuid&ipak=$pak&return=$return", "$Conf::mainserver");
}
if ($return == 0) {
move("$Conf::tmpdir/ROOTFILES", "$Conf::dbdir/rootfiles/$pak");
my $return = system("cd $Conf::tmpdir && NAME=$pak ./update.sh >> $Conf::logdir/update-$pak.log 2>&1");
$return %= 255;
if ($pakfiresettings{'UUID'} ne "off") {
- fetchfile("cgi-bin/counter?ver=$Conf::version&uuid=$Conf::uuid&upak=$pak&return=$return", "$Conf::mainserver");
+ fetchfile("counter.py?ver=$Conf::version&uuid=$Conf::uuid&upak=$pak&return=$return", "$Conf::mainserver");
}
if ($return == 0) {
move("$Conf::tmpdir/ROOTFILES", "$Conf::dbdir/rootfiles/$pak");
my $return = system("cd $Conf::tmpdir && NAME=$pak ./uninstall.sh >> $Conf::logdir/uninstall-$pak.log 2>&1");
$return %= 255;
if ($pakfiresettings{'UUID'} ne "off") {
- fetchfile("cgi-bin/counter?ver=$Conf::version&uuid=$Conf::uuid&dpak=$pak&return=$return", "$Conf::mainserver");
+ fetchfile("counter.py?ver=$Conf::version&uuid=$Conf::uuid&dpak=$pak&return=$return", "$Conf::mainserver");
}
if ($return == 0) {
open(FILE, "<$Conf::dbdir/rootfiles/$pak");
$Conf::uuid = `cat $Conf::dbdir/uuid`;
}
logger("Sending my uuid: $Conf::uuid");
- fetchfile("cgi-bin/counter?ver=$Conf::version&uuid=$Conf::uuid", "$Conf::mainserver");
+ fetchfile("counter.py?ver=$Conf::version&uuid=$Conf::uuid", "$Conf::mainserver");
system("rm -f $Conf::tmpdir/counter* 2>/dev/null");
}
}