gnupg/keyserver (ChangeLog gpgkeys_curl.c gpgkeys_ldap.c)
cvs user dshaw
cvs at cvs.gnupg.org
Mon Jan 24 19:15:37 CET 2005
Date: Monday, January 24, 2005 @ 19:23:56
Author: dshaw
Path: /cvs/gnupg/gnupg/keyserver
Modified: ChangeLog gpgkeys_curl.c gpgkeys_ldap.c
* gpgkeys_ldap.c (print_nocr): New. (get_key): Call it here to
canonicalize line endings.
* gpgkeys_curl.c (writer): Discard everything outside the BEGIN and
END lines when retrieving keys. Canonicalize line endings. (main):
Accept FTPS.
----------------+
ChangeLog | 15 +++++++++++---
gpgkeys_curl.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
gpgkeys_ldap.c | 14 ++++++++++++-
3 files changed, 77 insertions(+), 9 deletions(-)
Index: gnupg/keyserver/ChangeLog
diff -u gnupg/keyserver/ChangeLog:1.107 gnupg/keyserver/ChangeLog:1.108
--- gnupg/keyserver/ChangeLog:1.107 Sat Jan 22 04:27:19 2005
+++ gnupg/keyserver/ChangeLog Mon Jan 24 19:23:56 2005
@@ -1,4 +1,13 @@
-2005-01-21 David Shaw <dshaw at grover.jabberwocky.com>
+2005-01-24 David Shaw <dshaw at jabberwocky.com>
+
+ * gpgkeys_ldap.c (print_nocr): New.
+ (get_key): Call it here to canonicalize line endings.
+
+ * gpgkeys_curl.c (writer): Discard everything outside the BEGIN
+ and END lines when retrieving keys. Canonicalize line endings.
+ (main): Accept FTPS.
+
+2005-01-21 David Shaw <dshaw at jabberwocky.com>
* gpgkeys_ldap.c (main): Add "check-cert" option to disable SSL
certificate checking (which is on by default).
@@ -7,7 +16,7 @@
helper. Add "check-cert" option to disable SSL certificate
checking (which is on by default).
-2005-01-18 David Shaw <dshaw at grover.jabberwocky.com>
+2005-01-18 David Shaw <dshaw at jabberwocky.com>
* gpgkeys_curl.c: Fix typo.
@@ -19,7 +28,7 @@
* gpgkeys_http.c: Ditto.
* ksutil.h: s/MAX_PATH/URLMAX_PATH/.
-2005-01-17 David Shaw <dshaw at grover.jabberwocky.com>
+2005-01-17 David Shaw <dshaw at jabberwocky.com>
* gpgkeys_curl.c (main): Only allow specified protocols to use the
curl handler.
Index: gnupg/keyserver/gpgkeys_curl.c
diff -u gnupg/keyserver/gpgkeys_curl.c:1.10 gnupg/keyserver/gpgkeys_curl.c:1.11
--- gnupg/keyserver/gpgkeys_curl.c:1.10 Sat Jan 22 04:27:19 2005
+++ gnupg/keyserver/gpgkeys_curl.c Mon Jan 24 19:23:56 2005
@@ -55,12 +55,55 @@
}
}
-/* We wrap fwrite so to avoid DLL problems on Win32 (see curl faq for
- more). */
static size_t
writer(const void *ptr,size_t size,size_t nmemb,void *stream)
{
- return fwrite(ptr,size,nmemb,stream);
+ const char *buf=ptr;
+ size_t i;
+ static int markeridx=0,begun=0,done=0;
+ static const char *marker=BEGIN;
+
+ /* scan the incoming data for our marker */
+ for(i=0;!done && i<(size*nmemb);i++)
+ {
+ if(buf[i]==marker[markeridx])
+ {
+ markeridx++;
+ if(marker[markeridx]=='\0')
+ {
+ if(begun)
+ done=1;
+ else
+ {
+ /* We've found the BEGIN marker, so now we're looking
+ for the END marker. */
+ begun=1;
+ marker=END;
+ markeridx=0;
+ fprintf(output,BEGIN);
+ continue;
+ }
+ }
+ }
+ else
+ markeridx=0;
+
+ if(begun)
+ {
+ /* 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. */
+
+ if(buf[i]!='\r')
+ fputc(buf[i],output);
+ }
+ }
+
+ return size*nmemb;
}
static int
@@ -87,10 +130,10 @@
{
fprintf(console,"gpgkeys: %s fetch error %d: %s\n",scheme,
res,errorbuffer);
- fprintf(output,"KEY 0x%s FAILED %d\n",getkey,curl_err_to_gpg_err(res));
+ fprintf(output,"\nKEY 0x%s FAILED %d\n",getkey,curl_err_to_gpg_err(res));
}
else
- fprintf(output,"KEY 0x%s END\n",getkey);
+ fprintf(output,"\nKEY 0x%s END\n",getkey);
return KEYSERVER_OK;
}
@@ -319,6 +362,10 @@
else if(strcasecmp(scheme,"ftp")==0)
;
#endif /* FTP_VIA_LIBCURL */
+#ifdef FTPS_VIA_LIBCURL
+ else if(strcasecmp(scheme,"ftps")==0)
+ ;
+#endif /* FTPS_VIA_LIBCURL */
else
{
fprintf(console,"gpgkeys: scheme `%s' not supported\n",scheme);
Index: gnupg/keyserver/gpgkeys_ldap.c
diff -u gnupg/keyserver/gpgkeys_ldap.c:1.48 gnupg/keyserver/gpgkeys_ldap.c:1.49
--- gnupg/keyserver/gpgkeys_ldap.c:1.48 Sat Jan 22 04:27:19 2005
+++ gnupg/keyserver/gpgkeys_ldap.c Mon Jan 24 19:23:56 2005
@@ -952,6 +952,17 @@
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)
@@ -1091,7 +1102,8 @@
}
else
{
- fprintf(output,"%sKEY 0x%s END\n",vals[0],getkey);
+ print_nocr(output,vals[0]);
+ fprintf(output,"\nKEY 0x%s END\n",getkey);
ldap_value_free(vals);
}
More information about the Gnupg-commits
mailing list