version 1.58, 2003/11/04 08:54:09 |
version 1.58.2.2, 2005/03/10 17:15:04 |
|
|
#include "packet.h" |
#include "packet.h" |
#include "xmalloc.h" |
#include "xmalloc.h" |
#include "ssh1.h" |
#include "ssh1.h" |
#include "mpaux.h" |
|
#include "uidswap.h" |
#include "uidswap.h" |
#include "match.h" |
#include "match.h" |
#include "auth-options.h" |
#include "auth-options.h" |
|
|
#include "hostfile.h" |
#include "hostfile.h" |
#include "monitor_wrap.h" |
#include "monitor_wrap.h" |
#include "ssh.h" |
#include "ssh.h" |
|
#include "misc.h" |
|
|
/* import */ |
/* import */ |
extern ServerOptions options; |
extern ServerOptions options; |
|
|
* options bits e n comment |
* options bits e n comment |
* where bits, e and n are decimal numbers, |
* where bits, e and n are decimal numbers, |
* and comment is any string of characters up to newline. The maximum |
* and comment is any string of characters up to newline. The maximum |
* length of a line is 8000 characters. See the documentation for a |
* length of a line is SSH_MAX_PUBKEY_BYTES characters. See sshd(8) for a |
* description of the options. |
* description of the options. |
*/ |
*/ |
|
|
|
|
int |
int |
auth_rsa_key_allowed(struct passwd *pw, BIGNUM *client_n, Key **rkey) |
auth_rsa_key_allowed(struct passwd *pw, BIGNUM *client_n, Key **rkey) |
{ |
{ |
char line[8192], *file; |
char line[SSH_MAX_PUBKEY_BYTES], *file; |
int allowed = 0; |
int allowed = 0; |
u_int bits; |
u_int bits; |
FILE *f; |
FILE *f; |
|
|
* found, perform a challenge-response dialog to verify that the |
* found, perform a challenge-response dialog to verify that the |
* user really has the corresponding private key. |
* user really has the corresponding private key. |
*/ |
*/ |
while (fgets(line, sizeof(line), f)) { |
while (read_keyfile_line(f, file, line, sizeof(line), &linenum) != -1) { |
char *cp; |
char *cp; |
char *options; |
char *key_options; |
|
|
linenum++; |
|
|
|
/* Skip leading whitespace, empty and comment lines. */ |
/* Skip leading whitespace, empty and comment lines. */ |
for (cp = line; *cp == ' ' || *cp == '\t'; cp++) |
for (cp = line; *cp == ' ' || *cp == '\t'; cp++) |
; |
; |
|
|
*/ |
*/ |
if (*cp < '0' || *cp > '9') { |
if (*cp < '0' || *cp > '9') { |
int quoted = 0; |
int quoted = 0; |
options = cp; |
key_options = cp; |
for (; *cp && (quoted || (*cp != ' ' && *cp != '\t')); cp++) { |
for (; *cp && (quoted || (*cp != ' ' && *cp != '\t')); cp++) { |
if (*cp == '\\' && cp[1] == '"') |
if (*cp == '\\' && cp[1] == '"') |
cp++; /* Skip both */ |
cp++; /* Skip both */ |
|
|
quoted = !quoted; |
quoted = !quoted; |
} |
} |
} else |
} else |
options = NULL; |
key_options = NULL; |
|
|
/* Parse the key from the line. */ |
/* Parse the key from the line. */ |
if (hostfile_read_key(&cp, &bits, key) == 0) { |
if (hostfile_read_key(&cp, &bits, key) == 0) { |
|
|
* If our options do not allow this key to be used, |
* If our options do not allow this key to be used, |
* do not send challenge. |
* do not send challenge. |
*/ |
*/ |
if (!auth_parse_options(pw, options, file, linenum)) |
if (!auth_parse_options(pw, key_options, file, linenum)) |
continue; |
continue; |
|
|
/* break out, this key is allowed */ |
/* break out, this key is allowed */ |