]> andersk Git - openssh.git/blobdiff - sftp-common.c
- deraadt@cvs.openbsd.org 2002/07/06 01:00:49
[openssh.git] / sftp-common.c
index aed9b339a609464779e80dee27c293636ee92a30..6bed0ab8a06d1f26c6af458df4e9a3b9885e3a7f 100644 (file)
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: sftp-common.c,v 1.1 2001/02/04 11:11:54 djm Exp $");
+RCSID("$OpenBSD: sftp-common.c,v 1.6 2002/06/23 09:30:14 deraadt Exp $");
 
 #include "buffer.h"
 #include "bufaux.h"
-#include "getput.h"
 #include "log.h"
 #include "xmalloc.h"
 
 #include "sftp.h"
 #include "sftp-common.h"
 
+/* Clear contents of attributes structure */
 void
 attrib_clear(Attrib *a)
 {
@@ -47,6 +47,7 @@ attrib_clear(Attrib *a)
        a->mtime = 0;
 }
 
+/* Convert from struct stat to filexfer attribs */
 void
 stat_to_attrib(struct stat *st, Attrib *a)
 {
@@ -64,10 +65,12 @@ stat_to_attrib(struct stat *st, Attrib *a)
        a->mtime = st->st_mtime;
 }
 
+/* Decode attributes in buffer */
 Attrib *
 decode_attrib(Buffer *b)
 {
        static Attrib a;
+
        attrib_clear(&a);
        a.flags = buffer_get_int(b);
        if (a.flags & SSH2_FILEXFER_ATTR_SIZE)
@@ -86,6 +89,7 @@ decode_attrib(Buffer *b)
        if (a.flags & SSH2_FILEXFER_ATTR_EXTENDED) {
                char *type, *data;
                int i, count;
+
                count = buffer_get_int(b);
                for (i = 0; i < count; i++) {
                        type = buffer_get_string(b, NULL);
@@ -98,6 +102,7 @@ decode_attrib(Buffer *b)
        return &a;
 }
 
+/* Encode attributes to buffer */
 void
 encode_attrib(Buffer *b, Attrib *a)
 {
@@ -116,18 +121,19 @@ encode_attrib(Buffer *b, Attrib *a)
        }
 }
 
+/* Convert from SSH2_FX_ status to text error message */
 const char *
 fx2txt(int status)
 {
        switch (status) {
        case SSH2_FX_OK:
-               return("No Error");
+               return("No error");
        case SSH2_FX_EOF:
-               return("End of File");
+               return("End of file");
        case SSH2_FX_NO_SUCH_FILE:
-               return("No Such File");
+               return("No such file or directory");
        case SSH2_FX_PERMISSION_DENIED:
-               return("Permission Denied");
+               return("Permission denied");
        case SSH2_FX_FAILURE:
                return("Failure");
        case SSH2_FX_BAD_MESSAGE:
@@ -140,7 +146,6 @@ fx2txt(int status)
                return("Operation unsupported");
        default:
                return("Unknown status");
-       };
+       }
        /* NOTREACHED */
 }
-
This page took 0.035293 seconds and 4 git commands to generate.