[svn] GnuPG - r4414 - trunk/agent

svn author wk cvs at cvs.gnupg.org
Wed Jan 31 15:52:49 CET 2007


Author: wk
Date: 2007-01-31 15:52:48 +0100 (Wed, 31 Jan 2007)
New Revision: 4414

Modified:
   trunk/agent/ChangeLog
   trunk/agent/command-ssh.c
Log:
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.


Modified: trunk/agent/ChangeLog
===================================================================
--- trunk/agent/ChangeLog	2007-01-31 14:24:41 UTC (rev 4413)
+++ trunk/agent/ChangeLog	2007-01-31 14:52:48 UTC (rev 4414)
@@ -1,5 +1,13 @@
+2007-01-31  Moritz Schulte  <moritz at 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 at g10code.com>
 
+	* command-ssh.c (start_command_handler_ssh): 
+
 	* Makefile.am (t_common_ldadd): Add LIBICONV.
 
 2007-01-25  Werner Koch  <wk at g10code.com>

Modified: trunk/agent/command-ssh.c
===================================================================
--- trunk/agent/command-ssh.c	2007-01-31 14:24:41 UTC (rev 4413)
+++ trunk/agent/command-ssh.c	2007-01-31 14:52:48 UTC (rev 4414)
@@ -421,11 +421,9 @@
 		    unsigned char **string, u32 *string_size)
 {
   gpg_error_t err;
-  unsigned char *buffer;
-  u32 length;
+  unsigned char *buffer = NULL;
+  u32 length = 0;
 
-  buffer = NULL;
-
   /* Read string length.  */
   err = stream_read_uint32 (stream, &length);
   if (err)
@@ -796,7 +794,7 @@
       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 @@
       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,8 +2866,17 @@
 
   /* 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);
 




More information about the Gnupg-commits mailing list