diff options
| author | David Shaw <[email protected]> | 2004-10-13 18:30:29 +0000 |
|---|---|---|
| committer | David Shaw <[email protected]> | 2004-10-13 18:30:29 +0000 |
| commit | d603b7c3a16d4dfdbd26fa0ca28adf7ee850016e (patch) | |
| tree | de899dab667bd80a7afa4cae558387db1682144c /keyserver/gpgkeys_finger.c | |
| parent | Added SELInux hacks and did some cleanups. (diff) | |
| download | gnupg-d603b7c3a16d4dfdbd26fa0ca28adf7ee850016e.tar.gz gnupg-d603b7c3a16d4dfdbd26fa0ca28adf7ee850016e.zip | |
* gpgkeys_ldap.c (main), gpgkeys_hkp.c (main), gpgkeys_http.c (main),
gpgkeys_finger.c (main): Call timeout functions before performing an
action that could block for a long time.
* ksutil.h, ksutil.c: New. Right now just contains timeout functions.
Diffstat (limited to 'keyserver/gpgkeys_finger.c')
| -rw-r--r-- | keyserver/gpgkeys_finger.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/keyserver/gpgkeys_finger.c b/keyserver/gpgkeys_finger.c index d0755edaa..43158cf90 100644 --- a/keyserver/gpgkeys_finger.c +++ b/keyserver/gpgkeys_finger.c @@ -44,6 +44,7 @@ #define INCLUDED_BY_MAIN_MODULE 1 #include "util.h" #include "keyserver.h" +#include "ksutil.h" #ifdef _WIN32 #define sock_close(a) closesocket(a) @@ -51,7 +52,6 @@ #define sock_close(a) close(a) #endif - extern char *optarg; extern int optind; @@ -65,7 +65,6 @@ static FILE *input, *output, *console; #define BEGIN "-----BEGIN PGP PUBLIC KEY BLOCK-----" #define END "-----END PGP PUBLIC KEY BLOCK-----" - #ifdef _WIN32 static void deinit_sockets (void) @@ -364,6 +363,7 @@ main(int argc,char *argv[]) int arg,action=-1,ret=KEYSERVER_INTERNAL_ERROR; char line[MAX_LINE]; char *thekey=NULL; + unsigned int timeout=DEFAULT_KEYSERVER_TIMEOUT; console=stderr; @@ -472,11 +472,24 @@ main(int argc,char *argv[]) else verbose++; } + else if(strncasecmp(start,"timeout",7)==0) + { + if(no) + timeout=0; + else + timeout=atoi(&start[8]); + } continue; } } + if(timeout && register_timeout()==-1) + { + fprintf(console,"gpgkeys: unable to register timeout handler\n"); + return KEYSERVER_INTERNAL_ERROR; + } + /* 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. */ @@ -534,6 +547,8 @@ main(int argc,char *argv[]) fprintf(console,"Command:\tGET\n"); } + set_timeout(timeout); + ret = get_key(thekey); fail: |
