diff options
author | Marc G. Fournier <scrappy@FreeBSD.org> | 2006-09-04 01:59:28 +0000 |
---|---|---|
committer | Marc G. Fournier <scrappy@FreeBSD.org> | 2006-09-04 01:59:28 +0000 |
commit | 97367f94b1e2c55c77809fa25867324b7437205c (patch) | |
tree | 8192a6f12a2bd3305deaca433cb578d5e9536fba /sysutils/bsdstats/files | |
parent | 2fa3ce0df027aafcdf7a7e2d3a51671fb69c84cd (diff) |
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>
Notes
Notes:
svn path=/head/; revision=172118
Diffstat (limited to 'sysutils/bsdstats/files')
-rw-r--r-- | sysutils/bsdstats/files/300.statistics | 16 | ||||
-rw-r--r-- | sysutils/bsdstats/files/300.statistics.in | 16 |
2 files changed, 28 insertions, 4 deletions
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 ) |