gnupg/keyserver (ChangeLog ksutil.c ksutil.h)
cvs user dshaw
cvs at cvs.gnupg.org
Thu Mar 17 00:32:38 CET 2005
Date: Thursday, March 17, 2005 @ 00:46:07
Author: dshaw
Path: /cvs/gnupg/gnupg/keyserver
Modified: ChangeLog ksutil.c ksutil.h
* ksutil.h, ksutil.c (ks_action_to_string): New. (free_ks_options): Only
free if options exist.
-----------+
ChangeLog | 3 +++
ksutil.c | 36 ++++++++++++++++++++++++------------
ksutil.h | 5 ++++-
3 files changed, 31 insertions(+), 13 deletions(-)
Index: gnupg/keyserver/ChangeLog
diff -u gnupg/keyserver/ChangeLog:1.114 gnupg/keyserver/ChangeLog:1.115
--- gnupg/keyserver/ChangeLog:1.114 Wed Mar 16 16:17:03 2005
+++ gnupg/keyserver/ChangeLog Thu Mar 17 00:46:07 2005
@@ -1,5 +1,8 @@
2005-03-16 David Shaw <dshaw at jabberwocky.com>
+ * ksutil.h, ksutil.c (ks_action_to_string): New.
+ (free_ks_options): Only free if options exist.
+
* ksutil.h, ksutil.c (init_ks_options, free_ks_options,
parse_ks_options): Pull a lot of duplicated code into a single
options parser for all keyserver helpers.
Index: gnupg/keyserver/ksutil.c
diff -u gnupg/keyserver/ksutil.c:1.2 gnupg/keyserver/ksutil.c:1.3
--- gnupg/keyserver/ksutil.c:1.2 Wed Mar 16 16:17:03 2005
+++ gnupg/keyserver/ksutil.c Thu Mar 17 00:46:07 2005
@@ -85,13 +85,16 @@
void
free_ks_options(struct ks_options *opt)
{
- free(opt->host);
- free(opt->port);
- free(opt->scheme);
- free(opt->auth);
- free(opt->path);
- free(opt->ca_cert_file);
- free(opt);
+ if(opt)
+ {
+ free(opt->host);
+ free(opt->port);
+ free(opt->scheme);
+ free(opt->auth);
+ free(opt->path);
+ free(opt->ca_cert_file);
+ free(opt);
+ }
}
/* Returns 0 if we "ate" the line. Returns >0, a KEYSERVER_ error
@@ -109,11 +112,6 @@
char path[URLMAX_PATH+1];
char option[MAX_OPTION+1];
-#if 0
- if(sscanf(line,"%c",&hash)==1 && hash=='#')
- continue;
-#endif
-
if(line[0]=='#')
return 0;
@@ -267,3 +265,17 @@
return -1;
}
+
+const char *
+ks_action_to_string(enum ks_action action)
+{
+ switch(action)
+ {
+ case KS_UNKNOWN: return "UNKNOWN";
+ case KS_GET: return "GET";
+ case KS_SEND: return "SEND";
+ case KS_SEARCH: return "SEARCH";
+ }
+
+ return "?";
+}
Index: gnupg/keyserver/ksutil.h
diff -u gnupg/keyserver/ksutil.h:1.5 gnupg/keyserver/ksutil.h:1.6
--- gnupg/keyserver/ksutil.h:1.5 Wed Mar 16 16:17:03 2005
+++ gnupg/keyserver/ksutil.h Thu Mar 17 00:46:07 2005
@@ -59,9 +59,11 @@
unsigned int set_timeout(unsigned int seconds);
int register_timeout(void);
+enum ks_action {KS_UNKNOWN=0,KS_GET,KS_SEND,KS_SEARCH};
+
struct ks_options
{
- enum {KS_UNKNOWN,KS_GET,KS_SEND,KS_SEARCH} action;
+ enum ks_action action;
char *host;
char *port;
char *scheme;
@@ -83,5 +85,6 @@
struct ks_options *init_ks_options(void);
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);
#endif /* !_KSUTIL_H_ */
More information about the Gnupg-commits
mailing list