diff options
author | Damien Miller <djm@mindrot.org> | 2000-07-15 14:14:16 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2000-07-15 14:14:16 +1000 |
commit | be484b5d9889ca636fecdf1f6b73ddfbe4cce3c9 (patch) | |
tree | 8b1023f666bebd274c08fe579a61c70a8a66f283 /aux.c | |
parent | 055dc369837e1bde0f84a7ecfe669e4e44f10db9 (diff) |
- (djm) OpenBSD CVS updates
- provos@cvs.openbsd.org 2000/07/13 16:53:22
[aux.c readconf.c servconf.c ssh.h]
allow multiple whitespace but only one '=' between tokens, bug report from
Ralf S. Engelschall <rse@engelschall.com> but different fix. okay deraadt@
- provos@cvs.openbsd.org 2000/07/13 17:14:09
[clientloop.c]
typo; todd@fries.net
- provos@cvs.openbsd.org 2000/07/13 17:19:31
[scp.c]
close can fail on AFS, report error; from Greg Hudson <ghudson@mit.edu>
- markus@cvs.openbsd.org 2000/07/14 16:59:46
[readconf.c servconf.c]
allow leading whitespace. ok niels
- djm@cvs.openbsd.org 2000/07/14 22:01:38
[ssh-keygen.c ssh.c]
Always create ~/.ssh with mode 700; ok Markus
Diffstat (limited to 'aux.c')
-rw-r--r-- | aux.c | 32 |
1 files changed, 31 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | #include "includes.h" | 1 | #include "includes.h" |
2 | RCSID("$OpenBSD: aux.c,v 1.3 2000/06/18 17:13:41 markus Exp $"); | 2 | RCSID("$OpenBSD: aux.c,v 1.4 2000/07/13 22:53:21 provos Exp $"); |
3 | 3 | ||
4 | #include "ssh.h" | 4 | #include "ssh.h" |
5 | 5 | ||
@@ -39,3 +39,33 @@ set_nonblock(int fd) | |||
39 | if (fcntl(fd, F_SETFL, val) == -1) | 39 | if (fcntl(fd, F_SETFL, val) == -1) |
40 | error("fcntl(%d, F_SETFL, O_NONBLOCK): %s", fd, strerror(errno)); | 40 | error("fcntl(%d, F_SETFL, O_NONBLOCK): %s", fd, strerror(errno)); |
41 | } | 41 | } |
42 | |||
43 | /* Characters considered whitespace in strsep calls. */ | ||
44 | #define WHITESPACE " \t\r\n" | ||
45 | |||
46 | char * | ||
47 | strdelim(char **s) | ||
48 | { | ||
49 | char *old; | ||
50 | int wspace = 0; | ||
51 | |||
52 | if (*s == NULL) | ||
53 | return NULL; | ||
54 | |||
55 | old = *s; | ||
56 | |||
57 | *s = strpbrk(*s, WHITESPACE "="); | ||
58 | if (*s == NULL) | ||
59 | return (old); | ||
60 | |||
61 | /* Allow only one '=' to be skipped */ | ||
62 | if (*s[0] == '=') | ||
63 | wspace = 1; | ||
64 | *s[0] = '\0'; | ||
65 | |||
66 | *s += strspn(*s + 1, WHITESPACE) + 1; | ||
67 | if (*s[0] == '=' && !wspace) | ||
68 | *s += strspn(*s + 1, WHITESPACE) + 1; | ||
69 | |||
70 | return (old); | ||
71 | } | ||