summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcus Brinkmann <mb@g10code.com>2002-04-25 00:08:35 +0200
committerMarcus Brinkmann <mb@g10code.com>2002-04-25 00:08:35 +0200
commit898dda02e48dc6a0b80b0fd615fc4e51c239db9b (patch)
treec44393feb10c17a7723ec60b934d3416f5aac385
parent2002-04-24 Marcus Brinkmann <marcus@g10code.de> (diff)
downloadgnupg2-898dda02e48dc6a0b80b0fd615fc4e51c239db9b.tar.xz
gnupg2-898dda02e48dc6a0b80b0fd615fc4e51c239db9b.zip
2002-04-25 Marcus Brinkmann <marcus@g10code.de>
* server.c (option_handler): Accept display, ttyname, ttytype, lc_ctype and lc_messages options. * gpgsm.c (main): Allocate memory for these options. * gpgsm.h (struct opt): Make corresponding members non-const.
-rw-r--r--sm/ChangeLog7
-rw-r--r--sm/gpgsm.c10
-rw-r--r--sm/gpgsm.h10
-rw-r--r--sm/server.c40
4 files changed, 57 insertions, 10 deletions
diff --git a/sm/ChangeLog b/sm/ChangeLog
index 69deb671f..660b726e3 100644
--- a/sm/ChangeLog
+++ b/sm/ChangeLog
@@ -1,3 +1,10 @@
+2002-04-25 Marcus Brinkmann <marcus@g10code.de>
+
+ * server.c (option_handler): Accept display, ttyname, ttytype,
+ lc_ctype and lc_messages options.
+ * gpgsm.c (main): Allocate memory for these options.
+ * gpgsm.h (struct opt): Make corresponding members non-const.
+
2002-04-24 Marcus Brinkmann <marcus@g10code.de>
* gpgsm.h (struct opt): New members display, ttyname, ttytype,
diff --git a/sm/gpgsm.c b/sm/gpgsm.c
index f755c02c7..cb2c3bdf7 100644
--- a/sm/gpgsm.c
+++ b/sm/gpgsm.c
@@ -854,11 +854,11 @@ main ( int argc, char **argv)
case oNoOptions: break; /* no-options */
case oHomedir: opt.homedir = pargs.r.ret_str; break;
case oAgentProgram: opt.agent_program = pargs.r.ret_str; break;
- case oDisplay: opt.display = pargs.r.ret_str; break;
- case oTTYname: opt.ttyname = pargs.r.ret_str; break;
- case oTTYtype: opt.ttytype = pargs.r.ret_str; break;
- case oLCctype: opt.lc_ctype = pargs.r.ret_str; break;
- case oLCmessages: opt.lc_messages = pargs.r.ret_str; break;
+ case oDisplay: opt.display = xstrdup (pargs.r.ret_str); break;
+ case oTTYname: opt.ttyname = xstrdup (pargs.r.ret_str); break;
+ case oTTYtype: opt.ttytype = xstrdup (pargs.r.ret_str); break;
+ case oLCctype: opt.lc_ctype = xstrdup (pargs.r.ret_str); break;
+ case oLCmessages: opt.lc_messages = xstrdup (pargs.r.ret_str); break;
case oDirmngrProgram: opt.dirmngr_program = pargs.r.ret_str; break;
case oNoDefKeyring: default_keyring = 0; break;
diff --git a/sm/gpgsm.h b/sm/gpgsm.h
index 09a633d4c..0683fd12f 100644
--- a/sm/gpgsm.h
+++ b/sm/gpgsm.h
@@ -39,11 +39,11 @@ struct {
const char *homedir; /* configuration directory name */
const char *agent_program;
- const char *display;
- const char *ttyname;
- const char *ttytype;
- const char *lc_ctype;
- const char *lc_messages;
+ char *display;
+ char *ttyname;
+ char *ttytype;
+ char *lc_ctype;
+ char *lc_messages;
const char *dirmngr_program;
char *outfile; /* name of output file */
diff --git a/sm/server.c b/sm/server.c
index 13af393ba..54558ed8d 100644
--- a/sm/server.c
+++ b/sm/server.c
@@ -104,6 +104,46 @@ option_handler (ASSUAN_CONTEXT ctx, const char *key, const char *value)
return ASSUAN_Parameter_Error;
ctrl->include_certs = i;
}
+ else if (!strcmp (key, "display"))
+ {
+ if (opt.display)
+ free (opt.display);
+ opt.display = strdup (value);
+ if (!opt.display)
+ return ASSUAN_Out_Of_Core;
+ }
+ else if (!strcmp (key, "ttyname"))
+ {
+ if (opt.ttyname)
+ free (opt.ttyname);
+ opt.ttyname = strdup (value);
+ if (!opt.ttyname)
+ return ASSUAN_Out_Of_Core;
+ }
+ else if (!strcmp (key, "ttytype"))
+ {
+ if (opt.ttytype)
+ free (opt.ttytype);
+ opt.ttytype = strdup (value);
+ if (!opt.ttytype)
+ return ASSUAN_Out_Of_Core;
+ }
+ else if (!strcmp (key, "lc-ctype"))
+ {
+ if (opt.lc_ctype)
+ free (opt.lc_ctype);
+ opt.lc_ctype = strdup (value);
+ if (!opt.lc_ctype)
+ return ASSUAN_Out_Of_Core;
+ }
+ else if (!strcmp (key, "lc-messages"))
+ {
+ if (opt.lc_messages)
+ free (opt.lc_messages);
+ opt.lc_messages = strdup (value);
+ if (!opt.lc_messages)
+ return ASSUAN_Out_Of_Core;
+ }
else
return ASSUAN_Invalid_Option;