[Nagiosplug-devel] plugin isn't being executed
Reinaldo Silva
reinaldo at vexbr.com.br
Tue Aug 19 06:21:02 CEST 2003
Hi,
I am trying to make a little plugin that checks if the radius server is
autheticating the user. Nagis tells that there is no output after it is
executed and when I "stat"it, I realize that it hasn't been executed.
Can sombody help me? Here goes the code:
./chech_radius user password hsot:port secret
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc ,char **argv)
{
char line[100],cmd[256]="/bin/echo \"User-Name= ";
FILE *fp;
unlink(".radius");
strcat(cmd,argv[1]);
strcat(cmd,", User-Password= ");
strcat(cmd,argv[2]);
strcat(cmd,"\" | /usr/bin/radclient ");
strcat(cmd,argv[3]);
strcat(cmd," auth '");
strcat(cmd,argv[4]);
strcat(cmd,"' >> .radius");
system(cmd);
sleep(1);
fp = fopen(".radius","r");
bzero(line,sizeof(line));
fgets(line,sizeof(line),fp);
if(strstr(line,"code 2")!=NULL)
{
printf("Access Accept.");
return 0;
}
else
{
printf("Access Denied.");
return 2;
}
fclose(fp);
unlink(".radius");
return 3;
}
Reinaldo Silva
Vex WiFi
55 11 3444 7876
Reinaldo Silva
Vex WiFi
55 11 3444 7876
More information about the Devel
mailing list