summaryrefslogtreecommitdiff
path: root/sftp-server.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2013-06-02 07:31:17 +1000
committerDarren Tucker <dtucker@zip.com.au>2013-06-02 07:31:17 +1000
commita627d42e51ffa71e014d7b2d2c07118122fd3ec3 (patch)
tree7bda769de81f509e28d800916fa20abd37906d79 /sftp-server.c
parentc7aad0058c957afeb26a3f703e8cb0eddeb62365 (diff)
- djm@cvs.openbsd.org 2013/05/17 00:13:13
[xmalloc.h cipher.c sftp-glob.c ssh-keyscan.c ssh.c sftp-common.c ssh-ecdsa.c auth2-chall.c compat.c readconf.c kexgexs.c monitor.c gss-genr.c cipher-3des1.c kex.c monitor_wrap.c ssh-pkcs11-client.c auth-options.c rsa.c auth2-pubkey.c sftp.c hostfile.c auth2.c servconf.c auth.c authfile.c xmalloc.c uuencode.c sftp-client.c auth2-gss.c sftp-server.c bufaux.c mac.c session.c jpake.c kexgexc.c sshconnect.c auth-chall.c auth2-passwd.c sshconnect1.c buffer.c kexecdhs.c kexdhs.c ssh-rsa.c auth1.c ssh-pkcs11.c auth2-kbdint.c kexdhc.c sshd.c umac.c ssh-dss.c auth2-jpake.c bufbn.c clientloop.c monitor_mm.c scp.c roaming_client.c serverloop.c key.c auth-rsa.c ssh-pkcs11-helper.c ssh-keysign.c ssh-keygen.c match.c channels.c sshconnect2.c addrmatch.c mux.c canohost.c kexecdhc.c schnorr.c ssh-add.c misc.c auth2-hostbased.c ssh-agent.c bufec.c groupaccess.c dns.c packet.c readpass.c authfd.c moduli.c] bye, bye xfree(); ok markus@
Diffstat (limited to 'sftp-server.c')
-rw-r--r--sftp-server.c58
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
456static void 456static 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
584static void 584static 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
685static void 685static 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
711static void 711static 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
813static void 813static 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
910static void 910static 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
988static void 988static 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
1013static void 1013static 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
1034static void 1034static 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
1060static void 1060static 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
1122static void 1122static 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
1147static void 1147static 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
1171static void 1171static 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
1192static void 1192static 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
1209static void 1209static 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
1249static void 1249static 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 */