}
while(fgets(tmp6,sizeof(tmp6),fp_usr)!=NULL) {
fixendofline(tmp6);
- if(strcmp(tmp6,uinfo->label) == 0) {
+ if(strcmp(tmp6,uinfo->ip) == 0) {
limit_flag=1;
break;
}
debuga(_("(html10) Cannot open file %s\n"),PerUserLimitFile);
exit(EXIT_FAILURE);
}
- fprintf(fp_usr,"%s\n",uinfo->label);
+ fprintf(fp_usr,"%s\n",uinfo->ip);
fclose(fp_usr);
if(debug)
{
//! The ID of the user as found in the input file.
char id[MAX_USER_LEN];
+ //! The user's IP address.
+ char ip[30];
//! \c True if the ID is in fact the IP address from which the user connected.
bool id_is_ip;
//! \c True if the user doesn't have a report file.
void useragent(void);
// userinfo.c
-/*@shared@*/struct userinfostruct *userinfo_create(const char *userid);
+/*@shared@*/struct userinfostruct *userinfo_create(const char *userid,const char *ip);
void userinfo_free(void);
/*@shared@*/struct userinfostruct *userinfo_find_from_file(const char *filename);
/*@shared@*/struct userinfostruct *userinfo_find_from_id(const char *id);
memset(ufile,0,sizeof(*ufile));
ufile->next=first_user_file;
first_user_file=ufile;
- uinfo=userinfo_create(user);
+ uinfo=userinfo_create(user,ip);
ufile->user=uinfo;
uinfo->id_is_ip=id_is_ip;
nusers++;
}
uinfo=userinfo_find_from_id(user);
if (!uinfo) {
- uinfo=userinfo_create(user);
+ uinfo=userinfo_create(user,ip);
uinfo->id_is_ip=id_is_ip;
uinfo->no_report=true;
if(Ip2Name && id_is_ip) ip2name(user,sizeof(user));
//! The counter to generate unique user number when ::AnonymousOutputFiles is set.
static int AnonymousCounter=0;
-struct userinfostruct *userinfo_create(const char *userid)
+struct userinfostruct *userinfo_create(const char *userid,const char *ip)
{
struct usergroupstruct *group, *last;
struct userinfostruct *user;
if (j==0) user->filename[j++]='_'; //don't leave a file name empty
flen=j;
user->filename[j]='\0';
+ strncpy(user->ip,ip,sizeof(user->ip)-1);
+ user->ip[sizeof(user->ip)-1]='\0';
count=0;
for (group=first_user_group ; group ; group=group->next) {