summaryrefslogtreecommitdiff
path: root/auth-skey.c
diff options
context:
space:
mode:
Diffstat (limited to 'auth-skey.c')
-rw-r--r--auth-skey.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/auth-skey.c b/auth-skey.c
index a0d786cb2..cc5f45101 100644
--- a/auth-skey.c
+++ b/auth-skey.c
@@ -1,9 +1,11 @@
1#include "includes.h" 1#include "includes.h"
2 2
3#ifdef SKEY 3#ifdef SKEY
4RCSID("$Id: auth-skey.c,v 1.3 1999/11/23 22:25:52 markus Exp $"); 4RCSID("$Id: auth-skey.c,v 1.4 1999/12/01 16:54:35 markus Exp $");
5 5
6#include "ssh.h" 6#include "ssh.h"
7#include "packet.h"
8
7#ifdef HAVE_OPENSSL 9#ifdef HAVE_OPENSSL
8#include <openssl/sha1.h> 10#include <openssl/sha1.h>
9#endif 11#endif
@@ -13,6 +15,35 @@ RCSID("$Id: auth-skey.c,v 1.3 1999/11/23 22:25:52 markus Exp $");
13 15
14/* from %OpenBSD: skeylogin.c,v 1.32 1999/08/16 14:46:56 millert Exp % */ 16/* from %OpenBSD: skeylogin.c,v 1.32 1999/08/16 14:46:56 millert Exp % */
15 17
18/*
19 * try skey authentication,
20 * return 1 on success, 0 on failure, -1 if skey is not available
21 */
22
23int
24auth_skey_password(struct passwd * pw, const char *password)
25{
26 if (strncasecmp(password, "s/key", 5) == 0) {
27 char *skeyinfo = skey_keyinfo(pw->pw_name);
28 if (skeyinfo == NULL) {
29 debug("generating fake skeyinfo for %.100s.",
30 pw->pw_name);
31 skeyinfo = skey_fake_keyinfo(pw->pw_name);
32 }
33 if (skeyinfo != NULL)
34 packet_send_debug(skeyinfo);
35 /* Try again. */
36 return 0;
37 } else if (skey_haskey(pw->pw_name) == 0 &&
38 skey_passcheck(pw->pw_name, (char *) password) != -1) {
39 /* Authentication succeeded. */
40 return 1;
41 }
42 /* Fall back to ordinary passwd authentication. */
43 return -1;
44}
45
46+ /* from %OpenBSD: skeylogin.c,v 1.32 1999/08/16 14:46:56 millert Exp % */
16 47
17#define ROUND(x) (((x)[0] << 24) + (((x)[1]) << 16) + (((x)[2]) << 8) + \ 48#define ROUND(x) (((x)[0] << 24) + (((x)[1]) << 16) + (((x)[2]) << 8) + \
18 ((x)[3])) 49 ((x)[3]))