diff options
author | scrappy <scrappy@FreeBSD.org> | 2006-09-04 09:59:28 +0800 |
---|---|---|
committer | scrappy <scrappy@FreeBSD.org> | 2006-09-04 09:59:28 +0800 |
commit | 3867b3e87a0b5cdca348af04f49ff68149b31823 (patch) | |
tree | d83896a8fa76688ac250b31183894c6c4896550a /sysutils/bsdstats | |
parent | c2b031ec8973378798ac0d21775c4a567efdfc2e (diff) | |
download | freebsd-ports-gnome-3867b3e87a0b5cdca348af04f49ff68149b31823.tar.gz freebsd-ports-gnome-3867b3e87a0b5cdca348af04f49ff68149b31823.tar.zst freebsd-ports-gnome-3867b3e87a0b5cdca348af04f49ff68149b31823.zip |
First, set PATH similar to /etc/rc.shutdown, so that we don't have to
hardcode openssl, to allow for those using ports for it to easily make
use of acript
Second, check timestamp of /var/db/bsdstats to make sure that the 15
minutes have passed before submitting, so that ppl don't get that 'false
success' when they ctl-C
Submitted by: Oliver Fromme <olli@lurza.secnetix.de>
Diffstat (limited to 'sysutils/bsdstats')
-rw-r--r-- | sysutils/bsdstats/Makefile | 3 | ||||
-rw-r--r-- | sysutils/bsdstats/files/300.statistics | 16 | ||||
-rw-r--r-- | sysutils/bsdstats/files/300.statistics.in | 16 |
3 files changed, 29 insertions, 6 deletions
diff --git a/sysutils/bsdstats/Makefile b/sysutils/bsdstats/Makefile index c4e058b3fbfa..056d30108b15 100644 --- a/sysutils/bsdstats/Makefile +++ b/sysutils/bsdstats/Makefile @@ -6,8 +6,7 @@ # PORTNAME= bsdstats -PORTVERSION= 3.0 -PORTREVISION= 4 +PORTVERSION= 3.1 CATEGORIES= sysutils DISTFILES= diff --git a/sysutils/bsdstats/files/300.statistics b/sysutils/bsdstats/files/300.statistics index c4c6f15ac2e8..72038babd0f0 100644 --- a/sysutils/bsdstats/files/300.statistics +++ b/sysutils/bsdstats/files/300.statistics @@ -1,6 +1,6 @@ #!/bin/sh - # -# $FreeBSD: /tmp/pcvs/ports/sysutils/bsdstats/files/Attic/300.statistics,v 1.14 2006-08-26 17:12:50 scrappy Exp $ +# $FreeBSD: /tmp/pcvs/ports/sysutils/bsdstats/files/Attic/300.statistics,v 1.15 2006-09-04 01:59:28 scrappy Exp $ # # If there is a global system configuration file, suck it in. @@ -17,6 +17,9 @@ umask 066 checkin_server="bsdstats.org"; id_token_file='/var/db/bsdstats' +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin +export PATH + IFS=" " @@ -40,7 +43,7 @@ get_id_token () { if [ ! -f $id_token_file ] ; then - IDTOKEN=$( /usr/bin/openssl rand -base64 16 ) + IDTOKEN=$( openssl rand -base64 16 ) idf=$( mktemp "$id_token_file.XXXXXX" ) && \ /usr/sbin/chown root:wheel $idf && \ @@ -69,6 +72,15 @@ get_id_token () { echo "contains a 15 minute pause. Please be patient while this time" echo "limit elapses" sleep 900 + else + FILETIME=$( stat -f %m $id_token_file ) + NOW=$( date +%s ) + if [ $(( $NOW - 900 )) -le $FILETIME ]; then + SLEEPTIME=$(( 900 - ($NOW - $FILETIME) )) + echo "Token key is younger than 15 minutes!" + echo "Sleeping $SLEEPTIME seconds, please wait." + sleep $SLEEPTIME + fi fi . $id_token_file KEY=$( uri_escape $KEY ) diff --git a/sysutils/bsdstats/files/300.statistics.in b/sysutils/bsdstats/files/300.statistics.in index c59904a9ccd4..31bab01dd778 100644 --- a/sysutils/bsdstats/files/300.statistics.in +++ b/sysutils/bsdstats/files/300.statistics.in @@ -1,6 +1,6 @@ #!/bin/sh - # -# $FreeBSD: /tmp/pcvs/ports/sysutils/bsdstats/files/300.statistics.in,v 1.14 2006-08-26 17:12:50 scrappy Exp $ +# $FreeBSD: /tmp/pcvs/ports/sysutils/bsdstats/files/300.statistics.in,v 1.15 2006-09-04 01:59:28 scrappy Exp $ # # If there is a global system configuration file, suck it in. @@ -17,6 +17,9 @@ umask 066 checkin_server="bsdstats.org"; id_token_file='/var/db/bsdstats' +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin +export PATH + IFS=" " @@ -40,7 +43,7 @@ get_id_token () { if [ ! -f $id_token_file ] ; then - IDTOKEN=$( /usr/bin/openssl rand -base64 16 ) + IDTOKEN=$( openssl rand -base64 16 ) idf=$( mktemp "$id_token_file.XXXXXX" ) && \ /usr/sbin/chown root:wheel $idf && \ @@ -69,6 +72,15 @@ get_id_token () { echo "contains a 15 minute pause. Please be patient while this time" echo "limit elapses" sleep 900 + else + FILETIME=$( stat -f %m $id_token_file ) + NOW=$( date +%s ) + if [ $(( $NOW - 900 )) -le $FILETIME ]; then + SLEEPTIME=$(( 900 - ($NOW - $FILETIME) )) + echo "Token key is younger than 15 minutes!" + echo "Sleeping $SLEEPTIME seconds, please wait." + sleep $SLEEPTIME + fi fi . $id_token_file KEY=$( uri_escape $KEY ) |