summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Steves <stevesk@pobox.com>2001-02-05 13:42:43 +0000
committerKevin Steves <stevesk@pobox.com>2001-02-05 13:42:43 +0000
commit62c45db52688273493960b46fe07bae1acb3021d (patch)
tree6d3a7aaa23a9c53cf47eb5d1298335cd5c986810
parent8e74393416d9829c463c22db8243f189e5f8f474 (diff)
- deraadt@cvs.openbsd.org 2001/02/04 17:02:32
[sftp-int.c] ? == help - deraadt@cvs.openbsd.org 2001/02/04 16:47:46 [sftp-int.c] sort commands, so that abbreviations work as expected - stevesk@cvs.openbsd.org 2001/02/04 15:17:52 [sftp-int.c] debugging sftp: precedence and missing break. chmod, chown, chgrp seem to be working now. - markus@cvs.openbsd.org 2001/02/04 14:41:21 [sftp-int.c] use base 8 for umask/chmod - markus@cvs.openbsd.org 2001/02/04 11:11:54 [sftp-int.c] fix LCD
-rw-r--r--ChangeLog16
-rw-r--r--sftp-int.c62
2 files changed, 49 insertions, 29 deletions
diff --git a/ChangeLog b/ChangeLog
index adc970d47..689c2b4af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,22 @@
9 - stevesk@cvs.openbsd.org 2001/02/04 15:21:19 9 - stevesk@cvs.openbsd.org 2001/02/04 15:21:19
10 [sftp-server.c] 10 [sftp-server.c]
11 SSH2_FILEXFER_ATTR_UIDGID support; ok markus@ 11 SSH2_FILEXFER_ATTR_UIDGID support; ok markus@
12 - deraadt@cvs.openbsd.org 2001/02/04 17:02:32
13 [sftp-int.c]
14 ? == help
15 - deraadt@cvs.openbsd.org 2001/02/04 16:47:46
16 [sftp-int.c]
17 sort commands, so that abbreviations work as expected
18 - stevesk@cvs.openbsd.org 2001/02/04 15:17:52
19 [sftp-int.c]
20 debugging sftp: precedence and missing break. chmod, chown, chgrp
21 seem to be working now.
22 - markus@cvs.openbsd.org 2001/02/04 14:41:21
23 [sftp-int.c]
24 use base 8 for umask/chmod
25 - markus@cvs.openbsd.org 2001/02/04 11:11:54
26 [sftp-int.c]
27 fix LCD
12 28
1320010104 2920010104
14 - (bal) I think this is the last of the bsd-*.h that don't belong. 30 - (bal) I think this is the last of the bsd-*.h that don't belong.
diff --git a/sftp-int.c b/sftp-int.c
index 9ec5b9712..02e0d38c0 100644
--- a/sftp-int.c
+++ b/sftp-int.c
@@ -27,7 +27,7 @@
27/* XXX: recursive operations */ 27/* XXX: recursive operations */
28 28
29#include "includes.h" 29#include "includes.h"
30RCSID("$OpenBSD: sftp-int.c,v 1.1 2001/02/04 11:11:54 djm Exp $"); 30RCSID("$OpenBSD: sftp-int.c,v 1.7 2001/02/05 00:02:32 deraadt Exp $");
31 31
32#include "buffer.h" 32#include "buffer.h"
33#include "xmalloc.h" 33#include "xmalloc.h"
@@ -65,35 +65,36 @@ RCSID("$OpenBSD: sftp-int.c,v 1.1 2001/02/04 11:11:54 djm Exp $");
65#define I_SHELL 20 65#define I_SHELL 20
66 66
67struct CMD { 67struct CMD {
68 const int n;
69 const char *c; 68 const char *c;
69 const int n;
70}; 70};
71 71
72const struct CMD cmds[] = { 72const struct CMD cmds[] = {
73 { I_CHDIR, "CD" }, 73 { "CD", I_CHDIR },
74 { I_CHDIR, "CHDIR" }, 74 { "CHDIR", I_CHDIR },
75 { I_CHDIR, "LCD" }, 75 { "CHGRP", I_CHGRP },
76 { I_CHGRP, "CHGRP" }, 76 { "CHMOD", I_CHMOD },
77 { I_CHMOD, "CHMOD" }, 77 { "CHOWN", I_CHOWN },
78 { I_CHOWN, "CHOWN" }, 78 { "EXIT", I_QUIT },
79 { I_HELP, "HELP" }, 79 { "GET", I_GET },
80 { I_GET, "GET" }, 80 { "HELP", I_HELP },
81 { I_LCHDIR, "LCHDIR" }, 81 { "LCD", I_LCHDIR },
82 { I_LLS, "LLS" }, 82 { "LCHDIR", I_LCHDIR },
83 { I_LMKDIR, "LMKDIR" }, 83 { "LLS", I_LLS },
84 { I_LPWD, "LPWD" }, 84 { "LMKDIR", I_LMKDIR },
85 { I_LS, "LS" }, 85 { "LPWD", I_LPWD },
86 { I_LUMASK, "LUMASK" }, 86 { "LS", I_LS },
87 { I_MKDIR, "MKDIR" }, 87 { "LUMASK", I_LUMASK },
88 { I_PUT, "PUT" }, 88 { "MKDIR", I_MKDIR },
89 { I_PWD, "PWD" }, 89 { "PUT", I_PUT },
90 { I_QUIT, "EXIT" }, 90 { "PWD", I_PWD },
91 { I_QUIT, "QUIT" }, 91 { "QUIT", I_QUIT },
92 { I_RENAME, "RENAME" }, 92 { "RENAME", I_RENAME },
93 { I_RMDIR, "RMDIR" }, 93 { "RM", I_RM },
94 { I_RM, "RM" }, 94 { "RMDIR", I_RMDIR },
95 { I_SHELL, "!" }, 95 { "!", I_SHELL },
96 { -1, NULL} 96 { "?", I_HELP },
97 { NULL, -1}
97}; 98};
98 99
99void 100void
@@ -289,6 +290,7 @@ parse_args(const char **cpp, int *pflag, unsigned long *n_arg,
289 char **path1, char **path2) 290 char **path1, char **path2)
290{ 291{
291 const char *cmd, *cp = *cpp; 292 const char *cmd, *cp = *cpp;
293 int base = 0;
292 int i, cmdnum; 294 int i, cmdnum;
293 295
294 /* Skip leading whitespace */ 296 /* Skip leading whitespace */
@@ -383,6 +385,7 @@ parse_args(const char **cpp, int *pflag, unsigned long *n_arg,
383 break; 385 break;
384 case I_LUMASK: 386 case I_LUMASK:
385 case I_CHMOD: 387 case I_CHMOD:
388 base = 8;
386 case I_CHOWN: 389 case I_CHOWN:
387 case I_CHGRP: 390 case I_CHGRP:
388 /* Get numeric arg (mandatory) */ 391 /* Get numeric arg (mandatory) */
@@ -391,7 +394,7 @@ parse_args(const char **cpp, int *pflag, unsigned long *n_arg,
391 "to the %s command.", cmd); 394 "to the %s command.", cmd);
392 return(-1); 395 return(-1);
393 } 396 }
394 *n_arg = strtoul(cp, (char**)&cp, 0); 397 *n_arg = strtoul(cp, (char**)&cp, base);
395 if (!*cp || !strchr(WHITESPACE, *cp)) { 398 if (!*cp || !strchr(WHITESPACE, *cp)) {
396 error("You must supply a numeric argument " 399 error("You must supply a numeric argument "
397 "to the %s command.", cmd); 400 "to the %s command.", cmd);
@@ -500,10 +503,11 @@ parse_dispatch_command(int in, int out, const char *cmd, char **pwd)
500 a.flags |= SSH2_FILEXFER_ATTR_PERMISSIONS; 503 a.flags |= SSH2_FILEXFER_ATTR_PERMISSIONS;
501 a.perm = n_arg; 504 a.perm = n_arg;
502 do_setstat(in, out, path1, &a); 505 do_setstat(in, out, path1, &a);
506 break;
503 case I_CHOWN: 507 case I_CHOWN:
504 path1 = make_absolute(path1, *pwd); 508 path1 = make_absolute(path1, *pwd);
505 aa = do_stat(in, out, path1); 509 aa = do_stat(in, out, path1);
506 if (!aa->flags & SSH2_FILEXFER_ATTR_UIDGID) { 510 if (!(aa->flags & SSH2_FILEXFER_ATTR_UIDGID)) {
507 error("Can't get current ownership of " 511 error("Can't get current ownership of "
508 "remote file \"%s\"", path1); 512 "remote file \"%s\"", path1);
509 break; 513 break;
@@ -514,7 +518,7 @@ parse_dispatch_command(int in, int out, const char *cmd, char **pwd)
514 case I_CHGRP: 518 case I_CHGRP:
515 path1 = make_absolute(path1, *pwd); 519 path1 = make_absolute(path1, *pwd);
516 aa = do_stat(in, out, path1); 520 aa = do_stat(in, out, path1);
517 if (!aa->flags & SSH2_FILEXFER_ATTR_UIDGID) { 521 if (!(aa->flags & SSH2_FILEXFER_ATTR_UIDGID)) {
518 error("Can't get current ownership of " 522 error("Can't get current ownership of "
519 "remote file \"%s\"", path1); 523 "remote file \"%s\"", path1);
520 break; 524 break;