gnupg/keyserver (7 files)

cvs user dshaw cvs at cvs.gnupg.org
Wed Mar 23 00:27:04 CET 2005


    Date: Wednesday, March 23, 2005 @ 00:41:08
  Author: dshaw
    Path: /cvs/gnupg/gnupg/keyserver

Modified: ChangeLog gpgkeys_finger.c gpgkeys_hkp.c gpgkeys_http.c
          gpgkeys_ldap.c ksutil.c ksutil.h

* gpgkeys_ldap.c, ksutil.h, ksutil.c (print_nocr): Moved from
gpgkeys_ldap.c.  Print a string, but strip out any CRs.

* gpgkeys_finger.c (get_key), gpgkeys_hkp.c (get_key), gpgkeys_http.c
(get_key): Use it here when outputting key material to canonicalize
line endings.


------------------+
 ChangeLog        |    9 +++++++++
 gpgkeys_finger.c |    4 ++--
 gpgkeys_hkp.c    |    4 ++--
 gpgkeys_http.c   |    4 ++--
 gpgkeys_ldap.c   |   11 -----------
 ksutil.c         |   18 ++++++++++++++++++
 ksutil.h         |    1 +
 7 files changed, 34 insertions(+), 17 deletions(-)


Index: gnupg/keyserver/ChangeLog
diff -u gnupg/keyserver/ChangeLog:1.119 gnupg/keyserver/ChangeLog:1.120
--- gnupg/keyserver/ChangeLog:1.119	Sat Mar 19 15:24:36 2005
+++ gnupg/keyserver/ChangeLog	Wed Mar 23 00:41:08 2005
@@ -1,3 +1,12 @@
+2005-03-22  David Shaw  <dshaw at jabberwocky.com>
+
+	* gpgkeys_ldap.c, ksutil.h, ksutil.c (print_nocr): Moved from
+	gpgkeys_ldap.c.  Print a string, but strip out any CRs.
+
+	* gpgkeys_finger.c (get_key), gpgkeys_hkp.c (get_key),
+	gpgkeys_http.c (get_key): Use it here when outputting key material
+	to canonicalize line endings.
+
 2005-03-19  David Shaw  <dshaw at jabberwocky.com>
 
 	* gpgkeys_ldap.c (main): Fix three wrong calls to fail_all().
Index: gnupg/keyserver/gpgkeys_finger.c
diff -u gnupg/keyserver/gpgkeys_finger.c:1.14 gnupg/keyserver/gpgkeys_finger.c:1.15
--- gnupg/keyserver/gpgkeys_finger.c:1.14	Thu Mar 17 17:42:41 2005
+++ gnupg/keyserver/gpgkeys_finger.c	Wed Mar 23 00:41:08 2005
@@ -323,13 +323,13 @@
       
       if(gotit)
         {
-          fputs (line, output);
+	  print_nocr(output,line);
           if (!strncmp(line,END,strlen(END)))
             break;
         }
       else if(!strncmp(line,BEGIN,strlen(BEGIN)))
         {
-          fputs (line,output);
+	  print_nocr(output,line);
           gotit=1;
         }
     }
Index: gnupg/keyserver/gpgkeys_hkp.c
diff -u gnupg/keyserver/gpgkeys_hkp.c:1.49 gnupg/keyserver/gpgkeys_hkp.c:1.50
--- gnupg/keyserver/gpgkeys_hkp.c:1.49	Sat Feb  5 16:04:59 2005
+++ gnupg/keyserver/gpgkeys_hkp.c	Wed Mar 23 00:41:08 2005
@@ -267,14 +267,14 @@
 
 	  if(gotit)
 	    {
-	      fputs (line, output);
+	      print_nocr(output,line);
 	      if(strncmp(line,END,strlen(END))==0)
 		break;
 	    }
 	  else
 	    if(strncmp(line,BEGIN,strlen(BEGIN))==0)
 	      {
-		fputs (line,output);
+		print_nocr(output,line);
 		gotit=1;
 	      }
 	}
Index: gnupg/keyserver/gpgkeys_http.c
diff -u gnupg/keyserver/gpgkeys_http.c:1.13 gnupg/keyserver/gpgkeys_http.c:1.14
--- gnupg/keyserver/gpgkeys_http.c:1.13	Tue Feb  1 21:57:08 2005
+++ gnupg/keyserver/gpgkeys_http.c	Wed Mar 23 00:41:08 2005
@@ -92,14 +92,14 @@
 
 	  if(gotit)
 	    {
-	      fputs(line,output);
+	      print_nocr(output,line);
 	      if(strncmp(line,END,strlen(END))==0)
 		break;
 	    }
 	  else
 	    if(strncmp(line,BEGIN,strlen(BEGIN))==0)
 	      {
-		fputs(line,output);
+		print_nocr(output,line);
 		gotit=1;
 	      }
 	}
Index: gnupg/keyserver/gpgkeys_ldap.c
diff -u gnupg/keyserver/gpgkeys_ldap.c:1.53 gnupg/keyserver/gpgkeys_ldap.c:1.54
--- gnupg/keyserver/gpgkeys_ldap.c:1.53	Sat Mar 19 15:24:36 2005
+++ gnupg/keyserver/gpgkeys_ldap.c	Wed Mar 23 00:41:08 2005
@@ -953,17 +953,6 @@
   fprintf(output,"INFO %s END\n",certid);
 }
 
-static void
-print_nocr(FILE *stream,const char *str)
-{
-  while(*str)
-    {
-      if(*str!='\r')
-	fputc(*str,stream);
-      str++;
-    }
-}
-
 /* Note that key-not-found is not a fatal error */
 static int
 get_key(char *getkey)
Index: gnupg/keyserver/ksutil.c
diff -u gnupg/keyserver/ksutil.c:1.5 gnupg/keyserver/ksutil.c:1.6
--- gnupg/keyserver/ksutil.c:1.5	Fri Mar 18 00:16:41 2005
+++ gnupg/keyserver/ksutil.c	Wed Mar 23 00:41:08 2005
@@ -294,3 +294,21 @@
 
   return "?";
 }
+
+/* Canonicalize CRLF to just LF by stripping CRs.  This actually makes
+   sense, since on Unix-like machines LF is correct, and on win32-like
+   machines, our output buffer is opened in textmode and will
+   re-canonicalize line endings back to CRLF.  Since we only need to
+   handle armored keys, we don't have to worry about odd cases like
+   CRCRCR and the like. */
+
+void
+print_nocr(FILE *stream,const char *str)
+{
+  while(*str)
+    {
+      if(*str!='\r')
+	fputc(*str,stream);
+      str++;
+    }
+}
Index: gnupg/keyserver/ksutil.h
diff -u gnupg/keyserver/ksutil.h:1.7 gnupg/keyserver/ksutil.h:1.8
--- gnupg/keyserver/ksutil.h:1.7	Thu Mar 17 17:42:41 2005
+++ gnupg/keyserver/ksutil.h	Wed Mar 23 00:41:08 2005
@@ -87,5 +87,6 @@
 void free_ks_options(struct ks_options *opt);
 int parse_ks_options(char *line,struct ks_options *opt);
 const char *ks_action_to_string(enum ks_action action);
+void print_nocr(FILE *stream,const char *str);
 
 #endif /* !_KSUTIL_H_ */




More information about the Gnupg-commits mailing list