sarg
2.4.0
About: SARG ia a Squid Analysis Report Generator. Fossies Dox: sarg-2.4.0.tar.gz ("unofficial" and yet experimental doxygen-generated source code documentation) 
|
Go to the documentation of this file.
33 #define USERS_PER_GROUP 50
87 debuga(__FILE__,__LINE__,
_(
"Not enough memory to store the user's strings\n"));
99 group=malloc(
sizeof(*group));
101 debuga(__FILE__,__LINE__,
_(
"Not enough memory to store user \"%s\"\n"),userid);
104 memset(group,0,
sizeof(*group));
114 debuga(__FILE__,__LINE__,
_(
"Not enough memory to store user ID \"%s\"\n"),userid);
139 if (isalnum(userid[i]) || userid[i]==
'-' || userid[i]==
'_') {
156 for (i=0 ; i<lastuser ; i++) {
158 clen=sprintf(cstr,
"+%X",count++);
170 debuga(__FILE__,__LINE__,
_(
"Not enough memory to store the file name for user \"%s\"\n"),user->
id);
200 debuga(__FILE__,__LINE__,
_(
"Not enough memory to store label \"%s\" of user \"%s\"\n"),label,uinfo->
id);
211 for (i=0 ; i<group->
nusers ; i++)
213 return(group->
list+i);
224 for (i=0 ; i<group->
nusers ; i++)
225 if (strcmp(
id,group->
list[i].
id)==0)
226 return(group->
list+i);
237 for (i=0 ; i<group->
nusers ; i++)
238 if (strcmp(ip,group->
list[i].
ip)==0)
239 return(group->
list+i);
254 uscan=malloc(
sizeof(*uscan));
255 if (!uscan)
return(NULL);
284 if (!uscan)
return(NULL);
285 if (!uscan->
group)
return(NULL);
307 for (i=0 ; i<group->
nusers ; i++)
323 if (
debug)
debuga(__FILE__,__LINE__,
_(
"Reading user alias file \"%s\"\n"),Filename);
327 debuga(__FILE__,__LINE__,
_(
"Cannot store user's aliases\n"));
338 debuga(__FILE__,__LINE__,
_(
"Not enough memory to read file \"%s\"\n"),Filename);
344 debuga(__FILE__,__LINE__,
_(
"While reading \"%s\"\n"),Filename);
356 debuga(__FILE__,__LINE__,
_(
"List of user names to alias:\n"));
379 const char *user=*UserPtr;
406 if ((user[0]==
'\0') || (user[1]==
'\0' && (user[0]==
'-' || user[0]==
' '))) {
418 if ((str=strchr(user,
'+'))!=NULL || (str=strchr(user,
'\\'))!=NULL || (str=strchr(user,
'_'))!=NULL) {
425 if (
us[0]!=
'\0' && strcmp(user,
us)!=0)
463 if (user[0]==
'\0' || (user[1]==
'\0' && (user[0]==
'-' || user[0]==
' ' || user[0]==
':')))
void StringBuffer_Destroy(StringBufferObject *SPtr)
bool UserFilter
True to filter on users.
#define RECORDWITHOUTUSER_IGNORE
static struct usergroupstruct * first_user_group
The first group of users.
bool AnonymousOutputFiles
True to use anonymous file and directory names in the report.
bool SysUsers
True to restrict the log to the system users.
void debuga(const char *File, int Line, const char *msg,...)
void read_useralias(const char *Filename)
Group the users in one allocation unit. Structure to store a group of users and reduce the number of ...
static StringBufferObject UserStrings
String buffer to store the user's related constants.
StringBufferObject StringBuffer_Create(void)
struct userinfostruct * userinfo_advancescan(userscan uscan)
What is known about a user.
struct usergroupstruct * group
The group containing the user.
char * longline_read(FileObject *fp_in, longline line)
const char * FileObject_GetLastCloseError(void)
const char * FileObject_GetLastOpenError(void)
struct userinfostruct * userinfo_create(const char *userid, const char *ip)
const char * id
The ID of the user as found in the input file.
void Alias_Destroy(AliasObject *AliasPtr)
void userinfo_clearflag(void)
struct userinfostruct * userinfo_find_from_file(const char *filename)
Hold pointer to scan through the user list.
struct ReadLogDataStruct ReadFilter
The log file filtering.
bool id_is_ip
True if the ID is in fact the IP address from which the user connected.
int StripSuffixLen
Length of the suffix to strip from the user name.
enum UserProcessError process_user(const char **UserPtr, const char *IpAddress, bool *IsIp)
const char * label
The name of the user to display in the report.
int index
The index of the user in the group.
struct usergroupstruct * next
The next group of users.
static AliasObject UserAliases
User aliases.
void Alias_PrintList(struct AliasStruct *AliasData)
userscan userinfo_startscan(void)
UserProcessError
Error codes returned by process_user.
char * userfile
The list of the system users.
void userinfo_label(struct userinfostruct *uinfo, const char *label)
int Alias_Store(struct AliasStruct *AliasData, char *String)
FileObject * FileObject_Open(const char *FileName)
Object to group items together.
Include headers and define global variables. */.
#define ALIAS_PREFIX
The character prefixed in front of the host names that are aliased.
void userinfo_stopscan(userscan uscan)
longline longline_create(void)
const char * filename
The mangled name to use in file names of that user.
int vuexclude(const char *user)
static int AnonymousCounter
The counter to generate unique user number when AnonymousOutputFiles is set.
#define NTLMUSERFORMAT_USER
unsigned long int NtlmUserFormat
int testvaliduserchar(const char *user)
#define MAX_USER_FNAME_LEN
struct userinfostruct * userinfo_find_from_id(const char *id)
void longline_destroy(longline *line_ptr)
char * StringBuffer_Store(StringBufferObject SObj, const char *String)
char StripUserSuffix[256]
Domain suffix to strip from the user name.
int flag
A general purpose flag that can be set when scanning the user's list.
const char * ip
The user's IP address.
#define USERS_PER_GROUP
The number of users to group in one unit.
void safe_strcpy(char *dest, const char *src, int length)
struct userinfostruct * userinfo_find_from_ip(const char *ip)
const char * Alias_Replace(struct AliasStruct *AliasData, const char *Name)
Declaration of the structures and functions.
unsigned long int RecordsWithoutUser
int nusers
The number of users stored in the list.
void free_useralias(void)
#define RECORDWITHOUTUSER_IP
AliasObject Alias_Create(void)
int FileObject_Close(FileObject *File)
#define RECORDWITHOUTUSER_EVERYBODY
struct userinfostruct list[50]
A group of users.
@ LogLevel_Process
Process informational messages.