aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2007-01-31 14:52:48 +0000
committerWerner Koch <[email protected]>2007-01-31 14:52:48 +0000
commitcde3f5e61fa2139cc0b2d0d845cc321b4a38b389 (patch)
tree39d26da2f0db5315c4ed191995a514c491c51423
parentIncluded LIBICONV in all Makefiles. (diff)
downloadgnupg-cde3f5e61fa2139cc0b2d0d845cc321b4a38b389.tar.gz
gnupg-cde3f5e61fa2139cc0b2d0d845cc321b4a38b389.zip
agent/
* command-ssh.c (stream_read_string): Initialize LENGTH to zero. (start_command_handler_ssh): Use es_fgetc/es_ungetc to check if EOF has been reached before trying to process another request.
-rw-r--r--agent/ChangeLog8
-rw-r--r--agent/command-ssh.c22
2 files changed, 23 insertions, 7 deletions
diff --git a/agent/ChangeLog b/agent/ChangeLog
index 86f4569a0..06d7b85bf 100644
--- a/agent/ChangeLog
+++ b/agent/ChangeLog
@@ -1,5 +1,13 @@
+2007-01-31 Moritz Schulte <[email protected]> (wk)
+
+ * command-ssh.c (stream_read_string): Initialize LENGTH to zero.
+ (start_command_handler_ssh): Use es_fgetc/es_ungetc to check if
+ EOF has been reached before trying to process another request.
+
2007-01-31 Werner Koch <[email protected]>
+ * command-ssh.c (start_command_handler_ssh):
+
* Makefile.am (t_common_ldadd): Add LIBICONV.
2007-01-25 Werner Koch <[email protected]>
diff --git a/agent/command-ssh.c b/agent/command-ssh.c
index b44dc2140..97277fcba 100644
--- a/agent/command-ssh.c
+++ b/agent/command-ssh.c
@@ -421,10 +421,8 @@ stream_read_string (estream_t stream, unsigned int secure,
unsigned char **string, u32 *string_size)
{
gpg_error_t err;
- unsigned char *buffer;
- u32 length;
-
- buffer = NULL;
+ unsigned char *buffer = NULL;
+ u32 length = 0;
/* Read string length. */
err = stream_read_uint32 (stream, &length);
@@ -796,7 +794,7 @@ add_control_entry (ctrl_t ctrl, const char *hexgrip, int ttl)
struct tm *tp;
time_t atime = time (NULL);
- /* Not yet in the file - add it. Becuase the file has been
+ /* Not yet in the file - add it. Because the file has been
opened in append mode, we simply need to write to it. */
tp = localtime (&atime);
fprintf (fp, "# Key added on %04d-%02d-%02d %02d:%02d:%02d\n%s %d\n",
@@ -2646,7 +2644,8 @@ request_spec_lookup (int type)
break;
if (i == DIM (request_specs))
{
- log_info ("ssh request %u is not supported\n", type);
+ if (opt.verbose)
+ log_info ("ssh request %u is not supported\n", type);
spec = NULL;
}
else
@@ -2867,7 +2866,16 @@ start_command_handler_ssh (ctrl_t ctrl, int sock_client)
/* Main processing loop. */
while ( !ssh_request_process (ctrl, stream_sock) )
- ;
+ {
+ /* Check wether we have reached EOF before trying to read
+ another request. */
+ int c;
+
+ c = es_fgetc (stream_sock);
+ if (c == EOF)
+ break;
+ es_ungetc (c, stream_sock);
+ }
/* Reset the SCD in case it has been used. */
agent_reset_scd (ctrl);