home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / mail / sendmail / 3165 < prev    next >
Encoding:
Text File  |  1993-01-12  |  2.4 KB  |  66 lines

  1. Newsgroups: comp.mail.sendmail
  2. Path: sparky!uunet!stanford.edu!nntp.Stanford.EDU!yeahbut.stanford.edu!mosedale
  3. From: mosedale@yeahbut.stanford.edu (Dan Mosedale)
  4. Subject: Re: Default UUCP name & possible sendmail bugs
  5. Message-ID: <1993Jan13.013241.1652@leland.Stanford.EDU>
  6. Sender: news@leland.Stanford.EDU (Mr News)
  7. Organization: Stanford Yeast Genome Project
  8. References: <1993Jan12.224305.26275@leland.Stanford.EDU>
  9. Date: Wed, 13 Jan 93 01:32:41 GMT
  10. Lines: 54
  11.  
  12. I wrote:
  13. >
  14. > [...]
  15. >
  16. >    /etc/aliases is on the root partition, and is symlink to
  17. >    /usr/local/init/aliases.  /usr/local/init is an NFS partition
  18. >    which I'd like to mount read-only.
  19. >
  20. >The problem is this: when Sendmail (invoked with -bi or as newaliases)
  21. >goes to build the aliases.{dir,pag} databases, it refuses to build
  22. >them if /usr/local/init is mounted read-only (even though the database
  23. >files should be written to /etc, in this instance).
  24. >
  25. >I assume what is going on is that sendmail first stat()'s
  26. >/etc/aliases, and then finds the parent-dir of the stat'ed directory
  27. >and does a writability check on that, rather than simply checking the
  28. >writability of the directory where aliases ostensibly lives (i.e
  29. >/etc).
  30.  
  31. Turns out I was wrong here.  A browse through alias.c revealed the
  32. following code fragments:
  33.  
  34. 389           * We can't get an exclusive lock on a file that isn't opened for
  35. 390           * writing on most systems - sigh!
  36. 391           */
  37. 392          if ((af = fopen(AliasFile, "r+")) == NULL)
  38. 393          {
  39. 394                  if (tTd(27, 1))
  40. 395                          printf("Can't open %s\n", AliasFile);
  41.  
  42. [...]
  43.  
  44. 399          }
  45. 400  
  46. 401  #ifdef DBM
  47. 402          /* see if someone else is rebuilding the alias file already */
  48. 403          if (flock(fileno(af), LOCK_EX | LOCK_NB) < 0 &&
  49. 404              (errno == EWOULDBLOCK || errno == EAGAIN))
  50.  
  51. Now on SunOS, the man page for flock() says this:
  52.  
  53. > BUGS
  54. >      Locks obtained through the flock() mechanism are known  only
  55. >      within the system on which they were placed.  Thus, multiple
  56. >      clients may successfully acquire exclusive locks on the same
  57. >      remote  file.   If  this behavior is not explicitly desired,
  58. >      the fcntl(2V)  or  lockf(3)  system  calls  should  be  used
  59. >      instead;  these make use of the services of the network lock
  60. >      manager (see lockd(8C)).
  61.  
  62. Is there some reason the aliases file couldn't be locked using fcntl()
  63. or lockf()? 
  64.  
  65. -Dan
  66.