summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-02-15 03:19:56 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-02-15 03:19:56 +0000
commit6690494f2125a5576cde11f7642e5ba70c91579c (patch)
treea8f2785a522ac1de75d1687e77feace564eb951c
parent5393f9360d95e42556855c184f529e7a6792f711 (diff)
- stevesk@cvs.openbsd.org 2001/02/12 20:53:33
[sftp-int.c] lumask now works with 1 numeric arg; ok markus@, djm@
-rw-r--r--ChangeLog5
-rw-r--r--sftp-int.c17
2 files changed, 17 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 3df246d3c..99654a04c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -29,6 +29,9 @@
29 - markus@cvs.openbsd.org 2001/02/12 23:26:20 29 - markus@cvs.openbsd.org 2001/02/12 23:26:20
30 [sshd.c] 30 [sshd.c]
31 missing memset; from solar@openwall.com 31 missing memset; from solar@openwall.com
32 - stevesk@cvs.openbsd.org 2001/02/12 20:53:33
33 [sftp-int.c]
34 lumask now works with 1 numeric arg; ok markus@, djm@
32 35
3320010214 3620010214
34 - (djm) Don't try to close PAM session or delete credentials if the 37 - (djm) Don't try to close PAM session or delete credentials if the
@@ -3957,4 +3960,4 @@
3957 - Wrote replacements for strlcpy and mkdtemp 3960 - Wrote replacements for strlcpy and mkdtemp
3958 - Released 1.0pre1 3961 - Released 1.0pre1
3959 3962
3960$Id: ChangeLog,v 1.767 2001/02/15 03:17:13 mouring Exp $ 3963$Id: ChangeLog,v 1.768 2001/02/15 03:19:56 mouring Exp $
diff --git a/sftp-int.c b/sftp-int.c
index 9c3ebe5bf..c236f6dac 100644
--- a/sftp-int.c
+++ b/sftp-int.c
@@ -28,7 +28,7 @@
28/* XXX: recursive operations */ 28/* XXX: recursive operations */
29 29
30#include "includes.h" 30#include "includes.h"
31RCSID("$OpenBSD: sftp-int.c,v 1.20 2001/02/10 00:45:26 djm Exp $"); 31RCSID("$OpenBSD: sftp-int.c,v 1.21 2001/02/12 20:53:33 stevesk Exp $");
32 32
33#include "buffer.h" 33#include "buffer.h"
34#include "xmalloc.h" 34#include "xmalloc.h"
@@ -293,7 +293,9 @@ parse_args(const char **cpp, int *pflag, unsigned long *n_arg,
293 char **path1, char **path2) 293 char **path1, char **path2)
294{ 294{
295 const char *cmd, *cp = *cpp; 295 const char *cmd, *cp = *cpp;
296 char *cp2;
296 int base = 0; 297 int base = 0;
298 long l;
297 int i, cmdnum; 299 int i, cmdnum;
298 300
299 /* Skip leading whitespace */ 301 /* Skip leading whitespace */
@@ -387,18 +389,24 @@ parse_args(const char **cpp, int *pflag, unsigned long *n_arg,
387 /* Uses the rest of the line */ 389 /* Uses the rest of the line */
388 break; 390 break;
389 case I_LUMASK: 391 case I_LUMASK:
392 base = 8;
390 case I_CHMOD: 393 case I_CHMOD:
391 base = 8; 394 base = 8;
392 case I_CHOWN: 395 case I_CHOWN:
393 case I_CHGRP: 396 case I_CHGRP:
394 /* Get numeric arg (mandatory) */ 397 /* Get numeric arg (mandatory) */
395 if (*cp < '0' && *cp > '9') { 398 l = strtol(cp, &cp2, base);
399 if (cp2 == cp || ((l == LONG_MIN || l == LONG_MAX) &&
400 errno == ERANGE) || l < 0) {
396 error("You must supply a numeric argument " 401 error("You must supply a numeric argument "
397 "to the %s command.", cmd); 402 "to the %s command.", cmd);
398 return(-1); 403 return(-1);
399 } 404 }
400 *n_arg = strtoul(cp, (char**)&cp, base); 405 cp = cp2;
401 if (!*cp || !strchr(WHITESPACE, *cp)) { 406 *n_arg = l;
407 if (cmdnum == I_LUMASK && strchr(WHITESPACE, *cp))
408 break;
409 if (cmdnum == I_LUMASK || !strchr(WHITESPACE, *cp)) {
402 error("You must supply a numeric argument " 410 error("You must supply a numeric argument "
403 "to the %s command.", cmd); 411 "to the %s command.", cmd);
404 return(-1); 412 return(-1);
@@ -530,6 +538,7 @@ parse_dispatch_command(int in, int out, const char *cmd, char **pwd)
530 break; 538 break;
531 case I_LUMASK: 539 case I_LUMASK:
532 umask(n_arg); 540 umask(n_arg);
541 printf("Local umask: %03lo\n", n_arg);
533 break; 542 break;
534 case I_CHMOD: 543 case I_CHMOD:
535 path1 = make_absolute(path1, *pwd); 544 path1 = make_absolute(path1, *pwd);