diff options
Diffstat (limited to 'sftp-server.c')
-rw-r--r-- | sftp-server.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/sftp-server.c b/sftp-server.c index 39cecac59..c5cd47b7d 100644 --- a/sftp-server.c +++ b/sftp-server.c | |||
@@ -9,11 +9,6 @@ | |||
9 | * 2. Redistributions in binary form must reproduce the above copyright | 9 | * 2. Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * 3. All advertising materials mentioning features or use of this software | ||
13 | * must display the following acknowledgement: | ||
14 | * This product includes software developed by Markus Friedl. | ||
15 | * 4. The name of the author may not be used to endorse or promote products | ||
16 | * derived from this software without specific prior written permission. | ||
17 | * | 12 | * |
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 14 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
@@ -27,7 +22,7 @@ | |||
27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | */ | 23 | */ |
29 | #include "includes.h" | 24 | #include "includes.h" |
30 | RCSID("$OpenBSD: sftp-server.c,v 1.4 2000/09/04 19:10:08 markus Exp $"); | 25 | RCSID("$OpenBSD: sftp-server.c,v 1.6 2000/09/07 20:27:53 deraadt Exp $"); |
31 | 26 | ||
32 | #include "ssh.h" | 27 | #include "ssh.h" |
33 | #include "buffer.h" | 28 | #include "buffer.h" |
@@ -194,22 +189,22 @@ decode_attrib(Buffer *b) | |||
194 | { | 189 | { |
195 | static Attrib a; | 190 | static Attrib a; |
196 | attrib_clear(&a); | 191 | attrib_clear(&a); |
197 | a.flags = get_int(); | 192 | a.flags = buffer_get_int(b); |
198 | if (a.flags & SSH_FXA_HAVE_SIZE) { | 193 | if (a.flags & SSH_FXA_HAVE_SIZE) { |
199 | a.size_high = get_int(); | 194 | a.size_high = buffer_get_int(b); |
200 | a.size_low = get_int(); | 195 | a.size_low = buffer_get_int(b); |
201 | a.size = (((u_int64_t) a.size_high) << 32) + a.size_low; | 196 | a.size = (((u_int64_t) a.size_high) << 32) + a.size_low; |
202 | } | 197 | } |
203 | if (a.flags & SSH_FXA_HAVE_UGID) { | 198 | if (a.flags & SSH_FXA_HAVE_UGID) { |
204 | a.uid = get_int(); | 199 | a.uid = buffer_get_int(b); |
205 | a.gid = get_int(); | 200 | a.gid = buffer_get_int(b); |
206 | } | 201 | } |
207 | if (a.flags & SSH_FXA_HAVE_PERM) { | 202 | if (a.flags & SSH_FXA_HAVE_PERM) { |
208 | a.perm = get_int(); | 203 | a.perm = buffer_get_int(b); |
209 | } | 204 | } |
210 | if (a.flags & SSH_FXA_HAVE_TIME) { | 205 | if (a.flags & SSH_FXA_HAVE_TIME) { |
211 | a.atime = get_int(); | 206 | a.atime = buffer_get_int(b); |
212 | a.mtime = get_int(); | 207 | a.mtime = buffer_get_int(b); |
213 | } | 208 | } |
214 | return &a; | 209 | return &a; |
215 | } | 210 | } |
@@ -321,7 +316,7 @@ handle_to_string(int handle, char **stringp, int *hlenp) | |||
321 | } | 316 | } |
322 | 317 | ||
323 | int | 318 | int |
324 | handle_from_string(char *handle, int hlen) | 319 | handle_from_string(char *handle, u_int hlen) |
325 | { | 320 | { |
326 | /* XXX OVERFLOW ? */ | 321 | /* XXX OVERFLOW ? */ |
327 | char *ep; | 322 | char *ep; |
@@ -380,7 +375,8 @@ int | |||
380 | get_handle(void) | 375 | get_handle(void) |
381 | { | 376 | { |
382 | char *handle; | 377 | char *handle; |
383 | int hlen, val; | 378 | int val; |
379 | u_int hlen; | ||
384 | handle = get_string(&hlen); | 380 | handle = get_string(&hlen); |
385 | val = handle_from_string(handle, hlen); | 381 | val = handle_from_string(handle, hlen); |
386 | xfree(handle); | 382 | xfree(handle); |
@@ -580,7 +576,7 @@ process_write(void) | |||
580 | { | 576 | { |
581 | u_int32_t id, off_high, off_low; | 577 | u_int32_t id, off_high, off_low; |
582 | u_int64_t off; | 578 | u_int64_t off; |
583 | int len; | 579 | u_int len; |
584 | int handle, fd, ret, status = SSH_FX_FAILURE; | 580 | int handle, fd, ret, status = SSH_FX_FAILURE; |
585 | char *data; | 581 | char *data; |
586 | 582 | ||
@@ -722,8 +718,8 @@ process_fsetstat(void) | |||
722 | u_int32_t id; | 718 | u_int32_t id; |
723 | int handle, fd, ret; | 719 | int handle, fd, ret; |
724 | int status = SSH_FX_OK; | 720 | int status = SSH_FX_OK; |
725 | char *name = NULL; | 721 | char *name; |
726 | 722 | ||
727 | id = get_int(); | 723 | id = get_int(); |
728 | handle = get_handle(); | 724 | handle = get_handle(); |
729 | a = get_attrib(); | 725 | a = get_attrib(); |
@@ -1017,7 +1013,7 @@ main(int ac, char **av) | |||
1017 | { | 1013 | { |
1018 | fd_set rset, wset; | 1014 | fd_set rset, wset; |
1019 | int in, out, max; | 1015 | int in, out, max; |
1020 | size_t len, olen; | 1016 | ssize_t len, olen; |
1021 | 1017 | ||
1022 | handle_init(); | 1018 | handle_init(); |
1023 | 1019 | ||