[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
This commit is contained in:
Kevin Steves 2001-02-05 13:42:43 +00:00
parent 8e74393416
commit 62c45db526
2 changed files with 49 additions and 29 deletions

View File

@ -9,6 +9,22 @@
- stevesk@cvs.openbsd.org 2001/02/04 15:21:19 - stevesk@cvs.openbsd.org 2001/02/04 15:21:19
[sftp-server.c] [sftp-server.c]
SSH2_FILEXFER_ATTR_UIDGID support; ok markus@ SSH2_FILEXFER_ATTR_UIDGID support; ok markus@
- 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
20010104 20010104
- (bal) I think this is the last of the bsd-*.h that don't belong. - (bal) I think this is the last of the bsd-*.h that don't belong.

View File

@ -27,7 +27,7 @@
/* XXX: recursive operations */ /* XXX: recursive operations */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: sftp-int.c,v 1.1 2001/02/04 11:11:54 djm Exp $"); RCSID("$OpenBSD: sftp-int.c,v 1.7 2001/02/05 00:02:32 deraadt Exp $");
#include "buffer.h" #include "buffer.h"
#include "xmalloc.h" #include "xmalloc.h"
@ -65,35 +65,36 @@ RCSID("$OpenBSD: sftp-int.c,v 1.1 2001/02/04 11:11:54 djm Exp $");
#define I_SHELL 20 #define I_SHELL 20
struct CMD { struct CMD {
const int n;
const char *c; const char *c;
const int n;
}; };
const struct CMD cmds[] = { const struct CMD cmds[] = {
{ I_CHDIR, "CD" }, { "CD", I_CHDIR },
{ I_CHDIR, "CHDIR" }, { "CHDIR", I_CHDIR },
{ I_CHDIR, "LCD" }, { "CHGRP", I_CHGRP },
{ I_CHGRP, "CHGRP" }, { "CHMOD", I_CHMOD },
{ I_CHMOD, "CHMOD" }, { "CHOWN", I_CHOWN },
{ I_CHOWN, "CHOWN" }, { "EXIT", I_QUIT },
{ I_HELP, "HELP" }, { "GET", I_GET },
{ I_GET, "GET" }, { "HELP", I_HELP },
{ I_LCHDIR, "LCHDIR" }, { "LCD", I_LCHDIR },
{ I_LLS, "LLS" }, { "LCHDIR", I_LCHDIR },
{ I_LMKDIR, "LMKDIR" }, { "LLS", I_LLS },
{ I_LPWD, "LPWD" }, { "LMKDIR", I_LMKDIR },
{ I_LS, "LS" }, { "LPWD", I_LPWD },
{ I_LUMASK, "LUMASK" }, { "LS", I_LS },
{ I_MKDIR, "MKDIR" }, { "LUMASK", I_LUMASK },
{ I_PUT, "PUT" }, { "MKDIR", I_MKDIR },
{ I_PWD, "PWD" }, { "PUT", I_PUT },
{ I_QUIT, "EXIT" }, { "PWD", I_PWD },
{ I_QUIT, "QUIT" }, { "QUIT", I_QUIT },
{ I_RENAME, "RENAME" }, { "RENAME", I_RENAME },
{ I_RMDIR, "RMDIR" }, { "RM", I_RM },
{ I_RM, "RM" }, { "RMDIR", I_RMDIR },
{ I_SHELL, "!" }, { "!", I_SHELL },
{ -1, NULL} { "?", I_HELP },
{ NULL, -1}
}; };
void void
@ -289,6 +290,7 @@ parse_args(const char **cpp, int *pflag, unsigned long *n_arg,
char **path1, char **path2) char **path1, char **path2)
{ {
const char *cmd, *cp = *cpp; const char *cmd, *cp = *cpp;
int base = 0;
int i, cmdnum; int i, cmdnum;
/* Skip leading whitespace */ /* Skip leading whitespace */
@ -383,6 +385,7 @@ parse_args(const char **cpp, int *pflag, unsigned long *n_arg,
break; break;
case I_LUMASK: case I_LUMASK:
case I_CHMOD: case I_CHMOD:
base = 8;
case I_CHOWN: case I_CHOWN:
case I_CHGRP: case I_CHGRP:
/* Get numeric arg (mandatory) */ /* Get numeric arg (mandatory) */
@ -391,7 +394,7 @@ parse_args(const char **cpp, int *pflag, unsigned long *n_arg,
"to the %s command.", cmd); "to the %s command.", cmd);
return(-1); return(-1);
} }
*n_arg = strtoul(cp, (char**)&cp, 0); *n_arg = strtoul(cp, (char**)&cp, base);
if (!*cp || !strchr(WHITESPACE, *cp)) { if (!*cp || !strchr(WHITESPACE, *cp)) {
error("You must supply a numeric argument " error("You must supply a numeric argument "
"to the %s command.", cmd); "to the %s command.", cmd);
@ -500,10 +503,11 @@ parse_dispatch_command(int in, int out, const char *cmd, char **pwd)
a.flags |= SSH2_FILEXFER_ATTR_PERMISSIONS; a.flags |= SSH2_FILEXFER_ATTR_PERMISSIONS;
a.perm = n_arg; a.perm = n_arg;
do_setstat(in, out, path1, &a); do_setstat(in, out, path1, &a);
break;
case I_CHOWN: case I_CHOWN:
path1 = make_absolute(path1, *pwd); path1 = make_absolute(path1, *pwd);
aa = do_stat(in, out, path1); aa = do_stat(in, out, path1);
if (!aa->flags & SSH2_FILEXFER_ATTR_UIDGID) { if (!(aa->flags & SSH2_FILEXFER_ATTR_UIDGID)) {
error("Can't get current ownership of " error("Can't get current ownership of "
"remote file \"%s\"", path1); "remote file \"%s\"", path1);
break; break;
@ -514,7 +518,7 @@ parse_dispatch_command(int in, int out, const char *cmd, char **pwd)
case I_CHGRP: case I_CHGRP:
path1 = make_absolute(path1, *pwd); path1 = make_absolute(path1, *pwd);
aa = do_stat(in, out, path1); aa = do_stat(in, out, path1);
if (!aa->flags & SSH2_FILEXFER_ATTR_UIDGID) { if (!(aa->flags & SSH2_FILEXFER_ATTR_UIDGID)) {
error("Can't get current ownership of " error("Can't get current ownership of "
"remote file \"%s\"", path1); "remote file \"%s\"", path1);
break; break;