BUILD
上传用户:ycwykj01
上传日期:2007-01-04
资源大小:1819k
文件大小:16k
源码类别:

网络编程

开发平台:

Unix_Linux

  1.        UNIX BUILD NOTES
  2.      A change has been made from previous versions of the IMAP toolkit.
  3. There are no longer separate ANSI and non-ANSI source trees.  Nor is it
  4. possible to build directly on the source tree.  Instead, you *must* build
  5. through the top-level imap-4.7/Makefile, which will run a "process" step the
  6. first time and create the imap-4.7/c-client, imap-4.7/ipopd, and
  7. imap-4.7/imapd directories in which building actually takes place.
  8.      Before doing a make on UNIX, you should read imap-4.7/Makefile and see if
  9. your system type is known.  The various system types are three-letter codes.
  10. If your system type is known, then use this as the make option.  After the
  11. first time you do a make, this option is remembered in a file called OSTYPE,
  12. so just typing "make" suffices.
  13.      For example, if you are using a more or less modern Linux system, your
  14. system type is either slx (shadow passwords only) or lnp (PAM), and the
  15. appropriate command is:
  16. make slx (or make lnp)
  17.      There are other make options, described in imap-4.7/src/osdep/Makefile.
  18.      It's probably best to see if an existing port will work on your system
  19. before inventing a new port.  Try:
  20. sv4 generic SVR4
  21. a32 modern SVR4, SVR4 with gcc
  22. bsd basic 4.3 BSD
  23. nxt, mct, gul modern BSD, BSD with gcc
  24.      If you must invent a new port, you need to create an entry in
  25. imap-4.7/Makefile and imap-4.7/src/osdep/Makefile for your new port, as well as
  26. osdep/os_???.h and osdep/os_???.c files with the appropriate OS-dependent
  27. support for that system.  You also need to determine which setup process to
  28. use.  You should use the ua process unless you are sure that your compiler
  29. supports *ALL* aspects of ANSI C prototyping.  Note that some compilers, such
  30. as Ultrix, support some aspects of ANSI C but not others; c-client really
  31. beats on the full prototyping capability of ANSI C so you have to use the
  32. non-ANSI source tree for such systems.
  33.      If you send a new port back to us, we will make it available for others
  34. who use your particular system type.
  35.      The mbox driver is now enabled by default.  If the file "mbox" exists on
  36. the user's home directory and is in UNIX mailbox format, then when INBOX is
  37. opened this file will be selected as INBOX instead of the mail spool file.
  38. Messages will be automatically transferred from the mail spool file into the
  39. mbox file.  To disable this behavior, delete "mbox" from the EXTRADRIVERS list
  40. in the top-level Makefile and rebuild.
  41.      WARNING: The SVR2 (sv2) port is *incomplete*.  SVR2 does not appear to
  42. have any way to do ftruncate(), which is needed by the mbox, mbx, mmdf, mtx,
  43. tenex, and unix drivers.
  44.    UNIX INSTALLATION NOTES
  45.      Binaries from the build are:
  46. imap-4.7/mtest/mtest c-client testbed program
  47. imap-4.7/ipopd/ipop2d POP2 daemon
  48. imap-4.7/ipopd/ipop3d POP3 daemon
  49. imap-4.7/imapd/imapd IMAP4rev1 daemon
  50.      mtest is normally not used except by c-client developers.
  51. STEP 1: inetd setup
  52.      The ipop2d, ipop3d, and imapd daemons should be installed in a system
  53. daemon directory (in the following examples, /usr/local/etc is used), and
  54. invoked by your /etc/inetd.conf file with lines such as:
  55. pop stream tcp nowait root /usr/local/etc/ipop2d ipop2d
  56. pop3 stream tcp nowait root /usr/local/etc/ipop3d ipop3d
  57. imap stream tcp nowait root /usr/local/etc/imapd imapd
  58.      Note that different variants of UNIX have different versions of inetd,
  59. so you should verify the precise form of these commands (for example, some
  60. versions of inetd do not require the "nowait").
  61.      IMPORTANT NOTE: inetd has a limit of how many new connections it will
  62. allow in a certain interval, and when this limit is exceeded, it shuts down
  63. the server.  If you have anything beyond a small-scale server, you are
  64. probably going to run up against this limit.  You'll know when it happens;
  65. your syslog will give the misleading message "imap/tcp server failing
  66. (looping), service terminated" and users will complain that IMAP service is
  67. unavailable for the next 10 minutes.  Similarly with "pop3/tcp server
  68. failing"...
  69.      It must be emphasized that this is *NOT* a bug in the IMAP or POP
  70. servers, nor is it anything that I can "fix".  It is an inetd problem, and
  71. the only way to fix it is to change inetd's behavior.
  72.      By default, the parameters of this limit are (from inetd.c source code):
  73. #define TOOMANY         40              /* don't start more than TOOMANY */
  74. #define CNT_INTVL       60              /* servers in CNT_INTVL sec. */
  75. #define RETRYTIME       (60*10)         /* retry after bind or server fail */
  76. That is, no more than 40 connections (TOOMANY) in 60 seconds (CNT_INTL), and
  77. if exceeded, shut down the server for 10 minutes (RETRYTIME).  This was a
  78. good setting in the 1980s ARPAnet, but is much too small today.
  79.      Some versions of inetd allow you to see a higher maximum in the
  80. /etc/inetd.conf file.  Read "man inetd" and see if you see something like
  81. this in the text:
  82.      The wait/nowait entry is applicable to datagram sockets only [...]
  83.      [...]  The optional ``max'' suffix (separated from
  84.      ``wait'' or ``nowait'' by a dot) specifies the maximum number of server
  85.      instances that may be spawned from inetd within an interval of 60 sec-
  86.      onds. When omitted, ``max'' defaults to 40.
  87. If you see this, then edit the /etc/inetd.conf entry for imapd to be
  88. something like:
  89. imap stream tcp nowait.100 root /usr/local/etc/imapd imapd
  90.  (or, if you use TCP wrappers)
  91. imap stream tcp nowait.100 root /usr/local/etc/tcpd imapd
  92.      Otherwise, you'll need to edit the inetd source code to set TOOMANY to a
  93. higher value, then rebuild inetd.
  94. STEP 2: services setup
  95.      You may also have to edit your /etc/services (or Yellow Pages,
  96. NetInfo, etc. equivalent) to register these services, such as:
  97. pop 109/tcp
  98. pop3 110/tcp
  99. imap 143/tcp
  100. STEP 3: optional rimap setup
  101.      If you want to enable the rimap capability, which allows users with a
  102. suitable client and .rhosts file on the server to access IMAP services
  103. without transmitting her password in the clear over the network, you need
  104. to have /etc/rimapd as a link to the real copy of imapd.  Assuming you have
  105. imapd installed on /usr/local/etc as above:
  106. % ln -s /usr/local/etc/imapd /etc/rimapd
  107.      Technical note: rimap works by having the client routine tcp_aopen()
  108. invoke `rsh _host_ exec /etc/rimapd' in an child process, and then returning
  109. pipes to that process' standard I/O instead of a TCP socket.  You can set up
  110. `e-mail only accounts' by making the shell be something which accepts only
  111. that string and not ordinary UNIX shell commands.
  112. STEP 4: notes on privileges
  113.      Neither user "root", not any other UID 0 account, can log in via IMAP or
  114. POP.  "That's not a bug, it's a feature!"
  115.      This software is designed to run without privileges.  The mail spool
  116. directory must be protected 1777; that is, with world write and the sticky
  117. bit.  Of course, mail *files* should be protected 600!
  118.      An alternative to having the mail spool directory protected 1777, at the
  119. cost of some performance, is to use the external "mlock" program, available
  120. as part of the imap-utils package.  With mlock installed as /etc/mlock and
  121. setgid mail, the spool directory can be protected 775 with group mail.
  122. Please disregard this paragraph if you don't understand it COMPLETELY, and
  123. know EXACTLY what to do without question.
  124. STEP 5: SVR4 specific setup
  125.      There is one "gotcha" on System V Release 4 based systems such as
  126. Solaris.  These systems do not use the standard UNIX mail format, but rather a
  127. variant of that format that depends upon a bogus "Content-Length:" message
  128. header.  This is widely recognized to have been a terrible mistake.  One
  129. symptom of the problem is that under certain circumstances, a message may get
  130. broken up into several messages.  I'm also aware of security bugs caused by
  131. programs that foolishly trust "Content-Length:" headers with evil values.
  132.     To fix your system, edit your sendmail.cf to change the Mlocal line to
  133. have the -E flag.  A typical entry will lool like:
  134. Mlocal, P=/usr/lib/mail.local, F=flsSDFMmnPE, S=10, R=20, A=mail.local -d $u
  135.      NT/WIN32 BUILD AND INSTALLATION NOTES
  136.      I build using Visual C++ 6.0.  If you build with an earlier version of
  137. Visual C, you may need to install the Platform SDK (formerly called the Win32
  138. SDK) separately.  If you get errors while building os_nt.c that LogonUser() is
  139. undefined, it's a good bet that you don't have the Platform SDK installed
  140. and/or in your path properly.
  141.      There is also considerable debate about how new mail is to be snarfed.
  142. I am currently using something that seems to work with WinSMTP.  Look at
  143. the definition of MAILFILE in imap-4.7/src/osdep/nt/mailfile.h and at the
  144. sysinbox() function in imap-4.7/src/osdep/nt/env_nt.c to see what's there
  145. now, so you have a clue about how to hack it.
  146.      To build under NT, connect to the imap-4.7 directory and do:
  147. nmake -f makefile.nt
  148. The resulting binaries will be:
  149. imap-4.7mtestmtest.exe (testbed client)
  150. imap-4.7ipopdipop2d.exe POP2 server
  151. imap-4.7ipopdipop3d.exe POP3 server
  152. imap-4.7imapdimapd.exe IMAP4rev1 server
  153.      These servers are stdio servers.  I wrote a simple network listener
  154. for NT called inetlisn; currently it is available as:
  155. ftp://ftp.cac.washington.edu/mail/nt/inetlisn.tar
  156. To build this, use "nmake" after connecting to the inetlisn directory.
  157. inetlisn takes two arguments, the first being the port number and the second
  158. being the binary to run to serve a connection on that port, e.g.
  159. c:bininetlisn 143 c:mail_daemonsimapd
  160.      Note that NT imapd must be started as SYSTEM in order to be recognized as
  161. being "not logged in"; otherwise it will preauth as whatever user it is
  162. running as which is probably not what you want.  One way to have it run as
  163. system is to have inetlisn run by an AT command, e.g. if the time now is
  164. 2:05PM, try something like:
  165. AT 14:06 "c:bininetlisn 143 c:mail_daemonsimapd"
  166.      Bottom line: this is not plug-and-play on NT.  If you're not a hacker
  167. and/or are unwilling to invest the time to do some programming, you probably
  168. want to buy a commercial server for NT.
  169.      DOS/WIN16 BUILD NOTES
  170.      If you are building a DOS client, you will need a TCP/IP stack installed
  171. on your DOS system along with its development environment.  The currently
  172. supported stacks are Beame & Whiteside, PC-NFS, Novell, PC/IP, Waterloo, and
  173. Winsock.  mtest and a version of Pine called PC Pine run under DOS.
  174.       You do not use imap-4.7/Makefile under DOS, nor do you build any
  175. components other than c-client and mtest.  Merge the contents of
  176. imap-4.7/src/c-client, imap-4.7/src/charset, imap-4.7/src/mtest, and
  177. imap-4.7/src/osdep/dos onto a single directory on DOS and build from that.  The
  178. MAKE command on DOS takes an argument identifying the TCP/IP stack in use.  For
  179. example, do:
  180. MAKE MAKEFILE OS=WSK   (or MAKE -F MAKEFILE OS=WSK)
  181. to build for Winsock.  
  182.      If you write a program for DOS/Win16, you will probably have to write a
  183. replacement cache manager (look at mm_cache()) and otherwise disable most of
  184. c-client's caching.  Even so, memory limitations will be an ongoing problem,
  185. particularly with DOS, and you will have some severe performance problems.
  186. It's a bit better on Win16, but in my opinion you are better off writing a
  187. 32-bit program and telling your Win16 customers to upgrade to Windows 95 or at
  188. least install Win32s.
  189.      MACINTOSH BUILD NOTES
  190.      If you are building a Macintosh client, you will need MacTCP installed on
  191. your system as well as the MacTCP C includes and libraries.
  192.      You do not use imap-4.7/Makefile on the Mac, nor do you build any
  193. components other than c-client and mtest.  Merge the contents of
  194. imap-4.7/src/c-client, imap-4.7/src/charset, imap-4.7/src/mtest, and
  195. imap-4.7/src/osdep/mac onto a single directory on the Mac and build from that.
  196. mtext.sit.hqx is a THINK C project file and cute icon for building mtest,
  197. encoded with Binhex and StuffIt.
  198.      THINK C is a truly wretched product which help make me understand why
  199. Macintosh has lost most of its market share.  Not only does it do cretinous
  200. things such as barf about a cast in front of an lvalue, it also limits the size
  201. of code *or* data in a single file to 32K!  So much for having large character
  202. set tables.  Symantec says that "MacOS requires it, break up your files into
  203. smaller pieces" yet somehow gcc under MachTen contrives to compile C programs
  204. without subjecting the programmer to this idiocy.
  205.      As a result of this, I found myself obliged to comment out the #includes
  206. of the East Asian character sets in utf8.c in order to get it to build.  It's
  207. also necessary to break up some of the files, at least mail.c and imap4r1.c.
  208. Maybe you don't have to do this in CodeWarrior or whatever the new compiler is
  209. called, but I've pretty much given up on Macintosh.
  210.      If you use precompiled headers, you may get some compilation errors since
  211. some Apple symbols need to be redefined in order to get it to build under all
  212. versions of MacOS.  Try turning off the precompiled headers (so it will
  213. re-read the .h files) and see if it builds any better.
  214.      If you use a Mac C compiler with 2-byte ints (such as THINK C's normal
  215. mode) you will need to fix some bugs in the MacTCP C includes and libraries to
  216. prevent it from generating bad code, since those MacTCP files violate Apple's
  217. standards of always using explicit shorts or longs, never ints.  You could
  218. avoid this if you set 4-byte ints in THINK C; however, the ANSI and UNIX
  219. libraries in THINK C use 2-byte ints so you will also need to build 4-byte int
  220. versions of these.  c-client itself is 2-byte int or 4-byte int clean; it can
  221. be used in either mode.
  222.      The most important bug in the MacTCP files that you need to fix is in the
  223. file AddressXlation.h, you need to change the definition of the rtnCode member
  224. of the hostInfo structure to be long instead of int.  There are several other
  225. changes you need to make if you decide to compile dnr.c under THINK C instead
  226. of using the Apple-supplied object file; see me for details if you decide to
  227. undertake such an effort.  This is fixed in newer versions from Apple.
  228.      TOPS-20 BUILD NOTES
  229.      I have provided a c-client port for TOPS-20 systems, but you're on your
  230. own in terms of a nice TOPS-20 like main program.  Maybe someday some nice
  231. person will try porting Pine to TOPS-20.  I recently built mtest on TOPS-20
  232. (thank you, XKL!!), so the sources are known to compile with the ANSI C
  233. version of KCC.
  234.      You do not use imap-4.7/Makefile under TOPS-20, nor do you build any
  235. components other than c-client and mtest.  Merge the contents of
  236. imap-4.7/src/c-client, imap-4.7/src/charset, imap-4.7/src/mtest, and
  237. imap-4.7/src/osdep/tops-20 onto a single directory on TOPS-20 and build from
  238. that.  The command:
  239. DO BUILD.CTL
  240. will build the sources.  If you don't have MIC, then SUBMIT BUILD.CTL and let
  241. BATCON execute it.
  242.      KCC loves to give lots of diagnostics about unused parameters.  That's
  243. perfectly alright; just ignore them.
  244.        VMS BUILD NOTES
  245.       You do not use imap-4.7/Makefile under VMS, nor do you build any
  246. components other than c-client and mtest.  Merge the contents of
  247. imap-4.7/src/c-client, imap-4.7/src/charset, imap-4.7/src/mtest, and
  248. imap-4.7/src/osdep/vms onto a single directory on VMS and build from that.  The
  249. command to build it is:
  250. @BUILD MULTINET
  251. or @BUILD NETLIB
  252. If you just do @BUILD it will build with dummy TCP code, and since only TCP
  253. based drivers are provided here this isn't too useful.
  254.      If you aren't on the Pacific coast of the US or Canada, you probably will
  255. need to change the wired-in timezone in the BUILD.COM file.  Apparently, the
  256. wonderful VMS system that DEC loves so much doesn't maintain any concept of
  257. time zone; the VMS C compiler returns a null pointer from gmtime()!
  258.      Otherwise you're pretty much on your own here.
  259.       AMIGA BUILD AND INSTALLATION NOTES
  260.      See the UNIX build notes.  I can't tell you much more than that, since
  261. the Amiga code was contributed.
  262.        WCE BUILD NOTES
  263.      I build using Visual C++ 6.0 with the WCE extensions.  The current code
  264. has SH3 wired in for the compiler building.
  265.      To build under NT, connect to the imap-4.7 directory and do:
  266. nmake -f makefile.wce
  267.      The only binary produced is a cclient.lib file.  I haven't gotten as far
  268. as building mtest on WCE, mainly because I don't have a stdlib library.
  269.        OS2 BUILD NOTES
  270.      The OS2 port is incomplete.  There are no plans to continue work on it.