From 5519824c03b24668a793a97e1f9355686b1554ca Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Fri, 12 Mar 2010 09:45:23 +0000 Subject: [PATCH] Add ykval-checksum-clients. --- Makefile | 12 ++++---- NEWS | 4 +++ ykval-checksum-clients.php | 57 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 5 deletions(-) create mode 100755 ykval-checksum-clients.php diff --git a/Makefile b/Makefile index 39ed0d9..66c1b20 100644 --- a/Makefile +++ b/Makefile @@ -28,13 +28,14 @@ VERSION = 2.2 PACKAGE = yubikey-val -CODE = Makefile NEWS ykval-api.html ykval-common.php ykval-config.php \ - ykval-db.php ykval-db.sql ykval-export.php ykval-import.php \ - ykval-log.php ykval-ping.php ykval-queue.php ykval-revoke.php \ - ykval-synclib.php ykval-sync.php ykval-verify.php +CODE = Makefile NEWS ykval-api.html ykval-checksum-clients.php \ + ykval-common.php ykval-config.php ykval-db.php ykval-db.sql \ + ykval-export.php ykval-import.php ykval-log.php ykval-ping.php \ + ykval-queue.php ykval-revoke.php ykval-synclib.php \ + ykval-sync.php ykval-verify.php DOCS = doc/ClientInfoFormat.wiki doc/Installation.wiki \ doc/RevocationService.wiki doc/ServerReplicationProtocol.wiki \ - doc/Troubleshooting.wiki + doc/SyncMonitor.wiki doc/Troubleshooting.wiki all: @echo "Try 'make install' or 'make symlink'." @@ -59,6 +60,7 @@ install: install -D ykval-queue.php $(sbinprefix)/ykval-queue install -D ykval-export.php $(sbinprefix)/ykval-export install -D ykval-import.php $(sbinprefix)/ykval-import + install -D ykval-checksum-clients.php $(sbinprefix)/ykval-checksum-clients install -D --backup --mode 640 --group $(wwwgroup) ykval-config.php $(etcprefix)/ykval-config.php install -D ykval-db.sql $(docprefix)/ykval-db.sql install -D $(DOCS) $(docprefix)/ diff --git a/NEWS b/NEWS index f114762..8866028 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +* Version 2.3 + + * Add ykval-checksum-clients.php, see doc/SyncMonitor.wiki. + * Version 2.2 * Minor cleanups and fixes. diff --git a/ykval-checksum-clients.php b/ykval-checksum-clients.php new file mode 100755 index 0000000..1f0e4ec --- /dev/null +++ b/ykval-checksum-clients.php @@ -0,0 +1,57 @@ +#!/usr/bin/php +connect()) { + $myLog->log(LOG_WARNING, "Could not connect to database"); + exit(1); +} + +$everything = ""; +$result=$db->customQuery("SELECT id, active, secret ". + "FROM clients ". + "ORDER BY id"); +while($row = $result->fetch(PDO::FETCH_ASSOC)) { + $everything = $everything . + $row['id'] . "\t" . $row['active'] . "\t" . $row['secret'] . + "\n"; +} + +$hash = sha1 ($everything); + +if ($verbose) { + print $everything; +} +print substr ($hash, 0, 10) . "\n"; + +$result=null; +$db=null; + +?>