summaryrefslogtreecommitdiff
path: root/sftp-server.c
diff options
context:
space:
mode:
Diffstat (limited to 'sftp-server.c')
-rw-r--r--sftp-server.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/sftp-server.c b/sftp-server.c
index 1d13e97b2..8349c1763 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -14,7 +14,7 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16#include "includes.h" 16#include "includes.h"
17RCSID("$OpenBSD: sftp-server.c,v 1.45 2004/02/19 21:15:04 markus Exp $"); 17RCSID("$OpenBSD: sftp-server.c,v 1.46 2004/06/21 17:36:31 avsm Exp $");
18 18
19#include "buffer.h" 19#include "buffer.h"
20#include "bufaux.h" 20#include "bufaux.h"
@@ -260,7 +260,7 @@ send_msg(Buffer *m)
260} 260}
261 261
262static void 262static void
263send_status(u_int32_t id, u_int32_t error) 263send_status(u_int32_t id, u_int32_t status)
264{ 264{
265 Buffer msg; 265 Buffer msg;
266 const char *status_messages[] = { 266 const char *status_messages[] = {
@@ -276,14 +276,14 @@ send_status(u_int32_t id, u_int32_t error)
276 "Unknown error" /* Others */ 276 "Unknown error" /* Others */
277 }; 277 };
278 278
279 TRACE("sent status id %u error %u", id, error); 279 TRACE("sent status id %u error %u", id, status);
280 buffer_init(&msg); 280 buffer_init(&msg);
281 buffer_put_char(&msg, SSH2_FXP_STATUS); 281 buffer_put_char(&msg, SSH2_FXP_STATUS);
282 buffer_put_int(&msg, id); 282 buffer_put_int(&msg, id);
283 buffer_put_int(&msg, error); 283 buffer_put_int(&msg, status);
284 if (version >= 3) { 284 if (version >= 3) {
285 buffer_put_cstring(&msg, 285 buffer_put_cstring(&msg,
286 status_messages[MIN(error,SSH2_FX_MAX)]); 286 status_messages[MIN(status,SSH2_FX_MAX)]);
287 buffer_put_cstring(&msg, ""); 287 buffer_put_cstring(&msg, "");
288 } 288 }
289 send_msg(&msg); 289 send_msg(&msg);
@@ -863,20 +863,20 @@ process_readlink(void)
863{ 863{
864 u_int32_t id; 864 u_int32_t id;
865 int len; 865 int len;
866 char link[MAXPATHLEN]; 866 char buf[MAXPATHLEN];
867 char *path; 867 char *path;
868 868
869 id = get_int(); 869 id = get_int();
870 path = get_string(NULL); 870 path = get_string(NULL);
871 TRACE("readlink id %u path %s", id, path); 871 TRACE("readlink id %u path %s", id, path);
872 if ((len = readlink(path, link, sizeof(link) - 1)) == -1) 872 if ((len = readlink(path, buf, sizeof(buf) - 1)) == -1)
873 send_status(id, errno_to_portable(errno)); 873 send_status(id, errno_to_portable(errno));
874 else { 874 else {
875 Stat s; 875 Stat s;
876 876
877 link[len] = '\0'; 877 buf[len] = '\0';
878 attrib_clear(&s.attrib); 878 attrib_clear(&s.attrib);
879 s.name = s.long_name = link; 879 s.name = s.long_name = buf;
880 send_names(id, 1, &s); 880 send_names(id, 1, &s);
881 } 881 }
882 xfree(path); 882 xfree(path);