Bugzilla – Attachment 1393 Details for
Bug 1399
add statfs extension to sftp-server
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PATCH] add statfs extension to sftp-server
sftp-server-statfs.patch (text/plain), 1.68 KB, created by
Miklos Szeredi
on 2007-12-11 08:01:58 AEDT
(
hide
)
Description:
[PATCH] add statfs extension to sftp-server
Filename:
MIME Type:
Creator:
Miklos Szeredi
Created:
2007-12-11 08:01:58 AEDT
Size:
1.68 KB
patch
obsolete
>Index: ssh/sftp-server.c >=================================================================== >--- ssh.orig/sftp-server.c 2007-12-07 11:23:07.000000000 +0100 >+++ ssh/sftp-server.c 2007-12-07 12:36:10.000000000 +0100 >@@ -19,6 +19,7 @@ > #include <sys/stat.h> > #include <sys/time.h> > #include <sys/param.h> >+#include <sys/mount.h> > > #include <dirent.h> > #include <errno.h> >@@ -468,6 +469,24 @@ send_attrib(u_int32_t id, const Attrib * > buffer_free(&msg); > } > >+static void >+send_statfs(u_int32_t id, struct statfs *st) >+{ >+ Buffer msg; >+ >+ buffer_init(&msg); >+ buffer_put_char(&msg, SSH2_FXP_EXTENDED_REPLY); >+ buffer_put_int(&msg, id); >+ buffer_put_int(&msg, st->f_bsize); >+ buffer_put_int64(&msg, st->f_blocks); >+ buffer_put_int64(&msg, st->f_bfree); >+ buffer_put_int64(&msg, st->f_bavail); >+ buffer_put_int64(&msg, st->f_files); >+ buffer_put_int64(&msg, st->f_ffree); >+ send_msg(&msg); >+ buffer_free(&msg); >+} >+ > /* parse incoming */ > > static void >@@ -1057,6 +1076,25 @@ process_symlink(void) > } > > static void >+process_extended_statfs(u_int32_t id) >+{ >+ char *path; >+ struct statfs st; >+ int ret; >+ >+ path = get_string(NULL); >+ debug3("request %u: statfs", id); >+ logit("statfs \"%s\"", path); >+ >+ ret = statfs(path, &st); >+ if (ret == -1) >+ send_status(id, errno_to_portable(errno)); >+ else >+ send_statfs(id, &st); >+ xfree(path); >+} >+ >+static void > process_extended(void) > { > u_int32_t id; >@@ -1064,7 +1102,10 @@ process_extended(void) > > id = get_int(); > request = get_string(NULL); >- send_status(id, SSH2_FX_OP_UNSUPPORTED); /* MUST */ >+ if (strcmp(request, "statfs@openssh.org") == 0) >+ process_extended_statfs(id); >+ else >+ send_status(id, SSH2_FX_OP_UNSUPPORTED); /* MUST */ > xfree(request); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1399
:
1393
|
1475