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 diff --git a/Makefile b/Makefile index 3994d83..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 @@ -58,8 +61,6 @@ revoke: # Maintainer rules. PROJECT=yubikey-val-server-php -USER=simon@josefsson.org -KEYID=2117364A $(PACKAGE)-$(VERSION).tgz: $(FILES) git submodule init @@ -77,6 +78,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 diff --git a/ykval-synclib.php b/ykval-synclib.php index aabce67..7e8645d 100644 --- a/ykval-synclib.php +++ b/ykval-synclib.php @@ -294,6 +294,7 @@ class SyncLib foreach ($res as $my_server) { $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']); @@ -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']); @@ -374,6 +374,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;