diff -ruN imap-2007e.orig/Makefile imap-2007e/Makefile
--- imap-2007e.orig/Makefile	2008-06-04 12:43:35.000000000 -0600
+++ imap-2007e/Makefile	2012-05-02 16:16:16.000000000 -0600
@@ -100,6 +100,7 @@
 # osi	Apple iPhone and iPod Touch
 # osx	Mac OS X
 # oxp	Mac OS X with Pluggable Authentication Modules (PAM)
+# oxps	Mac OS X with Pluggable Authentication Modules (PAM, shared c-client lib)
 # ptx	PTX
 # pyr	Pyramid
 # qnx	QNX 4
@@ -418,8 +419,15 @@
 	$(TOUCH) ip6
 	$(BUILD) BUILDTYPE=osx IP=$(IP6) EXTRAAUTHENTICATORS="$(EXTRAAUTHENTICATORS) gss" \
 	PASSWDTYPE=pam \
-	EXTRACFLAGS="$(EXTRACFLAGS) -DMAC_OSX_KLUDGE=1" \
-	SPECIALS="SSLINCLUDE=/usr/include/openssl SSLLIB=/usr/lib SSLCERTS=/System/Library/OpenSSL/certs SSLKEYS=/System/Library/OpenSSL/private GSSINCLUDE=/usr/include GSSLIB=/usr/lib PAMDLFLAGS=-lpam"
+	EXTRACFLAGS="$(EXTRACFLAGS)" \
+	SPECIALS="SSLINCLUDE=@FINKPREFIX@/include/openssl SSLLIB=@FINKPREFIX@/lib SSLCERTS=@FINKPREFIX@/etc/ssl/certs SSLKEYS=@FINKPREFIX@/etc/ssl/private GSSINCLUDE=/usr/include GSSLIB=/usr/lib PAMDLFLAGS=-lpam"
+
+oxps:	an
+	$(TOUCH) ip6
+	$(BUILD) BUILDTYPE=osxs IP=$(IP6) EXTRAAUTHENTICATORS="$(EXTRAAUTHENTICATORS) gss" \
+	PASSWDTYPE=pam \
+	EXTRACFLAGS="$(EXTRACFLAGS)" \
+	SPECIALS="SSLINCLUDE=@FINKPREFIX@/include/openssl SSLLIB=@FINKPREFIX@/lib SSLCERTS=@FINKPREFIX@/etc/ssl/certs SSLKEYS=@FINKPREFIX@/etc/ssl/private GSSINCLUDE=/usr/include GSSLIB=/usr/lib PAMDLFLAGS=-lpam"
 
 osx:	osxok an
 	$(TOUCH) ip6
diff -ruN imap-2007e.orig/src/dmail/Makefile imap-2007e/src/dmail/Makefile
--- imap-2007e.orig/src/dmail/Makefile	2008-06-04 12:18:34.000000000 -0600
+++ imap-2007e/src/dmail/Makefile	2012-05-02 16:09:10.000000000 -0600
@@ -26,25 +26,21 @@
 
 
 C = ../c-client
-CCLIENTLIB = $C/c-client.a
 SHELL = /bin/sh
 
 # Get local definitions from c-client directory
 
 CC = `cat $C/CCTYPE`
 CFLAGS = -I$C `cat $C/CFLAGS`
-LDFLAGS = $(CCLIENTLIB) `cat $C/LDFLAGS`
+LDFLAGS = `cat $C/LDFLAGS`
 
-dmail: $(CCLIENTLIB) dmail.o dquota.o
+dmail: dmail.o dquota.o
 	$(CC) $(CFLAGS) -o dmail dmail.o dquota.o $(LDFLAGS)
 
 dmail.o: $C/mail.h $C/misc.h $C/osdep.h dquota.h
 
 dquota.o: dquota.h
 
-$(CCLIENTLIB):
-	cd $C;make
-
 clean:
 	rm -f *.o dmail
 
diff -ruN imap-2007e.orig/src/imapd/Makefile imap-2007e/src/imapd/Makefile
--- imap-2007e.orig/src/imapd/Makefile	2008-06-04 12:18:34.000000000 -0600
+++ imap-2007e/src/imapd/Makefile	2012-05-02 16:10:02.000000000 -0600
@@ -43,23 +43,19 @@
 # Get local definitions from c-client directory
 
 C = ../c-client
-CCLIENTLIB = $C/c-client.a
 CC = `cat $C/CCTYPE`
 CFLAGS = -I$C `cat $C/CFLAGS` $(NSBD) $(ENBD) -DANOFILE=\"$(ANO)\" \
 	-DALERTFILE=\"$(ALERT)\" -DNNTPFILE=\"$(NNTP)\" \
 	-DUSERALERTFILE=\"$(USERALERT)\" -DSHUTDOWNFILE=\"$(SHUTDOWN)\"
-LDFLAGS = $(CCLIENTLIB) `cat $C/LDFLAGS`
+LDFLAGS = `cat $C/LDFLAGS`
 
 all:	imapd
 
-imapd: $(CCLIENTLIB) imapd.o
+imapd: imapd.o
 	$(CC) $(CFLAGS) -o imapd imapd.o $(LDFLAGS)
 
 imapd.o: $C/mail.h $C/misc.h $C/osdep.h
 
-$(CCLIENTLIB):
-	cd $C;make
-
 clean:
 	rm -f *.o imapd || true
 
diff -ruN imap-2007e.orig/src/imapd/imapd.8 imap-2007e/src/imapd/imapd.8
--- imap-2007e.orig/src/imapd/imapd.8	2008-06-04 12:18:34.000000000 -0600
+++ imap-2007e/src/imapd/imapd.8	2012-05-02 13:02:45.000000000 -0600
@@ -16,7 +16,7 @@
 .SH NAME
 IMAPd \- Internet Message Access Protocol server
 .SH SYNOPSIS
-.B /usr/etc/imapd
+.B @FINKPREFIX@/sbin/imapd
 .SH DESCRIPTION
 .I imapd
 is a server which supports the
@@ -42,7 +42,7 @@
 by many Unix-based clients.  To do this, the
 .I imapd
 binary must have a link to
-.I /etc/rimapd
+.I @FINKPREFIX@/sbin/rimapd
 since this is where this software expects it to be located.
 .SH "SEE ALSO"
 rsh(1) ipopd(8)
diff -ruN imap-2007e.orig/src/ipopd/Makefile imap-2007e/src/ipopd/Makefile
--- imap-2007e.orig/src/ipopd/Makefile	2008-06-04 12:18:34.000000000 -0600
+++ imap-2007e/src/ipopd/Makefile	2012-05-02 16:10:22.000000000 -0600
@@ -26,30 +26,26 @@
 
 
 C = ../c-client
-CCLIENTLIB = $C/c-client.a
 SHELL = /bin/sh
 
 # Get local definitions from c-client directory
 
 CC = `cat $C/CCTYPE`
 CFLAGS = -I$C `cat $C/CFLAGS`
-LDFLAGS = $(CCLIENTLIB) `cat $C/LDFLAGS`
+LDFLAGS = `cat $C/LDFLAGS`
 
 ipopd: ipop2d ipop3d
 
-ipop2d: $(CCLIENTLIB) ipop2d.o
+ipop2d: ipop2d.o
 	$(CC) $(CFLAGS) -o ipop2d ipop2d.o $(LDFLAGS)
 
-ipop3d: $(CCLIENTLIB) ipop3d.o
+ipop3d: ipop3d.o
 	$(CC) $(CFLAGS) -o ipop3d ipop3d.o $(LDFLAGS)
 
 ipop2d.o: $C/mail.h $C/misc.h $C/osdep.h
 
 ipop3d.o: $C/mail.h $C/misc.h $C/osdep.h
 
-$(CCLIENTLIB):
-	cd $C;make
-
 clean:
 	rm -f *.o ipop2d ipop3d || true
 
diff -ruN imap-2007e.orig/src/ipopd/ipopd.8 imap-2007e/src/ipopd/ipopd.8
--- imap-2007e.orig/src/ipopd/ipopd.8	2008-06-04 12:18:34.000000000 -0600
+++ imap-2007e/src/ipopd/ipopd.8	2012-05-02 13:03:21.000000000 -0600
@@ -16,9 +16,9 @@
 .SH NAME
 IPOPd \- Post Office Protocol server
 .SH SYNOPSIS
-.B /usr/etc/ipop2d
+.B @FINKPREFIX@/sbin/ipop2d
 .PP
-.B /usr/etc/ipop3d
+.B @FINKPREFIX@/sbin/ipop3d
 .SH DESCRIPTION
 .I ipop2d
 and
diff -ruN imap-2007e.orig/src/mailutil/Makefile imap-2007e/src/mailutil/Makefile
--- imap-2007e.orig/src/mailutil/Makefile	2008-06-04 12:18:34.000000000 -0600
+++ imap-2007e/src/mailutil/Makefile	2012-05-02 16:09:31.000000000 -0600
@@ -26,23 +26,19 @@
 
 
 C = ../c-client
-CCLIENTLIB = $C/c-client.a
 SHELL = /bin/sh
 
 # Get local definitions from c-client directory
 
 CC = `cat $C/CCTYPE`
 CFLAGS = -I$C `cat $C/CFLAGS`
-LDFLAGS = $(CCLIENTLIB) `cat $C/LDFLAGS`
+LDFLAGS = `cat $C/LDFLAGS`
 
-mailutil: $(CCLIENTLIB) mailutil.o
+mailutil: mailutil.o
 	$(CC) $(CFLAGS) -o mailutil mailutil.o $(LDFLAGS)
 
 mailutil.o: $C/mail.h $C/misc.h $C/osdep.h
 
-$(CCLIENTLIB):
-	cd $C;make
-
 clean:
 	rm -f *.o mailutil
 
diff -ruN imap-2007e.orig/src/mlock/mlock.1 imap-2007e/src/mlock/mlock.1
--- imap-2007e.orig/src/mlock/mlock.1	1969-12-31 17:00:00.000000000 -0700
+++ imap-2007e/src/mlock/mlock.1	2012-05-02 17:29:08.000000000 -0600
@@ -0,0 +1,151 @@
+.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16)
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el       .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
+..
+.    nr % 0
+.    rr F
+.\}
+.el \{\
+.    de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "MLOCK 1"
+.TH MLOCK 1 "2012-05-02" "UW IMAP 2007e" ""
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+mlock \-\- lock a mailbox
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+/usr/bin/mlock
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+If \fBlibc\-client.dylib\fR is unable to create a mailbox lock file, it will call
+this program.  This makes using the mailbox safe over i.e. \s-1NFS\s0. There is
+no reason to call \fBmlock\fR yourself or through another program.  It is
+setgid mail so there is no need to change the permissions of
+\&\fI@FINKPREFIX@/var/mail\fR to 1777.
+.SH "BUGS"
+.IX Header "BUGS"
+No documentation other than this crappy man page,
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+mlock was written by Mark Crispin <mrc@cac.washington.edu>
+This man page was written for Debian GNU/Linux by Jaldhar H. Vyas
+<jaldhar@debian.org>
diff -ruN imap-2007e.orig/src/mtest/Makefile imap-2007e/src/mtest/Makefile
--- imap-2007e.orig/src/mtest/Makefile	2008-06-04 12:18:34.000000000 -0600
+++ imap-2007e/src/mtest/Makefile	2012-05-02 16:08:48.000000000 -0600
@@ -26,25 +26,21 @@
 
 
 C = ../c-client
-CCLIENTLIB = $C/c-client.a
 SHELL = /bin/sh
 
 # Get local definitions from c-client directory
 
 CC = `cat $C/CCTYPE`
 CFLAGS = -I$C `cat $C/CFLAGS`
-LDFLAGS = $(CCLIENTLIB) `cat $C/LDFLAGS`
+LDFLAGS = `cat $C/LDFLAGS`
 
 all:	mtest
 
-mtest: $(CCLIENTLIB) mtest.o
+mtest: mtest.o
 	$(CC) $(CFLAGS) -o mtest mtest.o $(LDFLAGS)
 
 mtest.o: $C/mail.h $C/misc.h $C/osdep.h $C/rfc822.h $C/smtp.h $C/nntp.h
 
-$(CCLIENTLIB):
-	cd $C;make
-
 clean:
 	rm -f *.o mtest || true
 
diff -ruN imap-2007e.orig/src/osdep/unix/Makefile imap-2007e/src/osdep/unix/Makefile
--- imap-2007e.orig/src/osdep/unix/Makefile	2008-06-04 12:18:34.000000000 -0600
+++ imap-2007e/src/osdep/unix/Makefile	2012-05-02 16:34:41.000000000 -0600
@@ -581,10 +581,27 @@
 
 osx:	# Mac OS X
 	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
-	 CRXTYPE=nfs \
-	 SPOOLDIR=/var/spool MAILSPOOL=/var/mail \
+	 SIGTYPE=psx CHECKPW=pam CRXTYPE=nfs \
+	 SPOOLDIR=@FINKPREFIX@/var/spool MAILSPOOL=@FINKPREFIX@/var/mail \
+	 ACTIVEFILE=@FINKPREFIX@/var/lib/news/active \
+	 LOCKPGM=@FINKPREFIX@/sbin/mlock \
+	 RSHPATH=/usr/bin/rsh \
+	 BASECFLAGS="-fPIC $(GCC4CFLAGS) -Wno-parentheses -Wno-switch -Wno-implicit-int -Wno-unused-value -Wno-format-extra-args -Wno-constant-conversion -Wno-implicit-function-declaration -Wno-format -I@FINKPREFIX@/include -I@FINKPREFIX@/include/openssl" \
+	 BASELDFLAGS="../c-client/c-client.a" \
+	 ARRC="$(ARRC) $(ARCHIVE)"
+
+osxs:	# Mac OS X Pluggable Authentication modules (c-client as shared lib)
+	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
+	 SIGTYPE=psx CHECKPW=pam CRXTYPE=nfs \
+	 SPOOLDIR=@FINKPREFIX@/var/spool MAILSPOOL=@FINKPREFIX@/var/mail \
+	 ACTIVEFILE=@FINKPREFIX@/var/lib/news/active \
+	 LOCKPGM=@FINKPREFIX@/sbin/mlock \
 	 RSHPATH=/usr/bin/rsh \
-	 BASECFLAGS="$(GCC4CFLAGS)"
+	 BASECFLAGS="-fPIC $(GCC4CFLAGS) -Wno-parentheses -Wno-switch -Wno-implicit-int -Wno-unused-value -Wno-format-extra-args -Wno-constant-conversion -Wno-implicit-function-declaration -Wno-format -I@FINKPREFIX@/include -I@FINKPREFIX@/include/openssl" \
+	 ARCHIVE="-lc-client" \
+	 BASELDFLAGS="-L../c-client -lc-client -L@FINKPREFIX@/lib $(PAMLDFLAGS) -lc" \
+	 ARRC="gcc -dynamiclib -undefined dynamic_lookup -install_name @FINKPREFIX@/lib/libc-client.1.dylib -compatibility_version 2.0 -current_version 2.0 -o libc-client.1.0.0.dylib $(PAMLDFLAGS) -lc $(EXTRALDFLAGS) $(SSLLDFLAGS) -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err" \
+	 LNS="ln -s libc-client.1.0.0.dylib libc-client.1.dylib; ln -s libc-client.1.0.0.dylib libc-client.dylib"
 
 ptx:	# PTX
 	$(BUILD) `$(CAT) SPECIALS` OS=$@ \
@@ -861,7 +878,7 @@
 # Cleanup
 
 clean:
-	sh -c '$(RM) auths.c crexcl.c ip_unix.c linkage.[ch] siglocal.c osdep*.[ch] *.o ARCHIVE *FLAGS *TYPE $(ARCHIVE) || true'
+	sh -c '$(RM) auths.c crexcl.c ip_unix.c linkage.[ch] siglocal.c osdep*.[ch] *.o ARCHIVE ARCHIVENAME *FLAGS *TYPE $(ARCHIVE) || true'
 
 
 # Dependencies
@@ -968,7 +985,8 @@
 	 -DLOCKPGM1=\"$(LOCKPGM1)\" -DLOCKPGM2=\"$(LOCKPGM2)\" \
 	 -DLOCKPGM3=\"$(LOCKPGM3)\" > OSCFLAGS
 	echo $(BASELDFLAGS) $(EXTRALDFLAGS) > LDFLAGS
-	echo "$(ARRC) $(ARCHIVE) $(BINARIES);$(RANLIB) $(ARCHIVE)" > ARCHIVE
+	echo "$(ARRC) $(BINARIES); $(LNS)" > ARCHIVE
+	echo $(ARCHIVE) > ARCHIVENAME
 	echo $(OS) > OSTYPE
 	./drivers $(EXTRADRIVERS) $(DEFAULTDRIVERS) dummy
 	./mkauths $(EXTRAAUTHENTICATORS) $(DEFAULTAUTHENTICATORS)
diff -ruN imap-2007e.orig/src/osdep/unix/env_unix.c imap-2007e/src/osdep/unix/env_unix.c
--- imap-2007e.orig/src/osdep/unix/env_unix.c	2008-06-04 12:46:10.000000000 -0600
+++ imap-2007e/src/osdep/unix/env_unix.c	2012-05-02 13:04:54.000000000 -0600
@@ -77,7 +77,7 @@
 static short anonymous = NIL;	/* is anonymous */
 static short blackBox = NIL;	/* is a black box */
 static short closedBox = NIL;	/* is a closed box (uses chroot() jail) */
-static short restrictBox = NIL;	/* is a restricted box */
+static short restrictBox = -1;	/* is a restricted box */
 static short has_no_life = NIL;	/* is a cretin with no life */
 				/* block environment init */
 static short block_env_init = NIL;
diff -ruN imap-2007e.orig/src/osdep/unix/flocklnx.c imap-2007e/src/osdep/unix/flocklnx.c
--- imap-2007e.orig/src/osdep/unix/flocklnx.c	2008-06-04 12:18:34.000000000 -0600
+++ imap-2007e/src/osdep/unix/flocklnx.c	2012-05-02 13:00:50.000000000 -0600
@@ -57,7 +57,7 @@
     case ENOLCK:		/* lock table is full */
       sprintf (tmp,"File locking failure: %s",strerror (errno));
       mm_log (tmp,WARN);	/* give the user a warning of what happened */
-      if (!logged++) syslog (LOG_ERR,tmp);
+         if (!logged++) syslog ("%s",LOG_ERR,tmp);
 				/* return failure if non-blocking lock */
       if (op & LOCK_NB) return -1;
       sleep (5);		/* slow down in case it loops */
diff -ruN imap-2007e.orig/src/osdep/unix/tcp_unix.c imap-2007e/src/osdep/unix/tcp_unix.c
--- imap-2007e.orig/src/osdep/unix/tcp_unix.c	2008-06-04 12:18:34.000000000 -0600
+++ imap-2007e/src/osdep/unix/tcp_unix.c	2012-05-02 13:04:10.000000000 -0600
@@ -346,12 +346,12 @@
 				/* return immediately if ssh disabled */
     if (!(sshpath && (ti = sshtimeout))) return NIL;
 				/* ssh command prototype defined yet? */
-    if (!sshcommand) sshcommand = cpystr ("%s %s -l %s exec /etc/r%sd");
+    if (!sshcommand) sshcommand = cpystr ("%s %s -l %s exec @FINKPREFIX@/sbin/r%sd");
   }
 				/* want rsh? */
   else if (rshpath && (ti = rshtimeout)) {
 				/* rsh command prototype defined yet? */
-    if (!rshcommand) rshcommand = cpystr ("%s %s -l %s exec /etc/r%sd");
+    if (!rshcommand) rshcommand = cpystr ("%s %s -l %s exec @FINKPREFIX@/sbin/r%sd");
   }
   else return NIL;		/* rsh disabled */
 				/* look like domain literal? */
diff -ruN imap-2007e.orig/src/tmail/Makefile imap-2007e/src/tmail/Makefile
--- imap-2007e.orig/src/tmail/Makefile	2008-06-04 12:18:34.000000000 -0600
+++ imap-2007e/src/tmail/Makefile	2012-05-02 16:09:20.000000000 -0600
@@ -26,25 +26,21 @@
 
 
 C = ../c-client
-CCLIENTLIB = $C/c-client.a
 SHELL = /bin/sh
 
 # Get local definitions from c-client directory
 
 CC = `cat $C/CCTYPE`
 CFLAGS = -I$C `cat $C/CFLAGS`
-LDFLAGS = $(CCLIENTLIB) `cat $C/LDFLAGS`
+LDFLAGS = `cat $C/LDFLAGS`
 
-tmail: $(CCLIENTLIB) tmail.o tquota.o
+tmail: tmail.o tquota.o
 	$(CC) $(CFLAGS) -o tmail tmail.o tquota.o $(LDFLAGS)
 
 tmail.o: $C/mail.h $C/misc.h $C/osdep.h tquota.h
 
 tquota.o: tquota.h
 
-$(CCLIENTLIB):
-	cd $C;make
-
 clean:
 	rm -f *.o tmail
 
