aboutsummaryrefslogtreecommitdiffstats
path: root/agent/call-scd.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2011-12-14 14:42:28 +0000
committerWerner Koch <[email protected]>2011-12-14 14:42:28 +0000
commit45cf9de341405a228e331bd3893cbcd6b72306be (patch)
treeed17de5057b13fc3cfb43c87cd927222c648a458 /agent/call-scd.c
parentscd: Fix resetting and closing of the reader. (diff)
downloadgnupg-45cf9de341405a228e331bd3893cbcd6b72306be.tar.gz
gnupg-45cf9de341405a228e331bd3893cbcd6b72306be.zip
agent: Pass comment lines from scd verbatim thru gpg-agent.
* agent/call-scd.c (pass_status_thru): Pass comment lines verbatim. * tools/gpg-connect-agent.c (help_cmd_p): New. (main): Treat an "SCD HELP" the same as "HELP".
Diffstat (limited to 'agent/call-scd.c')
-rw-r--r--agent/call-scd.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/agent/call-scd.c b/agent/call-scd.c
index 74f94c0f6..3f535db6d 100644
--- a/agent/call-scd.c
+++ b/agent/call-scd.c
@@ -1,5 +1,6 @@
/* call-scd.c - fork of the scdaemon to do SC operations
- * Copyright (C) 2001, 2002, 2005, 2007, 2010 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2002, 2005, 2007, 2010,
+ * 2011 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -1129,16 +1130,28 @@ pass_status_thru (void *opaque, const char *line)
char keyword[200];
int i;
- for (i=0; *line && !spacep (line) && i < DIM(keyword)-1; line++, i++)
- keyword[i] = *line;
- keyword[i] = 0;
- /* truncate any remaining keyword stuff. */
- for (; *line && !spacep (line); line++)
- ;
- while (spacep (line))
- line++;
+ if (line[0] == '#' && (!line[1] || spacep (line+1)))
+ {
+ /* We are called in convey comments mode. Now, if we see a
+ comment marker as keyword we forward the line verbatim to the
+ the caller. This way the comment lines from scdaemon won't
+ appear as status lines with keyword '#'. */
+ assuan_write_line (ctx, line);
+ }
+ else
+ {
+ for (i=0; *line && !spacep (line) && i < DIM(keyword)-1; line++, i++)
+ keyword[i] = *line;
+ keyword[i] = 0;
- assuan_write_status (ctx, keyword, line);
+ /* Truncate any remaining keyword stuff. */
+ for (; *line && !spacep (line); line++)
+ ;
+ while (spacep (line))
+ line++;
+
+ assuan_write_status (ctx, keyword, line);
+ }
return 0;
}