82 debuga(__FILE__,__LINE__,
_(
"Not enough memory to store the exlcluded IP addresses\n"));
110 debuga(__FILE__,__LINE__,
_(
"Not enough memory to store the exlcluded IP addresses\n"));
115 for (i=0 ; i<8 ; i++)
138 for (i=0 ; i<length ; i++)
141 }
else if (
url[i]==
'.') {
149 if (start>=length || firstdot)
return;
161 debuga(__FILE__,__LINE__,
_(
"Not enough memory to store the excluded URLs\n"));
169 item->
url=malloc(length+1);
171 debuga(__FILE__,__LINE__,
_(
"Not enough memory to store the excluded URLs\n"));
190 unsigned char ipv4[4];
191 unsigned short int ipv6[8];
195 if (access(hexfile, R_OK) != 0) {
196 debuga(__FILE__,__LINE__,
_(
"Cannot open file \"%s\": %s\n"),hexfile,strerror(errno));
200 debuga(__FILE__,__LINE__,
_(
"Loading exclude host file from \"%s\"\n"),hexfile);
202 if ((fp_ex = fopen(hexfile,
"r")) == NULL) {
203 debuga(__FILE__,__LINE__,
_(
"Cannot open file \"%s\": %s\n"),hexfile,strerror(errno));
207 while(fgets(buf,
sizeof(buf),fp_ex)!=NULL){
214 debuga(__FILE__,__LINE__,
_(
"While reading \"%s\"\n"),hexfile);
220 }
else if (type==2) {
222 }
else if (type==3) {
227 if (fclose(fp_ex)==EOF) {
228 debuga(__FILE__,__LINE__,
_(
"Read error in \"%s\": %s\n"),hexfile,strerror(errno));
248 unsigned char ipv4[4];
249 unsigned short int ipv6[8];
250 unsigned long int addr4;
258 for (length=0 ; (
unsigned char)
name[length]>
' ' &&
name[length]!=
':' &&
name[length]!=
'/' &&
name[length]!=
'?' ; length++)
259 if (
name[length]==
'.') {
266 if (
ndots<
sizeof(dotpos)/
sizeof(dotpos[0]))
267 dotpos[
ndots++]=length+1;
269 for (j=1 ; j<
ndots ; j++) dotpos[j-1]=dotpos[j];
270 dotpos[
ndots-1]=length+1;
276 const char *wurl=
name;
288 }
else if (type==2) {
291 for (i=0 ; i<4 ; i++) addr4=(addr4 << 8) | ipv4[i];
295 }
else if (type==3) {
302 if (j>=8 || length%16==0 || ((ipv6[j] ^
exclude_ip6[i].address[j]) & (0xFFFF<<(length-j*16)))==0)
317 debuga(__FILE__,__LINE__,
_(
"Loading exclude file from \"%s\"\n"),uexfile);
319 if ((fp_ex = fopen(uexfile,
"r")) == NULL) {
320 debuga(__FILE__,__LINE__,
_(
"Cannot open file \"%s\": %s\n"),uexfile,strerror(errno));
324 if (fseek(fp_ex, 0, SEEK_END)==-1) {
325 debuga(__FILE__,__LINE__,
_(
"Failed to move till the end of file \"%s\": %s\n"),uexfile,strerror(errno));
330 debuga(__FILE__,__LINE__,
_(
"Cannot get the size of file \"%s\"\n"),uexfile);
334 if (fseek(fp_ex, 0, SEEK_SET)==-1) {
335 debuga(__FILE__,__LINE__,
_(
"Failed to rewind file \"%s\": %s\n"),uexfile,strerror(errno));
340 debuga(__FILE__,__LINE__,
_(
"malloc error (%ld bytes required)\n"),nreg);
346 while(fgets(buf,
sizeof(buf),fp_ex)!=NULL){
347 if (strchr(buf,
'#') != NULL)
356 if (fclose(fp_ex)==EOF) {
357 debuga(__FILE__,__LINE__,
_(
"Read error in \"%s\": %s\n"),uexfile,strerror(errno));
372 while ((wuser=strstr(wuser,user))!=NULL) {
373 if (wuser[len]==
' ')
return(0);