From b754c24d29f87bbb26c493709236da3ab2ae4fb3 Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Mon, 11 Jun 2012 12:41:50 +0200 Subject: [PATCH 1/4] use one curl-handle per server does connection re-use while syncing to that server --- ykval-synclib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ykval-synclib.php b/ykval-synclib.php index 30834d7..8def5a5 100644 --- a/ykval-synclib.php +++ b/ykval-synclib.php @@ -295,6 +295,7 @@ class SyncLib $this->log(LOG_INFO, "Sending queue request to server on server " . $my_server['server']); $res=$this->db->customQuery("select * from queue WHERE (queued < " . $queued_limit . " or queued is null) and server='" . $my_server['server'] . "'"); + $ch = curl_init(); while ($entry=$res->fetch(PDO::FETCH_ASSOC)) { $this->log(LOG_INFO, "server=" . $entry['server'] . " , info=" . $entry['info']); $url=$entry['server'] . @@ -305,14 +306,13 @@ class SyncLib /* Send out sync request */ $this->log(LOG_DEBUG, 'url is ' . $url); - $ch = curl_init($url); + curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT, "YK-VAL"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); $response = curl_exec($ch); - curl_close($ch); if ($response==False) { $this->log(LOG_NOTICE, 'Timeout. Stopping queue resync for server ' . $my_server['server']); @@ -372,6 +372,7 @@ class SyncLib } } /* End of loop over each queue entry for a server */ + curl_close($ch); $res->closeCursor(); } /* End of loop over each distinct server in queue */ return true; From 4337fd13df86330f8d70660b1fcddd53bad22c66 Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Mon, 11 Jun 2012 12:50:57 +0200 Subject: [PATCH 2/4] fixup release target take USER and KEYID as arguments and check that we have edited NEWS --- Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3994d83..e46538e 100644 --- a/Makefile +++ b/Makefile @@ -58,8 +58,6 @@ revoke: # Maintainer rules. PROJECT=yubikey-val-server-php -USER=simon@josefsson.org -KEYID=2117364A $(PACKAGE)-$(VERSION).tgz: $(FILES) git submodule init @@ -77,6 +75,15 @@ clean: rm -rf $(PACKAGE)-$(VERSION) release: dist + @if test -z "$(USER)" || test -z "$(KEYID)"; then \ + echo "Try this instead:"; \ + echo " make release USER=[GOOGLEUSERNAME] KEYID=[PGPKEYID]"; \ + echo "For example:"; \ + echo " make release USER=simon@josefsson.org KEYID=2117364A"; \ + exit 1; \ + fi + @head -3 NEWS | grep -q "Version $(VERSION) .released `date -I`" || \ + (echo 'error: You need to update date/version in NEWS'; exit 1) gpg --detach-sign --default-key $(KEYID) $(PACKAGE)-$(VERSION).tgz gpg --verify $(PACKAGE)-$(VERSION).tgz.sig git push From a16cbf58c88c469b35320763059f721ad0fbcbd8 Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Tue, 12 Jun 2012 09:23:32 +0200 Subject: [PATCH 3/4] ignore release artifacts --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..16c3694 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +yubikey-val-*.tgz +yubikey-val-*.tgz.sig From a648a3f66e1771d28d3c89aed74cf21708eef46b Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Tue, 12 Jun 2012 13:45:40 +0200 Subject: [PATCH 4/4] add import/export clients scripts to Makefile --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e46538e..d816720 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,8 @@ CODE = COPYING Makefile NEWS 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 + ykval-sync.php ykval-verify.php ykval-export-clients.php \ + ykval-import-clients.php MUNIN = ykval-munin-ksmlatency.php ykval-munin-vallatency.php \ ykval-munin-queuelength.php DOCS = doc/ClientInfoFormat.wiki doc/Installation.wiki \ @@ -35,6 +36,8 @@ install: install -D ykval-queue.php $(DESTDIR)$(sbinprefix)/ykval-queue install -D ykval-export.php $(DESTDIR)$(sbinprefix)/ykval-export install -D ykval-import.php $(DESTDIR)$(sbinprefix)/ykval-import + install -D ykval-export-clients.php $(DESTDIR)$(sbinprefix)/ykval-export-clients + install -D ykval-import-clients.php $(DESTDIR)$(sbinprefix)/ykval-import-clients install -D ykval-checksum-clients.php $(DESTDIR)$(sbinprefix)/ykval-checksum-clients install -D ykval-munin-ksmlatency.php $(DESTDIR)$(muninprefix)/ykval_ksmlatency install -D ykval-munin-vallatency.php $(DESTDIR)$(muninprefix)/ykval_vallatency