char source[128], list[128];
char full_url[MAX_URL_LEN];
const char *url;
- char user[MAX_USER_LEN];
+ char UserBuf[MAX_USER_LEN];
+ const char *user;
char ip[45];
char userlabel[MAX_USER_LEN];
+ char IpBuf[MAX_USER_LEN];
long long int lmon, lday, lyear;
int mon, day, year;
int idata=0;
struct getwordstruct gwarea;
struct getwordstruct gwarea1;
struct userinfostruct *uinfo;
+ enum UserProcessError PUser;
getword_start(&gwarea,buf);
if(RedirectorLogFormat[0] != '\0') {
source[0]='\0';
list[0]='\0';
ip[0]='\0';
- user[0]='\0';
+ UserBuf[0]='\0';
full_url[0]='\0';
while(strcmp(leks,"end") != 0) {
if (getword(leks,sizeof(leks),&gwarea1,'#')<0) {
}
strcpy(ip,res);
} else if(strcmp(leks,"user") == 0) {
- if (strlen(res)>=sizeof(user)) {
+ if (strlen(res)>=sizeof(UserBuf)) {
debuga(__FILE__,__LINE__,_("User ID too long in redirector log file \"%s\"\n"),wentp);
RedirectorErrors++;
return;
}
- strcpy(user,res);
+ strcpy(UserBuf,res);
} else if(strcmp(leks,"url") == 0) {
/*
* Don't worry about the url being truncated as we only keep the host name
RedirectorErrors++;
return;
}
- if (getword_skip(MAXLEN,&gwarea,' ')<0 || getword(user,sizeof(user),&gwarea,' ')<0) {
+ if (getword_skip(MAXLEN,&gwarea,' ')<0 || getword(UserBuf,sizeof(UserBuf),&gwarea,' ')<0) {
debuga(__FILE__,__LINE__,_("Invalid user in file \"%s\"\n"),wentp);
RedirectorErrors++;
return;
return;
}
- if (StripSuffixLen>0)
- {
- int x=strlen(user);
- if (x>StripSuffixLen && strcasecmp(user+(x-StripSuffixLen),StripUserSuffix)==0)
- user[x-StripSuffixLen]='\0';
- }
- if(UserIp) {
- strcpy(user,ip);
- id_is_ip=true;
- } else {
- id_is_ip=false;
- if (user[0]=='\0' || (user[1]=='\0' && (user[0]=='-' || user[0]==' '))) {
- if(RecordsWithoutUser == RECORDWITHOUTUSER_IP) {
- strcpy(user,ip);
- id_is_ip=true;
- }
- if(RecordsWithoutUser == RECORDWITHOUTUSER_IGNORE)
- return;
- if(RecordsWithoutUser == RECORDWITHOUTUSER_EVERYBODY)
- strcpy(user,"everybody");
- }
- }
+ user=UserBuf;
+ PUser=process_user(&user,ip,&id_is_ip);
+ if (PUser!=USERERR_NoError) return;
+
uinfo=userinfo_find_from_id(user);
if (!uinfo) {
uinfo=userinfo_create(user,(id_is_ip) ? NULL : ip);
uinfo->no_report=true;
- if(Ip2Name && id_is_ip) ip2name(user,sizeof(user));
+ if (Ip2Name && id_is_ip) {
+ strcpy(IpBuf,user);
+ ip2name(IpBuf,sizeof(IpBuf));
+ user=IpBuf;
+ }
user_find(userlabel,MAX_USER_LEN, user);
userinfo_label(uinfo,userlabel);
}