1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-16 07:58:04 +00:00

Webalizer+GeoIP

This commit is contained in:
Andrey A. Chernov 2004-07-23 21:12:38 +00:00
parent 7d54de42c1
commit 56bc4566bf
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=114525
10 changed files with 323 additions and 0 deletions

View File

@ -129,6 +129,7 @@
SUBDIR += gallery
SUBDIR += gatling
SUBDIR += geeklog
SUBDIR += geolizer
SUBDIR += gforge
SUBDIR += glibwww
SUBDIR += gnuinfo

42
www/geolizer/Makefile Normal file
View File

@ -0,0 +1,42 @@
# New ports collection makefile for: geolizer
# Date created: 23 July 2004
# Whom: ache@FreeBSD.org
#
# $FreeBSD$
#
CONFLICTS= webalizer-2*
MASTERDIR= ${.CURDIR}/../webalizer
PATCH_SITES+= http://sysd.org/proj/
PATCHFILES+= geolizer_2.01-10-patch.20040216.tar.bz2
PATCH_DIST_STRIP= -p1
PATCHDIR= ${.CURDIR}/files
MD5_FILE= ${.CURDIR}/distinfo
DESCR= ${.CURDIR}/pkg-descr
DOCSDIR= ${PREFIX}/share/doc/webalizer
EXAMPLESDIR= ${PREFIX}/share/examples/webalizer
WEBALIZER_LANG=english
CFLAGS+= -I${LOCALBASE}/include
CONFIGURE_ARGS+= --enable-geoip \
--with-geoip-lib=${LOCALBASE} \
--with-geoip-inc=${LOCALBASE}
LIB_DEPENDS= gd.4:${PORTSDIR}/graphics/gd \
GeoIP.4:${PORTSDIR}/net/GeoIP
MAINTAINER= ports@FreeBSD.org
.include "${MASTERDIR}/Makefile"
# Overwrite section, can't be placed before
PORTNAME= geolizer
PORTREVISION= 0
DISTNAME= webalizer-2.01-10-src
COMMENT= A web server log file analysis program, using GeoIP library

4
www/geolizer/distinfo Normal file
View File

@ -0,0 +1,4 @@
MD5 (webalizer-2.01-10-src.tar.bz2) = 26d0a3c142423678daed2d6f579525d8
SIZE (webalizer-2.01-10-src.tar.bz2) = 252664
MD5 (geolizer_2.01-10-patch.20040216.tar.bz2) = fa2e960702c72a16707854537053a966
SIZE (geolizer_2.01-10-patch.20040216.tar.bz2) = 27688

View File

@ -0,0 +1,17 @@
--- linklist.c.bak Fri Sep 29 07:51:02 2000
+++ linklist.c Sat Oct 14 17:22:16 2000
@@ -197,12 +197,12 @@
strncpy(temp_buf,str,79);
temp_buf[79]=0;
- while (!isspace((int)*name)&&*name!=0) name++;
+ while (!isspace((unsigned char)*name)&&*name!=0) name++;
if (*name==0) name=temp_buf;
else
{
*name++=0;
- while (isspace((int)*name)&&*name!=0) name++;
+ while (isspace((unsigned char)*name)&&*name!=0) name++;
if (*name==0) name=temp_buf;
}

View File

@ -0,0 +1,65 @@
--- preserve.c.bak Fri Sep 29 07:51:32 2000
+++ preserve.c Sat Oct 14 17:34:03 2000
@@ -492,7 +492,7 @@
tmp_buf[strlen(tmp_buf)-1]=0;
if ((fgets(buffer,BUFSIZE,fp)) == NULL) return 10; /* error exit */
- if (!isdigit((int)buffer[0])) return 10; /* error exit */
+ if (!isdigit((unsigned char)buffer[0])) return 10; /* error exit */
/* load temporary node data */
sscanf(buffer,"%d %lu %lu %lf %lu %lu",
@@ -523,7 +523,7 @@
tmp_buf[strlen(buffer)-1]=0;
if ((fgets(buffer,BUFSIZE,fp)) == NULL) return 8; /* error exit */
- if (!isdigit((int)buffer[0])) return 8; /* error exit */
+ if (!isdigit((unsigned char)buffer[0])) return 8; /* error exit */
/* load temporary node data */
sscanf(buffer,"%d %lu %lu %lf %lu %lu",
@@ -563,7 +563,7 @@
tmp_buf[strlen(buffer)-1]=0;
if ((fgets(buffer,BUFSIZE,fp)) == NULL) return 9; /* error exit */
- if (!isdigit((int)buffer[0])) return 9; /* error exit */
+ if (!isdigit((unsigned char)buffer[0])) return 9; /* error exit */
/* load temporary node data */
sscanf(buffer,"%d %lu %lu %lf %lu %lu",
@@ -602,7 +602,7 @@
tmp_buf[strlen(buffer)-1]=0;
if ((fgets(buffer,BUFSIZE,fp)) == NULL) return 11; /* error exit */
- if (!isdigit((int)buffer[0])) return 11; /* error exit */
+ if (!isdigit((unsigned char)buffer[0])) return 11; /* error exit */
/* load temporary node data */
sscanf(buffer,"%d %lu",&t_rnode.flag,&t_rnode.count);
@@ -627,7 +627,7 @@
tmp_buf[strlen(buffer)-1]=0;
if ((fgets(buffer,BUFSIZE,fp)) == NULL) return 12; /* error exit */
- if (!isdigit((int)buffer[0])) return 12; /* error exit */
+ if (!isdigit((unsigned char)buffer[0])) return 12; /* error exit */
/* load temporary node data */
sscanf(buffer,"%d %lu",&t_anode.flag,&t_anode.count);
@@ -652,7 +652,7 @@
tmp_buf[strlen(buffer)-1]=0;
if ((fgets(buffer,BUFSIZE,fp)) == NULL) return 13; /* error exit */
- if (!isdigit((int)buffer[0])) return 13; /* error exit */
+ if (!isdigit((unsigned char)buffer[0])) return 13; /* error exit */
/* load temporary node data */
sscanf(buffer,"%lu",&t_snode.count);
@@ -677,7 +677,7 @@
tmp_buf[strlen(buffer)-1]=0;
if ((fgets(buffer,BUFSIZE,fp)) == NULL) return 14; /* error exit */
- if (!isdigit((int)buffer[0])) return 14; /* error exit */
+ if (!isdigit((unsigned char)buffer[0])) return 14; /* error exit */
/* load temporary node data */
sscanf(buffer,"%d %lu %lu %lf %lu %lu",

View File

@ -0,0 +1,71 @@
--- webalizer.c.orig Wed Oct 24 10:24:51 2001
+++ webalizer.c Tue Feb 12 05:29:59 2002
@@ -231,7 +231,7 @@
int main(int argc, char *argv[])
{
int i; /* generic counter */
- char *cp1, *cp2, *cp3, *str; /* generic char pointers */
+ unsigned char *cp1, *cp2, *cp3, *str; /* generic char pointers */
NLISTPTR lptr; /* generic list pointer */
extern char *optarg; /* used for command line */
@@ -569,7 +569,7 @@
/* convert month name to lowercase */
for (i=4;i<7;i++)
- log_rec.datetime[i]=tolower(log_rec.datetime[i]);
+ log_rec.datetime[i]=tolower((unsigned char)log_rec.datetime[i]);
/* get year/month/day/hour/min/sec values */
for (i=0;i<12;i++)
@@ -713,7 +713,7 @@
{
if ((cp1=strstr(log_rec.url,lptr->string))!=NULL)
{
- if ((cp1==log_rec.url)||(*(cp1-1)=='/'))
+ if ((cp1==(unsigned char *)log_rec.url)||(*(cp1-1)=='/'))
{
*cp1='\0';
if (log_rec.url[0]=='\0')
@@ -1466,19 +1466,19 @@
while ( (fgets(buffer,BUFSIZE,fp)) != NULL)
{
/* skip comments and blank lines */
- if ( (buffer[0]=='#') || isspace((int)buffer[0]) ) continue;
+ if ( (buffer[0]=='#') || isspace((unsigned char)buffer[0]) ) continue;
/* Get keyword */
cp1=buffer;cp2=keyword;
- while ( isalnum((int)*cp1) ) *cp2++ = *cp1++;
+ while ( isalnum((unsigned char)*cp1) ) *cp2++ = *cp1++;
*cp2='\0';
/* Get value */
cp2=value;
- while ( (*cp1!='\n')&&(*cp1!='\0')&&(isspace((int)*cp1)) ) cp1++;
+ while ( (*cp1!='\n')&&(*cp1!='\0')&&(isspace((unsigned char)*cp1)) ) cp1++;
while ( (*cp1!='\n')&&(*cp1!='\0') ) *cp2++ = *cp1++;
*cp2--='\0';
- while ( (isspace((int)*cp2)) && (cp2 != value) ) *cp2--='\0';
+ while ( (isspace((unsigned char)*cp2)) && (cp2 != value) ) *cp2--='\0';
/* check if blank keyword/value */
if ( (keyword[0]=='\0') || (value[0]=='\0') ) continue;
@@ -1820,7 +1820,7 @@
if (*cp1=='+') *cp1=' '; /* change + to space */
if (sp_flg && *cp1==' ') { cp1++; continue; } /* compress spaces */
if (*cp1==' ') sp_flg=1; else sp_flg=0; /* (flag spaces here) */
- *cp2++=tolower(*cp1); /* normal character */
+ *cp2++= *cp1; /* normal character */
cp1++;
}
}
@@ -1855,7 +1855,7 @@
int i=group_domains+1;
cp = str+strlen(str)-1;
- if (isdigit((int)*cp)) return NULL; /* ignore IP addresses */
+ if (isdigit((unsigned char)*cp)) return NULL; /* ignore IP addresses */
while (cp!=str)
{

View File

@ -0,0 +1,42 @@
--- output.c.orig Fri Jul 23 23:13:47 2004
+++ output.c Sat Jul 24 00:26:37 2004
@@ -1543,10 +1543,17 @@
rptr=*pointer++;
if (rptr->flag == OBJ_REG)
{
- fprintf(out_fp,"%-8lu %6.02f%% %s\n",
- rptr->count,
- (t_hit==0)?0:((float)rptr->count/t_hit)*100.0,
- rptr->string);
+ if (strstr(rptr->string,"://")!=NULL)
+ fprintf(out_fp,"%-8lu %6.02f%% <A HREF=\"%s\">%s</A>\n",
+ rptr->count,
+ (t_hit==0)?0:((float)rptr->count/t_hit)*100.0,
+ rptr->string,
+ rptr->string);
+ else
+ fprintf(out_fp,"%-8lu %6.02f%% %s\n",
+ rptr->count,
+ (t_hit==0)?0:((float)rptr->count/t_hit)*100.0,
+ rptr->string);
r_reg--;
}
}
@@ -2033,7 +2040,7 @@
while ( (*domain!='.')&&(domain!=hptr->string)) domain--;
if (domain==hptr->string)
country=NULL;
- else if (isdigit((int)*++domain))
+ else if (isdigit((unsigned char)*++domain))
{
#ifdef USE_GEOIP
if (use_geoip)
@@ -2918,7 +2925,7 @@
static char warpbuf[32][32];
static int index = -1;
- if (index<0 || index>32)
+ if (index<0 || index>=32)
index=0;
while (n>=base && usesuf<=10)

View File

@ -0,0 +1,42 @@
--- linklist.c.orig Sat Jun 23 11:12:40 2001
+++ linklist.c Sat Jun 23 11:19:54 2001
@@ -190,12 +190,12 @@
int add_glist(char *str, GLISTPTR *list)
{
GLISTPTR newptr,cptr,pptr;
- char temp_buf[80];
+ char temp_buf[LINKLIST_MAX_STRING];
char *name=temp_buf;
/* make local copy of string */
- strncpy(temp_buf,str,79);
- temp_buf[79]=0;
+ strncpy(temp_buf,str,LINKLIST_MAX_STRING - 1);
+ temp_buf[LINKLIST_MAX_STRING - 1]=0;
while (!isspace((unsigned char)*name)&&*name!=0) name++;
if (*name==0) name=temp_buf;
--- linklist.h.orig Fri Sep 29 05:50:30 2000
+++ linklist.h Sat Jun 23 11:15:57 2001
@@ -1,12 +1,18 @@
#ifndef _LINKLIST_H
#define _LINKLIST_H
-struct nlist { char string[80]; /* list struct for HIDE items */
+#ifndef LINKLIST_MAX_STRING
+#define LINKLIST_MAX_STRING 80
+#endif
+
+struct nlist { /* list struct for HIDE items */
+ char string[LINKLIST_MAX_STRING];
struct nlist *next; };
typedef struct nlist *NLISTPTR;
-struct glist { char string[80]; /* list struct for GROUP items */
- char name[80];
+struct glist { /* list struct for GROUP items */
+ char string[LINKLIST_MAX_STRING];
+ char name[LINKLIST_MAX_STRING];
struct glist *next; };
typedef struct glist *GLISTPTR;

View File

@ -0,0 +1,32 @@
--- webalizer.c 2002-04-16 18:11:31.000000000 -0400
+++ webalizer.c.new 2003-07-07 12:35:45.000000000 -0400
@@ -688,6 +688,14 @@
/* un-escape URL */
unescape(log_rec.url);
+ /* strip query portion of cgi scripts */
+ cp1 = log_rec.url;
+ while (*cp1 != '\0')
+ if (!isurlchar(*cp1)) { *cp1 = '\0'; break; }
+ else cp1++;
+ if (log_rec.url[0]=='\0')
+ { log_rec.url[0]='/'; log_rec.url[1]='\0'; }
+
/* check for service (ie: http://) and lowercase if found */
if ( (cp2=strstr(log_rec.url,"://")) != NULL)
{
@@ -699,14 +707,6 @@
}
}
- /* strip query portion of cgi scripts */
- cp1 = log_rec.url;
- while (*cp1 != '\0')
- if (!isurlchar(*cp1)) { *cp1 = '\0'; break; }
- else cp1++;
- if (log_rec.url[0]=='\0')
- { log_rec.url[0]='/'; log_rec.url[1]='\0'; }
-
/* strip off index.html (or any aliases) */
lptr=index_alias;
while (lptr!=NULL)

7
www/geolizer/pkg-descr Normal file
View File

@ -0,0 +1,7 @@
Patch for Webalizer to generate faster and more reliable geographic
statistics than using default DNS suffix method. It uses GeoIP library to
do that. In fact, if you disable DNS reversal on your HTTP server, it will
work faster and your stats get more accuracy when processed by patched
Webalizer.
WWW: http://sysd.org/proj/log.php#glzr