gnupg/keyserver (6 files)

cvs user dshaw cvs at cvs.gnupg.org
Wed Dec 22 20:14:04 CET 2004


    Date: Wednesday, December 22, 2004 @ 20:19:10
  Author: dshaw
    Path: /cvs/gnupg/gnupg/keyserver

Modified: ChangeLog gpgkeys_curl.c gpgkeys_finger.c gpgkeys_hkp.c
          gpgkeys_http.c gpgkeys_ldap.c

* gpgkeys_curl.c (main): New "follow-redirects" option.  Takes an optional
numeric value for the maximum number of redirects to allow.  Defaults to
5.

* gpgkeys_curl.c (main), gpgkeys_finger.c (main), gpgkeys_hkp.c (main),
gpgkeys_http.c (main), gpgkeys_ldap.c (main): Make sure that a "timeout"
option passed with no arguments is properly handled.


------------------+
 ChangeLog        |    9 +++++++++
 gpgkeys_curl.c   |   22 +++++++++++++++++++++-
 gpgkeys_finger.c |    4 +++-
 gpgkeys_hkp.c    |    4 +++-
 gpgkeys_http.c   |    4 +++-
 gpgkeys_ldap.c   |    4 +++-
 6 files changed, 42 insertions(+), 5 deletions(-)


Index: gnupg/keyserver/ChangeLog
diff -u gnupg/keyserver/ChangeLog:1.97 gnupg/keyserver/ChangeLog:1.98
--- gnupg/keyserver/ChangeLog:1.97	Wed Dec 22 19:07:21 2004
+++ gnupg/keyserver/ChangeLog	Wed Dec 22 20:19:10 2004
@@ -1,5 +1,14 @@
 2004-12-22  David Shaw  <dshaw at jabberwocky.com>
 
+	* gpgkeys_curl.c (main): New "follow-redirects" option.  Takes an
+	optional numeric value for the maximum number of redirects to
+	allow.  Defaults to 5.
+
+	* gpgkeys_curl.c (main), gpgkeys_finger.c (main), gpgkeys_hkp.c
+	(main), gpgkeys_http.c (main), gpgkeys_ldap.c (main): Make sure
+	that a "timeout" option passed with no arguments is properly
+	handled.
+
 	* gpgkeys_curl.c (get_key, writer): New function to wrap around
 	fwrite to avoid DLL access problem on win32.
 
Index: gnupg/keyserver/gpgkeys_curl.c
diff -u gnupg/keyserver/gpgkeys_curl.c:1.2 gnupg/keyserver/gpgkeys_curl.c:1.3
--- gnupg/keyserver/gpgkeys_curl.c:1.2	Wed Dec 22 19:07:21 2004
+++ gnupg/keyserver/gpgkeys_curl.c	Wed Dec 22 20:19:10 2004
@@ -123,6 +123,7 @@
   char line[MAX_LINE];
   char *thekey=NULL;
   unsigned int timeout=DEFAULT_KEYSERVER_TIMEOUT;
+  long follow_redirects=5;
 
   console=stderr;
 
@@ -269,8 +270,19 @@
 	    {
 	      if(no)
 		timeout=0;
-	      else
+	      else if(start[7]=='=')
 		timeout=atoi(&start[8]);
+	      else if(start[7]=='\0')
+		timeout=DEFAULT_KEYSERVER_TIMEOUT;
+	    }
+	  else if(strncasecmp(start,"follow-redirects",16)==0)
+	    {
+	      if(no)
+		follow_redirects=0;
+	      else if(start[16]=='=')
+		follow_redirects=atoi(&start[17]);
+	      else if(start[16]=='\0')
+		follow_redirects=-1;
 	    }
 
 	  continue;
@@ -312,6 +324,14 @@
       goto fail;
     }
 
+  if(follow_redirects)
+    {
+      curl_easy_setopt(curl,CURLOPT_FOLLOWLOCATION,1);
+      if(follow_redirects>0)
+	curl_easy_setopt(curl,CURLOPT_MAXREDIRS,follow_redirects);
+    }
+
+
   /* If it's a GET or a SEARCH, the next thing to come in is the
      keyids.  If it's a SEND, then there are no keyids. */
 
Index: gnupg/keyserver/gpgkeys_finger.c
diff -u gnupg/keyserver/gpgkeys_finger.c:1.8 gnupg/keyserver/gpgkeys_finger.c:1.9
--- gnupg/keyserver/gpgkeys_finger.c:1.8	Thu Oct 28 23:53:51 2004
+++ gnupg/keyserver/gpgkeys_finger.c	Wed Dec 22 20:19:10 2004
@@ -502,8 +502,10 @@
 	    {
 	      if(no)
 		timeout=0;
-	      else
+	      else if(start[7]=='=')
 		timeout=atoi(&start[8]);
+	      else if(start[7]=='\0')
+		timeout=DEFAULT_KEYSERVER_TIMEOUT;
 	    }
 
 	  continue;
Index: gnupg/keyserver/gpgkeys_hkp.c
diff -u gnupg/keyserver/gpgkeys_hkp.c:1.44 gnupg/keyserver/gpgkeys_hkp.c:1.45
--- gnupg/keyserver/gpgkeys_hkp.c:1.44	Mon Oct 18 17:53:28 2004
+++ gnupg/keyserver/gpgkeys_hkp.c	Wed Dec 22 20:19:10 2004
@@ -949,8 +949,10 @@
 	    {
 	      if(no)
 		timeout=0;
-	      else
+	      else if(start[7]=='=')
 		timeout=atoi(&start[8]);
+	      else if(start[7]=='\0')
+		timeout=DEFAULT_KEYSERVER_TIMEOUT;
 	    }
 
 	  continue;
Index: gnupg/keyserver/gpgkeys_http.c
diff -u gnupg/keyserver/gpgkeys_http.c:1.8 gnupg/keyserver/gpgkeys_http.c:1.9
--- gnupg/keyserver/gpgkeys_http.c:1.8	Wed Dec 22 19:07:21 2004
+++ gnupg/keyserver/gpgkeys_http.c	Wed Dec 22 20:19:10 2004
@@ -311,8 +311,10 @@
 	    {
 	      if(no)
 		timeout=0;
-	      else
+	      else if(start[7]=='=')
 		timeout=atoi(&start[8]);
+	      else if(start[7]=='\0')
+		timeout=DEFAULT_KEYSERVER_TIMEOUT;
 	    }
 
 	  continue;
Index: gnupg/keyserver/gpgkeys_ldap.c
diff -u gnupg/keyserver/gpgkeys_ldap.c:1.44 gnupg/keyserver/gpgkeys_ldap.c:1.45
--- gnupg/keyserver/gpgkeys_ldap.c:1.44	Fri Oct 15 14:19:06 2004
+++ gnupg/keyserver/gpgkeys_ldap.c	Wed Dec 22 20:19:10 2004
@@ -1763,8 +1763,10 @@
 	    {
 	      if(no)
 		timeout=0;
-	      else
+	      else if(start[7]=='=')
 		timeout=atoi(&start[8]);
+	      else if(start[7]=='\0')
+		timeout=DEFAULT_KEYSERVER_TIMEOUT;
 	    }
 
 	  continue;




More information about the Gnupg-commits mailing list