home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 35 Internet
/
35-Internet.zip
/
sarg1221.zip
/
exclude.c
< prev
next >
Wrap
C/C++ Source or Header
|
2002-10-11
|
1KB
|
63 lines
/*
* sarg - Squid user management log
* Mar/98 - Pedro L Orso - orso@onda.com.br
*/
#include "include/conf.h"
int vhexclude(char *excludefile, char *ip)
{
char whost[1024];
char wip1[1024], wip2[1024];
char sn1[4], sn2[4], sn3[4];
// DAS: Usage of "str[strlen(excludefile)]" is not corresponds to C standard
char *str = strdup(excludefile);
whost[0]='\0';
getword(whost,str,' ');
while(strcmp(whost,"*FIM*") != 0) {
if(strstr(ip,whost) !=0)
{
free(str);
return(0);
}
strcpy(wip1,ip);
getword(sn1,wip1,'.');
getword(sn2,wip1,'.');
getword(sn3,wip1,'.');
sprintf(wip1,"%s.%s.%s.0",sn1,sn2,sn3);
sprintf(wip2,"%s.%s.0.0",sn1,sn2);
if(strstr(whost,wip1) !=0 || strstr(whost,wip2) !=0 )
{
free(str);
return(0);
}
getword(whost,str,' ');
}
free(str);
return(1);
}
int vuexclude(char *excludeuser, char *user)
{
char wuser[MAXLEN];
strcpy(wuser,user);
strcat(wuser," ");
if(strstr(excludeuser,wuser) != 0 )
return(0);
return(1);
}