summaryrefslogtreecommitdiff
path: root/mail/popper/files/patch-af
blob: dff19989d2bd3a1a8cf2c47a3192da6e999bcf0f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--- pop_user.c.orig	Fri Jul 10 03:44:08 1998
+++ pop_user.c	Tue Oct  2 20:55:26 2001
@@ -40,6 +40,12 @@
 
 #include "popper.h"
 
+#ifdef OPIE
+#include <opie.h>
+int pwok, af_pwok;
+struct opie opiestate;
+#endif /* OPIE */
+
 /* 
  *  user:   Prompt for the user name at the start of a POP session
  */
@@ -62,6 +68,9 @@
     struct stat st;
     datum	key, value;
 # endif
+#ifdef OPIE
+    char prompt[OPIE_CHALLENGE_MAX + 1];
+#endif /* OPIE */
 
 #ifdef KERBEROS
     if (p->kerberos && strcmp(p->pop_parm[1], p->user)) {
@@ -167,6 +176,18 @@
 #endif /* APOP */
 
     /*  Tell the user that the password is required */
+#ifdef OPIE
+    if (opiechallenge(&opiestate, p->user, prompt) == 0) {
+	pw = getpwnam(p->user);
+	pwok = (pw != NULL) && af_pwok && opiealways(pw->pw_dir);
+	return (pop_msg(p,POP_SUCCESS,"OTP response %s %s for %s.", prompt,
+			pwok ? "requested" : "required", p->user));
+    } else {
+	pwok = 1;
+	return (pop_msg(p,POP_SUCCESS,"Password required for %s.",p->user));
+    }
+#else /* OPIE */
     return (pop_msg(p,POP_SUCCESS,"Password required for %s.",p->user));
+#endif /* OPIE */
 }