summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Steves <stevesk@cvs.openbsd.org>2001-09-03 20:58:34 +0000
committerKevin Steves <stevesk@cvs.openbsd.org>2001-09-03 20:58:34 +0000
commitfc922c9690dfeacb1cb9a33f451361bad456d167 (patch)
tree13a0a1049490dbbed4d448f7e3169fd48b82196a
parentc6753a59d1f2a463a81c695302127f864037aa39 (diff)
fatal() for nonexistent -Fssh_config. ok markus@
-rw-r--r--usr.bin/ssh/readconf.c9
-rw-r--r--usr.bin/ssh/readconf.h4
-rw-r--r--usr.bin/ssh/ssh.c10
3 files changed, 13 insertions, 10 deletions
diff --git a/usr.bin/ssh/readconf.c b/usr.bin/ssh/readconf.c
index 67a79f893d0..a7816d677d7 100644
--- a/usr.bin/ssh/readconf.c
+++ b/usr.bin/ssh/readconf.c
@@ -12,7 +12,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: readconf.c,v 1.88 2001/08/30 16:04:35 stevesk Exp $");
+RCSID("$OpenBSD: readconf.c,v 1.89 2001/09/03 20:58:33 stevesk Exp $");
#include "ssh.h"
#include "xmalloc.h"
@@ -668,10 +668,10 @@ parse_int:
/*
* Reads the config file and modifies the options accordingly. Options
* should already be initialized before this call. This never returns if
- * there is an error. If the file does not exist, this returns immediately.
+ * there is an error. If the file does not exist, this returns 0.
*/
-void
+int
read_config_file(const char *filename, const char *host, Options *options)
{
FILE *f;
@@ -682,7 +682,7 @@ read_config_file(const char *filename, const char *host, Options *options)
/* Open the file. */
f = fopen(filename, "r");
if (!f)
- return;
+ return 0;
debug("Reading configuration data %.200s", filename);
@@ -702,6 +702,7 @@ read_config_file(const char *filename, const char *host, Options *options)
if (bad_options > 0)
fatal("%s: terminating, %d bad configuration options",
filename, bad_options);
+ return 1;
}
/*
diff --git a/usr.bin/ssh/readconf.h b/usr.bin/ssh/readconf.h
index 802fd1908a2..faeef1dbfba 100644
--- a/usr.bin/ssh/readconf.h
+++ b/usr.bin/ssh/readconf.h
@@ -11,7 +11,7 @@
* called by a name other than "ssh" or "Secure Shell".
*/
-/* RCSID("$OpenBSD: readconf.h,v 1.37 2001/08/01 22:03:33 markus Exp $"); */
+/* RCSID("$OpenBSD: readconf.h,v 1.38 2001/09/03 20:58:33 stevesk Exp $"); */
#ifndef READCONF_H
#define READCONF_H
@@ -105,7 +105,7 @@ typedef struct {
void initialize_options(Options *);
void fill_default_options(Options *);
-void read_config_file(const char *, const char *, Options *);
+int read_config_file(const char *, const char *, Options *);
int
process_config_line(Options *, const char *, char *, const char *, int, int *);
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c
index 127d3be5e10..4951576b0f8 100644
--- a/usr.bin/ssh/ssh.c
+++ b/usr.bin/ssh/ssh.c
@@ -39,7 +39,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh.c,v 1.141 2001/08/29 23:27:23 stevesk Exp $");
+RCSID("$OpenBSD: ssh.c,v 1.142 2001/09/03 20:58:33 stevesk Exp $");
#include <openssl/evp.h>
#include <openssl/err.h>
@@ -605,14 +605,16 @@ again:
* file if the user specifies a config file on the command line.
*/
if (config != NULL) {
- read_config_file(config, host, &options);
+ if (!read_config_file(config, host, &options))
+ fatal("Can't open user config file %.100s: "
+ "%.100s", config, strerror(errno));
} else {
snprintf(buf, sizeof buf, "%.100s/%.100s", pw->pw_dir,
_PATH_SSH_USER_CONFFILE);
/* Read systemwide configuration file. */
- read_config_file(_PATH_HOST_CONFIG_FILE, host, &options);
- read_config_file(buf, host, &options);
+ (void)read_config_file(_PATH_HOST_CONFIG_FILE, host, &options);
+ (void)read_config_file(buf, host, &options);
}
/* Fill configuration defaults. */