<br><font size=2 face="sans-serif">Hello,</font>
<br>
<br><font size=2 face="sans-serif">i tryed to implement the Hack from Evan
into the C Source of then Nagios cmd.c File described in the Thread http://www.gossamer-threads.com/lists/rt/users/45186#45186</font>
<br>
<br><font size=2 face="sans-serif">I have only a little knowledge
of C , so i became a compiler Error.</font>
<br>
<br><font size=2 face="sans-serif">gcc -g -O2 -DHAVE_CONFIG_H -DNSCGI -o
cmd.cgi cmd.c extcmd_list.o getcgi.o cgiutils.o cgiauth.o macros-cgi.o
skiplist.o objects-cgi.o xobjects-cgi.o statusdata-cgi.o xstatusdata-cgi.o
comments-cgi.o downtime-cgi.o </font>
<br><font size=2 face="sans-serif">cmd.c: In function ‘make_ticket’:</font>
<br><font size=2 face="sans-serif">cmd.c:325: error: lvalue required as
left operand of assignment</font>
<br><font size=2 face="sans-serif">cmd.c:329: warning: passing argument
1 of ‘fgets’ from incompatible pointer type</font>
<br><font size=2 face="sans-serif">cmd.c:330: warning: passing argument
1 of ‘sprintf’ from incompatible pointer type</font>
<br><font size=2 face="sans-serif">cmd.c: In function ‘request_command_data’:</font>
<br><font size=2 face="sans-serif">cmd.c:1031: warning: passing argument
1 of ‘sprintf’ from incompatible pointer type</font>
<br><font size=2 face="sans-serif">cmd.c:1032: warning: passing argument
1 of ‘sprintf’ from incompatible pointer type</font>
<br><font size=2 face="sans-serif">cmd.c:1033: warning: passing argument
2 of ‘make_ticket’ from incompatible pointer type</font>
<br><font size=2 face="sans-serif">cmd.c:1033: warning: passing argument
3 of ‘make_ticket’ from incompatible pointer type</font>
<br><font size=2 face="sans-serif">cmd.c:1033: warning: passing argument
4 of ‘make_ticket’ from incompatible pointer type</font>
<br><font size=2 face="sans-serif">cmd.c:1035: warning: passing argument
1 of ‘strtok’ from incompatible pointer type</font>
<br><font size=2 face="sans-serif">cmd.c:1035: error: lvalue required as
left operand of assignment</font>
<br><font size=2 face="sans-serif">cmd.c:1036: error: lvalue required as
left operand of assignment</font>
<br><font size=2 face="sans-serif">cmd.c:1037: error: lvalue required as
left operand of assignment</font>
<br><font size=2 face="sans-serif">cmd.c:1038: warning: passing argument
1 of ‘sprintf’ from incompatible pointer type</font>
<br><font size=2 face="sans-serif">cmd.c:1039: warning: passing argument
1 of ‘sprintf’ from incompatible pointer type</font>
<br><font size=2 face="sans-serif">cmd.c:1040: warning: passing argument
1 of ‘snprintf’ from incompatible pointer type</font>
<br><font size=2 face="sans-serif">cmd.c:1044: warning: passing argument
1 of ‘snprintf’ from incompatible pointer type</font>
<br>
<br>
<br><font size=2 face="sans-serif">Have anyone a correct cmd.c file for
me, or have any suggestions ?</font>
<br>
<br><font size=2 face="sans-serif">Following Lines are added to the cmd.c
file :</font>
<br>
<br><font size=2 face="sans-serif"> 104 int subject(char *);</font>
<br><font size=2 face="sans-serif"> 105 int rt_comment(char *);</font>
<br><font size=2 face="sans-serif"> 106 int temp_rt_ticket_num(char
*);</font>
<br><font size=2 face="sans-serif"> 107 int temp_rt_comment(char *);</font>
<br><font size=2 face="sans-serif"> 108 int nagios_rt_comment(char
*);</font>
<br><font size=2 face="sans-serif"> 109 int temp_rt_ticket_num(char
*);</font>
<br><font size=2 face="sans-serif"> 110 int command_buffer(char *);</font>
<br><font size=2 face="sans-serif"> 111 int current_time(char *);</font>
<br><font size=2 face="sans-serif"> 112 int ticket_result(char *);</font>
<br><font size=2 face="sans-serif"> 113 int result(char *);</font>
<br>
<br>
<br><font size=2 face="sans-serif"> 311 int make_ticket(char * username,
char * subject, char * rt_comment, char * ticket_result)</font>
<br><font size=2 face="sans-serif"> 312 </font>
<br><font size=2 face="sans-serif"> 313 {</font>
<br><font size=2 face="sans-serif"> 314 char rt_command[300];</font>
<br><font size=2 face="sans-serif"> 315 char owner[100];</font>
<br><font size=2 face="sans-serif"> 316 FILE * temp_pipe;</font>
<br><font size=2 face="sans-serif"> 317 char requestor[40];</font>
<br><font size=2 face="sans-serif"> 318 sprintf (requestor, "%s
[at] mycompany", owner);</font>
<br><font size=2 face="sans-serif"> 319 sprintf (rt_command,"/opt/rt3/bin/rt
create -t ticket set status=new subject='%s' owner='%s' queue='Alarms'
requestors='%s' adm</font>
<br><font size=2 face="sans-serif"> incc='supervisor
[at] mycompany' priority='99'", subject,owner,requestor);</font>
<br><font size=2 face="sans-serif"> 320 </font>
<br><font size=2 face="sans-serif"> 321 /* Create the ticket */</font>
<br><font size=2 face="sans-serif"> 322 temp_pipe = popen(rt_command,"r");</font>
<br><font size=2 face="sans-serif"> 323 if (!temp_pipe)</font>
<br><font size=2 face="sans-serif"> 324 {</font>
<br><font size=2 face="sans-serif"> 325 result = "Failed to create
Ticket";</font>
<br><font size=2 face="sans-serif"> 326 }</font>
<br><font size=2 face="sans-serif"> 327 else</font>
<br><font size=2 face="sans-serif"> 328 {</font>
<br><font size=2 face="sans-serif"> 329 fgets(result, 300, temp_pipe);</font>
<br><font size=2 face="sans-serif"> 330 sprintf (result, "%s",
result);</font>
<br><font size=2 face="sans-serif"> 331 }</font>
<br><font size=2 face="sans-serif"> 332 }</font>
<br>
<br><font size=2 face="sans-serif">1027 </font>
<br><font size=2 face="sans-serif">1028 if (do_make_ticket)</font>
<br><font size=2 face="sans-serif">1029 {</font>
<br><font size=2 face="sans-serif">1030 /* create a ticket in request tracker
*/</font>
<br><font size=2 face="sans-serif">1031 sprintf (subject, "Alarm for
%s", host_name);</font>
<br><font size=2 face="sans-serif">1032 sprintf (rt_comment, "%s",
comment_data);</font>
<br><font size=2 face="sans-serif">1033 make_ticket (current_authdata.username,subject,rt_comment,
ticket_result);</font>
<br><font size=2 face="sans-serif">1034 printf ("<CENTER><B>%s</B></CENTER><BR>\n",ticket_result);</font>
<br><font size=2 face="sans-serif">1035 temp_rt_ticket_num = strtok (ticket_result,"
");</font>
<br><font size=2 face="sans-serif">1036 temp_rt_ticket_num = strtok (NULL,"
");</font>
<br><font size=2 face="sans-serif">1037 temp_rt_ticket_num = strtok (NULL,"
");</font>
<br><font size=2 face="sans-serif">1038 sprintf (temp_rt_comment,"
Ticket #%s acknowledged by %s", temp_rt_ticket_num,current_authdata.username);</font>
<br><font size=2 face="sans-serif">1039 sprintf (nagios_rt_comment, "%s
%s", comment_data,temp_rt_comment);</font>
<br><font size=2 face="sans-serif">1040 snprintf(command_buffer,sizeof(command_buffer)-1,"[%lu]ACKNOWLEDGE_HOST_PROBLEM;%s;%d;%d;%d;%s;%s\n",current_time,host_name,(st</font>
<br><font size=2 face="sans-serif"> icky_ack==TRUE)?ACKNOWLEDGEMENT_STICKY:ACKNOWLEDGEMENT_NORMAL,(send_notification==TRUE)?1:0,(persistent_comment==TRUE)?1:0,comm</font>
<br><font size=2 face="sans-serif"> ent_author,nagios_rt_comment);</font>
<br><font size=2 face="sans-serif">1041 }</font>
<br><font size=2 face="sans-serif">1042 else</font>
<br><font size=2 face="sans-serif">1043 {</font>
<br><font size=2 face="sans-serif">1044 snprintf(command_buffer,sizeof(command_buffer)-1,"[%lu]ACKNOWLEDGE_HOST_PROBLEM;%s;%d;%d;%d;%s;%s\n",current_time,host_name,(st</font>
<br><font size=2 face="sans-serif"> icky_ack==TRUE)?ACKNOWLEDGEMENT_STICKY:ACKNOWLEDGEMENT_NORMAL,(send_notification==TRUE)?1:0,(persistent_comment==TRUE)?1:0,comm</font>
<br><font size=2 face="sans-serif"> ent_author,comment_data);</font>
<br><font size=2 face="sans-serif">1045 }</font>
<br><font size=2 face="sans-serif">1046 break;</font>
<br><font size=2 face="sans-serif">1047 </font>
<br>
<br>
<br>
<br><font size=2 face="sans-serif">Thank you</font>
<br>
<br><font size=2 face="sans-serif">Greetings from Germany</font>
<br><font size=2 face="sans-serif">Ingo von Itter</font>
<br>
<br>
<br><font size="2">_______________________________________________________________________</font><br>
<font size="2">Geschäftsführer: Rolf Herzog, Thomas Benk</font><br>
<font size="2">AGES Maut System GmbH & Co. KG</font><br>
<font size="2">AG Düsseldorf HRA 14045, USt-IdNr.: DE 202525868</font><br>
<font size="2">AGES International GmbH & Co. KG</font><br>
<font size="2">AG Düsseldorf HRA 16636, USt-IdNr.: DE 813749831</font><br>
<font size="2">AGES ETS GmbH</font><br>
<font size="2">AG Düsseldorf HRB 55580, USt-IdNr.: DE 814789134</font>