|
Lines 19-24
Link Here
|
| 19 |
#include <sys/stat.h> |
19 |
#include <sys/stat.h> |
| 20 |
#include <sys/time.h> |
20 |
#include <sys/time.h> |
| 21 |
#include <sys/param.h> |
21 |
#include <sys/param.h> |
|
|
22 |
#include <sys/mount.h> |
| 22 |
|
23 |
|
| 23 |
#include <dirent.h> |
24 |
#include <dirent.h> |
| 24 |
#include <errno.h> |
25 |
#include <errno.h> |
|
Lines 468-473
send_attrib(u_int32_t id, const Attrib *
Link Here
|
| 468 |
buffer_free(&msg); |
469 |
buffer_free(&msg); |
| 469 |
} |
470 |
} |
| 470 |
|
471 |
|
|
|
472 |
static void |
| 473 |
send_statfs(u_int32_t id, struct statfs *st) |
| 474 |
{ |
| 475 |
Buffer msg; |
| 476 |
|
| 477 |
buffer_init(&msg); |
| 478 |
buffer_put_char(&msg, SSH2_FXP_EXTENDED_REPLY); |
| 479 |
buffer_put_int(&msg, id); |
| 480 |
buffer_put_int(&msg, st->f_bsize); |
| 481 |
buffer_put_int64(&msg, st->f_blocks); |
| 482 |
buffer_put_int64(&msg, st->f_bfree); |
| 483 |
buffer_put_int64(&msg, st->f_bavail); |
| 484 |
buffer_put_int64(&msg, st->f_files); |
| 485 |
buffer_put_int64(&msg, st->f_ffree); |
| 486 |
send_msg(&msg); |
| 487 |
buffer_free(&msg); |
| 488 |
} |
| 489 |
|
| 471 |
/* parse incoming */ |
490 |
/* parse incoming */ |
| 472 |
|
491 |
|
| 473 |
static void |
492 |
static void |
|
Lines 1057-1062
process_symlink(void)
Link Here
|
| 1057 |
} |
1076 |
} |
| 1058 |
|
1077 |
|
| 1059 |
static void |
1078 |
static void |
|
|
1079 |
process_extended_statfs(u_int32_t id) |
| 1080 |
{ |
| 1081 |
char *path; |
| 1082 |
struct statfs st; |
| 1083 |
int ret; |
| 1084 |
|
| 1085 |
path = get_string(NULL); |
| 1086 |
debug3("request %u: statfs", id); |
| 1087 |
logit("statfs \"%s\"", path); |
| 1088 |
|
| 1089 |
ret = statfs(path, &st); |
| 1090 |
if (ret == -1) |
| 1091 |
send_status(id, errno_to_portable(errno)); |
| 1092 |
else |
| 1093 |
send_statfs(id, &st); |
| 1094 |
xfree(path); |
| 1095 |
} |
| 1096 |
|
| 1097 |
static void |
| 1060 |
process_extended(void) |
1098 |
process_extended(void) |
| 1061 |
{ |
1099 |
{ |
| 1062 |
u_int32_t id; |
1100 |
u_int32_t id; |
|
Lines 1064-1070
process_extended(void)
Link Here
|
| 1064 |
|
1102 |
|
| 1065 |
id = get_int(); |
1103 |
id = get_int(); |
| 1066 |
request = get_string(NULL); |
1104 |
request = get_string(NULL); |
| 1067 |
send_status(id, SSH2_FX_OP_UNSUPPORTED); /* MUST */ |
1105 |
if (strcmp(request, "statfs@openssh.org") == 0) |
|
|
1106 |
process_extended_statfs(id); |
| 1107 |
else |
| 1108 |
send_status(id, SSH2_FX_OP_UNSUPPORTED); /* MUST */ |
| 1068 |
xfree(request); |
1109 |
xfree(request); |
| 1069 |
} |
1110 |
} |
| 1070 |
|
1111 |
|