Commit 644098a5 authored by rswindell's avatar rswindell
Browse files

Moved filter_ip() from str_util.c to userdat.c so str_util.c is not dependant

on date_str.c.
parent 1b9ec0bc
......@@ -194,28 +194,6 @@ BOOL DLLCALL trashcan(scfg_t* cfg, char* insearchof, char* name)
return(findstr(insearchof,fname));
}
/****************************************************************************/
/* Add an IP address (with comment) to the IP filter/trashcan file */
/****************************************************************************/
BOOL DLLCALL filter_ip(scfg_t* cfg, char* prot, char* reason, char* ip_addr, char* username)
{
char filename[MAX_PATH+1];
char tstr[64];
FILE* fp;
time_t now=time(NULL);
sprintf(filename,"%sip.can",cfg->text_dir);
if((fp=fopen(filename,"a"))==NULL)
return(FALSE);
fprintf(fp,"\n;%s %s by %s on %s\n%s\n"
,prot,reason,username,timestr(cfg,&now,tstr),ip_addr);
fclose(fp);
return(TRUE);
}
/****************************************************************************/
/* Returns the number of characters in 'str' not counting ctrl-ax codes */
/* or the null terminator */
......
......@@ -2223,3 +2223,26 @@ BOOL DLLCALL is_download_free(scfg_t* cfg, uint dirnum, user_t* user)
return(chk_ar(cfg,cfg->dir[dirnum]->ex_ar,user));
}
/****************************************************************************/
/* Add an IP address (with comment) to the IP filter/trashcan file */
/* ToDo: Move somewhere more appropriate (filter.c?) */
/****************************************************************************/
BOOL DLLCALL filter_ip(scfg_t* cfg, char* prot, char* reason, char* ip_addr, char* username)
{
char filename[MAX_PATH+1];
char tstr[64];
FILE* fp;
time_t now=time(NULL);
sprintf(filename,"%sip.can",cfg->text_dir);
if((fp=fopen(filename,"a"))==NULL)
return(FALSE);
fprintf(fp,"\n;%s %s by %s on %s\n%s\n"
,prot,reason,username,timestr(cfg,&now,tstr),ip_addr);
fclose(fp);
return(TRUE);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment