diff src/osdep/unix/env_unix.c @ 3:2366b362676d draft

imap-2007f
author HIROSE Yuuji <yuuji@gentei.org>
date Thu, 30 Oct 2014 00:00:57 +0900
parents 28a55bc1110c
children d741b3ecc917
line wrap: on
line diff
--- a/src/osdep/unix/env_unix.c	Mon Sep 14 20:06:41 2009 +0900
+++ b/src/osdep/unix/env_unix.c	Thu Oct 30 00:00:57 2014 +0900
@@ -21,7 +21,7 @@
  *		Internet: MRC@Washington.EDU
  *
  * Date:	1 August 1988
- * Last Edited:	15 May 2008
+ * Last Edited:	23 February 2009
  */
 
 #include <grp.h>
@@ -422,10 +422,6 @@
   case SET_DISABLEPLAINTEXT:
     disablePlaintext = (long) value;
   case GET_DISABLEPLAINTEXT:
-#ifdef RESTRICT_POP
-    if (getenv("INTRANET") == NIL) disablePlaintext = 1;
-    else disablePlaintext = NIL;
-#endif
     ret = (void *) disablePlaintext;
     break;
   case SET_CHROOTSERVER:
@@ -669,7 +665,6 @@
   char *s;
   struct passwd *pw;
   struct passwd *ret = NIL;
-#ifndef QMAIL	/* imapext md5 checker run previously. no need to do here */
   if (auth_md5.server) {	/* using CRAM-MD5 authentication? */
     if (s = auth_md5_pwd (user)) {
       if (!strcmp (s,pwd) || ((*pwd == ' ') && pwd[1] && !strcmp (s,pwd+1)))
@@ -678,9 +673,7 @@
       fs_give ((void **) &s);
     }
   }
-  else
-#endif
-  if (pw = pwuser (user)) {/* can get user? */
+  else if (pw = pwuser (user)) {/* can get user? */
     s = cpystr (pw->pw_name);	/* copy returned name in case we need it */
     if (*pwd && !(ret = checkpw (pw,pwd,argc,argv)) &&
 	(*pwd == ' ') && pwd[1] && (ret = pwuser (s)))
@@ -704,10 +697,6 @@
   struct passwd *pw = NIL;
   int level = LOG_NOTICE;
   char *err = "failed";
-#ifdef QMAIL
-  char usr[MAILTMPLEN], *apoppswd;
-  strncpy(usr, user, MAILTMPLEN-1);
-#endif
 				/* cretins still haven't given up */
   if ((strlen (user) >= NETMAXUSER) ||
       (authuser && (strlen (authuser) >= NETMAXUSER))) {
@@ -717,16 +706,6 @@
   }
   else if (logtry-- <= 0) err = "excessive login failures";
   else if (disablePlaintext) err = "disabled";
-#ifdef QMAIL
-  else if ((logtry > 0) &&
-            (apoppswd = auth_md5_pwd(usr))
-           && !strcmp(apoppswd, pwd)
-           && (pw = getpwnam(usr))) {
-    memset(apoppswd, 0, strlen(apoppswd));
-    fs_give((void**) &apoppswd);
-    return pw_login(pw, usr, pw->pw_name, pw->pw_dir, argc, argv);
-  }
-#endif
   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;
@@ -749,34 +728,6 @@
   return pw_login (pwuser (user),authuser,user,NIL,argc,argv);
 }
 
-void permitsmtp()	/* to update tcp permission */
-{
-#ifdef POPBEFORESMTP
-  #include <sys/types.h>
-  #include <sys/wait.h>
-  #ifndef POP3RECORDER
-  # define POP3RECORDER "/usr/local/etc/pop3-record"
-  #endif
-  int child;
-  int wstat;
-  char *permsmtp = POP3RECORDER;
-
-  switch(child = fork())
-   {
-    case -1:
-	syslog (LOG_INFO,"Cannot exec %s", permsmtp);
-	_exit(111);
-	break;
-    case 0:
-	execl(permsmtp, permsmtp, 0);
-	syslog (LOG_INFO,"Cannot exec %s", permsmtp);
-	_exit(111); break;
-   }
-  waitpid(child, &wstat, 0);
-#endif
-}
-
-
 
 /* Log in as anonymous daemon
  * Accepts: argument count
@@ -830,14 +781,8 @@
       else fatal ("Login failed after chroot");
     }
 				/* normal login */
-#ifdef QMAIL
-    else if (((pw->pw_uid == geteuid ()) || (permitsmtp(), loginpw (pw,argc,argv
-))) &&
-             (ret = env_init (user,home))) chdir (myhomedir ());
-#else
     else if (((pw->pw_uid == geteuid ()) || loginpw (pw,argc,argv)) &&
-             (ret = env_init (user,home))) chdir (myhomedir ());
-#endif
+	     (ret = env_init (user,home))) chdir (myhomedir ());
     fs_give ((void **) &home);	/* clean up */
     if (user) fs_give ((void **) &user);
   }
@@ -1868,7 +1813,7 @@
   restrictBox = NIL;		/* can't restrict */
   if (blackBox) {		/* if black box */
 				/* toss out driver dependent names */
-    printf (path,"%s/INBOX",mymailboxdir ());
+    sprintf (path,"%s/INBOX",mymailboxdir ());
     blackBox = NIL;		/* well that's evil - evil is going on */
     ret = mail_create (stream,path);
     blackBox = T;		/* restore the box */

yatex.org