diff options
author | des <des@FreeBSD.org> | 2004-07-27 11:34:25 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2004-07-27 11:34:25 +0000 |
commit | 12cbe81d0299980b5a96fc2e79aac6a77c4f69f8 (patch) | |
tree | 659e666f83da0436353b2a1050d79896311e2ca8 | |
parent | f67167048a0d1e289ca69d4d5de9326736ed5f26 (diff) | |
download | FreeBSD-src-12cbe81d0299980b5a96fc2e79aac6a77c4f69f8.zip FreeBSD-src-12cbe81d0299980b5a96fc2e79aac6a77c4f69f8.tar.gz |
Don't strip trailing linear whitespace from passwords.
MFC after: 2 weeks
-rw-r--r-- | usr.bin/fetch/fetch.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c index 85488a1..d695234 100644 --- a/usr.bin/fetch/fetch.c +++ b/usr.bin/fetch/fetch.c @@ -275,8 +275,8 @@ query_auth(struct url *URL) fprintf(stderr, "Login: "); if (fgets(URL->user, sizeof URL->user, stdin) == NULL) return (-1); - for (i = 0; URL->user[i]; ++i) - if (isspace(URL->user[i])) + for (i = strlen(URL->user); i >= 0; --i) + if (URL->user[i] == '\r' || URL->user[i] == '\n') URL->user[i] = '\0'; fprintf(stderr, "Password: "); @@ -293,10 +293,10 @@ query_auth(struct url *URL) } if (nopwd) return (-1); - - for (i = 0; URL->pwd[i]; ++i) - if (isspace(URL->pwd[i])) + for (i = strlen(URL->pwd); i >= 0; --i) + if (URL->pwd[i] == '\r' || URL->pwd[i] == '\n') URL->pwd[i] = '\0'; + return (0); } |