summaryrefslogtreecommitdiff
path: root/sftp-server.c
diff options
context:
space:
mode:
Diffstat (limited to 'sftp-server.c')
-rw-r--r--sftp-server.c46
1 files changed, 19 insertions, 27 deletions
diff --git a/sftp-server.c b/sftp-server.c
index 9166853ed..1d13e97b2 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -1,28 +1,20 @@
1/* 1/*
2 * Copyright (c) 2000, 2001, 2002 Markus Friedl. All rights reserved. 2 * Copyright (c) 2000-2004 Markus Friedl. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Permission to use, copy, modify, and distribute this software for any
5 * modification, are permitted provided that the following conditions 5 * purpose with or without fee is hereby granted, provided that the above
6 * are met: 6 * copyright notice and this permission notice appear in all copies.
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * 7 *
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */ 15 */
24#include "includes.h" 16#include "includes.h"
25RCSID("$OpenBSD: sftp-server.c,v 1.43 2003/06/25 22:39:36 miod Exp $"); 17RCSID("$OpenBSD: sftp-server.c,v 1.45 2004/02/19 21:15:04 markus Exp $");
26 18
27#include "buffer.h" 19#include "buffer.h"
28#include "bufaux.h" 20#include "bufaux.h"
@@ -149,7 +141,7 @@ handle_init(void)
149} 141}
150 142
151static int 143static int
152handle_new(int use, char *name, int fd, DIR *dirp) 144handle_new(int use, const char *name, int fd, DIR *dirp)
153{ 145{
154 int i; 146 int i;
155 147
@@ -184,7 +176,7 @@ handle_to_string(int handle, char **stringp, int *hlenp)
184} 176}
185 177
186static int 178static int
187handle_from_string(char *handle, u_int hlen) 179handle_from_string(const char *handle, u_int hlen)
188{ 180{
189 int val; 181 int val;
190 182
@@ -298,7 +290,7 @@ send_status(u_int32_t id, u_int32_t error)
298 buffer_free(&msg); 290 buffer_free(&msg);
299} 291}
300static void 292static void
301send_data_or_handle(char type, u_int32_t id, char *data, int dlen) 293send_data_or_handle(char type, u_int32_t id, const char *data, int dlen)
302{ 294{
303 Buffer msg; 295 Buffer msg;
304 296
@@ -311,7 +303,7 @@ send_data_or_handle(char type, u_int32_t id, char *data, int dlen)
311} 303}
312 304
313static void 305static void
314send_data(u_int32_t id, char *data, int dlen) 306send_data(u_int32_t id, const char *data, int dlen)
315{ 307{
316 TRACE("sent data id %u len %d", id, dlen); 308 TRACE("sent data id %u len %d", id, dlen);
317 send_data_or_handle(SSH2_FXP_DATA, id, data, dlen); 309 send_data_or_handle(SSH2_FXP_DATA, id, data, dlen);
@@ -330,7 +322,7 @@ send_handle(u_int32_t id, int handle)
330} 322}
331 323
332static void 324static void
333send_names(u_int32_t id, int count, Stat *stats) 325send_names(u_int32_t id, int count, const Stat *stats)
334{ 326{
335 Buffer msg; 327 Buffer msg;
336 int i; 328 int i;
@@ -350,7 +342,7 @@ send_names(u_int32_t id, int count, Stat *stats)
350} 342}
351 343
352static void 344static void
353send_attrib(u_int32_t id, Attrib *a) 345send_attrib(u_int32_t id, const Attrib *a)
354{ 346{
355 Buffer msg; 347 Buffer msg;
356 348
@@ -567,7 +559,7 @@ process_fstat(void)
567} 559}
568 560
569static struct timeval * 561static struct timeval *
570attrib_to_tv(Attrib *a) 562attrib_to_tv(const Attrib *a)
571{ 563{
572 static struct timeval tv[2]; 564 static struct timeval tv[2];
573 565