SET(sarg_VERSION 2)
SET(sarg_REVISION "3.2-pre1")
SET(sarg_BUILD "")
-SET(sarg_BUILDDATE "Feb-02-2011")
+SET(sarg_BUILDDATE "Apr-24-2011")
INCLUDE(AddFileDependencies)
INCLUDE(CheckIncludeFile)
SARG ChangeLog
-Jan-25-2011 Version 2.3.2-pre1
+Apr-24-2011 Version 2.3.2-pre1
- Add support for sorttable.js (http://www.kryogenix.org/code/browser/sorttable/) to dynamically sort some tables (thanks to Éric).
- Add the two command line options --lastlog and --keeplogs to set the number of reports to keep or to keep all the reports respectively (thanks to Emmanuel Lacour for the suggestion).
- Report the user ID in the e-mail report.
- Delete unused files from the directory containing the user report (thanks to alf-man).
- Add the index_fields option to hide the directory size column in the index sorted by date.
- Split the input log file in several files each containing one day worth of data (thanks to Mauricio Silveira).
+ - Take the date_format into account when converting a log file.
+ - Accept IPv6 addresses in the realtime report.
+ - Don't fail for an empty report directory when building the index.
+ - Fix a read error when parsing the time of a common log format.
+ - Use anonymous file and directory names in the report to hide the identity of the user whose report is displayed and shorten the total path length.
Sep-18-2010 Version 2.3.1
- Remove the distinct printf for the alpha architecture as it doesn't work anymore and is not necessary anyway.
if (getparam_string("output_dir",buf,OutputDir,sizeof(OutputDir))>0) return;
+ if (getparam_bool("anonymous_output_files",buf,&AnonymousOutputFiles)>0) return;
+
if (getparam_string("output_email",buf,OutputEmail,sizeof(OutputEmail))>0) return;
if (getparam_2words("per_user_limit",buf,PerUserLimitFile,sizeof(PerUserLimitFile),wbuf,sizeof(wbuf))>0) {
unsigned long int IndexFields;
bool UserAuthentication;
char AuthUserTemplateFile[1024];
+//! \c True to use anonymous file and directory names in the report.
+bool AnonymousOutputFiles;
char val1[MAXLEN];
char val2[MAXLEN];
char val3[MAXLEN];
-#define VERSION PACKAGE_VERSION" Feb-02-2011"
+#define VERSION PACKAGE_VERSION" Apr-24-2011"
#define PGM PACKAGE_NAME
#define URL "http://sarg.sourceforge.net"
strcpy(FontSize,"9px");
strcpy(TempDir,"/tmp");
strcpy(OutputDir,"/var/www/html/squid-reports");
+ AnonymousOutputFiles=false;
Ip2Name=false;
strcpy(DateFormat,"u");
OverwriteReport=false;
#
#output_dir /var/www/html/squid-reports
+# TAG: anonymous_output_files yes/no
+# Use anonymous file and directory names in the report. If it is set to
+# no (the default), the user id/ip/name is slightly mangled to create a
+# suitable file name to store the report of the user but the user's
+# identity can easily be guessed from the mangled name. If this option is
+# set, any file or directory belonging to the user is replaced by a short
+# number. The purpose is to hide the identity of the user when looking
+# at the report file names but it may serve to shorten the path too.
+#
+#anonymous_output_files no
+
# TAG: output_email
# Email address to send the reports. If you use this tag, no html reports will be generated.
# sarg -e email
//! The first group of users.
static struct usergroupstruct *first_user_group=NULL;
+//! The counter to generate unique user number when ::AnonymousOutputFiles is set.
+static int AnonymousCounter=0;
struct userinfostruct *userinfo_create(const char *userid)
{
strncpy(user->id,userid,MAX_USER_LEN-1);
user->id[MAX_USER_LEN-1]='\0';
- skip=0;
- j=0;
- for (i=0 ; userid[i] && j<MAX_USER_FNAME_LEN-1 ; i++) {
- if (isalnum(userid[i]) || userid[i]=='-' || userid[i]=='_') {
- user->filename[j++]=userid[i];
- skip=0;
- } else {
- if (!skip) {
- user->filename[j++]='_';
- skip=1;
+ if (AnonymousOutputFiles) {
+ snprintf(user->filename,sizeof(user->filename),"%d",AnonymousCounter++);
+ } else {
+ skip=0;
+ j=0;
+ for (i=0 ; userid[i] && j<MAX_USER_FNAME_LEN-1 ; i++) {
+ if (isalnum(userid[i]) || userid[i]=='-' || userid[i]=='_') {
+ user->filename[j++]=userid[i];
+ skip=0;
+ } else {
+ if (!skip) {
+ user->filename[j++]='_';
+ skip=1;
+ }
}
}
- }
- user->filename[j]='\0';
- flen=i;
-
- count=0;
- for (group=first_user_group ; group ; group=group->next) {
- lastuser=(group->next) ? group->nusers : group->nusers-1;
- for (i=0 ; i<lastuser ; i++) {
- if (strcasecmp(user->filename,group->list[i].filename)==0) {
- clen=sprintf(cstr,"-%04X",count++);
- if (flen+clen<MAX_USER_FNAME_LEN)
- strcpy(user->filename+flen,cstr);
- else
- strcpy(user->filename+MAX_USER_FNAME_LEN-clen,cstr);
+ user->filename[j]='\0';
+ flen=i;
+
+ count=0;
+ for (group=first_user_group ; group ; group=group->next) {
+ lastuser=(group->next) ? group->nusers : group->nusers-1;
+ for (i=0 ; i<lastuser ; i++) {
+ if (strcasecmp(user->filename,group->list[i].filename)==0) {
+ clen=sprintf(cstr,"-%04X",count++);
+ if (flen+clen<MAX_USER_FNAME_LEN)
+ strcpy(user->filename+flen,cstr);
+ else
+ strcpy(user->filename+MAX_USER_FNAME_LEN-clen,cstr);
+ }
}
}
}