diff options
author | Colin Watson <cjwatson@debian.org> | 2013-09-14 15:43:03 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2013-09-14 15:43:03 +0100 |
commit | 8faf8c84430cf3c19705b1d9f8889d256e7fd1fd (patch) | |
tree | e6cb74192adb00fda5e4d1457547851d7e0d86af /sftp-server.c | |
parent | 328b60656f29db6306994d7498dede386ec2d1c3 (diff) | |
parent | c41345ad7ee5a22689e2c009595e85fa27b4b39a (diff) |
merge 6.3p1
Diffstat (limited to 'sftp-server.c')
-rw-r--r-- | sftp-server.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/sftp-server.c b/sftp-server.c index cce074a56..285f21aaf 100644 --- a/sftp-server.c +++ b/sftp-server.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sftp-server.c,v 1.96 2013/01/04 19:26:38 jmc Exp $ */ | 1 | /* $OpenBSD: sftp-server.c,v 1.97 2013/05/17 00:13:14 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000-2004 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000-2004 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -319,11 +319,11 @@ handle_close(int handle) | |||
319 | 319 | ||
320 | if (handle_is_ok(handle, HANDLE_FILE)) { | 320 | if (handle_is_ok(handle, HANDLE_FILE)) { |
321 | ret = close(handles[handle].fd); | 321 | ret = close(handles[handle].fd); |
322 | xfree(handles[handle].name); | 322 | free(handles[handle].name); |
323 | handle_unused(handle); | 323 | handle_unused(handle); |
324 | } else if (handle_is_ok(handle, HANDLE_DIR)) { | 324 | } else if (handle_is_ok(handle, HANDLE_DIR)) { |
325 | ret = closedir(handles[handle].dirp); | 325 | ret = closedir(handles[handle].dirp); |
326 | xfree(handles[handle].name); | 326 | free(handles[handle].name); |
327 | handle_unused(handle); | 327 | handle_unused(handle); |
328 | } else { | 328 | } else { |
329 | errno = ENOENT; | 329 | errno = ENOENT; |
@@ -367,7 +367,7 @@ get_handle(void) | |||
367 | handle = get_string(&hlen); | 367 | handle = get_string(&hlen); |
368 | if (hlen < 256) | 368 | if (hlen < 256) |
369 | val = handle_from_string(handle, hlen); | 369 | val = handle_from_string(handle, hlen); |
370 | xfree(handle); | 370 | free(handle); |
371 | return val; | 371 | return val; |
372 | } | 372 | } |
373 | 373 | ||
@@ -450,7 +450,7 @@ send_handle(u_int32_t id, int handle) | |||
450 | handle_to_string(handle, &string, &hlen); | 450 | handle_to_string(handle, &string, &hlen); |
451 | debug("request %u: sent handle handle %d", id, handle); | 451 | debug("request %u: sent handle handle %d", id, handle); |
452 | send_data_or_handle(SSH2_FXP_HANDLE, id, string, hlen); | 452 | send_data_or_handle(SSH2_FXP_HANDLE, id, string, hlen); |
453 | xfree(string); | 453 | free(string); |
454 | } | 454 | } |
455 | 455 | ||
456 | static void | 456 | static void |
@@ -578,7 +578,7 @@ process_open(void) | |||
578 | } | 578 | } |
579 | if (status != SSH2_FX_OK) | 579 | if (status != SSH2_FX_OK) |
580 | send_status(id, status); | 580 | send_status(id, status); |
581 | xfree(name); | 581 | free(name); |
582 | } | 582 | } |
583 | 583 | ||
584 | static void | 584 | static void |
@@ -679,7 +679,7 @@ process_write(void) | |||
679 | } | 679 | } |
680 | } | 680 | } |
681 | send_status(id, status); | 681 | send_status(id, status); |
682 | xfree(data); | 682 | free(data); |
683 | } | 683 | } |
684 | 684 | ||
685 | static void | 685 | static void |
@@ -705,7 +705,7 @@ process_do_stat(int do_lstat) | |||
705 | } | 705 | } |
706 | if (status != SSH2_FX_OK) | 706 | if (status != SSH2_FX_OK) |
707 | send_status(id, status); | 707 | send_status(id, status); |
708 | xfree(name); | 708 | free(name); |
709 | } | 709 | } |
710 | 710 | ||
711 | static void | 711 | static void |
@@ -807,7 +807,7 @@ process_setstat(void) | |||
807 | status = errno_to_portable(errno); | 807 | status = errno_to_portable(errno); |
808 | } | 808 | } |
809 | send_status(id, status); | 809 | send_status(id, status); |
810 | xfree(name); | 810 | free(name); |
811 | } | 811 | } |
812 | 812 | ||
813 | static void | 813 | static void |
@@ -904,7 +904,7 @@ process_opendir(void) | |||
904 | } | 904 | } |
905 | if (status != SSH2_FX_OK) | 905 | if (status != SSH2_FX_OK) |
906 | send_status(id, status); | 906 | send_status(id, status); |
907 | xfree(path); | 907 | free(path); |
908 | } | 908 | } |
909 | 909 | ||
910 | static void | 910 | static void |
@@ -953,13 +953,13 @@ process_readdir(void) | |||
953 | if (count > 0) { | 953 | if (count > 0) { |
954 | send_names(id, count, stats); | 954 | send_names(id, count, stats); |
955 | for (i = 0; i < count; i++) { | 955 | for (i = 0; i < count; i++) { |
956 | xfree(stats[i].name); | 956 | free(stats[i].name); |
957 | xfree(stats[i].long_name); | 957 | free(stats[i].long_name); |
958 | } | 958 | } |
959 | } else { | 959 | } else { |
960 | send_status(id, SSH2_FX_EOF); | 960 | send_status(id, SSH2_FX_EOF); |
961 | } | 961 | } |
962 | xfree(stats); | 962 | free(stats); |
963 | } | 963 | } |
964 | } | 964 | } |
965 | 965 | ||
@@ -982,7 +982,7 @@ process_remove(void) | |||
982 | status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; | 982 | status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; |
983 | } | 983 | } |
984 | send_status(id, status); | 984 | send_status(id, status); |
985 | xfree(name); | 985 | free(name); |
986 | } | 986 | } |
987 | 987 | ||
988 | static void | 988 | static void |
@@ -1007,7 +1007,7 @@ process_mkdir(void) | |||
1007 | status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; | 1007 | status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; |
1008 | } | 1008 | } |
1009 | send_status(id, status); | 1009 | send_status(id, status); |
1010 | xfree(name); | 1010 | free(name); |
1011 | } | 1011 | } |
1012 | 1012 | ||
1013 | static void | 1013 | static void |
@@ -1028,7 +1028,7 @@ process_rmdir(void) | |||
1028 | status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; | 1028 | status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; |
1029 | } | 1029 | } |
1030 | send_status(id, status); | 1030 | send_status(id, status); |
1031 | xfree(name); | 1031 | free(name); |
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | static void | 1034 | static void |
@@ -1041,7 +1041,7 @@ process_realpath(void) | |||
1041 | id = get_int(); | 1041 | id = get_int(); |
1042 | path = get_string(NULL); | 1042 | path = get_string(NULL); |
1043 | if (path[0] == '\0') { | 1043 | if (path[0] == '\0') { |
1044 | xfree(path); | 1044 | free(path); |
1045 | path = xstrdup("."); | 1045 | path = xstrdup("."); |
1046 | } | 1046 | } |
1047 | debug3("request %u: realpath", id); | 1047 | debug3("request %u: realpath", id); |
@@ -1054,7 +1054,7 @@ process_realpath(void) | |||
1054 | s.name = s.long_name = resolvedname; | 1054 | s.name = s.long_name = resolvedname; |
1055 | send_names(id, 1, &s); | 1055 | send_names(id, 1, &s); |
1056 | } | 1056 | } |
1057 | xfree(path); | 1057 | free(path); |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | static void | 1060 | static void |
@@ -1115,8 +1115,8 @@ process_rename(void) | |||
1115 | status = SSH2_FX_OK; | 1115 | status = SSH2_FX_OK; |
1116 | } | 1116 | } |
1117 | send_status(id, status); | 1117 | send_status(id, status); |
1118 | xfree(oldpath); | 1118 | free(oldpath); |
1119 | xfree(newpath); | 1119 | free(newpath); |
1120 | } | 1120 | } |
1121 | 1121 | ||
1122 | static void | 1122 | static void |
@@ -1141,7 +1141,7 @@ process_readlink(void) | |||
1141 | s.name = s.long_name = buf; | 1141 | s.name = s.long_name = buf; |
1142 | send_names(id, 1, &s); | 1142 | send_names(id, 1, &s); |
1143 | } | 1143 | } |
1144 | xfree(path); | 1144 | free(path); |
1145 | } | 1145 | } |
1146 | 1146 | ||
1147 | static void | 1147 | static void |
@@ -1164,8 +1164,8 @@ process_symlink(void) | |||
1164 | status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; | 1164 | status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; |
1165 | } | 1165 | } |
1166 | send_status(id, status); | 1166 | send_status(id, status); |
1167 | xfree(oldpath); | 1167 | free(oldpath); |
1168 | xfree(newpath); | 1168 | free(newpath); |
1169 | } | 1169 | } |
1170 | 1170 | ||
1171 | static void | 1171 | static void |
@@ -1185,8 +1185,8 @@ process_extended_posix_rename(u_int32_t id) | |||
1185 | status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; | 1185 | status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; |
1186 | } | 1186 | } |
1187 | send_status(id, status); | 1187 | send_status(id, status); |
1188 | xfree(oldpath); | 1188 | free(oldpath); |
1189 | xfree(newpath); | 1189 | free(newpath); |
1190 | } | 1190 | } |
1191 | 1191 | ||
1192 | static void | 1192 | static void |
@@ -1203,7 +1203,7 @@ process_extended_statvfs(u_int32_t id) | |||
1203 | send_status(id, errno_to_portable(errno)); | 1203 | send_status(id, errno_to_portable(errno)); |
1204 | else | 1204 | else |
1205 | send_statvfs(id, &st); | 1205 | send_statvfs(id, &st); |
1206 | xfree(path); | 1206 | free(path); |
1207 | } | 1207 | } |
1208 | 1208 | ||
1209 | static void | 1209 | static void |
@@ -1242,8 +1242,8 @@ process_extended_hardlink(u_int32_t id) | |||
1242 | status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; | 1242 | status = (ret == -1) ? errno_to_portable(errno) : SSH2_FX_OK; |
1243 | } | 1243 | } |
1244 | send_status(id, status); | 1244 | send_status(id, status); |
1245 | xfree(oldpath); | 1245 | free(oldpath); |
1246 | xfree(newpath); | 1246 | free(newpath); |
1247 | } | 1247 | } |
1248 | 1248 | ||
1249 | static void | 1249 | static void |
@@ -1264,7 +1264,7 @@ process_extended(void) | |||
1264 | process_extended_hardlink(id); | 1264 | process_extended_hardlink(id); |
1265 | else | 1265 | else |
1266 | send_status(id, SSH2_FX_OP_UNSUPPORTED); /* MUST */ | 1266 | send_status(id, SSH2_FX_OP_UNSUPPORTED); /* MUST */ |
1267 | xfree(request); | 1267 | free(request); |
1268 | } | 1268 | } |
1269 | 1269 | ||
1270 | /* stolen from ssh-agent */ | 1270 | /* stolen from ssh-agent */ |