diff options
author | David Shaw <[email protected]> | 2002-02-19 23:10:32 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2002-02-19 23:10:32 +0000 |
commit | 8ac8b1525e559f1ddb86fda9c79138ce0571c3f0 (patch) | |
tree | f18c91fa5b86ec4fb49d57736490b7e1325c675a | |
parent | Fix compiler warning. (diff) | |
download | gnupg-8ac8b1525e559f1ddb86fda9c79138ce0571c3f0.tar.gz gnupg-8ac8b1525e559f1ddb86fda9c79138ce0571c3f0.zip |
Catch corruption in HKP index lines (can be caused by broken or malicious
keyservers).
Add KEYSERVER_NOT_SUPPORTED for unsupported actions (say, a keyserver that
has no way to search, or a readonly keyserver that has no way to add).
Also add a USE_EXTERNAL_HKP define to disable the internal HKP keyserver
code.
-rw-r--r-- | g10/ChangeLog | 11 | ||||
-rw-r--r-- | g10/hkp.c | 6 | ||||
-rw-r--r-- | g10/keyserver.c | 9 | ||||
-rw-r--r-- | include/ChangeLog | 6 | ||||
-rw-r--r-- | include/keyserver.h | 3 |
5 files changed, 34 insertions, 1 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index 8ae6963cc..281751960 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,14 @@ +2002-02-19 David Shaw <[email protected]> + + * hkp.c (parse_hkp_index): Catch corruption in HKP index lines + (can be caused by broken or malicious keyservers). + + * keyserver.c (keyserver_work): Add KEYSERVER_NOT_SUPPORTED for + unsupported actions (say, a keyserver that has no way to search, + or a readonly keyserver that has no way to add). Also add a + USE_EXTERNAL_HKP define to disable the internal HKP keyserver + code. + 2002-02-14 Werner Koch <[email protected]> * g10.c: New option --no-use-agent. @@ -337,6 +337,12 @@ parse_hkp_index(IOBUF buffer,char *line) { int uidindex=0; + if(line==NULL) + { + uid=m_strdup("Key index corrupted"); + return ret; + } + /* All that's left is the user name. Strip off anything <between brackets> and de-urlencode it. */ diff --git a/g10/keyserver.c b/g10/keyserver.c index 2dcd098c0..47347e573 100644 --- a/g10/keyserver.c +++ b/g10/keyserver.c @@ -538,6 +538,7 @@ keyserver_work(int action,STRLIST list,u32 (*kidlist)[2],int count) return G10ERR_BAD_URI; } +#ifndef USE_EXTERNAL_HKP /* Use the internal HKP code */ if(strcasecmp(opt.keyserver_scheme,"x-hkp")==0 || strcasecmp(opt.keyserver_scheme,"hkp")==0 || @@ -563,6 +564,7 @@ keyserver_work(int action,STRLIST list,u32 (*kidlist)[2],int count) return 0; } +#endif /* It's not the internal HKP code, so try and spawn a handler for it */ @@ -576,6 +578,13 @@ keyserver_work(int action,STRLIST list,u32 (*kidlist)[2],int count) opt.keyserver_scheme); break; + case KEYSERVER_NOT_SUPPORTED: + log_error(_("action \"%s\" not supported with keyserver " + "scheme \"%s\"\n"), + action==GET?"get":action==SEND?"send": + action==SEARCH?"search":"unknown", + opt.keyserver_scheme); + case KEYSERVER_INTERNAL_ERROR: default: log_error(_("keyserver internal error\n")); diff --git a/include/ChangeLog b/include/ChangeLog index 6cb933ff6..9751fa64f 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,9 @@ +2002-02-19 David Shaw <[email protected]> + + * keyserver.h: Add KEYSERVER_NOT_SUPPORTED for unsupported actions + (say, a keyserver that has no way to search, or a readonly + keyserver that has no way to add). + 2002-01-02 Stefan Bellon <[email protected]> * util.h [__riscos__]: Updated prototype list. diff --git a/include/keyserver.h b/include/keyserver.h index e7513d134..017711a76 100644 --- a/include/keyserver.h +++ b/include/keyserver.h @@ -24,7 +24,8 @@ /* Return codes */ #define KEYSERVER_OK 0 #define KEYSERVER_INTERNAL_ERROR 1 -#define KEYSERVER_VERSION_ERROR 2 +#define KEYSERVER_NOT_SUPPORTED 2 +#define KEYSERVER_VERSION_ERROR 3 #define KEYSERVER_SCHEME_NOT_FOUND 127 #endif /* !_KEYSERVER_H_ */ |