summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-06-10 00:41:18 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-06-10 00:41:18 +0000
commitd1aed9c0579d3de30cd7b4c0eecf6eee660668ed (patch)
treecacaa0e52b9c4dfe5c39b8732e26b871607ad480
parent9841b0a1acd9b2ed190ac77a42f3c05a106a2d98 (diff)
- (bal) Missed two files in major resync. auth-bsdauth.c and auth-skey.c
-rw-r--r--ChangeLog5
-rw-r--r--Makefile.in4
-rw-r--r--auth-bsdauth.c116
-rw-r--r--auth-skey.c97
4 files changed, 219 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index abeda270a..44b282462 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
120010610
2 - (bal) Missed two files in major resync. auth-bsdauth.c and auth-skey.c
3
120010609 420010609
2 - OpenBSD CVS Sync 5 - OpenBSD CVS Sync
3 - markus@cvs.openbsd.org 2001/05/30 12:55:13 6 - markus@cvs.openbsd.org 2001/05/30 12:55:13
@@ -5592,4 +5595,4 @@
5592 - Wrote replacements for strlcpy and mkdtemp 5595 - Wrote replacements for strlcpy and mkdtemp
5593 - Released 1.0pre1 5596 - Released 1.0pre1
5594 5597
5595$Id: ChangeLog,v 1.1272 2001/06/09 02:26:58 mouring Exp $ 5598$Id: ChangeLog,v 1.1273 2001/06/10 00:41:18 mouring Exp $
diff --git a/Makefile.in b/Makefile.in
index 3bb432e18..e6dec0be7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,4 +1,4 @@
1# $Id: Makefile.in,v 1.175 2001/05/03 23:39:54 mouring Exp $ 1# $Id: Makefile.in,v 1.176 2001/06/10 00:41:19 mouring Exp $
2 2
3prefix=@prefix@ 3prefix=@prefix@
4exec_prefix=@exec_prefix@ 4exec_prefix=@exec_prefix@
@@ -49,7 +49,7 @@ LIBSSH_OBJS=atomicio.o authfd.o authfile.o bufaux.o buffer.o canohost.o channels
49 49
50SSHOBJS= ssh.o sshconnect.o sshconnect1.o sshconnect2.o sshtty.o readconf.o clientloop.o 50SSHOBJS= ssh.o sshconnect.o sshconnect1.o sshconnect2.o sshtty.o readconf.o clientloop.o
51 51
52SSHDOBJS= sshd.o auth.o auth1.o auth2.o auth-chall.o auth2-chall.o auth-rhosts.o auth-options.o auth-krb4.o auth-pam.o auth2-pam.o auth-passwd.o auth-rsa.o auth-rh-rsa.o auth-sia.o sshpty.o sshlogin.o loginrec.o servconf.o serverloop.o md5crypt.o session.o groupaccess.o 52SSHDOBJS= sshd.o auth.o auth1.o auth2.o auth-chall.o auth2-chall.o auth-rhosts.o auth-options.o auth-krb4.o auth-pam.o auth2-pam.o auth-passwd.o auth-rsa.o auth-rh-rsa.o auth-sia.o sshpty.o sshlogin.o loginrec.o servconf.o serverloop.o md5crypt.o session.o groupaccess.o auth-skey.o auth-bsdauth.o
53 53
54MANPAGES = scp.1.out ssh-add.1.out ssh-agent.1.out ssh-keygen.1.out ssh-keyscan.1.out ssh.1.out sshd.8.out sftp-server.8.out sftp.1.out 54MANPAGES = scp.1.out ssh-add.1.out ssh-agent.1.out ssh-keygen.1.out ssh-keyscan.1.out ssh.1.out sshd.8.out sftp-server.8.out sftp.1.out
55MANPAGES_IN = scp.1 ssh-add.1 ssh-agent.1 ssh-keygen.1 ssh-keyscan.1 ssh.1 sshd.8 sftp-server.8 sftp.1 55MANPAGES_IN = scp.1 ssh-add.1 ssh-agent.1 ssh-keygen.1 ssh-keyscan.1 ssh.1 sshd.8 sftp-server.8 sftp.1
diff --git a/auth-bsdauth.c b/auth-bsdauth.c
new file mode 100644
index 000000000..3732477de
--- /dev/null
+++ b/auth-bsdauth.c
@@ -0,0 +1,116 @@
1/*
2 * Copyright (c) 2001 Markus Friedl. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */
24#include "includes.h"
25RCSID("$OpenBSD: auth-bsdauth.c,v 1.1 2001/05/18 14:13:28 markus Exp $");
26
27#ifdef BSD_AUTH
28#include "xmalloc.h"
29#include "auth.h"
30#include "log.h"
31
32static void *
33bsdauth_init_ctx(Authctxt *authctxt)
34{
35 return authctxt;
36}
37
38static int
39bsdauth_query(void *ctx, char **name, char **infotxt,
40 u_int *numprompts, char ***prompts, u_int **echo_on)
41{
42 Authctxt *authctxt = ctx;
43 char *challenge = NULL;
44
45 if (authctxt->as != NULL) {
46 debug2("bsdauth_query: try reuse session");
47 challenge = auth_getitem(authctxt->as, AUTHV_CHALLENGE);
48 if (challenge == NULL) {
49 auth_close(authctxt->as);
50 authctxt->as = NULL;
51 }
52 }
53
54 if (challenge == NULL) {
55 debug2("bsdauth_query: new bsd auth session");
56 debug3("bsdauth_query: style %s",
57 authctxt->style ? authctxt->style : "<default>");
58 authctxt->as = auth_userchallenge(authctxt->user,
59 authctxt->style, "auth-ssh", &challenge);
60 if (authctxt->as == NULL)
61 challenge = NULL;
62 debug2("bsdauth_query: <%s>", challenge ? challenge : "empty");
63 }
64
65 if (challenge == NULL)
66 return -1;
67
68 *name = xstrdup("");
69 *infotxt = xstrdup("");
70 *numprompts = 1;
71 *prompts = xmalloc(*numprompts * sizeof(char*));
72 *echo_on = xmalloc(*numprompts * sizeof(u_int));
73 (*echo_on)[0] = 0;
74 (*prompts)[0] = xstrdup(challenge);
75
76 return 0;
77}
78
79static int
80bsdauth_respond(void *ctx, u_int numresponses, char **responses)
81{
82 Authctxt *authctxt = ctx;
83 int authok;
84
85 if (authctxt->as == 0)
86 error("bsdauth_respond: no bsd auth session");
87
88 if (numresponses != 1)
89 return -1;
90
91 authok = auth_userresponse(authctxt->as, responses[0], 0);
92 authctxt->as = NULL;
93 debug3("bsdauth_respond: <%s> = <%d>", responses[0], authok);
94
95 return (authok == 0) ? -1 : 0;
96}
97
98static void
99bsdauth_free_ctx(void *ctx)
100{
101 Authctxt *authctxt = ctx;
102
103 if (authctxt && authctxt->as) {
104 auth_close(authctxt->as);
105 authctxt->as = NULL;
106 }
107}
108
109KbdintDevice bsdauth_device = {
110 "bsdauth",
111 bsdauth_init_ctx,
112 bsdauth_query,
113 bsdauth_respond,
114 bsdauth_free_ctx
115};
116#endif
diff --git a/auth-skey.c b/auth-skey.c
new file mode 100644
index 000000000..f921fc1bb
--- /dev/null
+++ b/auth-skey.c
@@ -0,0 +1,97 @@
1/*
2 * Copyright (c) 2001 Markus Friedl. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */
24#include "includes.h"
25RCSID("$OpenBSD: auth-skey.c,v 1.12 2001/05/18 14:13:28 markus Exp $");
26
27#ifdef SKEY
28
29#include <skey.h>
30
31#include "xmalloc.h"
32#include "auth.h"
33
34static void *
35skey_init_ctx(Authctxt *authctxt)
36{
37 return authctxt;
38}
39
40#define PROMPT "\nS/Key Password: "
41
42static int
43skey_query(void *ctx, char **name, char **infotxt,
44 u_int* numprompts, char ***prompts, u_int **echo_on)
45{
46 Authctxt *authctxt = ctx;
47 char challenge[1024], *p;
48 int len;
49 struct skey skey;
50
51 if (skeychallenge(&skey, authctxt->user, challenge) == -1)
52 return -1;
53
54 *name = xstrdup("");
55 *infotxt = xstrdup("");
56 *numprompts = 1;
57 *prompts = xmalloc(*numprompts * sizeof(char*));
58 *echo_on = xmalloc(*numprompts * sizeof(u_int));
59 (*echo_on)[0] = 0;
60
61 len = strlen(challenge) + strlen(PROMPT) + 1;
62 p = xmalloc(len);
63 p[0] = '\0';
64 strlcat(p, challenge, len);
65 strlcat(p, PROMPT, len);
66 (*prompts)[0] = p;
67
68 return 0;
69}
70
71static int
72skey_respond(void *ctx, u_int numresponses, char **responses)
73{
74 Authctxt *authctxt = ctx;
75
76 if (authctxt->valid &&
77 numresponses == 1 &&
78 skey_haskey(authctxt->pw->pw_name) == 0 &&
79 skey_passcheck(authctxt->pw->pw_name, responses[0]) != -1)
80 return 0;
81 return -1;
82}
83
84static void
85skey_free_ctx(void *ctx)
86{
87 /* we don't have a special context */
88}
89
90KbdintDevice skey_device = {
91 "skey",
92 skey_init_ctx,
93 skey_query,
94 skey_respond,
95 skey_free_ctx
96};
97#endif /* SKEY */