97
97
if(strncmp(buf,"#",1) == 0)
99
99
if(strstr(buf,"loglocation ") != 0) {
100
getword(loglocation,sizeof(loglocation),buf,'\'');
101
getword(loglocation,sizeof(loglocation),buf,'\'');
100
if (getword(loglocation,sizeof(loglocation),buf,'\'')<0 || getword(loglocation,sizeof(loglocation),buf,'\'')<0) {
101
printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",DansGuardianConf);
107
109
strcpy(buf,text[7]);
108
getword(urly,sizeof(urly),buf,' ');
109
getword(href,sizeof(href),buf,' ');
110
sprintf(msg,"%s DansGuardian %s: %s",urly,buf,loglocation);
110
if (getword(urly,sizeof(urly),buf,' ')<0 || getword(href,sizeof(href),buf,' ')<0) {
111
printf("SARG: Maybe you have a broken record or garbage in your %s entry.\n",text[7]);
114
debuga("%s DansGuardian %s: %s",urly,buf,loglocation);
114
if((fp_in=fopen(loglocation,"r"))==NULL) {
117
if((fp_in=MY_FOPEN(loglocation,"r"))==NULL) {
115
118
fprintf(stderr, "SARG: (dansguardian) %s: %s\n",text[8],loglocation);
119
122
while(fgets(buf,sizeof(buf),fp_in) != NULL) {
120
123
if(strstr(buf," *DENIED* ") == 0)
122
getword(year,sizeof(year),buf,'.');
123
getword(mon,sizeof(year),buf,'.');
124
getword(day,sizeof(day),buf,' ');
125
getword(hour,sizeof(hour),buf,' ');
126
getword(user,sizeof(user),buf,' ');
127
getword(ip,sizeof(ip),buf,' ');
128
getword(url,sizeof(url),buf,'/');
129
getword(url,sizeof(url),buf,'/');
130
getword(url,sizeof(url),buf,' ');
131
getword(code1,sizeof(code1),buf,' ');
132
getword(code1,sizeof(code1),buf,' ');
133
getword(code2,sizeof(code2),buf,' ');
125
if (getword(year,sizeof(year),buf,'.')<0 || getword(mon,sizeof(mon),buf,'.')<0 ||
126
getword(day,sizeof(day),buf,' ')<0 || getword(hour,sizeof(hour),buf,' ')<0 ||
127
getword(user,sizeof(user),buf,' ')<0 || getword(ip,sizeof(ip),buf,' ')<0 ||
128
getword(url,sizeof(url),buf,'/')<0 || getword(url,sizeof(url),buf,'/')<0 ||
129
getword(url,sizeof(url),buf,' ')<0 || getword(code1,sizeof(code1),buf,' ')<0 ||
130
getword(code1,sizeof(code1),buf,' ')<0 || getword(code2,sizeof(code2),buf,' ')<0) {
131
printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",loglocation);
134
134
sprintf(wdata,"%s%02d%s",year,atoi(mon),day);
135
135
idata = atoi(wdata);
152
151
if(fp_guard) fclose(fp_guard);
153
152
if(fp_ou) fclose(fp_ou);
156
sprintf(msg,"%s: %s",text[54],guard_ou);
155
debuga("%s: %s",text[54],guard_ou);
157
sprintf(tmp6,"sort -k 1,1 -k 2,2 -k 4,4 \"%s\" -o \"%s\"",guard_in, guard_ou);
158
cstatus=system(tmp6);
159
if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) {
160
fprintf(stderr, "SARG: sort command return status %d\n",WEXITSTATUS(cstatus));
161
fprintf(stderr, "SARG: sort command: %s\n",tmp6);
160
sprintf(tmp6,"sort -k 1,1 -k 2,2 -k 4,4 '%s' -o '%s'",guard_in, guard_ou);
162
164
unlink(guard_in);