CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
PROJECT(sarg C)
SET(sarg_VERSION 2)
-SET(sarg_REVISION "3")
+SET(sarg_REVISION "3.1-pre1")
SET(sarg_BUILD "")
-SET(sarg_BUILDDATE "Jun-21-2010")
+SET(sarg_BUILDDATE "Jul-14-2010")
INCLUDE(AddFileDependencies)
INCLUDE(CheckIncludeFile)
SARG ChangeLog
-Jun-21-2009 Version 2.3
+Jul-14-2010 Version 2.3.1
+ - Remove the distinct printf for the alpha architecture as it doesn't work anymore and is not necessary anyway.
+ - Don't abort if "onload" or "script" is found in the user agent string.
+
+Jun-21-2010 Version 2.3
- LDAP usertab added.
Now you can have your users in a LDAP Server.
Use these tags in sarg.conf: LDAPHost, LDAPPort, LDAPBindDN, LDAPBindPW,
dnl Process this file with autoconf to produce a configure script.
-AC_INIT([sarg],[2.3])
+AC_INIT([sarg],[2.3.1-pre1])
AC_CONFIG_SRCDIR([log.c])
AC_CONFIG_AUX_DIR(cfgaux)
if (olduser[0] != '\0') {
#if defined(__FreeBSD__)
fprintf(fp_top2,"%s\t%qu\t%qu\t%qu\n",olduser,tnbytes,tnacc,tnelap);
-#elif defined(__alpha) || __ALPHA
- fprintf(fp_top2,"%s\t%ld\t%ld\t%ld\n",olduser,tnbytes,tnacc,tnelap);
#else
fprintf(fp_top2,"%s\t%"PRIu64"\t%"PRIu64"\t%"PRIu64"\n",olduser,(uint64_t)tnbytes,(uint64_t)tnacc,(uint64_t)tnelap);
#endif
if (olduser[0] != '\0') {
#if defined(__FreeBSD__)
fprintf(fp_top2,"%s\t%qu\t%qu\t%qu\n",olduser,tnbytes,tnacc,tnelap);
-#elif defined(__alpha) || __ALPHA
- fprintf(fp_top2,"%s\t%ld\t%ld\t%ld\n",olduser,tnbytes,tnacc,tnelap);
#else
fprintf(fp_top2,"%s\t%"PRIu64"\t%"PRIu64"\t%"PRIu64"\n",olduser,(uint64_t)tnbytes,(uint64_t)tnacc,(uint64_t)tnelap);
#endif
}
#if defined(__FreeBSD__)
fprintf(fp_top1,"TOTAL\t%qu\t%qu\t%qu\n",ttnbytes,ttnacc,ttnelap);
-#elif defined(__alpha) || __ALPHA
- fprintf(fp_top1,"TOTAL\t%ld\t%ld\t%ld\n",ttnbytes,ttnacc,ttnelap);
#else
fprintf(fp_top1,"TOTAL\t%"PRIu64"\t%"PRIu64"\t%"PRIu64"\n",(uint64_t)ttnbytes,(uint64_t)ttnacc,(uint64_t)ttnelap);
#endif
fputs("------- -------------------- -------- --------------- ------- ---------- ---------- -------\n",fp_top3);
#if defined(__FreeBSD__)
fprintf(fp_top3,"%-7s %20s %8qu %15s %8s %9s %10qu\n",_("TOTAL")," ",ttnacc,fixnum(ttnbytes,1)," ",buildtime(ttnelap),ttnelap);
-#elif defined(__alpha) || __ALPHA
- fprintf(fp_top3,"%-7s %20s %8ld %15s %8s %9s %10ld\n",_("TOTAL")," ",ttnacc,fixnum(ttnbytes,1)," ",buildtime(ttnelap),ttnelap);
#else
fprintf(fp_top3,"%-7s %20s %8"PRIu64" %15s %8s %9s %10"PRIu64"\n",_("TOTAL")," ",(uint64_t)ttnacc,fixnum(ttnbytes,1)," ",buildtime(ttnelap),(uint64_t)ttnelap);
#endif
} else {
#if defined(__FreeBSD__)
fprintf(fp_top3,"%7d %20s %8lld %15s %3.2lf%% %10s %10qu %3.2lf%%\n",posicao,user,nacc,fixnum(nbytes,1),perc,buildtime(elap),elap,perc2);
-#elif defined(__alpha) || __ALPHA
- fprintf(fp_top3,"%7d %20s %8lld %15s %3.2lf%% %10s %10ld %3.2lf%%\n",posicao,user,nacc,fixnum(nbytes,1),perc,buildtime(elap),elap,perc2);
#else
fprintf(fp_top3,"%7d %20s %8"PRIu64" %15s %3.2lf%% %10s %10"PRIu64" %3.2lf%%\n",posicao,user,(uint64_t)nacc,fixnum(nbytes,1),perc,buildtime(elap),(uint64_t)elap,perc2);
#endif
strip_latin(strip1);
#if defined(__FreeBSD__)
fprintf(fp_top3,"%-7s %20s %8qu %15s %8s %9s %10qu\n",strip1," ",avgacc,fixnum(tnbytes,1)," ",buildtime(avgelap),avgelap);
-#elif defined(__alpha) || __ALPHA
- fprintf(fp_top3,"%-7s %20s %8ld %15s %8s %9s %10ld\n",strip1," ",avgacc,fixnum(tnbytes,1)," ",buildtime(avgelap),avgelap);
#else
fprintf(fp_top3,"%-7s %20s %8"PRIu64" %15s %8s %9s %10"PRIu64"\n",strip1," ",(uint64_t)avgacc,fixnum(tnbytes,1)," ",buildtime(avgelap),(uint64_t)avgelap);
#endif
-#define VERSION PACKAGE_VERSION" Jun-21-2010"
+#define VERSION PACKAGE_VERSION" Jul-14-2010"
#define PGM PACKAGE_NAME
#define URL "http://sarg.sourceforge.net"
ipbefore[0]='\0';
namebefore[0]='\0';
- sprintf(tmp3,"%s/squagent.unsort",TempDir);
- sprintf(tmp2,"%s/squagent.log",TempDir);
+ sprintf(tmp3,"%s/sarg/squagent.unsort",TempDir);
+ sprintf(tmp2,"%s/sarg/squagent.log",TempDir);
if((fp_in=fopen(UserAgentLog,"r"))==NULL) {
debuga(_("(useragent) Cannot open file %s\n"),UserAgentLog);
debuga(_("Maybe you have a broken useragent entry in your %s file\n"),UserAgentLog);
exit(EXIT_FAILURE);
}
- strcpy(warea,agent);
- strup(warea);
- if(strstr(warea,"SCRIPT") != 0 || strstr(warea,"ONLOAD") != 0)
- baddata();
if(gwarea.current[0]!='\0') {
if (getword_skip(MAXLEN,&gwarea,' ')<0 || getword(user,sizeof(user),&gwarea,'\n')<0) {
debuga(_("Maybe you have a broken record or garbage in your %s file\n"),UserAgentLog);
exit(EXIT_FAILURE);
}
- }
-
- if(user[0] == '-')
- strcpy(user,ip);
- if(user[0] == '\0')
+ if(user[0] == '-')
+ strcpy(user,ip);
+ if(user[0] == '\0')
+ strcpy(user,ip);
+ } else {
strcpy(user,ip);
+ }
fprintf(fp_ou,"%s\t%s\t%s\n",ip,agent,user);
- user[0]='\0';
useragent_count++;
}
}
fclose(fp_in);
- fclose(fp_ou);
+ if (fclose(fp_ou)==EOF) {
+ debuga(_("Failed to close file %s - %s\n"),tmp3,strerror(errno));
+ exit(EXIT_FAILURE);
+ }
if(debug) {
debuga(_("Sorting file: %s\n"),tmp2);
}
if(strcmp(user,user_old) != 0) {
- fprintf(fp_ht,"<tr><td class=\"data2\">%s</td><td class=\"data2\">%s</td></tr>\n",user,agent);
+ fprintf(fp_ht,"<tr><td class=\"data2\">%s</td><td class=\"data2\">",user);
+ output_html_string(fp_ht,agent,250);
+ fputs("</td></tr>\n",fp_ht);
strcpy(user_old,user);
strcpy(agent_old,agent);
- } else {
- if(strcmp(agent,agent_old) != 0) {
- fprintf(fp_ht,"<tr><td></td><td class=\"data2\">%s</td></tr>\n",agent);
- strcpy(agent_old,agent);
- }
+ } else if(strcmp(agent,agent_old) != 0) {
+ fputs("<tr><td></td><td class=\"data2\">",fp_ht);
+ output_html_string(fp_ht,agent,250);
+ fputs("</td></tr>\n",fp_ht);
+ strcpy(agent_old,agent);
}
}
while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
getword_start(&gwarea,buf);
if (getword(ip,sizeof(ip),&gwarea,'\t')<0) {
- debuga(_("There is an invalid IP address in file %s\n"),tmp);
+ debuga(_("There is an invalid IP address in file %s\n"),tmp3);
exit(EXIT_FAILURE);
}
if (getword(agent,sizeof(agent),&gwarea,'\t')<0) {
- debuga(_("There is an invalid useragent in file %s\n"),tmp);
+ debuga(_("There is an invalid useragent in file %s\n"),tmp3);
exit(EXIT_FAILURE);
}
agentot2+=agentot;
fclose(fp_in);
- fclose(fp_ou);
+ if (fclose(fp_ou)==EOF) {
+ debuga(_("Failed to close file %s - %s\n"),tmp3,strerror(errno));
+ exit(EXIT_FAILURE);
+ }
unlink(tmp3);
fixendofline(buf);
getword_start(&gwarea,buf);
if (getword(tagent,sizeof(tagent),&gwarea,' ')<0) {
- debuga(_("There is an invalid useragent in file %s\n"),tmp);
+ debuga(_("There is an invalid useragent in file %s\n"),tmp3);
exit(EXIT_FAILURE);
}
nagent=atoi(tagent);
perc=(agentot2>0) ? nagent * 100. / agentot2 : 0.;
- fprintf(fp_ht,"<tr><td class=\"data2\">%s</td><td class=\"data\">%d</td><td class=\"data\">%3.2lf</td></tr>\n",gwarea.current,nagent,perc);
+ fputs("<tr><td class=\"data2\">",fp_ht);
+ output_html_string(fp_ht,gwarea.current,250);
+ fprintf(fp_ht,"</td><td class=\"data\">%d</td><td class=\"data\">%3.2lf</td></tr>\n",nagent,perc);
}
fclose(fp_in);