Subject: Time to send a message via SMTP

From: "Mark Elvers" <[email-masked]>
Date: Wed, 13 Sep 2000 23:29:20 +0100

I have an intermittent problem using the c-client library which I would
appreciate some suggestions on.  I'm sure it's not a problem with the
library, but I need understand what the library is doing at a particular
point to find the cause of the problem.  Previously, I've been using IMAP
4.7, and more recently IMAP 2000 (rel cand 6)

The problem can easily be shown in mtest by sending a simple "Hello World"
email, where I see a 40-50 second delay following the

[Trying IP address [x.x.x.x]]

and before the

[Ok]

prompt; at other times the exact same sequence is completed within 1-2
seconds.

At the times when the delay occurs, I've tried to telnet to the SMTP server
at port 25 and I get an immediate response back.

Any suggestions would be greatly received.

--mte

-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------

---

From: Rudi van Houten <[email-masked]>
Date: Thu, 14 Sep 2000 00:37:55 +0200

>prompt; at other times the exact same sequence is completed within 1-2

You don't give specific addresses, or even protocol logs. So I am 
wildly guessing:
Is the contacted SMTP server trying to resolve YOUR address?? The 
first time that will take some time (minutes sometimes), whithin the 
time the records are hold in the DNS cache response will be 
instantly. After timeout of the record waiting will start anew.

--
Rudi van Houten   >>> ;-) Fantasie is de mens gegeven als vergoeding <<<
wiskunde k.512    >>>     voor wat hij niet is, en gevoel voor humor <<<
Tel. 1418         >>>     om hem te troosten met wat hij is.         <<<

---

From: Mark Crispin <[email-masked]>
Date: Wed, 13 Sep 2000 16:39:47 -0700 (PDT)

> instantly. After timeout of the record waiting will start anew.

I agree that this is the most plausible explanation.

If your application enables protocol debugging (by setting OP_DEBUG in the
smtp_open() call), you can see what the server is doing and at what time.  A
long delay prior to the server banner is a good indication of DNS resolution
delay.

---

From: "Mark Elvers" <[email-masked]>
Date: Thu, 14 Sep 2000 10:07:10 +0100

The name server resides on the same server as the IMAP and indeed SMTP
server (small site!).  I've simulated an empty name server cache by stopping
named and restarting, then using mtest to send a message (with Debug
protocol on).  I saw an 8 second delay from the "[Trying IP address ...]"
before the "220 server ESMTP Sendmail" line.  Running it again, there was no
delay at all.  Which I guess proves the point.

In this kind of setup where the all the servers are on the same physical
box, the "first run" delay should always be the same?  Or am I missing
something here on my understanding of DNS?

Thanks

--mte

-----Original Message-----
From:	[email-masked]
[mailto:[email-masked]] On Behalf Of Rudi van Houten
Sent:	13 September 2000 23:38
To:	[email-masked]
Cc:	[email-masked]
Subject:	Re: Time to send a message via SMTP

---

From: "Jaldhar H. Vyas" <[email-masked]>
Date: Mon, 18 Sep 2000 12:41:00 -0400 (EDT)

This is something which the Debian GNU/Linux package of imap has had
for a while and I've been meaning to contribute.  The patch is against
IMAP-2000 RC6.

The benefits of making c-client a shared lib are memory savings
(particularly if you have many concurrent imapd processes) and it makes
for easier updates.  In Debian the roxen-imap, imp, mod_php and pine
packages use the shared c-client as well as imapd, and ipop[23]d.  So if a
fix appears in c-client, they all get updated in fell swoop.

It works by creating a new build target, lnps.  Use it as you would any
other build target.  If you are building imap-utils too, you're going to
have to modify each programs Makefile in the same manner as mtest.

Although this patch is only for Linux, it should be really easy to adapt
for other systems that use shared libraries.

%<----------------CUT HERE-----------------------------------%<
--- uw-imap-2000.orig/src/imapd/Makefile
+++ uw-imap-2000/src/imapd/Makefile
@@ -34,17 +34,19 @@
 ALERT=/etc/imapd.alert
 USERALERT=.imapalert
 ANO=/etc/anonymous.newsgroups
+CCLIENTLIB = $C/`cat $C/$ARCHIVENAME`
 SHELL= /bin/sh

 # Get local definitions from c-client directory
 
 C = ../c-client
-CCLIENTLIB = $C/c-client.a
+CCLIENTLIB = $C/`cat $C/$ARCHIVENAME`
+
 CC = `cat $C/CCTYPE`
 CFLAGS = -I$C `cat $C/CFLAGS` -DANOFILE=\"$(ANO)\" \
 	-DALERTFILE=\"$(ALERT)\" -DUSERALERTFILE=\"$(USERALERT)\"
-LDFLAGS = $(CCLIENTLIB) `cat $C/LDFLAGS`
+LDFLAGS = `cat $C/LDFLAGS`
 
 all:	imapd
 
--- uw-imap-2000.orig/src/ipopd/Makefile
+++ uw-imap-2000/src/ipopd/Makefile
@@ -32,14 +32,14 @@

 C = ../c-client
-CCLIENTLIB = $C/c-client.a
+CCLIENTLIB = $C/`cat $C/$ARCHIVENAME`
 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
 
--- uw-imap-2000.orig/src/osdep/unix/Makefile
+++ uw-imap-2000/src/osdep/unix/Makefile
@@ -138,7 +138,7 @@
 	 SPOOLDIR=/var/spool \
 	 RSHPATH=/usr/bin/rsh \
 	 BASECFLAGS="-g -Dunix=1 -D_BSD" \
-	 BASELDFLAGS="-lbsd"
+	 BASELDFLAGS="../c-client/c-client.a -lbsd"
 
 a41:	# AIX 4.1 for RS/6000
 	$(BUILD) `cat EXTRASPECIALS` OS=$@ \
@@ -146,7 +146,7 @@
 	 SPOOLDIR=/var/spool \
 	 RSHPATH=/usr/bin/rsh \
 	 BASECFLAGS="-g -Dunix=1 -D_BSD" \
-	 BASELDFLAGS="-lbsd -ls"
+	 BASELDFLAGS="../c-client/c-client.a -lbsd -ls"
 
 aix:	# AIX/370
 	@echo You are building for AIX on an S/370 class machine
@@ -154,12 +154,13 @@
 	$(BUILD) `cat EXTRASPECIALS` OS=$@ \
 	 CRXTYPE=nfs \
 	 BASECFLAGS="-g" \
-	 BASELDFLAGS="-lbsd"
+	 BASELDFLAGS="../c-client/c-client.a -lbsd"
 
 aos:	# AOS for RT
 	$(BUILD) `cat EXTRASPECIALS` OS=$@ \
 	 CRXTYPE=nfs \
 	 BASECFLAGS="-g -Dconst="
+	 BASELDFLAGS="../c-client/c-client.a"
 
 art:	# AIX 2.2.1 for RT
 	$(BUILD) `cat EXTRASPECIALS` OS=$@ \
@@ -168,6 +169,7 @@
 	 ACTIVEFILE=/usr/local/news/control/active \
 	 RSHPATH=/bin/rsh \
 	 BASECFLAGS="-g -Dconst= -Dvoid=char" \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 RANLIB=true 
 
 asv:	# Altos SVR4
@@ -176,7 +178,7 @@
 	 ACTIVEFILE=/usr/spool/news/active \
 	 RSHPATH=/usr/bin/rcmd \
 	 BASECFLAGS="-Dconst= -DSIGSTOP=SIGKILL" \
-	 BASELDFLAGS="-lsocket -lrpc -lgen -lcrypt -lxenix" \
+	 BASELDFLAGS="../c-client/c-client.a -lsocket -lrpc -lgen -lcrypt -lxenix" \
 	 RANLIB=true
 
 aux:	# A/UX
@@ -192,6 +194,7 @@
 	 SPOOLDIR=/var NEWSSPOOL=/var/news/spool \
 	 ACTIVEFILE=/var/news/etc/active \
 	 RSHPATH=/usr/bin/rsh \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 BASECFLAGS="-g -O2 -pipe" CC=shlicc
 
 bsd:	# BSD UNIX
@@ -206,7 +209,7 @@
 	 ACTIVEFILE=/usr/local/news/lib/active \
 	 RSHPATH=/usr/bin/rsh \
 	 BASECFLAGS="-g -O -pipe" \
-	 BASELDFLAGS="-lcrypt"
+	 BASELDFLAGS="../c-client/c-client.a -lcrypt"
 
 bsi:	# BSD/i386
 	$(BUILD) `cat EXTRASPECIALS` OS=$@ \
@@ -214,6 +217,7 @@
 	 SPOOLDIR=/var NEWSSPOOL=/var/news/spool \
 	 ACTIVEFILE=/var/news/etc/active \
 	 RSHPATH=/usr/bin/rsh \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 BASECFLAGS="-g -O2 -pipe"
 
 bso:	# OpenBSD
@@ -222,11 +226,13 @@
 	 SPOOLDIR=/var \
 	 ACTIVEFILE=/usr/local/news/lib/active \
 	 RSHPATH=/usr/bin/rsh \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 BASECFLAGS="-O2 -pipe"
 
 cvx:	# Convex
 	$(BUILD) `cat EXTRASPECIALS` OS=$@ \
 	 CRXTYPE=nfs \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 BASECFLAGS="-O -ext -Dconst="
 
 d-g:	# Data General DG/UX
@@ -236,7 +242,7 @@
 	 ACTIVEFILE=/local/news/active \
 	 RSHPATH=/usr/bin/remsh \
 	 BASECFLAGS="-g -Dconst=" \
-	 BASELDFLAGS="-lnsl -lsocket" \
+	 BASELDFLAGS="../c-client/c-client.a -lnsl -lsocket" \
 	 RANLIB=true
 
 d54:	# Data General DG/UX 5.4
@@ -246,7 +252,7 @@
 	 ACTIVEFILE=/local/news/active \
 	 RSHPATH=/usr/bin/remsh \
 	 BASECFLAGS="-g -Dconst=" \
-	 BASELDFLAGS="-lnsl -lsocket" \
+	 BASELDFLAGS="../c-client/c-client.a -lnsl -lsocket" \
 	 RANLIB=true
 
 dpx:	# Bull DPX/2
@@ -254,7 +260,7 @@
 	 SIGTYPE=sv4 CHECKPW=sv4 LOGINPW=sv4 \
 	 RSHPATH=/usr/bin/remsh \
 	 BASECFLAGS="-Dconst= -DSYSTEM5 -DSHORT_IDENT" \
-	 BASELDFLAGS="-linet" \
+	 BASELDFLAGS="../c-client/c-client.a -linet" \
 	 RANLIB=true LN=ln
 
 drs:	# ICL DRS/NX
@@ -264,18 +270,20 @@
 	 ACTIVEFILE=/var/lib/news/active \
 	 RSHPATH=/usr/bin/rsh \
 	 BASECFLAGS="-O" \
-	 BASELDFLAGS="-lsocket -lgen" \
+	 BASELDFLAGS="../c-client/c-client.a -lsocket -lgen" \
 	 RANLIB=true
 
 do4:	# Apollo Domain/OS sr10.4
 	$(BUILD) `cat EXTRASPECIALS` OS=$@ \
 	 CRXTYPE=nfs \
 	 BASECFLAGS="-A systype,bsd4.3 -D_APOLLO_SOURCE" \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 RANLIB=true
 
 dyn:	# Dynix
 	$(BUILD) `cat EXTRASPECIALS` OS=$@ \
 	 CRXTYPE=nfs \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 BASECFLAGS="-g -Dconst="
 
 epx:	# EP/IX
@@ -285,7 +293,7 @@
 	 ACTIVEFILE=/usr/share/news/active \
 	 RSHPATH=/usr/net/rsh \
 	 BASECFLAGS="-g -systype svr4" \
-	 BASELDFLAGS="-lsocket -lnsl -lgen" \
+	 BASELDFLAGS="../c-client/c-client.a -lsocket -lnsl -lgen" \
 	 RANLIB=true
 
 gas:	# GCC Altos SVR4
@@ -294,7 +302,7 @@
 	 ACTIVEFILE=/usr/spool/news/active \
 	 RSHPATH=/usr/bin/rcmd \
 	 BASECFLAGS="-g -O -DALTOS_SYSTEM_V -DSIGSTOP=SIGKILL" \
-	 BASELDFLAGS="-lsocket -lrpc -lgen -lcrypt -lxenix" \
+	 BASELDFLAGS="../c-client/c-client.a -lsocket -lrpc -lgen -lcrypt -lxenix" \
 	 RANLIB=true CC=gcc
 
 gh9:	# GCC HP-UX9.x
@@ -303,6 +311,7 @@
 	 MAILSPOOL=/usr/mail \
 	 RSHPATH=/usr/bin/remsh \
 	 BASECFLAGS="-g -O2" \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 RANLIB=true CC=gcc
 
 ghp:	# GCC HP-UX
@@ -312,6 +321,7 @@
 	 ACTIVEFILE=/var/news/active \
 	 RSHPATH=/usr/bin/remsh \
 	 BASECFLAGS="-g -O2" \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 RANLIB=true CC=gcc
 
 gs5:	# GCC 2.7.1 (95q4) SCO Open Server 5.0.x
@@ -322,7 +332,7 @@
 	 ACTIVEFILE=/var/lib/news/active \
 	 RSHPATH=/usr/bin/rcmd \
 	 BASECFLAGS="-O3 -belf -I/usr/include -L/lib" \
-	 BASELDFLAGS="-lsocket -lcrypt -lprot -lx -ltinfo -lm" \
+	 BASELDFLAGS="../c-client/c-client.a -lsocket -lcrypt -lprot -lx -ltinfo -lm" \
 	 RANLIB=true CC=gcc
 
 # Is the bizarre MAKEFLAGS= needed here?
@@ -333,6 +343,7 @@
 	 MAILSPOOL=/usr/mail \
 	 RSHPATH=/usr/bsd/rsh \
 	 BASECFLAGS="-g -O2" \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 RANLIB=true CC=gcc
 
 gso:	# GCC Solaris
@@ -342,21 +353,21 @@
 	 ACTIVEFILE=/usr/share/news/active \
 	 RSHPATH=/usr/bin/rsh \
 	 BASECFLAGS="-g -O2" \
-	 BASELDFLAGS="-lsocket -lnsl -lgen" \
+	 BASELDFLAGS="../c-client/c-client.a -lsocket -lnsl -lgen" \
 	 RANLIB=true CC=gcc
 
 gsu:	# GCC SUN-OS
 	$(BUILD) `cat EXTRASPECIALS` OS=sun \
 	 CRXTYPE=nfs \
 	 BASECFLAGS="-g -O2" \
-	 BASELDFLAGS="-ldl" \
+	 BASELDFLAGS="../c-client/c-client.a -ldl" \
 	 CC=gcc
 
 gul:	# GCC Ultrix
 	$(BUILD) `cat EXTRASPECIALS` OS=ult \
 	 SIGTYPE=psx CHECKPW=ult CRXTYPE=nfs \
 	 BASECFLAGS="-g -O" \
-	 BASELDFLAGS="-lauth -lc" \
+	 BASELDFLAGS="../c-client/c-client.a -lauth -lc" \
 	 CC=gcc
 
 hpp:	# HP-UX 9.x
@@ -365,7 +376,7 @@
 	 MAILSPOOL=/usr/mail \
 	 RSHPATH=/usr/bin/remsh \
 	 BASECFLAGS="-g -Aa -D_HPUX_SOURCE" \
-	 BASELDFLAGS="-lnet -lV3" \
+	 BASELDFLAGS="../c-client/c-client.a -lnet -lV3" \
 	 RANLIB=true
 
 hpx:	# HP-UX 10.x
@@ -375,7 +386,7 @@
 	 ACTIVEFILE=/var/news/active \
 	 RSHPATH=/usr/bin/remsh \
 	 BASECFLAGS="-g -Ae" \
-	 BASELDFLAGS="-lnet -lV3" \
+	 BASELDFLAGS="../c-client/c-client.a -lnet -lV3" \
 	 RANLIB=true
 
 isc:	# Interactive
@@ -384,7 +395,7 @@
 	 SPOOLDIR=/var/spool MAILSPOOL=/var/mail \
 	 ACTIVEFILE=/var/spool/news/active \
 	 BASECFLAGS="-Xp -D_SYSV3" \
-	 BASELDFLAGS="-linet -lnsl_s -lgen -lx -lsec -liberty" \
+	 BASELDFLAGS="../c-client/c-client.a -linet -lnsl_s -lgen -lx -lsec -liberty" \
 	 RANLIB=true
 
 lnp:	# Linux Pluggable Authentication modules
@@ -393,8 +404,20 @@
 	 SPOOLDIR=/var/spool \
 	 ACTIVEFILE=/var/lib/news/active \
 	 RSHPATH=/usr/bin/rsh \
-	 BASECFLAGS="-g -fno-omit-frame-pointer -O6" \
-	 BASELDFLAGS="-lpam -ldl"
+	 BASECFLAGS="-g -fno-omit-frame-pointer -O2" \
+	 BASELDFLAGS="../c-client/c-client.a -lpam -ldl"
+
+lnps:	# Linux Pluggable Authentication modules (c-client as shared lib)
+	$(BUILD) `cat EXTRASPECIALS` OS=lnx \
+	 SIGTYPE=psx CHECKPW=pam CRXTYPE=nfs \
+	 SPOOLDIR=/var/spool \
+	 ACTIVEFILE=/var/lib/news/active \
+	 RSHPATH=/usr/bin/rsh \
+	 BASECFLAGS="-fPIC -g -fno-omit-frame-pointer -O2 -DNFSKLUDGE" \
+	 ARCHIVE="libc-client.so" \
+	 BASELDFLAGS="-L../c-client -lc-client -lpam -ldl -lc" \
+	 ARRC="ld -shared -soname libc-client.so.$(VERSION) -lpam -ldl -lc -o" \
+	 RANLIB=true
 
 lnx:	# Linux non-shadow passwords
 	@echo You are building for traditional Linux *without* shadow
@@ -406,6 +429,7 @@
 	 SPOOLDIR=/var/spool \
 	 ACTIVEFILE=/var/lib/news/active \
 	 RSHPATH=/usr/bin/rsh \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 BASECFLAGS="-g -O"
 
 lyn:	# LynxOS
@@ -419,6 +443,7 @@
 mct:	# MachTen - CRXTYPE=nfs doesn't work (at least not on 2.2)
 	$(BUILD) `cat EXTRASPECIALS` OS=$@ \
 	 SPOOLDIR=/var/spool \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 BASECFLAGS="-g -O -pipe"
 
 mnt:	# Mint
@@ -427,6 +452,7 @@
 	 SPOOLDIR=/var/spool \
 	 ACTIVEFILE=/var/lib/news/active \
 	 RSHPATH=/usr/bin/rsh \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 BASECFLAGS="-g -O"
 
 neb:	# NetBSD
@@ -436,7 +462,7 @@
 	 ACTIVEFILE=/var/db/news/active \
 	 RSHPATH=/usr/bin/rsh \
 	 BASECFLAGS="-g -O -pipe" \
-	 BASELDFLAGS="-lcrypt"
+	 BASELDFLAGS="../c-client/c-client.a -lcrypt"
 
 nec:	# NEC UX
 	$(BUILD) `cat EXTRASPECIALS` OS=sv4 \
@@ -445,17 +471,19 @@
 	 ACTIVEFILE=/var/news/lib/active \
 	 RSHPATH=/usr/bin/rsh \
 	 BASECFLAGS="-g -Kopt=2 -KOlimit=2000" \
-	 BASELDFLAGS="-lsocket -lnsl -lgen" \
+	 BASELDFLAGS="../c-client/c-client.a -lsocket -lnsl -lgen" \
 	 RANLIB=true CC=/usr/abiccs/bin/cc
 
 nxt:	# NEXTSTEP
 	$(BUILD) `cat EXTRASPECIALS` OS=$@ \
 	 CRXTYPE=nfs \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 BASECFLAGS="-g -O -pipe"
 
 nx3:	# NEXTSTEP 3.0 single threaded
 	$(BUILD) `cat EXTRASPECIALS` OS=nxt \
 	 CRXTYPE=nfs \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 BASECFLAGS="-g -O -pipe -Wall"
 	echo "void malloc_singlethreaded (void);" >> linkage.h
 	echo "  malloc_singlethreaded ();" >> linkage.c
@@ -464,6 +492,7 @@
 	$(BUILD) `cat EXTRASPECIALS` OS=$@ \
 	 SIGTYPE=psx CRXTYPE=nfs \
 	 SPOOLDIR=/var/spool \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 BASECFLAGS="-g3 -O2 -Olimit 1500"
 
 # Note: sia_become_user() used by LOGINPW=os4 doesn't seem to work right.  The
@@ -473,6 +502,7 @@
 	$(BUILD) `cat EXTRASPECIALS` OS=$@ \
 	 SIGTYPE=psx CHECKPW=os4 LOGINPW=os4 CRXTYPE=nfs \
 	 SPOOLDIR=/var/spool \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 BASECFLAGS="-g3 -std0 -O2"
 
 ptx:	# PTX
@@ -481,12 +511,13 @@
 	 MAILSPOOL=/usr/mail \
 	 RSHPATH=/usr/bin/resh \
 	 BASECFLAGS="-Wc,-O3 -Wc,-seq -Dprivate=PRIVATE" \
-	 BASELDFLAGS="-lseq -lsec -lsocket -linet -lnsl -lgen" \
+	 BASELDFLAGS="../c-client/c-client.a -lseq -lsec -lsocket -linet -lnsl -lgen" \
 	 RANLIB=true
 
 pyr:	# Pyramid
 	$(BUILD) `cat EXTRASPECIALS` OS=$@ \
 	 CRXTYPE=nfs \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 BASECFLAGS="-g -Dconst="
 
 qnx:	# QNX
@@ -494,11 +525,12 @@
 	 CHECKPW=psx LOGINPW=old \
 	 RSHPATH=/usr/ucb/rsh \
 	 BASECFLAGS="-Otax -g -Dunix=1 -D_POSIX_SOURCE" \
-	 BASELDFLAGS="-g -N128k -llogin -lsocket -lunix"
+	 BASELDFLAGS="../c-client/c-client.a -g -N128k -llogin -lsocket -lunix"
 
 s40:	# SUN-OS 4.0
 	$(BUILD) `cat EXTRASPECIALS` OS=$@ \
 	 CRXTYPE=nfs \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 BASECFLAGS="-g -Dconst="
 
 sc5:	# SCO Open Server 5.0
@@ -509,7 +541,7 @@
 	 ACTIVEFILE=/var/lib/news/active \
 	 RSHPATH=/usr/bin/rcmd \
 	 BASECFLAGS="-O3 -s" \
-	 BASELDFLAGS="-lsocket -lcrypt -lprot -lx -ltinfo -lm" \
+	 BASELDFLAGS="../c-client/c-client.a -lsocket -lcrypt -lprot -lx -ltinfo -lm" \
 	 RANLIB=true
 
 sco:	# Santa Cruz Operation
@@ -518,7 +550,7 @@
 	 CREATEPROTO=mmdfproto EMPTYPROTO=mmdfproto \
 	 RSHPATH=/usr/bin/rcmd \
 	 BASECFLAGS="-O3" \
-	 BASELDFLAGS="-lsocket -lprot -lcrypt_i -lx -los" \
+	 BASELDFLAGS="../c-client/c-client.a -lsocket -lprot -lcrypt_i -lx -los" \
 	 RANLIB=true LN=ln
 
 # Notes:
@@ -531,6 +563,7 @@
 	 SIGTYPE=sv4 CRXTYPE=nfs \
 	 MAILSPOOL=/usr/mail \
 	 RSHPATH=/usr/bsd/rsh \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 BASECFLAGS="-g3 -O2 -Olimit 8192" \
 	 RANLIB=true
 
@@ -539,6 +572,7 @@
 	 SIGTYPE=sv4 CRXTYPE=nfs \
 	 MAILSPOOL=/usr/mail \
 	 RSHPATH=/usr/bsd/rsh \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 BASECFLAGS="-g3 -O2 -woff 1048,1110,1116" \
 	 RANLIB=true
 
@@ -551,7 +585,7 @@
 	 ACTIVEFILE=/var/news/active \
 	 RSHPATH=/usr/bin/remsh \
 	 BASECFLAGS="-g -Ae" \
-	 BASELDFLAGS="-lnet -lV3 -lsec" \
+	 BASELDFLAGS="../c-client/c-client.a -lnet -lV3 -lsec" \
 	 RANLIB=true
 
 slx:	# Secure Linux
@@ -564,7 +598,7 @@
 	 ACTIVEFILE=/var/lib/news/active \
 	 RSHPATH=/usr/bin/rsh \
 	 BASECFLAGS="-g -fno-omit-frame-pointer -O6" \
-	 BASELDFLAGS="-lcrypt"
+	 BASELDFLAGS="../c-client/c-client.a -lcrypt"
 
 sl4:	# Secure Linux using libc4
 	@echo You are building for libc4 versions of Secure Linux
@@ -576,7 +610,7 @@
 	 ACTIVEFILE=/var/lib/news/active \
 	 RSHPATH=/usr/bin/rsh \
 	 BASECFLAGS="-g -fno-omit-frame-pointer -O6" \
-	 BASELDFLAGS="-lshadow"
+	 BASELDFLAGS="../c-client/c-client.a -lshadow"
 
 sl5:	# Secure Linux using libc5
 	@echo You are building for libc5 versions of Secure Linux
@@ -587,6 +621,7 @@
 	 SPOOLDIR=/var/spool \
 	 ACTIVEFILE=/var/lib/news/active \
 	 RSHPATH=/usr/bin/rsh \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 BASECFLAGS="-g -fno-omit-frame-pointer -O6"
 
 snx:	# Siemens Nixdorf SINIX and Reliant UNIX
@@ -596,7 +631,7 @@
 	 ACTIVEFILE=/usr/share/news/active \
 	 RSHPATH=/usr/bin/rsh \
 	 BASECFLAGS="-g -D_SYS_CLOCK_H -Dconst=" \
-	 BASELDFLAGS="-lsocket -lnsl -lgen" \
+	 BASELDFLAGS="../c-client/c-client.a -lsocket -lnsl -lgen" \
 	 RANLIB=true
 
 # Note: It is a long and disgusting story about why cc is set to ucbcc.  You
@@ -641,26 +676,26 @@
 	 ACTIVEFILE=/usr/share/news/active \
 	 RSHPATH=/usr/bin/rsh \
 	 BASECFLAGS="-g -O2" \
-	 BASELDFLAGS="-lsocket -lnsl -lgen" \
+	 BASELDFLAGS="../c-client/c-client.a -lsocket -lnsl -lgen" \
 	 RANLIB=true CC=ucbcc
 
 sos:	# Secure OSF/1
 	$(BUILD) `cat EXTRASPECIALS` OS=$@ \
 	 SIGTYPE=psx CHECKPW=sec LOGINPW=sec CRXTYPE=nfs \
 	 BASECFLAGS="-g3 -O2 -Olimit 1500" \
-	 BASELDFLAGS="-lsecurity -laud"
+	 BASELDFLAGS="../c-client/c-client.a -lsecurity -laud"
 
 ssn:	# Secure SUN-OS
 	$(BUILD) `cat EXTRASPECIALS` OS=sun \
 	 CHECKPW=ssn CRXTYPE=nfs \
 	 BASECFLAGS="-g -Dconst=" \
-	 BASELDFLAGS="-ldl"
+	 BASELDFLAGS="../c-client/c-client.a -ldl"
 
 sun:	# SUN-OS
 	$(BUILD) `cat EXTRASPECIALS` OS=$@ \
 	 CRXTYPE=nfs \
 	 BASECFLAGS="-g -Dconst=" \
-	 BASELDFLAGS="-ldl"
+	 BASELDFLAGS="../c-client/c-client.a -ldl"
 
 sv2:	# SVR2
 	@echo You are being *very* optimistic!
@@ -669,7 +704,7 @@
 	 MAILSPOOL=/usr/mail \
 	 RSHPATH=/usr/bin/remsh \
 	 BASECFLAGS="-Dconst= -DSYSTEM5 -DSHORT_IDENT -I/usr/ethernet/include" \
-	 BASELDFLAGS="-lnet" \
+	 BASELDFLAGS="../c-client/c-client.a -lnet" \
 	 RANLIB=true LN=ln
 
 sv4:	# SVR4
@@ -679,14 +714,14 @@
 	 ACTIVEFILE=/usr/share/news/active \
 	 RSHPATH=/usr/bin/resh \
 	 BASECFLAGS="-g -Dconst=" \
-	 BASELDFLAGS="-lsocket -lnsl -lgen" \
+	 BASELDFLAGS="../c-client/c-client.a -lsocket -lnsl -lgen" \
 	 RANLIB=true
 
 ult:	# Ultrix
 	$(BUILD) `cat EXTRASPECIALS` OS=$@ \
 	 SIGTYPE=psx CHECKPW=ult CRXTYPE=nfs \
 	 BASECFLAGS="-g3 -O2 -Olimit 1500 -Dconst=" \
-	 BASELDFLAGS="-lauth -lc"
+	 BASELDFLAGS="../c-client/c-client.a -lauth -lc"
 
 uw2:	# UnixWare SVR4.2
 	$(BUILD) `cat EXTRASPECIALS` OS=sv4 \
@@ -695,18 +730,19 @@
 	 ACTIVEFILE=/var/news/lib/active \
 	 RSHPATH=/usr/bin/rsh \
 	 BASECFLAGS="-g" \
-	 BASELDFLAGS="-lsocket -lnsl -lgen" \
+	 BASELDFLAGS="../c-client/c-client.a -lsocket -lnsl -lgen" \
 	 RANLIB=true
 
 vul:	# VAX Ultrix
 	$(BUILD) `cat EXTRASPECIALS` OS=ult \
 	 SIGTYPE=psx CHECKPW=ult CRXTYPE=nfs \
 	 BASECFLAGS="-O2 -Dconst=" \
-	 BASELDFLAGS="-lauth -lc"
+	 BASELDFLAGS="../c-client/c-client.a -lauth -lc"
 
 vu2:	# VAX Ultrix 2.3, etc.
 	$(BUILD) `cat EXTRASPECIALS` OS=$@ \
 	 CRXTYPE=nfs \
+	 BASELDFLAGS="../c-client/c-client.a" \
 	 BASECFLAGS="-O2 -Dconst= -Dvoid=char"

@@ -724,7 +760,7 @@
 # Cleanup
 
 clean:
-	sh -c '$(RM) auths.c crexcl.c flockbsd.c linkage.[ch] siglocal.c osdep*.[ch] *.o ARCHIVE *FLAGS *TYPE $(ARCHIVE) || true'
+	sh -c '$(RM) auths.c crexcl.c flockbsd.c linkage.[ch] siglocal.c osdep*.[ch] *.o ARCHIVE ARCHIVENAME *FLAGS *TYPE $(ARCHIVE) || true'

 # Dependencies
@@ -814,6 +851,7 @@
 	 -DRSHPATH=\"$(RSHPATH)\" -DLOCKPGM=\"$(LOCKPGM)\" > OSCFLAGS
 	echo $(BASELDFLAGS) $(EXTRALDFLAGS) > LDFLAGS
 	echo "$(ARRC) $(ARCHIVE) $(BINARIES);$(RANLIB) $(ARCHIVE)" > ARCHIVE
+	echo $(ARCHIVE) > ARCHIVENAME
 	./drivers $(EXTRADRIVERS) $(DEFAULTDRIVERS) dummy
 	./mkauths $(EXTRAAUTHENTICATORS) $(DEFAULTAUTHENTICATORS)
 	$(LN) os_$(OS).h osdep.h
--- uw-imap-2000.orig/src/mtest/Makefile
+++ uw-imap-2000/src/mtest/Makefile
@@ -32,20 +32,20 @@

 C = ../c-client
-CCLIENTLIB = $C/c-client.a
+CCLIENTLIB = $C/`cat $C/$ARCHIVENAME`
 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
 	$(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):

---

From: Mark Crispin <[email-masked]>
Date: Mon, 18 Sep 2000 10:27:26 -0700 (PDT)

Thank you for your suggested patch for shared libraries.

For support reasons, I have traditionally been hesitant to adopt shared
libraries.  The first problem is having some systems built with shared
libraries and some systems without; if this is done, it should be
comprehensive for all systems which support shared libraries.

The second problem is much more serious.  We have had in the past weird bugs
with shared libraries caused by a version skew.  We have at time wasted many
hours chasing after a bug, only to find that without telling us the site made
c-client, pico, etc. a shared library and that the program was picking up the
wrong version of the shared library.

The API between c-client and its callers is subject to change; there has to be
an effective method to protect against version skews, which means versioning
in the shared library filename.  It may sound extreme to have a separate libc-
client.so.2000.RC5, libc-client.so.2000.RC6, etc. but I don't see how it can
be safely avoided.  I shudder to think about what might have to be done with
betas...

The bottom line is that although shared libraries are something that we
eventually do want to do, it's not something we want to get into yet.

I am very concerned with the following statement which you have made:

> (particularly if you have many concurrent imapd processes)

This statement implies that Linux does not share code pages between multiple
instances of the same application.  I can not believe that this is true.  The
guys who work on Linux are too smart to make such an incredible design blunder
especially since every other UNIX variant gets it right.

It should not matter how many imapd processes that you have running.  The only
time that a shared library would make a difference is when different programs
use the same library.  So, on a server system which runs imapd and ipop3d
without shared libraries, the maximum number of instances of c-client in
memory would be 2.

Furthermore, it only really matters for long-lasting applications such as Pine
and imapd.  Since the imap-utils are ephemeral by nature, they may start up a
little bit faster if there's a shared library, but a non-shared version is
unlikely to cause a noticable difference in system memory use.

> and it makes

This is true; however as I noted above it's a double-edged sword.  It's also
possible to break multiple programs in one fell swoop.

This is particularly true of the imap-utils.  Some of these programs, most
notably tmail, use internal mechanisms and are *very* sensitive to the version
of c-client that they are built with.

---

From: "Jaldhar H. Vyas" <[email-masked]>
Date: Mon, 18 Sep 2000 17:20:18 -0400 (EDT)

> comprehensive for all systems which support shared libraries.

Unfortunately I don't currently have access to many platforms otherwise I
would do this for you.  I suspect it wouldn't be that hard especially for
platforms that use gcc.

> wrong version of the shared library.

For us this isn't so much of a problem because our packages can have
versioned dependencies.  I.e I can say a package depends on libc-client4.5
only and the user would get an error if he didn't have the right version
installed.  (Actually if he were using our package management tool
apt-get, it would offer to install the correct library package for
him.)  RPM. Solaris packages etc. work the same way.
 
I can see it would be a problem for people people who do not have or use a
decent package management system--if they aren't careful.  But I suspect
such people have developed their own schemes for keeping track of
versions.  If they haven't then its' not your fault if things break all
over the place.

> be safely avoided.  I shudder to think about what might have to be done with

Isn't that what exactly what the soname is for?  In fact I do have
libc-client.so.4,7 and libc-client.so.2000 I don't see why that would be a
problem except it takes up a little extra diskspace.

If the API did change significantly wouldn't that cause even more problems
for people who had c-client linked statically into their apps?

> especially since every other UNIX variant gets it right.

It does I misspoke.  I do remember when I was benchmarking seeing some
difference in memory usage.  It may have been for some other reason.

> without shared libraries, the maximum number of instances of c-client in

These aren't the only programs that use c-client nowadays.  As the number
of such programs go up, the advantage of having a shared lib will become
greater.

> possible to break multiple programs in one fell swoop.

But realistically how often do you completely break things?  Far fewer (in
fact I can't remember one) than when you make incremental changes/bug
fixes etc.

> of c-client that they are built with.

That's why I made a seperate build target.  There's no reason why you
couldn't mix and match static and dynamic linking as the situation demands
it.

Mark, it's your call whether to accept the patch or not.  The Debian imap
package will continue using it anyway.  But I think it's something people
would want to use.

-- 
Jaldhar H. Vyas <[email-masked]>

---

From: "Jaldhar H. Vyas" <[email-masked]>
Date: Mon, 18 Sep 2000 17:29:58 -0400 (EDT)

There is a third-party maildir driver most recently maintained by David
R. Harris ([email-masked])  However he doesn't seem to be responding at that
address anymore.  Does anyone know if he has a new address? Or if someone
else is maintaining this driver now?

I have a couple of questions about this driver, the most important being
why does it not allow creating folders wbeginning with a dot?  Just a
convenience for the user (so he doesn't have to see all the dot-files in
his home directory when listing mailboxes,) or is there a more technical
reason?

Any information gratefully accepted.

---

From: Mark Crispin <[email-masked]>
Date: Mon, 18 Sep 2000 13:52:32 -0700 (PDT)

> package will continue using it anyway.  But I think it's something people

There's no question that c-client will be supported as a shared library.  The
only question is "when", not "if".