#include "include/conf.h"
#include "include/defs.h"
+#include "include/readlog.h"
/*!
The buffer to store the list of the suffixes to take into account when generating
\brief Declaration of the structures and functions.
*/
-#include "readlog.h"
+struct ReadLogStruct;//forward declaration
struct getwordstruct
{
//! The time corresponding to the entry.
struct tm EntryTime;
//! The IP address connecting to internet.
- char *Ip;
+ const char *Ip;
//! The user's name.
- char *User;
+ const char *User;
/*!
The URL of the visited site.
if(RecordsWithoutUser == RECORDWITHOUTUSER_EVERYBODY)
log_entry.User="everybody";
} else {
- strlow(log_entry.User);
if(NtlmUserFormat == NTLMUSERFORMAT_USER) {
if ((str=strchr(log_entry.User,'+'))!=NULL || (str=strchr(log_entry.User,'\\'))!=NULL || (str=strchr(log_entry.User,'_'))!=NULL) {
log_entry.User=str+1;
#include "include/conf.h"
#include "include/defs.h"
+#include "include/readlog.h"
/*!
A new file is being read. The name of the file is \a FileName.
int Hour;
int Minute;
int Second;
+ char *Ip;
+ char *User;
// get IP address
- Entry->Ip=Line;
+ Entry->Ip=Ip=Line;
for (IpLen=0 ; *Line && *Line!=' ' ; IpLen++) Line++;
if (*Line!=' ' || IpLen==0) return(RLRC_Unknown);
}
// the ID of the user or - if the user is unidentified
- Entry->User=++Line;
+ Entry->User=User=++Line;
for (UserLen=0 ; *Line && *Line!=' ' ; UserLen++) Line++;
if (*Line!=' ' || UserLen==0) return(RLRC_Unknown);
}
// it is safe to alter the line buffer now that we are returning a valid entry
- Entry->Ip[IpLen]='\0';
+ Ip[IpLen]='\0';
Entry->HttpCode[HttpCodeLen]='\0';
Entry->Url[UrlLen]='\0';
- Entry->User[UserLen]='\0';
+ User[UserLen]='\0';
return(RLRC_NoError);
}
#include "include/conf.h"
#include "include/defs.h"
+#include "include/readlog.h"
/*!
Maximum number of columns accepted in an extended log format.
{
int col;
enum ext_col_id col_id;
+ char *Ip=NULL;
char *IpEnd;
+ char *User=NULL;
char *UserEnd;
char *UrlEnd;
char *HttpCodeEnd;
switch (col_id)
{
case EXTCOL_Ip:
- Entry->Ip=Line;
+ Entry->Ip=Ip=Line;
Line=ExtLog_GetString(Line,col,&IpEnd);
if (!Line) return(RLRC_Unknown);
break;
case EXTCOL_UserName:
- Entry->User=Line;
+ Entry->User=User=Line;
Line=ExtLog_GetString(Line,col,&UserEnd);
if (!Line) return(RLRC_Unknown);
break;
return(RLRC_InternalError);
}
- ExtLog_FixString(Entry->Ip,IpEnd);
- ExtLog_FixString(Entry->User,UserEnd);
+ ExtLog_FixString(Ip,IpEnd);
+ ExtLog_FixString(User,UserEnd);
ExtLog_FixString(Entry->Url,UrlEnd);
ExtLog_FixString(Entry->HttpCode,HttpCodeEnd);
#include "include/conf.h"
#include "include/defs.h"
+#include "include/readlog.h"
//! \c True if the current log is known to be a sarg parsed log.
static bool InSargLog=false;
int Hour;
int Minute;
int Second;
+ char *Ip;
+ char *User;
if (strncmp(Line,"*** SARG Log ***",16)==0) {
if (InvalidFileName) {
Entry->EntryTime.tm_isdst=-1;
// the ID of the user
- Entry->User=++Line;
+ Entry->User=User=++Line;
for (UserLen=0 ; *Line && *Line!='\t' ; UserLen++) Line++;
if (*Line!='\t' || UserLen==0) return(RLRC_Unknown);
// get IP address
- Entry->Ip=++Line;
+ Entry->Ip=Ip=++Line;
for (IpLen=0 ; *Line && *Line!='\t' ; IpLen++) Line++;
if (*Line!='\t' || IpLen==0) return(RLRC_Unknown);
}
// it is safe to alter the line buffer now that we are returning a valid entry
- Entry->Ip[IpLen]='\0';
+ Ip[IpLen]='\0';
Entry->HttpCode[HttpCodeLen]='\0';
Entry->Url[UrlLen]='\0';
- Entry->User[UserLen]='\0';
+ User[UserLen]='\0';
return(RLRC_NoError);
}
#include "include/conf.h"
#include "include/defs.h"
+#include "include/readlog.h"
/*!
A new file is being read. The name of the file is \a FileName.
int UrlLen;
int UserLen;
struct tm *tt;
+ char *Ip;
+ char *User;
// get log time.
Begin=Line;
if (*Line!=' ' || Line==Begin) return(RLRC_Unknown);
// get IP address. It can be a fqdn if that option is enabled in squid.
- Entry->Ip=++Line;
+ Entry->Ip=Ip=++Line;
for (IpLen=0 ; *Line && *Line!=' ' ; IpLen++) Line++;
if (*Line!=' ' || IpLen==0) return(RLRC_Unknown);
if (*Line!=' ' || UrlLen==0) return(RLRC_Unknown);
// the ID of the user or - if the user is unidentified
- Entry->User=++Line;
+ Entry->User=User=++Line;
for (UserLen=0 ; *Line && *Line!=' ' ; UserLen++) Line++;
if (*Line!=' ' || UserLen==0) return(RLRC_Unknown);
memcpy(&Entry->EntryTime,tt,sizeof(struct tm));
// it is safe to alter the line buffer now that we are returning a valid entry
- Entry->Ip[IpLen]='\0';
+ Ip[IpLen]='\0';
Entry->HttpCode[HttpCodeLen]='\0';
Entry->Url[UrlLen]='\0';
- Entry->User[UserLen]='\0';
+ User[UserLen]='\0';
return(RLRC_NoError);
}