"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "web/ackinfo.c" between
xymon-4.3.28.tar.gz and xymon-4.3.29.tar.gz

About: Xymon is a system for monitoring servers, applications and networks (like Big Brother; former name "hobbit").

ackinfo.c  (xymon-4.3.28):ackinfo.c  (xymon-4.3.29)
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* Xymon CGI for sending in an "ackinfo" message. */ /* Xymon CGI for sending in an "ackinfo" message. */
/* */ /* */
/* Copyright (C) 2005-2011 Henrik Storner <henrik@storner.dk> */ /* Copyright (C) 2005-2011 Henrik Storner <henrik@storner.dk> */
/* */ /* */
/* This program is released under the GNU General Public License (GPL), */ /* This program is released under the GNU General Public License (GPL), */
/* version 2. See the file "COPYING" for details. */ /* version 2. See the file "COPYING" for details. */
/* */ /* */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
static char rcsid[] = "$Id: ackinfo.c 7949 2016-03-03 23:44:55Z jccleaver $"; static char rcsid[] = "$Id: ackinfo.c 7949M 2019-07-23 14:46:51Z (local) $";
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <time.h> #include <time.h>
#include <limits.h> #include <limits.h>
#include <ctype.h> #include <ctype.h>
#include "libxymon.h" #include "libxymon.h"
skipping to change at line 65 skipping to change at line 65
} }
cwalk = cwalk->next; cwalk = cwalk->next;
} }
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int argi; int argi;
char *envarea = NULL; char *envarea = NULL;
char *xymonmsg; SBUF_DEFINE(xymonmsg);
for (argi = 1; (argi < argc); argi++) { for (argi = 1; (argi < argc); argi++) {
if (argnmatch(argv[argi], "--env=")) { if (argnmatch(argv[argi], "--env=")) {
char *p = strchr(argv[argi], '='); char *p = strchr(argv[argi], '=');
loadenv(p+1, envarea); loadenv(p+1, envarea);
} }
else if (argnmatch(argv[argi], "--area=")) { else if (argnmatch(argv[argi], "--area=")) {
char *p = strchr(argv[argi], '='); char *p = strchr(argv[argi], '=');
envarea = strdup(p+1); envarea = strdup(p+1);
} }
skipping to change at line 125 skipping to change at line 125
/* Get the login username */ /* Get the login username */
if (!ackedby) ackedby = getenv("REMOTE_USER"); if (!ackedby) ackedby = getenv("REMOTE_USER");
if (!ackedby) ackedby = "UnknownUser"; if (!ackedby) ackedby = "UnknownUser";
if (validity == -1) validity = 30; /* 30 minutes */ if (validity == -1) validity = 30; /* 30 minutes */
validity = validity*60; validity = validity*60;
p = strchr(ackmsg, '\n'); if (p) *p = '\0'; p = strchr(ackmsg, '\n'); if (p) *p = '\0';
/* ackinfo HOST.TEST\nlevel\nvaliduntil\nackedby\nmsg */ /* ackinfo HOST.TEST\nlevel\nvaliduntil\nackedby\nmsg */
xymonmsg = (char *)malloc(1024 + strlen(hostname) + strlen(testna SBUF_MALLOC(xymonmsg, 1024 + strlen(hostname) + strlen(testname)
me) + strlen(ackedby) + strlen(ackmsg)); + strlen(ackedby) + strlen(ackmsg));
sprintf(xymonmsg, "ackinfo %s.%s\n%d\n%d\n%s\n%s\n", snprintf(xymonmsg, xymonmsg_buflen, "ackinfo %s.%s\n%d\n%d\n%s\n%
s\n",
hostname, testname, level, validity, ackedby, ackmsg); hostname, testname, level, validity, ackedby, ackmsg);
sendmessage(xymonmsg, NULL, XYMON_TIMEOUT, NULL); sendmessage(xymonmsg, NULL, XYMON_TIMEOUT, NULL);
} }
else { else {
xymonmsg = (char *)malloc(1024 + (hostname ? strlen(hostname) : 9 ) + (testname ? strlen(testname) : 9) + (ackmsg ? strlen(ackmsg) : 9)); xymonmsg = (char *)malloc(1024 + (hostname ? strlen(hostname) : 9 ) + (testname ? strlen(testname) : 9) + (ackmsg ? strlen(ackmsg) : 9));
sprintf(xymonmsg, "error in input params: hostname=%s, testname=% s, ackmsg=%s, validity=%d\n", snprintf(xymonmsg, xymonmsg_buflen, "error in input params: hostn ame=%s, testname=%s, ackmsg=%s, validity=%d\n",
(hostname ? hostname : "<unknown>"), (testname ? testname : "<unknown>"), (ackmsg ? ackmsg : "<unknown>"), validity); (hostname ? hostname : "<unknown>"), (testname ? testname : "<unknown>"), (ackmsg ? ackmsg : "<unknown>"), validity);
} }
fprintf(stdout, "Content-type: %s\n", xgetenv("HTMLCONTENTTYPE")); fprintf(stdout, "Content-type: %s\n", xgetenv("HTMLCONTENTTYPE"));
fprintf(stdout, "Location: %s\n", getenv("HTTP_REFERER")); fprintf(stdout, "Location: %s\n", getenv("HTTP_REFERER"));
fprintf(stdout, "\n"); fprintf(stdout, "\n");
fprintf(stdout, "Sent to xymond:\n%s\n", htmlquoted(xymonmsg)); fprintf(stdout, "Sent to xymond:\n%s\n", htmlquoted(xymonmsg));
return 0; return 0;
} }
 End of changes. 4 change blocks. 
6 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)