Mercurial > hgrepos > hgweb.cgi > imapext
changeset 3:2366b362676d draft
imap-2007f
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Thu, 30 Oct 2014 00:00:57 +0900 |
parents | fc6002700ecd |
children | d741b3ecc917 |
files | Makefile docs/RELNOTES src/c-client/auth_log.c src/c-client/auth_md5.c src/c-client/mail.c src/c-client/mail.h src/imapd/imapd.c src/ipopd/ipop3d.c src/osdep/unix/Makefile src/osdep/unix/env_unix.c src/osdep/unix/os_a52.c src/osdep/unix/os_a52.h src/osdep/unix/tcp_unix.c src/osdep/unix/unix.c |
diffstat | 14 files changed, 162 insertions(+), 254 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Mon Sep 14 20:06:41 2009 +0900 +++ b/Makefile Thu Oct 30 00:00:57 2014 +0900 @@ -37,6 +37,7 @@ # The following ports are bundled: # a32 AIX 3.2 for RS/6000 # a41 AIX 4.1 for RS/6000 +# a52 Attempt at AIX 5.2 # aix AIX/370 (not RS/6000!!) # ami AmigaDOS # am2 AmigaDOS with a 68020+ @@ -252,9 +253,7 @@ # British. As of 2005, the Julian calendar and the Gregorian calendar # diverge by 15 days. -# EXTRACFLAGS=-DQMAIL -DRESTRICT_POP -DXADDR_DELIM="+" -DDOTQMAIL=".forward" -## EXTRACFLAGS=-DQMAIL -DRESTRICT_POP -EXTRACFLAGS=-DQMAIL -DRESTRICT_POP -DINET6 +EXTRACFLAGS= # Extra linker flags (additional/alternative libraries, etc.) @@ -308,7 +307,7 @@ # Note on SCO you may have to set LN to "ln". -a32 a41 aix bs3 bsi d-g d54 do4 drs epx ga4 gas gh9 ghp ghs go5 gsc gsg gso gul h11 hpp hpx lnp lyn mct mnt nec nto nxt nx3 osf os4 ptx qnx sc5 sco sgi sg6 shp sl4 sl5 slx snx soc sol sos uw2: an +a32 a41 a52 aix bs3 bsi d-g d54 do4 drs epx ga4 gas gh9 ghp ghs go5 gsc gsg gso gul h11 hpp hpx lnp lyn mct mnt nec nto nxt nx3 osf os4 ptx qnx sc5 sco sgi sg6 shp sl4 sl5 slx snx soc sol sos uw2: an $(BUILD) BUILDTYPE=$@ # If you use sv4, you may find that it works to move it to use the an process. @@ -730,7 +729,6 @@ clean: @echo Removing old processed sources and binaries... $(SH) -c '$(RM) an ua OSTYPE SPECIALS c-client mtest imapd ipopd mailutil mlock dmail tmail || true' - $(SH) -c '$(RM) ip6 || true' $(CD) tools;$(MAKE) clean
--- a/docs/RELNOTES Mon Sep 14 20:06:41 2009 +0900 +++ b/docs/RELNOTES Thu Oct 30 00:00:57 2014 +0900 @@ -11,6 +11,17 @@ * ======================================================================== */ +Updated: 22 July 2011 + +imap-2007f fixes a couple bugs. +Fix for RFC 4959 Initial Client Response auth failures noted first by + MacOSX Lion Mail users. +Adjust tcp_open.c:tcp_socket_open to make it a little more useful by adding + a write file descriptor test to the select in the case that the open + timeout is set. +In osdep/unix/env_unix.c:create_path there was a printf that should have + been an sprintf. Doesn't matter on modern systems. + Updated: 16 December 2008 imap-2007e is a maintenance release, consisting primarily of bugfixes to
--- a/src/c-client/auth_log.c Mon Sep 14 20:06:41 2009 +0900 +++ b/src/c-client/auth_log.c Thu Oct 30 00:00:57 2014 +0900 @@ -105,10 +105,6 @@ char *ret = NIL; char *user,*pass,*authuser; if (user = (*responder) (PWD_USER,sizeof (PWD_USER),NIL)) { -#ifdef QMAIL - extern char* conv_virtualdomain(char*); - user = conv_virtualdomain(user); -#endif if (pass = (*responder) (PWD_PWD,sizeof (PWD_PWD),NIL)) { /* delimit user from possible admin */ if (authuser = strchr (user,'*')) *authuser++ = '\0';
--- a/src/c-client/auth_md5.c Mon Sep 14 20:06:41 2009 +0900 +++ b/src/c-client/auth_md5.c Thu Oct 30 00:00:57 2014 +0900 @@ -75,11 +75,9 @@ long auth_md5_valid (void) { -#ifndef QMAIL /* qmail extension can always handle MD5 */ struct stat sbuf; /* server forbids MD5 if no MD5 enable file */ if (stat (MD5ENABLE,&sbuf)) auth_md5.server = NIL; -#endif return T; /* MD5 is otherwise valid */ } @@ -188,7 +186,6 @@ char *auth_md5_pwd (char *user) { struct stat sbuf; -#ifndef QMAIL int fd = open (MD5ENABLE,O_RDONLY,NIL); unsigned char *s,*t,*buf,*lusr,*lret; char *r; @@ -217,77 +214,6 @@ fs_give ((void **) &buf); /* flush the buffer */ close (fd); /* don't need file any longer */ } -#else -# ifndef USERAPOPFILE -# define USERAPOPFILE ".apop" -# endif -# ifndef XADDR_DELIM -# ifdef POSTFIX /* Same if-condition is in maildir.c.. sorry */ -# define XADDR_DELIM "+" -# else -# define XADDR_DELIM "-" -# endif -# endif - extern char *myMailSuffix; - char mycrypt[BUFSIZ+1]; - char *ret = NIL, *tmp=NIL; - FILE *apopfile = NIL; - struct passwd *pw = getpwnam(user); - if (!pw) pw = getpwnam(lcase(tmp=cpystr(user))); - if (!pw && strstr(user, XADDR_DELIM)) { /* Check qmail alias */ - char tmp[BUFSIZ]; - char *s = user; - memset(tmp, 0, BUFSIZ); - while (*s && s && !pw) { - s = strstr(s, XADDR_DELIM); - if (!s) break; - strncpy(tmp, user, s-user); - s++; - pw = getpwnam(tmp); - } - if (pw) { - myMailSuffix = lcase(cpystr(s-1)); - user[strlen(tmp)] = '\0'; /* zap suffix */ - } - } - if (pw) { - snprintf(mycrypt, BUFSIZ, "%s/%s", pw->pw_dir, USERAPOPFILE); - if (NIL != myMailSuffix) strcat(mycrypt, myMailSuffix); - if (stat(mycrypt, &sbuf) < 0) { - /* printf("Cannot stat [%s]\015\n", mycrypt); */ - return ret; - } - if (sbuf.st_mode & ~(S_IFREG | S_IREAD | S_IWRITE)) { - /* printf("Your apoppassword file is readable by others. Do chmod 600 %s%c\n", mycrypt, 015); */ - return ret; - } -#ifdef APOPOPEN - if (stat(APOPOPEN, &sbuf) >= 0) { /* if APPOPEN exists */ - /* read apop password via APOPOPEN program */ - int bytes = 3+strlen(APOPOPEN)+strlen(mycrypt); - char *aproc = (char*) fs_get(bytes); - snprintf(aproc, bytes, "%s %s%c", APOPOPEN, mycrypt, '\0'); - apopfile = popen(aproc, "r"); - memset(aproc, 0, bytes); - fs_give((void**)&aproc); - } -#endif /* APOPOPEN */ - if ((NIL!=apopfile) || (apopfile = fopen( mycrypt, "r" ))) { - fgets(mycrypt, sizeof(mycrypt) - 1, apopfile); - fclose(apopfile); - if (mycrypt[0]) { - char p = strlen(mycrypt); - while (p > 0 && (mycrypt[p-1] == '\n' || mycrypt[p-1] == '\r')) { - mycrypt[--p] = '\0'; /* zap trailing newlines */ - } - } - } else { - return ret; - } - ret = cpystr(mycrypt); - memset(mycrypt, 0, sizeof(mycrypt)); - } -#endif /* if QMAIL */ return ret; /* return password */ } @@ -305,9 +231,6 @@ int i,j; char *ret = NIL; char *s,*authuser,tmp[MAILTMPLEN]; -#ifdef QMAIL - char *userback = cpystr(user); -#endif unsigned char digest[MD5DIGLEN]; MD5CONTEXT ctx; char *hex = "0123456789abcdef"; @@ -337,15 +260,7 @@ memset (tmp,0,MAILTMPLEN); /* erase sensitive information */ } if (!ret) sleep (3); /* slow down possible cracker */ - else { - extern void permitsmtp(); - /* permitsmtp();*/ - } -#ifdef QMAIL - return (ret) ? userback : ret; -#else return ret; -#endif } /*
--- a/src/c-client/mail.c Mon Sep 14 20:06:41 2009 +0900 +++ b/src/c-client/mail.c Thu Oct 30 00:00:57 2014 +0900 @@ -6081,9 +6081,6 @@ if (auth->server && !compare_cstring (auth->name,mechanism)) return (!(auth->flags & AU_DISABLE) && ((auth->flags & AU_SECURE) || -#ifdef QMAIL - getenv("INTRANET") || -#endif !mail_parameters (NIL,GET_DISABLEPLAINTEXT,NIL))) ? (*auth->server) (resp,argc,argv) : NIL; return NIL; /* no authenticator found */
--- a/src/c-client/mail.h Mon Sep 14 20:06:41 2009 +0900 +++ b/src/c-client/mail.h Thu Oct 30 00:00:57 2014 +0900 @@ -21,12 +21,12 @@ * Internet: MRC@Washington.EDU * * Date: 22 November 1989 - * Last Edited: 16 December 2008 + * Last Edited: 22 July 2011 */ /* The Version */ -#define CCLIENTVERSION "2007e" +#define CCLIENTVERSION "2007f" /* Build parameters */ @@ -858,7 +858,6 @@ unsigned int spare7 : 1; /* seventh spare bit */ unsigned int spare8 : 1; /* eighth spare bit */ void *sparep; /* spare pointer */ - void *maildirp; /* for the Maildir driver */ unsigned long user_flags; /* user-assignable flags */ } MESSAGECACHE;
--- a/src/imapd/imapd.c Mon Sep 14 20:06:41 2009 +0900 +++ b/src/imapd/imapd.c Thu Oct 30 00:00:57 2014 +0900 @@ -21,7 +21,7 @@ * Internet: MRC@Washington.EDU * * Date: 5 November 1990 - * Last Edited: 3 March 2008 + * Last Edited: 22 July 2011 */ /* Parameter files */ @@ -553,9 +553,6 @@ /* plaintext login with password */ else if (!strcmp (cmd,"LOGIN")) { - #ifdef QMAIL - extern char* conv_virtualdomain(char*); - #endif if (user) fs_give ((void **) &user); if (pass) fs_give ((void **) &pass); /* two arguments */ @@ -576,11 +573,7 @@ else { /* delimit user from possible admin */ if (s = strchr (user,'*')) *s++ ='\0'; /* see if username and password are OK */ -#ifdef QMAIL - if (server_login (conv_virtualdomain(user),pass,s,argc,argv)) { -#else if (server_login (user,pass,s,argc,argv)) { -#endif state = SELECT; /* make select */ alerttime = 0; /* force alert */ response = logwin;/* return logged-in capabilities */ @@ -2148,7 +2141,7 @@ /* must be at least one BASE64 char */ else if (!base64mask[*ret]) return NIL; else { /* quick and dirty */ - while (base64mask[*s++]); /* scan until end of BASE64 */ + while (base64mask[*s]) s++; /* scan until end of BASE64 */ if (*s == '=') ++s; /* allow up to two padding chars */ if (*s == '=') ++s; }
--- a/src/ipopd/ipop3d.c Mon Sep 14 20:06:41 2009 +0900 +++ b/src/ipopd/ipop3d.c Thu Oct 30 00:00:57 2014 +0900 @@ -96,9 +96,6 @@ void trmint (); int pass_login (char *t,int argc,char *argv[]); char *apop_login (char *chal,char *user,char *md5,int argc,char *argv[]); -#ifdef QMAIL -char* conv_virtualdomain(char *account); -#endif char *responder (void *challenge,unsigned long clen,unsigned long *rlen); int mbxopen (char *mailbox); long blat (char *text,long lines,unsigned long size,STRING *st); @@ -131,11 +128,7 @@ AUTHENTICATOR *auth = mail_lookup_auth (1); while (auth && compare_cstring (auth->name,"CRAM-MD5")) auth = auth->next; /* build challenge -- less than 128 chars */ -#ifndef QMAIL - if (!(auth->flags & AU_DISABLE)) -#else if (auth && auth->server && !(auth->flags & AU_DISABLE)) -#endif sprintf (challenge,"<%lx.%lx@%.64s>",(unsigned long) getpid (), (unsigned long) time (0),tcp_serverhost ()); else challenge[0] = '\0'; /* no MD5 authentication */ @@ -265,17 +258,10 @@ /* get user name */ if (!(t && *t && (s = strtok (t," ")) && (t = strtok(NIL,"\012")))) PSOUT ("-ERR Missing APOP argument\015\012"); - #ifdef QMAIL - else if (!(user = apop_login (challenge,conv_virtualdomain(s),t,argc,argv))) { - #else /* !QMAIL */ - else if (!(user = apop_login (challenge,s,t,argc,argv))) { - #endif /* QMAIL */ - PSOUT ("-ERR Bad APOP (Maybe your password is expired)\015\012"); - user = cpystr (s); - syslog (LOG_INFO,"APOP login failure user=%.80s host=%.80s", - user,tcp_clienthost ()); - } else if ((state = mbxopen ("INBOX")) == TRANSACTION) - syslog (LOG_INFO,"APOP user=%.80s host=%.80s nmsgs=%ld/%ld", + else if (!(user = apop_login (challenge,s,t,argc,argv))) + PSOUT ("-ERR Bad APOP\015\012"); + else if ((state = mbxopen ("INBOX")) == TRANSACTION) + syslog (LOG_INFO,"APOP user=%.80s host=%.80s nmsgs=%lu/%lu", user,tcp_clienthost (),nmsgs,stream->nmsgs); else syslog (LOG_INFO,"APOP user=%.80s host=%.80s no mailbox", user,tcp_clienthost ()); @@ -293,20 +279,8 @@ } else PSOUT ("+OK STLS completed\015\012"); } -#ifndef RESTRICT_POP else if (!mail_parameters (NIL,GET_DISABLEPLAINTEXT,NIL) && !strcmp (s,"USER")) { -#else /* !RESTRICT_POP */ - else if (!strcmp (s,"USER")) { - if (getenv("INTRANET") == NIL) { - PSOUT("-ERR Sorry, we don't allow POP3 from your network. Use APOP instead.\015\012"); - user = cpystr(t); - syslog (LOG_INFO,"Plain POP3 is restricted user=%.80s host=%.80s", - user,tcp_clienthost ()); - memset(user, '\0', strlen(user)); - break; - } -#endif if (host) fs_give ((void **) &host); if (user) fs_give ((void **) &user); if (pass) fs_give ((void **) &pass); @@ -320,11 +294,7 @@ user = cpystr (s);/* copy user name */ } /* local user name */ -#ifdef QMAIL - else user = conv_virtualdomain(cpystr (t)); -#else else user = cpystr (t); -#endif PSOUT ("+OK User name accepted, password please\015\012"); } else PSOUT ("-ERR Missing username argument\015\012");
--- a/src/osdep/unix/Makefile Mon Sep 14 20:06:41 2009 +0900 +++ b/src/osdep/unix/Makefile Thu Oct 30 00:00:57 2014 +0900 @@ -27,7 +27,7 @@ # Command line build parameters EXTRAAUTHENTICATORS= -EXTRADRIVERS=maildir mbox +EXTRADRIVERS=mbox PASSWDTYPE=std SSLTYPE=nopwd IP=4 @@ -102,7 +102,6 @@ NEWSSPOOL=$(SPOOLDIR)/news RSHPATH=/usr/ucb/rsh MD5PWD=/etc/cram-md5.pwd -MD5CFLAGS= -DAPOPOPEN=\"/usr/local/sbin/deapop\" -DUSERAPOPFILE=\".apop\" -DPOPBEFORESMTP -DPOP3RECORDER=\"/usr/local/etc/pop3-record\" # Tries one of the test alternatives below if not specified. LOCKPGM= # Test alternatives if LOCKPGM not specified @@ -145,21 +144,17 @@ # However, mh needs to be before any sysinbox formats (such as mmdf or unix) # since otherwise INBOX won't work correctly when mh_allow_inbox is set. # -DEFAULTDRIVERS=maildir imap nntp pop3 mix mx mbx tenex mtx mh mmdf unix news phile +DEFAULTDRIVERS=imap nntp pop3 mix mx mbx tenex mtx mh mmdf unix news phile CHUNKSIZE=65536 # Normally no need to change any of these -EXTRACFLAGS=-DQMAIL -# Next variable controls default maildir when user has no ~/.qmail -#MAILDIRCFLAGS=-DDEFAULTMAILDIR="maildir" -DQMAILCONTROL="/var/qmail/control" -MAILDIRCFLAGS=-DQMAILCONTROL="/var/qmail/control" ARCHIVE=c-client.a BINARIES=osdep.o mail.o misc.o newsrc.o smanager.o utf8.o utf8aux.o siglocal.o \ dummy.o pseudo.o netmsg.o flstring.o fdstring.o \ rfc822.o nntp.o smtp.o imap4r1.o pop3.o \ - unix.o mbx.o mmdf.o tenex.o mtx.o news.o phile.o mh.o mx.o mix.o maildir.o -CFLAGS=-g $(EXTRACFLAGS) + unix.o mbx.o mmdf.o tenex.o mtx.o news.o phile.o mh.o mx.o mix.o +CFLAGS=-g CAT=cat MAKE=make @@ -204,6 +199,14 @@ BASECFLAGS="-g -Dunix=1 -D_BSD -qro -qroconst" \ BASELDFLAGS="-ls" +a52: # Attempt at AIX 5.2 + $(BUILD) `$(CAT) SPECIALS` OS=$@ \ + SIGTYPE=psx CHECKPW=a41 CRXTYPE=nfs \ + SPOOLDIR=/var/spool \ + RSHPATH=/usr/bin/rsh \ + BASECFLAGS="-g -Dunix=1 -D_BSD -qro -qroconst" \ + BASELDFLAGS="-ls" + aix: # AIX/370 @echo You are building for AIX on an S/370 class machine @echo If you want AIX on an RS/6000 you need to use a32 or a41 instead! @@ -897,7 +900,6 @@ unix.o: mail.h misc.h osdep.h unix.h pseudo.h dummy.h utf8.o: mail.h misc.h osdep.h utf8.h tmap.c widths.c utf8aux.o: mail.h misc.h osdep.h utf8.h -maildir.o: mail.h misc.h osdep.h maildir.h dummy.h # OS-dependent @@ -966,7 +968,6 @@ @echo Once-only environment setup... echo $(CC) > CCTYPE echo $(BASECFLAGS) '$(EXTRACFLAGS)' -DCHUNKSIZE=$(CHUNKSIZE) > CFLAGS - echo '$(MAILDIRCFLAGS)' >> CFLAGS echo -DCREATEPROTO=$(CREATEPROTO) -DEMPTYPROTO=$(EMPTYPROTO) \ -DMD5ENABLE=\"$(MD5PWD)\" -DMAILSPOOL=\"$(MAILSPOOL)\" \ -DANONYMOUSHOME=\"$(MAILSPOOL)/anonymous\" \ @@ -974,7 +975,6 @@ -DRSHPATH=\"$(RSHPATH)\" -DLOCKPGM=\"$(LOCKPGM)\" \ -DLOCKPGM1=\"$(LOCKPGM1)\" -DLOCKPGM2=\"$(LOCKPGM2)\" \ -DLOCKPGM3=\"$(LOCKPGM3)\" > OSCFLAGS - echo $(MD5CFLAGS) >> OSCFLAGS echo $(BASELDFLAGS) $(EXTRALDFLAGS) > LDFLAGS echo "$(ARRC) $(ARCHIVE) $(BINARIES);$(RANLIB) $(ARCHIVE)" > ARCHIVE echo $(OS) > OSTYPE
--- 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 */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/osdep/unix/os_a52.c Thu Oct 30 00:00:57 2014 +0900 @@ -0,0 +1,63 @@ +/* ======================================================================== + * Copyright 1988-2006 University of Washington + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * + * ======================================================================== + */ + +/* + * Program: Operating-system dependent routines -- AIX 4.1 on RS 6000 + * + * Author: Mark Crispin + * Networks and Distributed Computing + * Computing & Communications + * University of Washington + * Administration Building, AG-44 + * Seattle, WA 98195 + * Internet: MRC@CAC.Washington.EDU + * + * Date: 1 August 1988 + * Last Edited: 30 August 2006 + */ + +#include "tcp_unix.h" /* must be before osdep includes tcp.h */ +#include "mail.h" +#include "osdep.h" +#include <stdio.h> +#include <sys/time.h> +#include <sys/socket.h> +#include <sys/stat.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <netdb.h> +#include <ctype.h> +#include <errno.h> +extern int errno; /* just in case */ +#include <pwd.h> +#include "misc.h" +#include <sys/select.h> +#include <stddef.h> /* needed for authenticate() */ + +int authenticate (char *UserName,char *Response,int *Reenter,char **Message); + +extern int sys_nerr; +extern char *sys_errlist[]; + + +#include "fs_unix.c" +#include "ftl_unix.c" +#include "nl_unix.c" +#include "env_unix.c" +#include "tcp_unix.c" +#include "gr_waitp.c" +#include "tz_sv4.c" +#include "flocksim.c" +#undef setpgrp +#include "setpgrp.c" +#include "utime.c"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/osdep/unix/os_a52.h Thu Oct 30 00:00:57 2014 +0900 @@ -0,0 +1,53 @@ +/* ======================================================================== + * Copyright 1988-2006 University of Washington + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * + * ======================================================================== + */ + +/* + * Program: Operating-system dependent routines -- AIX on RS6000 + * + * Author: Mark Crispin + * Networks and Distributed Computing + * Computing & Communications + * University of Washington + * Administration Building, AG-44 + * Seattle, WA 98195 + * Internet: MRC@CAC.Washington.EDU + * + * Date: 1 August 1988 + * Last Edited: 30 August 2006 + */ + +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <sys/types.h> +#include <time.h> /* for struct tm */ +#include <dirent.h> +#include <fcntl.h> +#include <utime.h> +#include <syslog.h> +#include <sys/file.h> +#include <ustat.h> + + +#define setpgrp(a,b) Setpgrp(a,b) +int Setpgrp (int pid,int gid); + +#define utime portable_utime +int portable_utime (char *file,time_t timep[2]); + +#include "env_unix.h" +#include "fs.h" +#include "ftl.h" +#include "nl.h" +#include "tcp.h" +#include "flocksim.h"
--- a/src/osdep/unix/tcp_unix.c Mon Sep 14 20:06:41 2009 +0900 +++ b/src/osdep/unix/tcp_unix.c Thu Oct 30 00:00:57 2014 +0900 @@ -239,7 +239,7 @@ size_t len; time_t now; struct protoent *pt = getprotobyname ("tcp"); - fd_set fds,efds; + fd_set rfds,wfds,efds; struct timeval tmo; struct sockaddr *sadr = ip_sockaddr (family,adr,adrlen,port,&len); blocknotify_t bn = (blocknotify_t) mail_parameters (NIL,GET_BLOCKNOTIFY,NIL); @@ -285,13 +285,15 @@ now = time (0); /* open timeout */ ti = ttmo_open ? now + ttmo_open : 0; tmo.tv_usec = 0; - FD_ZERO (&fds); /* initialize selection vector */ + FD_ZERO (&rfds); /* initialize selection vector */ + FD_ZERO (&wfds); /* initialize selection vector */ FD_ZERO (&efds); /* handle errors too */ - FD_SET (sock,&fds); /* block for error or readable */ + FD_SET (sock,&rfds); /* block for error or readable or writable */ + FD_SET (sock,&wfds); FD_SET (sock,&efds); do { /* block under timeout */ tmo.tv_sec = ti ? ti - now : 0; - i = select (sock+1,&fds,NIL,&efds,ti ? &tmo : NIL); + i = select (sock+1,&rfds,&wfds,&efds,ti ? &tmo : NIL); now = time (0); /* fake timeout if interrupt & time expired */ if ((i < 0) && (errno == EINTR) && ti && (ti <= now)) i = 0; } while ((i < 0) && (errno == EINTR)); @@ -300,7 +302,7 @@ fcntl (sock,F_SETFL,flgs); /* This used to be a zero-byte read(), but that crashes Solaris */ /* get socket status */ - while (((i = *ctr = read (sock,tmp,1)) < 0) && (errno == EINTR)); + if(FD_ISSET(sock, &rfds)) while (((i = *ctr = read (sock,tmp,1)) < 0) && (errno == EINTR)); } if (i <= 0) { /* timeout or error? */ i = i ? errno : ETIMEDOUT;/* determine error code */ @@ -818,20 +820,6 @@ return stream->localhost; /* return local host name */ } -/* Get $TCPREMOTEHOST || $TCPREMOTEHOST - * If invoked via tcpserver or couriertcpd, consult $TCPREMOTEHOST - * or $TCPREMOTEIP - */ -char* gettcpremoteip() -{ - if (getenv("TCPREMOTEHOST") && strcmp("0", getenv("TCPREMOTEHOST"))) { - return getenv("TCPREMOTEHOST"); - } else if (getenv("TCPREMOTEIP")) { - return getenv("TCPREMOTEIP"); - } - return "NON-IPv4"; -} - /* TCP/IP get client host address (server calls only) * Returns: client host address */ @@ -862,15 +850,6 @@ if (!myClientHost) { size_t sadrlen; struct sockaddr *sadr = ip_newsockaddr (&sadrlen); -#ifdef INET6 - if (getenv("TCPREMOTEIP")) { - myClientHost = - cpystr((getenv("TCPREMOTEHOST") - && strcasecmp("UNKNOWN", getenv("TCPREMOTEHOST"))) - ? getenv("TCPREMOTEHOST") - : getenv("TCPREMOTEIP")); - } else -#endif if (getpeername (0,sadr,(void *) &sadrlen)) { char *s,*t,*v,tmp[MAILTMPLEN]; if ((s = getenv (t = "SSH_CLIENT")) || @@ -934,8 +913,7 @@ size_t sadrlen; struct sockaddr *sadr = ip_newsockaddr (&sadrlen); /* get stdin's name */ - if (getsockname (0,sadr,(void *) &sadrlen) || - (myServerPort = ip_sockaddrtoport (sadr)) < 0) + if (getsockname (0,sadr,(void *) &sadrlen)) myServerHost = cpystr (mylocalhost ()); else { /* get stdin's name */ myServerHost = tcp_name (sadr,NIL);
--- a/src/osdep/unix/unix.c Mon Sep 14 20:06:41 2009 +0900 +++ b/src/osdep/unix/unix.c Thu Oct 30 00:00:57 2014 +0900 @@ -202,7 +202,6 @@ /* driver parameters */ static long unix_fromwidget = T; -char *myMailSuffix =NIL; /* home directory name */ /* UNIX mail validate mailbox * Accepts: mailbox name @@ -2402,15 +2401,6 @@ } f->filepos += size; /* update file position */ } - -/* Return my mail suffix(of qmail or Postfix) - * Returns: my mail address extensional suffix - */ - -char *mymailsuffix () -{ - return myMailSuffix ? myMailSuffix : ""; -} /* MBOX mail routines */