Enlarged read buffer size. Fixed header comments.
authorPekka Riikonen <priikone@silcnet.org>
Wed, 14 Feb 2007 14:43:34 +0000 (14:43 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Wed, 14 Feb 2007 14:43:34 +0000 (14:43 +0000)
lib/silcsftp/sftp_client.c
lib/silcsftp/sftp_server.c
lib/silcsftp/sftp_util.c
lib/silcsftp/silcsftp.h

index 3fb2ee024f01332594c16d1347f09be661254989..0f6305af75f21aa99ef750b1654c024c54f25227 100644 (file)
@@ -313,6 +313,7 @@ static void silc_sftp_call_request(SilcSFTPClient sftp,
     break;
 
   default:
+    SILC_LOG_DEBUG(("Unknown request type %d", req->type));
     break;
   }
 
@@ -329,7 +330,7 @@ static void silc_sftp_client_io(SilcStream stream, SilcStreamStatus status,
                                void *context)
 {
   SilcSFTPClient sftp = context;
-  unsigned char inbuf[30720];
+  unsigned char inbuf[33792];
   SilcBufferStruct packet;
   int ret;
 
@@ -347,6 +348,8 @@ static void silc_sftp_client_io(SilcStream stream, SilcStreamStatus status,
       return;
     }
 
+    SILC_LOG_DEBUG(("Read %d bytes", ret));
+
     /* Now process the SFTP packet */
     silc_buffer_set(&packet, inbuf, ret);
     silc_sftp_client_receive_process(context, &packet);
@@ -455,7 +458,7 @@ void silc_sftp_client_receive_process(SilcSFTP context, SilcBuffer buffer)
 
   /* Parse the packet */
   type = silc_sftp_packet_decode(buffer, &payload, &payload_len);
-  if (!type)
+  if (type <= 0)
     return;
 
   silc_buffer_set(&buf, payload, payload_len);
index c78575aa548ecbdbd657cff253b8b7f519f1f0f0..549751e8aecc9cd3488b207f6e9dfdacf2c39794 100644 (file)
@@ -90,7 +90,7 @@ static void silc_sftp_server_io(SilcStream stream, SilcStreamStatus status,
                                void *context)
 {
   SilcSFTPServer sftp = context;
-  unsigned char inbuf[30720];
+  unsigned char inbuf[33792];
   SilcBufferStruct packet;
   int ret;
 
@@ -427,7 +427,7 @@ static void silc_sftp_server_receive_process(SilcSFTP sftp, SilcBuffer buffer)
 
   /* Parse the packet */
   type = silc_sftp_packet_decode(buffer, &payload, &payload_len);
-  if (!type)
+  if (type <= 0)
     return;
 
   silc_buffer_set(&buf, payload, payload_len);
index 6aa40dbe9aff2dd28db61a40ac91df48ac0442ad..826181856b24dd7ce839de8eee1b8a0700625d38 100644 (file)
@@ -90,7 +90,8 @@ SilcBuffer silc_sftp_packet_encode_vp(SilcSFTPPacket packet,
 
 /* Decodes the SFTP packet data `packet' and return the SFTP packet type.
    The payload of the packet is returned to the `payload' pointer. Returns
-   0 if error occurred during decoding. */
+   0 if error occurred during decoding and -1 if partial packet was
+   received. */
 
 SilcSFTPPacket silc_sftp_packet_decode(SilcBuffer packet,
                                       unsigned char **payload,
@@ -111,7 +112,7 @@ SilcSFTPPacket silc_sftp_packet_decode(SilcBuffer packet,
     return 0;
 
   if (len > (silc_buffer_len(packet) - 5))
-    return 0;
+    return -1;
 
   silc_buffer_pull(packet, 5);
   ret = silc_buffer_unformat(packet,
index c1aa5624cf858f6c3e5e55885fff63e4d6d487de..cf6711fe9b4d7dc194116dd4d48b60a93f90eb0c 100644 (file)
@@ -426,8 +426,8 @@ SilcSFTP silc_sftp_client_start(SilcStream stream,
  * DESCRIPTION
  *
  *    Shutdown's the SFTP client.  The caller is responsible of closing
- *    the associated socket connection.  The SFTP context is freed and is
- *    invalid after this function returns.
+ *    the associated stream.  The SFTP context is freed and is invalid after
+ *    this function returns.
  *
  ***/
 void silc_sftp_client_shutdown(SilcSFTP sftp);
@@ -889,9 +889,9 @@ SilcSFTP silc_sftp_server_start(SilcStream stream,
  *
  * DESCRIPTION
  *
- *    Shutdown's the SFTP server.  The caller is responsible of closing
- *    the associated socket connection.  The SFTP context is freed and is
- *    invalid after this function returns.
+ *    Shutdown the SFTP server.  The caller is responsible of closing the
+ *    associated stream.  The SFTP context is freed and is invalid after
+ *    this function returns.
  *
  ***/
 void silc_sftp_server_shutdown(SilcSFTP sftp);
@@ -943,7 +943,8 @@ typedef enum {
  *
  *    This structure includes the monitor type specific data.  The
  *    application can check what the client has requested from this
- *    structure.
+ *    structure.  See the comments below what data is available for what
+ *    monitor type.
  *
  * SOURCE
  */