diff options
author | Damien Miller <djm@mindrot.org> | 2000-04-29 23:57:08 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2000-04-29 23:57:08 +1000 |
commit | eba71bab9bf01c0d688f829a8971f902732558df (patch) | |
tree | a9d5b50568bfc10cc50291fd3604debfaf3e3783 /hostfile.c | |
parent | 8117111a3c1360727e3c54aad31aa045e7a7871b (diff) |
- Merge big update to OpenSSH-2.0 from OpenBSD CVS
[README.openssh2]
- interop w/ F-secure windows client
- sync documentation
- ssh_host_dsa_key not ssh_dsa_key
[auth-rsa.c]
- missing fclose
[auth.c authfile.c compat.c dsa.c dsa.h hostfile.c key.c key.h radix.c]
[readconf.c readconf.h ssh-add.c ssh-keygen.c ssh.c ssh.h sshconnect.c]
[sshd.c uuencode.c uuencode.h authfile.h]
- add DSA pubkey auth and other SSH2 fixes. use ssh-keygen -[xX]
for trading keys with the real and the original SSH, directly from the
people who invented the SSH protocol.
[auth.c auth.h authfile.c sshconnect.c auth1.c auth2.c sshconnect.h]
[sshconnect1.c sshconnect2.c]
- split auth/sshconnect in one file per protocol version
[sshconnect2.c]
- remove debug
[uuencode.c]
- add trailing =
[version.h]
- OpenSSH-2.0
[ssh-keygen.1 ssh-keygen.c]
- add -R flag: exit code indicates if RSA is alive
[sshd.c]
- remove unused
silent if -Q is specified
[ssh.h]
- host key becomes /etc/ssh_host_dsa_key
[readconf.c servconf.c ]
- ssh/sshd default to proto 1 and 2
[uuencode.c]
- remove debug
[auth2.c ssh-keygen.c sshconnect2.c sshd.c]
- xfree DSA blobs
[auth2.c serverloop.c session.c]
- cleanup logging for sshd/2, respect PasswordAuth no
[sshconnect2.c]
- less debug, respect .ssh/config
[README.openssh2 channels.c channels.h]
- clientloop.c session.c ssh.c
- support for x11-fwding, client+server
Diffstat (limited to 'hostfile.c')
-rw-r--r-- | hostfile.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/hostfile.c b/hostfile.c index 29efe5656..e1c2429bd 100644 --- a/hostfile.c +++ b/hostfile.c | |||
@@ -14,7 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include "includes.h" | 16 | #include "includes.h" |
17 | RCSID("$OpenBSD: hostfile.c,v 1.16 2000/04/14 10:30:31 markus Exp $"); | 17 | RCSID("$OpenBSD: hostfile.c,v 1.17 2000/04/26 20:56:29 markus Exp $"); |
18 | 18 | ||
19 | #include "packet.h" | 19 | #include "packet.h" |
20 | #include "match.h" | 20 | #include "match.h" |
@@ -39,13 +39,8 @@ hostfile_read_key(char **cpp, unsigned int *bitsp, Key *ret) | |||
39 | for (cp = *cpp; *cp == ' ' || *cp == '\t'; cp++) | 39 | for (cp = *cpp; *cp == ' ' || *cp == '\t'; cp++) |
40 | ; | 40 | ; |
41 | 41 | ||
42 | /* Get number of bits. */ | 42 | bits = key_read(ret, &cp); |
43 | if (*cp < '0' || *cp > '9') | 43 | if (bits == 0) |
44 | return 0; /* Bad bit count... */ | ||
45 | for (bits = 0; *cp >= '0' && *cp <= '9'; cp++) | ||
46 | bits = 10 * bits + *cp - '0'; | ||
47 | |||
48 | if (!key_read(ret, bits, &cp)) | ||
49 | return 0; | 44 | return 0; |
50 | 45 | ||
51 | /* Skip trailing whitespace. */ | 46 | /* Skip trailing whitespace. */ |
@@ -182,24 +177,18 @@ add_host_to_hostfile(const char *filename, const char *host, Key *key) | |||
182 | { | 177 | { |
183 | FILE *f; | 178 | FILE *f; |
184 | int success = 0; | 179 | int success = 0; |
185 | |||
186 | if (key == NULL) | 180 | if (key == NULL) |
187 | return 1; | 181 | return 1; /* XXX ? */ |
188 | |||
189 | /* Open the file for appending. */ | ||
190 | f = fopen(filename, "a"); | 182 | f = fopen(filename, "a"); |
191 | if (!f) | 183 | if (!f) |
192 | return 0; | 184 | return 0; |
193 | |||
194 | fprintf(f, "%s ", host); | 185 | fprintf(f, "%s ", host); |
195 | if (key_write(key, f)) { | 186 | if (key_write(key, f)) { |
196 | fprintf(f, "\n"); | ||
197 | success = 1; | 187 | success = 1; |
198 | } else { | 188 | } else { |
199 | error("add_host_to_hostfile: saving key failed"); | 189 | error("add_host_to_hostfile: saving key in %s failed", filename); |
200 | } | 190 | } |
201 | 191 | fprintf(f, "\n"); | |
202 | /* Close the file. */ | ||
203 | fclose(f); | 192 | fclose(f); |
204 | return success; | 193 | return success; |
205 | } | 194 | } |