summaryrefslogtreecommitdiff
path: root/mail/imap-uw/patches/patch-am
blob: 3b048236e20be4ccb20cbcdb723ffe089bc1f4a9 (plain)
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
$NetBSD: patch-am,v 1.6 2007/08/03 17:03:31 obache Exp $

--- src/osdep/unix/env_unix.c.orig	2007-05-29 20:29:52.000000000 +0000
+++ src/osdep/unix/env_unix.c
@@ -29,6 +29,9 @@
 #include <grp.h>
 #include <signal.h>
 #include <sys/wait.h>
+#ifdef USE_WHOSON
+#include <whoson.h>
+#endif /* USE_WHOSON */
 
 
 /* in case stat.h is ancient */
@@ -693,7 +696,15 @@ long server_login (char *user,char *pwd,
   else if (disablePlaintext) err = "disabled";
   else if (!(authuser && *authuser)) pw = valpwd (user,pwd,argc,argv);
   else if (valpwd (authuser,pwd,argc,argv)) pw = pwuser (user);
-  if (pw && pw_login (pw,authuser,pw->pw_name,NIL,argc,argv)) return T;
+  if (pw && pw_login (pw,authuser,pw->pw_name,NIL,argc,argv)) {
+#ifdef USE_WHOSON
+    struct sockaddr_in sin;
+    int sinlen = sizeof (struct sockaddr_in);
+    if (getpeername(0,(struct sockaddr *) &sin,&sinlen) == 0)
+      wso_login(inet_ntoa(sin.sin_addr),user,NULL,0);
+#endif
+    return T;
+  }
   syslog (level|LOG_AUTH,"Login %s user=%.64s auth=%.64s host=%.80s",err,
 	  user,(authuser && *authuser) ? authuser : user,tcp_clienthost ());
   sleep (3);			/* slow down possible cracker */
@@ -956,7 +967,8 @@ char *sysinbox ()
 {
   char tmp[MAILTMPLEN];
   if (!sysInbox) {		/* initialize if first time */
-    sprintf (tmp,"%s/%s",MAILSPOOL,myusername ());
+    /* Substitute SPOOLDIR and MAILBOX appropriately for pkgsrc. */
+    sprintf (tmp,"%s/%s",@SPOOLDIR@,@MAILBOX@);
     sysInbox = cpystr (tmp);	/* system inbox is from mail spool */
   }
   return sysInbox;