diff options
Diffstat (limited to 'feature-openssh-7.4-hima-sftpserver-oom-and-fix.patch')
-rw-r--r-- | feature-openssh-7.4-hima-sftpserver-oom-and-fix.patch | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/feature-openssh-7.4-hima-sftpserver-oom-and-fix.patch b/feature-openssh-7.4-hima-sftpserver-oom-and-fix.patch index 7af483c..3fa984d 100644 --- a/feature-openssh-7.4-hima-sftpserver-oom-and-fix.patch +++ b/feature-openssh-7.4-hima-sftpserver-oom-and-fix.patch @@ -1,20 +1,19 @@ From 6d98c61e18fe65a52e21df9cece74675f9c18125 Mon Sep 17 00:00:00 2001 -From: shenyining <shenyining@huawei.com> +From: s00467541 <shenyining@huawei.com> Date: Thu, 16 Apr 2020 17:13:24 +0800 Subject: [PATCH] sync patch, add new judgement and delete default sftp-put-check.cfg -Signed-off-by: shenyining <shenyining@huawei.com> - +Signed-off-by: s00467541 <shenyining@huawei.com> --- - sftp-server.c | 702 +++++++++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 690 insertions(+), 12 deletions(-) + sftp-server.c | 703 +++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 691 insertions(+), 12 deletions(-) diff --git a/sftp-server.c b/sftp-server.c -index 5677aa3..4eb06d1 100644 +index 01d6f8f..682c19a 100644 --- a/sftp-server.c +++ b/sftp-server.c -@@ -30,6 +30,12 @@ +@@ -29,6 +29,12 @@ #include <sys/statvfs.h> #endif @@ -27,7 +26,7 @@ index 5677aa3..4eb06d1 100644 #include <dirent.h> #include <errno.h> #include <fcntl.h> -@@ -57,6 +63,17 @@ +@@ -51,6 +57,17 @@ #include "sftp.h" #include "sftp-common.h" @@ -45,7 +44,7 @@ index 5677aa3..4eb06d1 100644 char *sftp_realpath(const char *, char *); /* sftp-realpath.c */ /* Maximum data read that we are willing to accept */ -@@ -98,6 +115,452 @@ struct Stat { +@@ -89,6 +106,452 @@ struct Stat { Attrib attrib; }; @@ -498,7 +497,7 @@ index 5677aa3..4eb06d1 100644 /* Packet handlers */ static void process_open(u_int32_t id); static void process_close(u_int32_t id); -@@ -755,6 +1218,15 @@ process_open(u_int32_t id) +@@ -695,6 +1158,15 @@ process_open(u_int32_t id) (r = sshbuf_get_u32(iqueue, &pflags)) != 0 || /* portable flags */ (r = decode_attrib(iqueue, &a)) != 0) fatal_fr(r, "parse"); @@ -514,7 +513,7 @@ index 5677aa3..4eb06d1 100644 debug3("request %u: open flags %d", id, pflags); flags = flags_from_portable(pflags); -@@ -788,6 +1260,8 @@ process_open(u_int32_t id) +@@ -728,6 +1200,8 @@ process_open(u_int32_t id) (void) umask(old_umask); /* restore umask to something sane */ if (status != SSH2_FX_OK) send_status(id, status); @@ -523,7 +522,7 @@ index 5677aa3..4eb06d1 100644 free(name); } -@@ -820,6 +1294,17 @@ process_read(u_int32_t id) +@@ -759,6 +1233,17 @@ process_read(u_int32_t id) (r = sshbuf_get_u32(iqueue, &len)) != 0) fatal_fr(r, "parse"); @@ -541,7 +540,7 @@ index 5677aa3..4eb06d1 100644 debug("request %u: read \"%s\" (handle %d) off %llu len %u", id, handle_to_name(handle), handle, (unsigned long long)off, len); if ((fd = handle_to_fd(handle)) == -1) -@@ -874,6 +1359,18 @@ process_write(u_int32_t id) +@@ -800,6 +1285,18 @@ process_write(u_int32_t id) (r = sshbuf_get_string(iqueue, &data, &len)) != 0) fatal_fr(r, "parse"); @@ -560,7 +559,7 @@ index 5677aa3..4eb06d1 100644 debug("request %u: write \"%s\" (handle %d) off %llu len %zu", id, handle_to_name(handle), handle, (unsigned long long)off, len); fd = handle_to_fd(handle); -@@ -888,17 +1385,30 @@ process_write(u_int32_t id) +@@ -813,17 +1310,30 @@ process_write(u_int32_t id) strerror(errno)); } else { /* XXX ATOMICIO ? */ @@ -601,7 +600,7 @@ index 5677aa3..4eb06d1 100644 } } } -@@ -917,6 +1427,16 @@ process_do_stat(u_int32_t id, int do_lstat) +@@ -841,6 +1352,16 @@ process_do_stat(u_int32_t id, int do_lstat) if ((r = sshbuf_get_cstring(iqueue, &name, NULL)) != 0) fatal_fr(r, "parse"); @@ -618,7 +617,7 @@ index 5677aa3..4eb06d1 100644 debug3("request %u: %sstat", id, do_lstat ? "l" : ""); verbose("%sstat name \"%s\"", do_lstat ? "l" : "", name); r = do_lstat ? lstat(name, &st) : stat(name, &st); -@@ -953,6 +1473,16 @@ process_fstat(u_int32_t id) +@@ -877,6 +1398,16 @@ process_fstat(u_int32_t id) if ((r = get_handle(iqueue, &handle)) != 0) fatal_fr(r, "parse"); @@ -635,7 +634,7 @@ index 5677aa3..4eb06d1 100644 debug("request %u: fstat \"%s\" (handle %u)", id, handle_to_name(handle), handle); fd = handle_to_fd(handle); -@@ -1005,6 +1535,14 @@ process_setstat(u_int32_t id) +@@ -929,6 +1460,14 @@ process_setstat(u_int32_t id) (r = decode_attrib(iqueue, &a)) != 0) fatal_fr(r, "parse"); @@ -650,7 +649,7 @@ index 5677aa3..4eb06d1 100644 debug("request %u: setstat name \"%s\"", id, name); if (a.flags & SSH2_FILEXFER_ATTR_SIZE) { logit("set \"%s\" size %llu", -@@ -1059,6 +1597,13 @@ process_fsetstat(u_int32_t id) +@@ -983,6 +1522,13 @@ process_fsetstat(u_int32_t id) else { char *name = handle_to_name(handle); @@ -664,7 +663,7 @@ index 5677aa3..4eb06d1 100644 if (a.flags & SSH2_FILEXFER_ATTR_SIZE) { logit("set \"%s\" size %llu", name, (unsigned long long)a.size); -@@ -1116,6 +1661,14 @@ process_opendir(u_int32_t id) +@@ -1040,6 +1586,14 @@ process_opendir(u_int32_t id) if ((r = sshbuf_get_cstring(iqueue, &path, NULL)) != 0) fatal_fr(r, "parse"); @@ -679,17 +678,18 @@ index 5677aa3..4eb06d1 100644 debug3("request %u: opendir", id); logit("opendir \"%s\"", path); dirp = opendir(path); -@@ -1170,6 +1723,9 @@ process_readdir(u_int32_t id) +@@ -1094,6 +1648,10 @@ process_readdir(u_int32_t id) strcmp(path, "/") ? "/" : "", dp->d_name); if (lstat(pathname, &st) == -1) continue; -+ if (RETURN_OK != path_permition_check(pathname,FLAG_PERMITOP)) { -+ continue; -+ } ++ if (RETURN_OK != path_permition_check(pathname,FLAG_PERMITOP)) ++ { ++ continue; ++ } stat_to_attrib(&st, &(stats[count].attrib)); stats[count].name = xstrdup(dp->d_name); - stats[count].long_name = ls_file(dp->d_name, &st, -@@ -1202,6 +1758,14 @@ process_remove(u_int32_t id) + stats[count].long_name = ls_file(dp->d_name, &st, 0, 0); +@@ -1125,6 +1683,14 @@ process_remove(u_int32_t id) if ((r = sshbuf_get_cstring(iqueue, &name, NULL)) != 0) fatal_fr(r, "parse"); @@ -704,7 +704,7 @@ index 5677aa3..4eb06d1 100644 debug3("request %u: remove", id); logit("remove name \"%s\"", name); r = unlink(name); -@@ -1221,6 +1785,14 @@ process_mkdir(u_int32_t id) +@@ -1144,6 +1710,14 @@ process_mkdir(u_int32_t id) (r = decode_attrib(iqueue, &a)) != 0) fatal_fr(r, "parse"); @@ -719,7 +719,7 @@ index 5677aa3..4eb06d1 100644 mode = (a.flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ? a.perm & 07777 : 0777; debug3("request %u: mkdir", id); -@@ -1240,6 +1812,14 @@ process_rmdir(u_int32_t id) +@@ -1163,6 +1737,14 @@ process_rmdir(u_int32_t id) if ((r = sshbuf_get_cstring(iqueue, &name, NULL)) != 0) fatal_fr(r, "parse"); @@ -734,7 +734,7 @@ index 5677aa3..4eb06d1 100644 debug3("request %u: rmdir", id); logit("rmdir name \"%s\"", name); r = rmdir(name); -@@ -1264,8 +1844,12 @@ process_realpath(u_int32_t id) +@@ -1187,8 +1769,12 @@ process_realpath(u_int32_t id) } debug3("request %u: realpath", id); verbose("realpath \"%s\"", path); @@ -749,7 +749,7 @@ index 5677aa3..4eb06d1 100644 } else { Stat s; attrib_clear(&s.attrib); -@@ -1286,6 +1870,16 @@ process_rename(u_int32_t id) +@@ -1209,6 +1795,16 @@ process_rename(u_int32_t id) (r = sshbuf_get_cstring(iqueue, &newpath, NULL)) != 0) fatal_fr(r, "parse"); @@ -766,7 +766,7 @@ index 5677aa3..4eb06d1 100644 debug3("request %u: rename", id); logit("rename old \"%s\" new \"%s\"", oldpath, newpath); status = SSH2_FX_FAILURE; -@@ -1345,6 +1939,14 @@ process_readlink(u_int32_t id) +@@ -1268,6 +1864,14 @@ process_readlink(u_int32_t id) if ((r = sshbuf_get_cstring(iqueue, &path, NULL)) != 0) fatal_fr(r, "parse"); @@ -781,7 +781,7 @@ index 5677aa3..4eb06d1 100644 debug3("request %u: readlink", id); verbose("readlink \"%s\"", path); if ((len = readlink(path, buf, sizeof(buf) - 1)) == -1) -@@ -1370,6 +1972,16 @@ process_symlink(u_int32_t id) +@@ -1293,6 +1897,16 @@ process_symlink(u_int32_t id) (r = sshbuf_get_cstring(iqueue, &newpath, NULL)) != 0) fatal_fr(r, "parse"); @@ -798,7 +798,7 @@ index 5677aa3..4eb06d1 100644 debug3("request %u: symlink", id); logit("symlink old \"%s\" new \"%s\"", oldpath, newpath); /* this will fail if 'newpath' exists */ -@@ -1390,6 +2002,16 @@ process_extended_posix_rename(u_int32_t id) +@@ -1313,6 +1927,16 @@ process_extended_posix_rename(u_int32_t id) (r = sshbuf_get_cstring(iqueue, &newpath, NULL)) != 0) fatal_fr(r, "parse"); @@ -815,7 +815,7 @@ index 5677aa3..4eb06d1 100644 debug3("request %u: posix-rename", id); logit("posix-rename old \"%s\" new \"%s\"", oldpath, newpath); r = rename(oldpath, newpath); -@@ -1408,6 +2030,15 @@ process_extended_statvfs(u_int32_t id) +@@ -1331,6 +1955,15 @@ process_extended_statvfs(u_int32_t id) if ((r = sshbuf_get_cstring(iqueue, &path, NULL)) != 0) fatal_fr(r, "parse"); @@ -831,7 +831,7 @@ index 5677aa3..4eb06d1 100644 debug3("request %u: statvfs", id); logit("statvfs \"%s\"", path); -@@ -1426,6 +2057,17 @@ process_extended_fstatvfs(u_int32_t id) +@@ -1349,6 +1982,17 @@ process_extended_fstatvfs(u_int32_t id) if ((r = get_handle(iqueue, &handle)) != 0) fatal_fr(r, "parse"); @@ -849,7 +849,7 @@ index 5677aa3..4eb06d1 100644 debug("request %u: fstatvfs \"%s\" (handle %u)", id, handle_to_name(handle), handle); if ((fd = handle_to_fd(handle)) < 0) { -@@ -1448,6 +2090,15 @@ process_extended_hardlink(u_int32_t id) +@@ -1371,6 +2015,15 @@ process_extended_hardlink(u_int32_t id) (r = sshbuf_get_cstring(iqueue, &newpath, NULL)) != 0) fatal_fr(r, "parse"); @@ -865,7 +865,7 @@ index 5677aa3..4eb06d1 100644 debug3("request %u: hardlink", id); logit("hardlink old \"%s\" new \"%s\"", oldpath, newpath); r = link(oldpath, newpath); -@@ -1464,6 +2115,17 @@ process_extended_fsync(u_int32_t id) +@@ -1387,6 +2040,17 @@ process_extended_fsync(u_int32_t id) if ((r = get_handle(iqueue, &handle)) != 0) fatal_fr(r, "parse"); @@ -883,7 +883,7 @@ index 5677aa3..4eb06d1 100644 debug3("request %u: fsync (handle %u)", id, handle); verbose("fsync \"%s\"", handle_to_name(handle)); if ((fd = handle_to_fd(handle)) < 0) -@@ -2006,6 +2668,22 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw, int reset_handle +@@ -1672,6 +2336,22 @@ sftp_server_main(int argc, char **argv, struct passwd *user_pw, int reset_handle log_init_handler(__progname, log_level, log_facility, log_stderr, reset_handler); @@ -907,5 +907,5 @@ index 5677aa3..4eb06d1 100644 * On platforms where we can, avoid making /proc/self/{mem,maps} * available to the user so that sftp access doesn't automatically -- -2.27.0 +2.23.0 |