mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-28 00:04:30 +02:00
- stevesk@cvs.openbsd.org 2001/02/12 20:53:33
[sftp-int.c] lumask now works with 1 numeric arg; ok markus@, djm@
This commit is contained in:
parent
5393f9360d
commit
6690494f21
@ -29,6 +29,9 @@
|
|||||||
- markus@cvs.openbsd.org 2001/02/12 23:26:20
|
- markus@cvs.openbsd.org 2001/02/12 23:26:20
|
||||||
[sshd.c]
|
[sshd.c]
|
||||||
missing memset; from solar@openwall.com
|
missing memset; from solar@openwall.com
|
||||||
|
- stevesk@cvs.openbsd.org 2001/02/12 20:53:33
|
||||||
|
[sftp-int.c]
|
||||||
|
lumask now works with 1 numeric arg; ok markus@, djm@
|
||||||
|
|
||||||
20010214
|
20010214
|
||||||
- (djm) Don't try to close PAM session or delete credentials if the
|
- (djm) Don't try to close PAM session or delete credentials if the
|
||||||
@ -3957,4 +3960,4 @@
|
|||||||
- Wrote replacements for strlcpy and mkdtemp
|
- Wrote replacements for strlcpy and mkdtemp
|
||||||
- Released 1.0pre1
|
- Released 1.0pre1
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.767 2001/02/15 03:17:13 mouring Exp $
|
$Id: ChangeLog,v 1.768 2001/02/15 03:19:56 mouring Exp $
|
||||||
|
17
sftp-int.c
17
sftp-int.c
@ -28,7 +28,7 @@
|
|||||||
/* XXX: recursive operations */
|
/* XXX: recursive operations */
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: sftp-int.c,v 1.20 2001/02/10 00:45:26 djm Exp $");
|
RCSID("$OpenBSD: sftp-int.c,v 1.21 2001/02/12 20:53:33 stevesk Exp $");
|
||||||
|
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
@ -293,7 +293,9 @@ 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;
|
||||||
|
char *cp2;
|
||||||
int base = 0;
|
int base = 0;
|
||||||
|
long l;
|
||||||
int i, cmdnum;
|
int i, cmdnum;
|
||||||
|
|
||||||
/* Skip leading whitespace */
|
/* Skip leading whitespace */
|
||||||
@ -387,18 +389,24 @@ parse_args(const char **cpp, int *pflag, unsigned long *n_arg,
|
|||||||
/* Uses the rest of the line */
|
/* Uses the rest of the line */
|
||||||
break;
|
break;
|
||||||
case I_LUMASK:
|
case I_LUMASK:
|
||||||
|
base = 8;
|
||||||
case I_CHMOD:
|
case I_CHMOD:
|
||||||
base = 8;
|
base = 8;
|
||||||
case I_CHOWN:
|
case I_CHOWN:
|
||||||
case I_CHGRP:
|
case I_CHGRP:
|
||||||
/* Get numeric arg (mandatory) */
|
/* Get numeric arg (mandatory) */
|
||||||
if (*cp < '0' && *cp > '9') {
|
l = strtol(cp, &cp2, base);
|
||||||
|
if (cp2 == cp || ((l == LONG_MIN || l == LONG_MAX) &&
|
||||||
|
errno == ERANGE) || l < 0) {
|
||||||
error("You must supply a numeric argument "
|
error("You must supply a numeric argument "
|
||||||
"to the %s command.", cmd);
|
"to the %s command.", cmd);
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
*n_arg = strtoul(cp, (char**)&cp, base);
|
cp = cp2;
|
||||||
if (!*cp || !strchr(WHITESPACE, *cp)) {
|
*n_arg = l;
|
||||||
|
if (cmdnum == I_LUMASK && strchr(WHITESPACE, *cp))
|
||||||
|
break;
|
||||||
|
if (cmdnum == I_LUMASK || !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);
|
||||||
return(-1);
|
return(-1);
|
||||||
@ -530,6 +538,7 @@ parse_dispatch_command(int in, int out, const char *cmd, char **pwd)
|
|||||||
break;
|
break;
|
||||||
case I_LUMASK:
|
case I_LUMASK:
|
||||||
umask(n_arg);
|
umask(n_arg);
|
||||||
|
printf("Local umask: %03lo\n", n_arg);
|
||||||
break;
|
break;
|
||||||
case I_CHMOD:
|
case I_CHMOD:
|
||||||
path1 = make_absolute(path1, *pwd);
|
path1 = make_absolute(path1, *pwd);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user