summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2001-01-20 15:55:21 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2001-01-20 15:55:21 +0000
commit262421925ebd1030ff488e67395f295dc82ae8f4 (patch)
tree3e606eed14b34a8a24998d26c192c916c46eb8a8
parentf49044f612979553a6a98532f86ee6b4c6509808 (diff)
pass the filename to auth_parse_options()
-rw-r--r--usr.bin/ssh/auth-options.c26
-rw-r--r--usr.bin/ssh/auth-options.h12
-rw-r--r--usr.bin/ssh/auth-rsa.c10
-rw-r--r--usr.bin/ssh/auth2.c6
4 files changed, 31 insertions, 23 deletions
diff --git a/usr.bin/ssh/auth-options.c b/usr.bin/ssh/auth-options.c
index b603bb994e1..5a830bfa403 100644
--- a/usr.bin/ssh/auth-options.c
+++ b/usr.bin/ssh/auth-options.c
@@ -10,13 +10,12 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: auth-options.c,v 1.9 2001/01/19 15:55:10 markus Exp $");
+RCSID("$OpenBSD: auth-options.c,v 1.10 2001/01/20 15:55:20 markus Exp $");
#include "ssh.h"
#include "packet.h"
#include "xmalloc.h"
#include "match.h"
-#include "pathnames.h"
/* Flags set authorized_keys flags */
int no_port_forwarding_flag = 0;
@@ -49,9 +48,12 @@ auth_clear_options(void)
}
}
-/* return 1 if access is granted, 0 if not. side effect: sets key option flags */
+/*
+ * return 1 if access is granted, 0 if not.
+ * side effect: sets key option flags
+ */
int
-auth_parse_options(struct passwd *pw, char *options, u_long linenum)
+auth_parse_options(struct passwd *pw, char *options, char *file, u_long linenum)
{
const char *cp;
if (!options)
@@ -107,9 +109,9 @@ auth_parse_options(struct passwd *pw, char *options, u_long linenum)
}
if (!*options) {
debug("%.100s, line %lu: missing end quote",
- _PATH_SSH_USER_PERMITTED_KEYS, linenum);
+ file, linenum);
packet_send_debug("%.100s, line %lu: missing end quote",
- _PATH_SSH_USER_PERMITTED_KEYS, linenum);
+ file, linenum);
continue;
}
forced_command[i] = 0;
@@ -137,9 +139,9 @@ auth_parse_options(struct passwd *pw, char *options, u_long linenum)
}
if (!*options) {
debug("%.100s, line %lu: missing end quote",
- _PATH_SSH_USER_PERMITTED_KEYS, linenum);
+ file, linenum);
packet_send_debug("%.100s, line %lu: missing end quote",
- _PATH_SSH_USER_PERMITTED_KEYS, linenum);
+ file, linenum);
continue;
}
s[i] = 0;
@@ -171,9 +173,9 @@ auth_parse_options(struct passwd *pw, char *options, u_long linenum)
}
if (!*options) {
debug("%.100s, line %lu: missing end quote",
- _PATH_SSH_USER_PERMITTED_KEYS, linenum);
+ file, linenum);
packet_send_debug("%.100s, line %lu: missing end quote",
- _PATH_SSH_USER_PERMITTED_KEYS, linenum);
+ file, linenum);
continue;
}
patterns[i] = 0;
@@ -220,9 +222,9 @@ next_option:
bad_option:
log("Bad options in %.100s file, line %lu: %.50s",
- _PATH_SSH_USER_PERMITTED_KEYS, linenum, options);
+ file, linenum, options);
packet_send_debug("Bad options in %.100s file, line %lu: %.50s",
- _PATH_SSH_USER_PERMITTED_KEYS, linenum, options);
+ file, linenum, options);
/* deny access */
return 0;
}
diff --git a/usr.bin/ssh/auth-options.h b/usr.bin/ssh/auth-options.h
index 76d420d2333..0808673e6ad 100644
--- a/usr.bin/ssh/auth-options.h
+++ b/usr.bin/ssh/auth-options.h
@@ -11,7 +11,7 @@
* called by a name other than "ssh" or "Secure Shell".
*/
-/* $OpenBSD: auth-options.h,v 1.6 2000/12/19 23:17:55 markus Exp $ */
+/* $OpenBSD: auth-options.h,v 1.7 2001/01/20 15:55:20 markus Exp $ */
#ifndef AUTH_OPTIONS_H
#define AUTH_OPTIONS_H
@@ -23,8 +23,14 @@ extern int no_pty_flag;
extern char *forced_command;
extern struct envstring *custom_environment;
-/* return 1 if access is granted, 0 if not. side effect: sets key option flags */
-int auth_parse_options(struct passwd *pw, char *options, u_long linenum);
+/*
+ * return 1 if access is granted, 0 if not.
+ * side effect: sets key option flags
+ */
+int
+auth_parse_options(struct passwd *pw, char *options, char *file,
+ u_long linenum);
+
/* reset options flags */
void auth_clear_options(void);
diff --git a/usr.bin/ssh/auth-rsa.c b/usr.bin/ssh/auth-rsa.c
index 65ff8ea208f..5037b796e3d 100644
--- a/usr.bin/ssh/auth-rsa.c
+++ b/usr.bin/ssh/auth-rsa.c
@@ -14,7 +14,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: auth-rsa.c,v 1.35 2001/01/19 15:55:10 markus Exp $");
+RCSID("$OpenBSD: auth-rsa.c,v 1.36 2001/01/20 15:55:20 markus Exp $");
#include "rsa.h"
#include "packet.h"
@@ -122,7 +122,7 @@ auth_rsa_challenge_dialog(RSA *pk)
int
auth_rsa(struct passwd *pw, BIGNUM *client_n)
{
- char line[8192], file[1024];
+ char line[8192], file[MAXPATHNAME];
int authenticated;
u_int bits;
FILE *f;
@@ -237,9 +237,9 @@ auth_rsa(struct passwd *pw, BIGNUM *client_n)
/* Parse the key from the line. */
if (!auth_rsa_read_key(&cp, &bits, pk->e, pk->n)) {
debug("%.100s, line %lu: bad key syntax",
- _PATH_SSH_USER_PERMITTED_KEYS, linenum);
+ file, linenum);
packet_send_debug("%.100s, line %lu: bad key syntax",
- _PATH_SSH_USER_PERMITTED_KEYS, linenum);
+ file, linenum);
continue;
}
/* cp now points to the comment part. */
@@ -259,7 +259,7 @@ auth_rsa(struct passwd *pw, BIGNUM *client_n)
* If our options do not allow this key to be used,
* do not send challenge.
*/
- if (!auth_parse_options(pw, options, linenum))
+ if (!auth_parse_options(pw, options, file, linenum))
continue;
/* Perform the challenge-response dialog for this key. */
diff --git a/usr.bin/ssh/auth2.c b/usr.bin/ssh/auth2.c
index 72ea3426058..a31fee485d0 100644
--- a/usr.bin/ssh/auth2.c
+++ b/usr.bin/ssh/auth2.c
@@ -23,7 +23,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: auth2.c,v 1.29 2001/01/19 15:55:10 markus Exp $");
+RCSID("$OpenBSD: auth2.c,v 1.30 2001/01/20 15:55:20 markus Exp $");
#include <openssl/dsa.h>
#include <openssl/rsa.h>
@@ -515,7 +515,7 @@ authmethod_lookup(const char *name)
int
user_key_allowed(struct passwd *pw, Key *key)
{
- char line[8192], file[1024];
+ char line[8192], file[MAXPATHNAME];
int found_key = 0;
FILE *f;
u_long linenum = 0;
@@ -618,7 +618,7 @@ user_key_allowed(struct passwd *pw, Key *key)
}
}
if (key_equal(found, key) &&
- auth_parse_options(pw, options, linenum) == 1) {
+ auth_parse_options(pw, options, file, linenum) == 1) {
found_key = 1;
debug("matching key found: file %s, line %ld",
file, linenum);