summaryrefslogtreecommitdiff
path: root/authfile.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-01-29 07:51:26 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-01-29 07:51:26 +0000
commit1170d71b5d93f7674f490d6109e8913e6ac237f0 (patch)
tree65a095c9be4ed9f1f44e49ea8779023a1463306a /authfile.c
parent36579d3daa83a41059adaea84a9e75693185b51c (diff)
- stevesk@cvs.openbsd.org 2001/01/28 22:27:05
[authfile.c] spelling. use sizeof vs. strlen(). ok markus@
Diffstat (limited to 'authfile.c')
-rw-r--r--authfile.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/authfile.c b/authfile.c
index c79b2d021..8d39e32e4 100644
--- a/authfile.c
+++ b/authfile.c
@@ -36,7 +36,7 @@
36 */ 36 */
37 37
38#include "includes.h" 38#include "includes.h"
39RCSID("$OpenBSD: authfile.c,v 1.25 2001/01/21 19:05:44 markus Exp $"); 39RCSID("$OpenBSD: authfile.c,v 1.26 2001/01/28 22:27:05 stevesk Exp $");
40 40
41#include <openssl/err.h> 41#include <openssl/err.h>
42#include <openssl/evp.h> 42#include <openssl/evp.h>
@@ -51,7 +51,8 @@ RCSID("$OpenBSD: authfile.c,v 1.25 2001/01/21 19:05:44 markus Exp $");
51#include "log.h" 51#include "log.h"
52 52
53/* Version identification string for identity files. */ 53/* Version identification string for identity files. */
54#define AUTHFILE_ID_STRING "SSH PRIVATE KEY FILE FORMAT 1.1\n" 54static const char authfile_id_string[] =
55 "SSH PRIVATE KEY FILE FORMAT 1.1\n";
55 56
56/* 57/*
57 * Saves the authentication (private) key in a file, encrypting it with 58 * Saves the authentication (private) key in a file, encrypting it with
@@ -111,9 +112,8 @@ save_private_key_rsa1(const char *filename, const char *passphrase,
111 buffer_init(&encrypted); 112 buffer_init(&encrypted);
112 113
113 /* First store keyfile id string. */ 114 /* First store keyfile id string. */
114 cp = AUTHFILE_ID_STRING; 115 for (i = 0; authfile_id_string[i]; i++)
115 for (i = 0; cp[i]; i++) 116 buffer_put_char(&encrypted, authfile_id_string[i]);
116 buffer_put_char(&encrypted, cp[i]);
117 buffer_put_char(&encrypted, 0); 117 buffer_put_char(&encrypted, 0);
118 118
119 /* Store cipher type. */ 119 /* Store cipher type. */
@@ -247,8 +247,8 @@ load_public_key_rsa(const char *filename, RSA * pub, char **comment_return)
247 } 247 }
248 close(fd); 248 close(fd);
249 249
250 /* Check that it is at least big enought to contain the ID string. */ 250 /* Check that it is at least big enough to contain the ID string. */
251 if (len < strlen(AUTHFILE_ID_STRING) + 1) { 251 if (len < sizeof(authfile_id_string)) {
252 debug3("Bad RSA1 key file %.200s.", filename); 252 debug3("Bad RSA1 key file %.200s.", filename);
253 buffer_free(&buffer); 253 buffer_free(&buffer);
254 return 0; 254 return 0;
@@ -257,8 +257,8 @@ load_public_key_rsa(const char *filename, RSA * pub, char **comment_return)
257 * Make sure it begins with the id string. Consume the id string 257 * Make sure it begins with the id string. Consume the id string
258 * from the buffer. 258 * from the buffer.
259 */ 259 */
260 for (i = 0; i < (u_int) strlen(AUTHFILE_ID_STRING) + 1; i++) 260 for (i = 0; i < sizeof(authfile_id_string); i++)
261 if (buffer_get_char(&buffer) != (u_char) AUTHFILE_ID_STRING[i]) { 261 if (buffer_get_char(&buffer) != authfile_id_string[i]) {
262 debug3("Bad RSA1 key file %.200s.", filename); 262 debug3("Bad RSA1 key file %.200s.", filename);
263 buffer_free(&buffer); 263 buffer_free(&buffer);
264 return 0; 264 return 0;
@@ -337,8 +337,8 @@ load_private_key_rsa1(int fd, const char *filename,
337 } 337 }
338 close(fd); 338 close(fd);
339 339
340 /* Check that it is at least big enought to contain the ID string. */ 340 /* Check that it is at least big enough to contain the ID string. */
341 if (len < strlen(AUTHFILE_ID_STRING) + 1) { 341 if (len < sizeof(authfile_id_string)) {
342 debug3("Bad RSA1 key file %.200s.", filename); 342 debug3("Bad RSA1 key file %.200s.", filename);
343 buffer_free(&buffer); 343 buffer_free(&buffer);
344 return 0; 344 return 0;
@@ -347,8 +347,8 @@ load_private_key_rsa1(int fd, const char *filename,
347 * Make sure it begins with the id string. Consume the id string 347 * Make sure it begins with the id string. Consume the id string
348 * from the buffer. 348 * from the buffer.
349 */ 349 */
350 for (i = 0; i < (u_int) strlen(AUTHFILE_ID_STRING) + 1; i++) 350 for (i = 0; i < sizeof(authfile_id_string); i++)
351 if (buffer_get_char(&buffer) != (u_char) AUTHFILE_ID_STRING[i]) { 351 if (buffer_get_char(&buffer) != authfile_id_string[i]) {
352 debug3("Bad RSA1 key file %.200s.", filename); 352 debug3("Bad RSA1 key file %.200s.", filename);
353 buffer_free(&buffer); 353 buffer_free(&buffer);
354 return 0; 354 return 0;