diff -Naurp sarg-2.2.3.1/auth.c sarg-2.2.3.1.oden/auth.c --- sarg-2.2.3.1/auth.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/auth.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,7 @@ */ #include "include/conf.h" +void getword(char *word, char *line, int stop); void htaccess(char *name) { diff -Naurp sarg-2.2.3.1/authfail.c sarg-2.2.3.1.oden/authfail.c --- sarg-2.2.3.1/authfail.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/authfail.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,13 @@ */ #include "include/conf.h" +void css(FILE *fp_css); +void show_sarg(FILE *fp_ou, char *ind); +void getword(char *word, char *line, int stop); +void fixip(char *ip); +void ip2name(char *ip); +char *subs(char *str, char *from, char *to); +void show_info(FILE *fp_ou); void authfail_report() { diff -Naurp sarg-2.2.3.1/convlog.c sarg-2.2.3.1.oden/convlog.c --- sarg-2.2.3.1/convlog.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/convlog.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,7 @@ */ #include "include/conf.h" +void getword(char *word, char *line, int stop); void convlog(char *arq, char *df, int dfrom, int duntil) { diff -Naurp sarg-2.2.3.1/css.c sarg-2.2.3.1.oden/css.c --- sarg-2.2.3.1/css.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/css.c 2007-09-20 18:05:41.000000000 +0200 @@ -59,7 +59,7 @@ void css(FILE *fp_css) fprintf(fp_css,".data2 a:link,a:visited {font-family:%s;color:#0000FF;font-size:%s;background-color:%s;text-decoration:none;}\n", FontFace, FontSize, TxBgColor); fprintf(fp_css,".data3 {font-family:%s;color:%s;font-size:%s;text-align:center;background-color:%s;border-right:1px solid #6A5ACD;border-bottom:1px solid #6A5ACD;}\n", FontFace, TxColor, FontSize, TxBgColor); fprintf(fp_css,".data3 a:link,a:visited {font-family:%s;color:#0000FF;font-size:%s;text-align:center;background-color:%s;text-decoration:none;}\n", FontFace, FontSize, TxBgColor); - fprintf(fp_css,".text {font-family:%s;color:%s;font-size:%s;text-align:right;}\n", FontFace, TxColor, FontSize, TxBgColor); + fprintf(fp_css,".text {font-family:%s;color:%s;font-size:%s;text-align:right;background-color:%s;}\n", FontFace, TxColor, FontSize, TxBgColor); fprintf(fp_css,".link {font-family:%s;font-size:%s;color:#0000FF;}\n", FontFace, FontSize); fprintf(fp_css,".link a:link,a:visited {font-family:%s;font-size:%s;color:#0000FF;text-decoration:none;}\n</style>\n", FontFace, FontSize); } diff -Naurp sarg-2.2.3.1/dansguardian_log.c sarg-2.2.3.1.oden/dansguardian_log.c --- sarg-2.2.3.1/dansguardian_log.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/dansguardian_log.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,8 +24,11 @@ */ #include "include/conf.h" +void conv_month(char *month); +void debuga(char *msg); +void getword(char *word, char *line, int stop); -int dansguardian_log() +void dansguardian_log() { FILE *fp_in = NULL, *fp_ou = NULL, *fp_guard = NULL; @@ -38,7 +41,6 @@ int dansguardian_log() char ip[30]; char wdata[127]; int idata=0; - int x, y; bzero(day, 3); bzero(mon, 4); @@ -160,5 +162,4 @@ int dansguardian_log() sprintf(tmp6,"sort -k 1,1 -k 2,2 -k 4,4 '%s' -o '%s'",guard_in, guard_ou); system(tmp6); unlink(guard_in); - return; } diff -Naurp sarg-2.2.3.1/dansguardian_report.c sarg-2.2.3.1.oden/dansguardian_report.c --- sarg-2.2.3.1/dansguardian_report.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/dansguardian_report.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,13 @@ */ #include "include/conf.h" +void css(FILE *fp_css); +void show_sarg(FILE *fp_ou, char *ind); +void getword(char *word, char *line, int stop); +void fixip(char *ip); +void ip2name(char *ip); +char *subs(char *str, char *from, char *to); +void show_info(FILE *fp_ou); void dansguardian_report() { @@ -31,10 +38,8 @@ void dansguardian_report() FILE *fp_in = NULL, *fp_ou = NULL; char url[MAXLEN]; - char html[MAXLEN]; char html2[MAXLEN]; char dansguardian_in[MAXLEN]; - char dansguardian_ou[MAXLEN]; char per[MAXLEN]; char report[MAXLEN]; char period[100]; @@ -46,7 +51,6 @@ void dansguardian_report() char date[15]; char date2[15]; char hour[15]; - char ftime[128]; char *str; int z=0; int count=0; diff -Naurp sarg-2.2.3.1/datafile.c sarg-2.2.3.1.oden/datafile.c --- sarg-2.2.3.1/datafile.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/datafile.c 2007-09-20 18:05:41.000000000 +0200 @@ -27,6 +27,12 @@ void saverecs(char *dirname, char *user, long long int nacc, char *url, long long int nbytes, char *ip, char *hora, char *dia, long long int nelap, long long int incache, long long int oucache); void grava_SmartFilter(char *dirname, char *user, char *ip, char *data, char *hora, char *url, char *smart); +void getword(char *word, char *line, int stop); +void ip2name(char *ip); +void gravatmp(char *oldaccuser, char *dirname, char *oldurl, long long int nacc, long long int nbytes, char *oldmsg, long long int nelap, int indexonly, long long int incache, long long int oucache); +void debuga(char *msg); +void my_lltoa(unsigned long long int n, char s[], int len); +void name2ip(char *name); void data_file(char *tmp) { @@ -70,7 +76,6 @@ void data_file(char *tmp) exit(1); } strcpy(wdname,direntp->d_name); - strip_prefix: getword(wname2,wdname,'.'); strcat(user,wname2); diff -Naurp sarg-2.2.3.1/decomp.c sarg-2.2.3.1.oden/decomp.c --- sarg-2.2.3.1/decomp.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/decomp.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,7 @@ */ #include "include/conf.h" +void debuga(char *msg); void decomp(char *arq, char *zip, char *tmp) { diff -Naurp sarg-2.2.3.1/denied.c sarg-2.2.3.1.oden/denied.c --- sarg-2.2.3.1/denied.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/denied.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,13 @@ */ #include "include/conf.h" +void css(FILE *fp_css); +void show_sarg(FILE *fp_ou, char *ind); +void getword(char *word, char *line, int stop); +void fixip(char *ip); +void ip2name(char *ip); +char *subs(char *str, char *from, char *to); +void show_info(FILE *fp_ou); void gen_denied_report() { diff -Naurp sarg-2.2.3.1/download.c sarg-2.2.3.1.oden/download.c --- sarg-2.2.3.1/download.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/download.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,13 @@ */ #include "include/conf.h" +void css(FILE *fp_css); +void show_sarg(FILE *fp_ou, char *ind); +void getword(char *word, char *line, int stop); +void fixip(char *ip); +void ip2name(char *ip); +char *subs(char *str, char *from, char *to); +void show_info(FILE *fp_ou); void download_report() { diff -Naurp sarg-2.2.3.1/email.c sarg-2.2.3.1.oden/email.c --- sarg-2.2.3.1/email.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/email.c 2007-09-20 18:05:41.000000000 +0200 @@ -25,6 +25,11 @@ #include "include/conf.h" +char *fixnum(long long int value, int n); +char *buildtime(long long int elap); +void strip_latin(char *line); +void fixip(char *ip); + int geramail(const char *dirname, int debug, const char *outdir, int userip, char *email, char *TempDir) { diff -Naurp sarg-2.2.3.1/exclude.c sarg-2.2.3.1.oden/exclude.c --- sarg-2.2.3.1/exclude.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/exclude.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,7 @@ */ #include "include/conf.h" +void getword(char *word, char *line, int stop); int vhexclude(char *excludefile, char *url) { @@ -34,12 +35,12 @@ int vhexclude(char *excludefile, char *u int len = strlen(excludefile); if((str=(char *) malloc(len+1))==NULL) { - fprintf(stderr, "SARG: %s (%ld):\n",text[59], len); + fprintf(stderr, "SARG: %s (%d):\n",text[59], len); exit(1); } len = strlen(url); if((wurl=(char *) malloc(len+1))==NULL) { - fprintf(stderr, "SARG: %s (%ld):\n",text[59], len); + fprintf(stderr, "SARG: %s (%d):\n",text[59], len); exit(1); } whost[0]='\0'; diff -Naurp sarg-2.2.3.1/getconf.c sarg-2.2.3.1.oden/getconf.c --- sarg-2.2.3.1/getconf.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/getconf.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,11 @@ */ #include "include/conf.h" +void getword(char *word, char *line, int stop); +void fixnone(char *str); +void ccharset(); +void debuga(char *msg); +void language_load(char *language); extern numlist hours, weekdays; diff -Naurp sarg-2.2.3.1/grepday.c sarg-2.2.3.1.oden/grepday.c --- sarg-2.2.3.1/grepday.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/grepday.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,11 @@ */ #include "include/conf.h" +char *fixnum(long long int value, int n); +char *subs(char *str, char *from, char *to); +void fixip(char *ip); +void ip2name(char *ip); +void getword(char *word, char *line, int stop); int blue; int white; diff -Naurp sarg-2.2.3.1/html.c sarg-2.2.3.1.oden/html.c --- sarg-2.2.3.1/html.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/html.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,30 +24,45 @@ */ #include "include/conf.h" +void getword(char *word, char *line, int stop); +void report_day(char *user, int *iprel, int *ipuser); +void greport_day(char *user, int *iprel, int *ipuser); +void fixip(char *ip); +void css(FILE *fp_css); +void show_sarg(FILE *fp_ou, char *ind); +void ip2name(char *ip); +char *subs(char *str, char *from, char *to); +void debuga(char *msg); +char *fixnum(long long int value, int n); +char *fixnum2(long long int value, int n); +void url_module(char *url, char *w2); +char *buildtime(long long int elap); +void my_lltoa(unsigned long long int n, char s[], int len); +void show_info(FILE *fp_ou); +void htaccess(char *name); void htmlrel() { DIR *dirp; - FILE *fp_in, *fp_ou, *fp_ip, *fp_ip2, *fp_usr, *fp_tt; + FILE *fp_in, *fp_ou, *fp_ip, *fp_ip2, *fp_usr; struct dirent *direntp; long long int nnbytes=0, unbytes=0, tnbytes=0, totbytes=0, totbytes2=0; long long int totelap=0, totelap2=0, nnelap=0, unelap=0, tnelap=0; long long int incache=0, oucache=0, tnincache=0, tnoucache=0, twork=0, twork2=0; char arqin[MAXLEN], arqou[MAXLEN], arqper[MAXLEN], arqip[MAXLEN]; - char nacc[20], nbytes[20], url[1024], purl[1024], tmsg[50], tmsg2[50], nelap[20], csort[MAXLEN]; + char nacc[20], nbytes[20], url[1024], tmsg[50], nelap[20], csort[MAXLEN]; char period[MAXLEN], usuario[MAXLEN], wusuario[MAXLEN], u2[MAXLEN], duser[MAXLEN]; char userbytes[20], userelap[20], userurl[1024], userhora[9], userdia[9]; char user_ip[MAXLEN], olduserip[MAXLEN], tmp2[MAXLEN], tmp3[MAXLEN], incac[20], oucac[20]; char denied_report[255], name2[MAXLEN]; - char ttd1[3], ttd2[3], ttd3[5], ttt1[3], ttt2[3], ttt3[3]; char *str; - char ftime[128], warea[MAXLEN]; + char warea[MAXLEN]; char wtemp[MAXLEN], totuser[8]; long long int tnacc=0, ttnacc=0, unacc=0; float perc=0, perc2=0, ouperc=0, inperc=0; char *s; - int x, count; + int count; if(strstr(ReportType,"users_sites") == 0) return; diff -Naurp sarg-2.2.3.1/include/conf.h sarg-2.2.3.1.oden/include/conf.h --- sarg-2.2.3.1/include/conf.h 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/include/conf.h 2007-09-20 18:05:41.000000000 +0200 @@ -118,7 +118,7 @@ char href3[MAXLEN]; char df[20]; char day[3], month[4], year[5]; char nmonth[30]; -char y1[5], y2[5]; +char Y1[5], Y2[5]; char d1[3], d2[3]; char m1[4], m2[4]; char ltext110[50]; diff -Naurp sarg-2.2.3.1/index.c sarg-2.2.3.1.oden/index.c --- sarg-2.2.3.1/index.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/index.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,21 @@ */ #include "include/conf.h" +void mklastlog(); +void debuga(char *msg); +void conv_month(char *month); +void getword(char *word, char *line, int stop); +void conv_month_name(char *month); +char* get_size(char *path, char *file); +void obtdate(char *dirname, char *name, char *data); +void obtuser(char *dirname, char *name, char *tuser); +void obttotal(char *dirname, char *name, char *tbytes, char *tuser, char *media); +void buildymd(char *dia, char *mes, char *ano, char *wdata); +void write_html_header(FILE *fp_ou, char * ind); +void name_month(char *month); +void write_html_trailer(FILE *fp_ou); +void zdate(char *ftime, char *DateFormat); +void show_info(FILE *fp_ou); void make_index() { @@ -69,31 +84,31 @@ void make_index() if(strcmp(IndexTree,"date") == 0) { if(!isdigit(direntp->d_name[0]) && !isdigit(direntp->d_name[1])) continue; if(strlen(direntp->d_name) > 4) { - bzero(y1,5); - bzero(y2,5); + bzero(Y1,5); + bzero(Y2,5); bzero(m1,4); bzero(m2,4); bzero(d1,3); bzero(d2,3); if(strcmp(df,"u") == 0) { - strncpy(y1,direntp->d_name,4); + strncpy(Y1,direntp->d_name,4); strncpy(m1,direntp->d_name+4,3); strncpy(d1,direntp->d_name+7,2); - strncpy(y2,direntp->d_name+10,4); + strncpy(Y2,direntp->d_name+10,4); strncpy(m2,direntp->d_name+14,3); strncpy(d2,direntp->d_name+17,2); } else if(strcmp(df,"e") == 0) { - strncpy(y1,direntp->d_name+5,4); + strncpy(Y1,direntp->d_name+5,4); strncpy(m1,direntp->d_name+2,3); strncpy(d1,direntp->d_name,2); - strncpy(y2,direntp->d_name+15,4); + strncpy(Y2,direntp->d_name+15,4); strncpy(m2,direntp->d_name+12,3); strncpy(d2,direntp->d_name+10,2); } conv_month(m1); conv_month(m2); } - sprintf(val1,"%s%s",outdir,y1); + sprintf(val1,"%s%s",outdir,Y1); if(access(val1, R_OK) != 0) mkdir(val1,0755); if(strcmp(m1,m2) != 0) sprintf(val2,"%s/%s-%s",val1,m1,m2); else sprintf(val2,"%s/%s",val1,m1); @@ -110,7 +125,7 @@ void make_index() } else { if(!isdigit(direntp->d_name[0]) && !isdigit(direntp->d_name[1])) continue; if(strlen(direntp->d_name) == 4) { - strcpy(y1,direntp->d_name); + strcpy(Y1,direntp->d_name); sprintf(val1,"%s%s",outdir,direntp->d_name); dirp2 = opendir(val1); while ((direntp2 = readdir( dirp2 )) != NULL) { @@ -139,9 +154,9 @@ void make_index() strcpy(d1,warea); strcpy(d2,warea); } - if(strcmp(df,"u") == 0) sprintf(val4,"%s%s%s%s-%s%s%s",outdir,y1,m1,d1,y1,m2,d2); - else if(strcmp(df,"e") == 0) sprintf(val4,"%s%s%s%s-%s%s%s",outdir,d1,m1,y1,d2,m2,y1); - sprintf(val5,"%s%s/%s/%s",outdir,y1,direntp2->d_name,direntp3->d_name); + if(strcmp(df,"u") == 0) sprintf(val4,"%s%s%s%s-%s%s%s",outdir,Y1,m1,d1,Y1,m2,d2); + else if(strcmp(df,"e") == 0) sprintf(val4,"%s%s%s%s-%s%s%s",outdir,d1,m1,Y1,d2,m2,Y1); + sprintf(val5,"%s%s/%s/%s",outdir,Y1,direntp2->d_name,direntp3->d_name); if(rename(val5,val4)) { fprintf(stderr, "SARG: (index) rename error - %s\n",strerror(errno)); exit(1); diff -Naurp sarg-2.2.3.1/ip2name.c sarg-2.2.3.1.oden/ip2name.c --- sarg-2.2.3.1/ip2name.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/ip2name.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,7 @@ */ #include "include/conf.h" +void getword(char *word, char *line, int stop); void ip2name(char *ip) { diff -Naurp sarg-2.2.3.1/language.c sarg-2.2.3.1.oden/language.c --- sarg-2.2.3.1/language.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/language.c 2007-09-20 18:05:41.000000000 +0200 @@ -25,6 +25,8 @@ #include "include/conf.h" +void getword(char *word, char *line, int stop); + void language_load(char *language) { diff -Naurp sarg-2.2.3.1/lastlog.c sarg-2.2.3.1.oden/lastlog.c --- sarg-2.2.3.1/lastlog.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/lastlog.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,8 @@ */ #include "include/conf.h" +void getword(char *word, char *line, int stop); +void debuga(char *msg); void mklastlog() { diff -Naurp sarg-2.2.3.1/log.c sarg-2.2.3.1.oden/log.c --- sarg-2.2.3.1/log.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/log.c 2007-09-20 18:05:41.000000000 +0200 @@ -49,6 +49,36 @@ int compar( const void *, const void * ) #define _FILE_OFFSET_BITS 64 +void language_load(char *language); +void getword(char *word, char *line, int stop); +void date_from(char *date, char *dfrom, char *duntil); +void usage(char *prog); +void version(); +void debuga(char *msg); +void getconf(); +void realtime(void); +char *subs(char *str, char *from, char *to); +void convlog(char *arq, char *df, int dfrom, int duntil); +void splitlog(char *arq, char *df, int dfrom, int duntil, char *convert); +void load_excludecodes(); +void my_mkdir(char *name); +void decomp(char *arq, char *zip, char *tmp); +void getword3(char *word, char *line, int stop); +void conv_month_name(char *month); +int vercode(char *code); +int testvaliduserchar(char *user); +char *strlow(char *string); +void builddia(char *dia, char *mes, char *ano, char *df, char *wdata); +int vhexclude(char *excludefile, char *url); +int vuexclude(char *excludeuser, char *user); +void fixip(char *ip); +void fixper(char *tbuf, char *period, char *duntil); +void debugaz(char *head, char *msg); +void sort_users_log(char *tmp, int debug); +void data_file(char *tmp); +void gerarel(); +void recomp(char *arq, char *zip); + int main(argc,argv) int argc; char *argv[]; @@ -145,7 +175,7 @@ int main(argc,argv) SquidGuardLogAlternate[0]='\0'; arq[0]='\0'; - strcpy(AccessLog,"/usr/local/squid/var/logs/access.log"); + strcpy(AccessLog,"/var/log/squid/access.log"); sprintf(ExcludeCodes,"%s/exclude_codes",SYSCONFDIR); strcpy(GraphDaysBytesBarColor,"orange"); strcpy(BgColor,"#ffffff"); @@ -160,7 +190,7 @@ int main(argc,argv) strcpy(LogoTextColor,"#006699"); strcpy(FontSize,"9px"); strcpy(TempDir,"/tmp"); - strcpy(OutputDir,"/var/www/html/squid-reports"); + strcpy(OutputDir,"/var/www/localhost/htdocs/squid-reports"); strcpy(Ip2Name,"no"); strcpy(DateFormat,"u"); strcpy(OverwriteReport,"no"); @@ -645,7 +675,7 @@ int main(argc,argv) if (strlen(Ulimit) > 0) { #if defined(RLIMIT_NOFILE) getrlimit (RLIMIT_NOFILE, &rl); -#else #if defined(RLIMIT_OFILE) +#elif defined(RLIMIT_OFILE) getrlimit (RLIMIT_OFILE, &rl); #endif l1 = rl.rlim_cur; @@ -656,7 +686,7 @@ int main(argc,argv) rl.rlim_max = atol(Ulimit); #if defined(RLIMIT_NOFILE) if(setrlimit (RLIMIT_NOFILE, &rl) == -1) { - #else #if defined(RLIMIT_OFILE) + #elif defined(RLIMIT_OFILE) if(setrlimit (RLIMIT_OFILE, &rl) == -1) { #endif sprintf(msg,"setrlimit error - %s\n",strerror(errno)); @@ -1216,7 +1246,7 @@ int main(argc,argv) if(download_flag && strstr(code,"DENIED") == 0) { ndownload = 1; - sprintf(bufz, "%s %s %s %s %s %s\n",dia,hora,user,ip,download_url); + sprintf(bufz, "%s %s %s %s %s\n",dia,hora,user,ip,download_url); #ifdef LEGACY_WRITE_DOWNLOAD sprintf(tmp3,"%s/sarg/download.unsort",tmp); @@ -1395,7 +1425,6 @@ int main(argc,argv) sort_users_log(tmp, debug); - report_gen: if(strlen(DataFile) > 0) data_file(tmp); else diff -Naurp sarg-2.2.3.1/realtime.c sarg-2.2.3.1.oden/realtime.c --- sarg-2.2.3.1/realtime.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/realtime.c 2007-09-20 18:05:41.000000000 +0200 @@ -29,6 +29,12 @@ void getdata(char *, FILE *); void datashow(char *); void getlog(); void header(); +void getword(char *word, char *line, int stop); +void debuga(char *msg); +void getword3(char *word, char *line, int stop); +void ip2name(char *ip); +char *subs(char *str, char *from, char *to); +void css(FILE *fp_css); char dat[128]; char tim[128]; @@ -37,7 +43,7 @@ char ouser[MAXLEN]=""; char ourl[MAXLEN]=""; void -realtime(int argc, char *argv[]) +realtime(void) { getlog(); diff -Naurp sarg-2.2.3.1/repday.c sarg-2.2.3.1.oden/repday.c --- sarg-2.2.3.1/repday.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/repday.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,14 @@ */ #include "include/conf.h" +void getword(char *word, char *line, int stop); +void css(FILE *fp_css); +void show_sarg(FILE *fp_ou, char *ind); +void fixip(char *ip); +void ip2name(char *ip); +char *subs(char *str, char *from, char *to); +char *fixtime(long int elap); +void show_info(FILE *fp_ou); extern numlist hours; diff -Naurp sarg-2.2.3.1/report.c sarg-2.2.3.1.oden/report.c --- sarg-2.2.3.1/report.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/report.c 2007-09-20 18:05:41.000000000 +0200 @@ -25,6 +25,37 @@ #include "include/conf.h" #include "include/defs.h" +void vrfydir(char *dir, char *per1, char *addr, char *site, char *us, char *form); +void debugaz(char *head, char *msg); +void gperiod(); +void useragent(); +void getword(char *word, char *line, int stop); +void ip2name(char *ip); +void my_mkdir(char *name); +void css(FILE *fp_css); +void show_sarg(FILE *fp_ou, char *ind); +char *subs(char *str, char *from, char *to); +void day_totalize(const char *tmp, char *user, int indexonly); +void tmpsort(); +int totalger(const char *dirname, int debug, const char *outdir); +void download_report(); +void dansguardian_log(); +void squidguard_log(); +void topuser(); +void topsites(); +void siteuser(); +void gen_denied_report(); +void authfail_report(); +void smartfilter_report(); +void dansguardian_report(); +void squidguard_report(); +void htmlrel(); +void make_index(); +int geramail(const char *dirname, int debug, const char *outdir, int userip, char *email, char *TempDir); +void index_only(); +void removetmp(char *outdir); +void debuga(char *msg); +void my_lltoa(unsigned long long int n, char s[], int len); void gerarel() { diff -Naurp sarg-2.2.3.1/siteuser.c sarg-2.2.3.1.oden/siteuser.c --- sarg-2.2.3.1/siteuser.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/siteuser.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,15 @@ */ #include "include/conf.h" +void css(FILE *fp_css); +void show_sarg(FILE *fp_ou, char *ind); +char *strlow(char *string); +void getword(char *word, char *line, int stop); +void fixip(char *ip); +char *subs(char *str, char *from, char *to); +void ip2name(char *ip); +char *fixnum(long long int value, int n); +void show_info(FILE *fp_ou); void siteuser() { diff -Naurp sarg-2.2.3.1/smartfilter.c sarg-2.2.3.1.oden/smartfilter.c --- sarg-2.2.3.1/smartfilter.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/smartfilter.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,10 @@ */ #include "include/conf.h" +char *strup(char *string); +void getword(char *word, char *line, int stop); +void fixip(char *ip); +void zdate(char *ftime, char *DateFormat); void smartfilter_report() { diff -Naurp sarg-2.2.3.1/sort.c sarg-2.2.3.1.oden/sort.c --- sarg-2.2.3.1/sort.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/sort.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,10 @@ */ #include "include/conf.h" +void getword(char *word, char *line, int stop); +void debuga(char *msg); +char *strup(char *string); +char *strlow(char *string); void tmpsort() { diff -Naurp sarg-2.2.3.1/splitlog.c sarg-2.2.3.1.oden/splitlog.c --- sarg-2.2.3.1/splitlog.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/splitlog.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,7 @@ */ #include "include/conf.h" +void getword(char *word, char *line, int stop); void splitlog(char *arq, char *df, int dfrom, int duntil, char *convert) { diff -Naurp sarg-2.2.3.1/squidguard_log.c sarg-2.2.3.1.oden/squidguard_log.c --- sarg-2.2.3.1/squidguard_log.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/squidguard_log.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,9 @@ */ #include "include/conf.h" +void getword(char *word, char *line, int stop); +void debuga(char *msg); +void conv_month(char *month); static char **files_done = NULL; static int nfiles_done = 0; @@ -159,7 +162,7 @@ void read_log(char *wentp, FILE *fp_ou) } -int squidguard_log() +void squidguard_log() { FILE *fp_ou = NULL, *fp_guard = NULL; @@ -168,7 +171,6 @@ int squidguard_log() char logdir[MAXLEN]; char year[10], day[10], mon[10]; char user[MAXLEN]; - char ip[30]; int x, y; str2 = user; diff -Naurp sarg-2.2.3.1/squidguard_report.c sarg-2.2.3.1.oden/squidguard_report.c --- sarg-2.2.3.1/squidguard_report.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/squidguard_report.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,13 @@ */ #include "include/conf.h" +void css(FILE *fp_css); +void show_sarg(FILE *fp_ou, char *ind); +void getword(char *word, char *line, int stop); +void fixip(char *ip); +void ip2name(char *ip); +char *subs(char *str, char *from, char *to); +void show_info(FILE *fp_ou); void squidguard_report() { @@ -31,10 +38,8 @@ void squidguard_report() FILE *fp_in = NULL, *fp_ou = NULL; char url[MAXLEN]; - char html[MAXLEN]; char html2[MAXLEN]; char squidguard_in[MAXLEN]; - char squidguard_ou[MAXLEN]; char per[MAXLEN]; char report[MAXLEN]; char period[100]; @@ -46,7 +51,6 @@ void squidguard_report() char data[15]; char data2[15]; char hora[15]; - char ftime[128]; char *str; int z=0; int count=0; diff -Naurp sarg-2.2.3.1/topsites.c sarg-2.2.3.1.oden/topsites.c --- sarg-2.2.3.1/topsites.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/topsites.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,14 @@ */ #include "include/conf.h" +void getword(char *word, char *line, int stop); +void my_lltoa(unsigned long long int n, char s[], int len); +char *strlow(char *string); +void css(FILE *fp_css); +void show_sarg(FILE *fp_ou, char *ind); +char *fixnum(long long int value, int n); +char *fixtime(long int elap); +void show_info(FILE *fp_ou); void topsites() { @@ -216,7 +224,7 @@ void topsites() sprintf(wwork1,"%s",fixnum(twork1,1)); sprintf(wwork2,"%s",fixnum(twork2,1)); - sprintf(wwork3,"%s",fixtime(twork3,1)); + sprintf(wwork3,"%s",fixtime(twork3)); if(strlen(BlockIt) > 0) sprintf(BlockImage,"<a href=\"%s%s?url=%s\"><img src=\"../images/sarg-squidguard-block.png\" border=\"0\"></a> ",wwwDocumentRoot,BlockIt,url); diff -Naurp sarg-2.2.3.1/topuser.c sarg-2.2.3.1.oden/topuser.c --- sarg-2.2.3.1/topuser.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/topuser.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,8 +24,20 @@ */ #include "include/conf.h" +void my_lltoa(unsigned long long int n, char s[], int len); +char *strup(char *string); +char *strlow(char *string); +void css(FILE *fp_css); +void show_sarg(FILE *fp_ou, char *ind); +void fixip(char *ip); +void ip2name(char *ip); +char *fixnum(long long int value, int n); +char *fixnum2(long long int value, int n); +char *buildtime(long long int elap); +char *subs(char *str, char *from, char *to); +void show_info(FILE *fp_ou); -int topuser() +void topuser() { FILE *fp_in = NULL, *fp_ou = NULL, *fp_top1 = NULL, *fp_top2 = NULL, *fp_top3 = NULL; diff -Naurp sarg-2.2.3.1/totday.c sarg-2.2.3.1.oden/totday.c --- sarg-2.2.3.1/totday.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/totday.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,8 @@ */ #include "include/conf.h" +void getword(char *word, char *line, int stop); +void my_lltoa(unsigned long long int n, char s[], int len); void day_totalize(const char *tmp, char *user, int indexonly) { diff -Naurp sarg-2.2.3.1/totger.c sarg-2.2.3.1.oden/totger.c --- sarg-2.2.3.1/totger.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/totger.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,7 @@ */ #include "include/conf.h" +void my_lltoa(unsigned long long int n, char s[], int len); int totalger(const char *dirname, int debug, const char *outdir) diff -Naurp sarg-2.2.3.1/useragent.c sarg-2.2.3.1.oden/useragent.c --- sarg-2.2.3.1/useragent.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/useragent.c 2007-09-20 18:05:41.000000000 +0200 @@ -24,6 +24,11 @@ */ #include "include/conf.h" +void debuga(char *msg); +void getword(char *word, char *line, int stop); +void show_sarg(FILE *fp_ou, char *ind); +void ip2name(char *ip); +void zdate(char *ftime, char *DateFormat); void useragent() { diff -Naurp sarg-2.2.3.1/util.c sarg-2.2.3.1.oden/util.c --- sarg-2.2.3.1/util.c 2007-01-02 20:11:26.000000000 +0100 +++ sarg-2.2.3.1.oden/util.c 2007-09-20 18:05:41.000000000 +0200 @@ -31,6 +31,8 @@ static char mtab1[12][4]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}; static char mtab2[12][3]={"01","02","03","04","05","06","07","08","09","10","11","12"}; +void css(FILE *fp_css); + /*void fgetword(char *word, char *line, int stop) { //VARIANT N1 @@ -57,7 +59,7 @@ void getword(char *word, char *line, int { int x = 0, y = 0; int limit=10000; - char wline[MAXLEN]; + //char wline[MAXLEN]; //strcpy(wline,line); @@ -510,7 +512,6 @@ char *fixnum2(long long int value, int n char ret[MAXIMO * 2]; char *pret; register int i, j, k; - static char abbrev[30]; my_lltoa(value, num, 0); bzero(buf, MAXIMO*2); @@ -719,15 +720,15 @@ void vrfydir(char *dir, char *per1, char struct dirent *direntp; if(strcmp(IndexTree,"date") == 0) { - bzero(y1,5); - bzero(y2,5); + bzero(Y1,5); + bzero(Y2,5); bzero(d1,3); bzero(d2,3); bzero(m1,4); bzero(m2,4); if(strncmp(df,"u",1) == 0) { - strncpy(y1,period,4); - strncpy(y2,period+10,4); + strncpy(Y1,period,4); + strncpy(Y2,period+10,4); strncpy(m1,period+4,3); strncpy(m2,period+14,3); strncpy(d1,period+7,2); @@ -737,16 +738,16 @@ void vrfydir(char *dir, char *per1, char strncpy(d2,period+10,2); strncpy(m1,period+2,3); strncpy(m2,period+12,3); - strncpy(y1,period+5,4); - strncpy(y2,period+15,4); + strncpy(Y1,period+5,4); + strncpy(Y2,period+15,4); } conv_month(m1); conv_month(m2); - sprintf(wdir,"%s%s",outdir,y1); - if(strcmp(y1,y2) != 0) { + sprintf(wdir,"%s%s",outdir,Y1); + if(strcmp(Y1,Y2) != 0) { strncat(wdir,"-",1); - strncat(wdir,y2,strlen(y2)); + strncat(wdir,Y2,strlen(Y2)); } if(access(wdir, R_OK) != 0) my_mkdir(wdir); @@ -1234,7 +1235,7 @@ void show_sarg(FILE *fp_ou, char *ind) if(strcmp(ShowSargLogo,"yes") == 0) fprintf(fp_ou,"<center><table cellpadding=0 cellspacing=0>\n<tr><th class=\"logo\"><a href=\"http://sarg.sourceforge.net\"><img src=\"%s/images/sarg.png\" border=\"0\" align=\"absmiddle\" title=\"SARG, Squid Analysis Report Generator. Logo by Osamu Matsuzaki\"></a> <font class=\"logo\">Squid Analysis Report Generator</font></th></tr>\n<tr><th class=\"title\"> </th></tr>\n<table>\n",ind); } -get_size(char *path, char *file) +char* get_size(char *path, char *file) { FILE *fp; char response[255]; @@ -1260,7 +1261,7 @@ void write_html_header(FILE *fp_ou, char } -char url_module(char *url, char *w2) +void url_module(char *url, char *w2) { int x, y; char w[255]; @@ -1279,8 +1280,6 @@ char url_module(char *url, char *w2) w2[y]=w[x]; y++; } - - return; }