char elap[255];
char user[MAX_USER_LEN];
char data[255];
- char ip[MAXLEN];
+ char ip[60];
char tam[255];
char hora[30];
char mes[30];
if(debugm)
printf("BUF=%s\n",linebuf);
- log_entry.EntryTime=NULL;
+ memset(&log_entry,0,sizeof(log_entry));
if (ilf==ILF_Squid || ilf==ILF_Common || ilf==ILF_Unknown) {
getword_start(&gwarea,linebuf);
if (getword(data,sizeof(data),&gwarea,' ')<0) {
}
if((str=(char *) strchr(data, '.')) != (char *) NULL && (str=(char *) strchr(str+1, '.')) != (char *) NULL ) {
strcpy(ip,data);
+ log_entry.Ip=ip;
strcpy(elap,"0");
if(squid24) {
if (getword(user,sizeof(user),&gwarea,' ')<0 || getword_skip(255,&gwarea,' ')<0) {
debuga(_("Maybe you have a broken client IP address in your %s file\n"),arq);
exit(EXIT_FAILURE);
}
+ log_entry.Ip=ip;
if (getword(code,sizeof(code),&gwarea,' ')<0){
debuga(_("Maybe you have a broken result code in your %s file\n"),arq);
exit(EXIT_FAILURE);
debuga(_("Maybe you have a broken record or garbage in your %s file\n"),arq);
exit(EXIT_FAILURE);
}
+ log_entry.Ip=ip;
if (getword_ptr(linebuf,&full_url,&gwarea,'\t')<0){
debuga(_("Maybe you have a broken record or garbage in your %s file\n"),arq);
exit(EXIT_FAILURE);
exit(EXIT_FAILURE);
}
strcpy(ip,str);
+ log_entry.Ip=ip;
} else if (x==isa_cols[ISACOL_UserName]) {
if (strlen(str)>=sizeof(user)) {
debuga(_("Maybe you have a broken user ID in your %s file\n"),arq);
log_entry.EntryTime=&tt;
}
if (log_entry.EntryTime==NULL) {
- debuga(_("Unknown input log file format\n"));
+ debuga(_("Unknown input log file format: no time\n"));
+ break;
+ }
+ if (log_entry.Ip==NULL) {
+ debuga(_("Unknown input log file format: no IP addresses\n"));
break;
}
if (!url || url[0] == '\0') continue;
if(addr[0] != '\0'){
- if(strcmp(addr,ip)!=0) continue;
+ if(strcmp(addr,log_entry.Ip)!=0) continue;
}
if(Filter->HostFilter) {
if(!vhexclude(url)) {
}
if(UserIp) {
- strcpy(user,ip);
+ strcpy(user,log_entry.Ip);
id_is_ip=true;
} else {
id_is_ip=false;
if(strcmp(user,"-") == 0 || strcmp(user," ") == 0 || strcmp(user,"") == 0) {
if(RecordsWithoutUser == RECORDWITHOUTUSER_IP) {
- strcpy(user,ip);
+ strcpy(user,log_entry.Ip);
id_is_ip=true;
}
if(RecordsWithoutUser == RECORDWITHOUTUSER_IGNORE)
}
strcpy( sz_Last_User , user ) ;
}*/
- if (fprintf(ufile->file, "%s\t%s\t%s\t%s\t%ld\t%s\t%ld\t%s\n",dia,hora,ip,url,nbytes,code,elap_time,smartfilter)<=0) {
+ if (fprintf(ufile->file, "%s\t%s\t%s\t%s\t%ld\t%s\t%ld\t%s\n",dia,hora,log_entry.Ip,url,nbytes,code,elap_time,smartfilter)<=0) {
debuga(_("Write error in the log file of user %s\n"),user);
exit(EXIT_FAILURE);
}
if(fp_log && ilf!=ILF_Sarg)
- fprintf(fp_log, "%s\t%s\t%s\t%s\t%s\t%ld\t%s\t%ld\t%s\n",dia,hora,user,ip,url,nbytes,code,elap_time,smartfilter);
+ fprintf(fp_log, "%s\t%s\t%s\t%s\t%s\t%ld\t%s\t%ld\t%s\n",dia,hora,user,log_entry.Ip,url,nbytes,code,elap_time,smartfilter);
totregsg++;
exit (1);
}
}
- fprintf(fp_Download_Unsort,"%s\t%s\t%s\t%s\t%s\n",dia,hora,user,ip,download_url);
+ fprintf(fp_Download_Unsort,"%s\t%s\t%s\t%s\t%s\n",dia,hora,user,log_entry.Ip,download_url);
}
if(fp_denied && strstr(code,"DENIED/403") != 0) {
- fprintf(fp_denied, "%s\t%s\t%s\t%s\t%s\n",dia,hora,user,ip,full_url);
+ fprintf(fp_denied, "%s\t%s\t%s\t%s\t%s\n",dia,hora,user,log_entry.Ip,full_url);
denied_count++;
}
if((ReportType & REPORT_TYPE_AUTH_FAILURES) != 0) {
if(fp_authfail && (strstr(code,"DENIED/401") != 0 || strstr(code,"DENIED/407") != 0)) {
- fprintf(fp_authfail, "%s\t%s\t%s\t%s\t%s\n",dia,hora,user,ip,full_url);
+ fprintf(fp_authfail, "%s\t%s\t%s\t%s\t%s\n",dia,hora,user,log_entry.Ip,full_url);
authfail_count++;
}
}
}
if(debugm){
- printf("IP=\t%s\n",ip);
+ printf("IP=\t%s\n",log_entry.Ip);
printf("USER=\t%s\n",user);
printf("ELAP=\t%ld\n",elap_time);
printf("DATE=\t%s\n",dia);