* 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.
This commit is contained in:
Werner Koch 2007-01-31 14:52:48 +00:00
parent b861561e47
commit cde3f5e61f
2 changed files with 23 additions and 7 deletions

View File

@ -1,5 +1,13 @@
2007-01-31 Moritz Schulte <moritz@g10code.com> (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 <wk@g10code.com>
* command-ssh.c (start_command_handler_ssh):
* Makefile.am (t_common_ldadd): Add LIBICONV.
2007-01-25 Werner Koch <wk@g10code.com>

View File

@ -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);