I apologize for the length of this posting. The responses lead me
to assume that locking the yppasswd master is possible. It uses the
technique that passwd does. The problem is that the file created is
different under 4.1[.1] and the earlier OS versions. In fact, I am not
sure what the correct file is under 4.1 and on. For you people running
the earlier OS versions, you can safely(?) use "/etc/ptmp". Maybe someone
at sun will provide us with the answer to 4.1 and on.
strings /usr/etc/rpc.yppasswdd | grep ptmp ( on 4.1[.1] )
strings /usr/etc/rpc.yppasswdd | grep ptmp ( on 4.0.3 )
Mark Galbraith <email@example.com>
For Stergios :
To time for the perl version yet. "Real soon now" is what I
keep telling everyone. :-).
Nicky Ayoub firstname.lastname@example.org
Dept. of E.E Concordia University
Montreal QC. H3G 1M8 (514) 848-3107
From: Mike Raffety <email@example.com>
[ ** NB ** May not be true for 4.1 and on. -nicky ]
>yppasswdd uses the file /etc/ptmp regardless of the name of the file
>actually being updated (/etc/passwd or /etc/yppasswd or /etc/yp/passwd).
>One side effect of this is that the file that yppasswdd is updating
>must be on the same filesystem as /etc/ptmp will be, since the rename()
>system call is used to move /etc/ptmp to /etc/yppasswd (or whatever).
>Just make sure that the copy your perl script works on is named /etc/ptmp,
>and that will lock out the yppasswdd from attempting a simultaneous update.
From: Christopher RABSON <firstname.lastname@example.org>
> (The secret seems to be a lock-file called $DIR/passwd.ptmp,
> where $DIR is the value used in /var/yp/Makefile.)
> The rpc.yppasswdd (in SunOS 4.0.3, anyway) does an open on the
> ptmp file using the flags O_WRONLY|O_CREAT|O_EXCL. If the result is
> less than 0 and the value of errno is EEXIST, then you know the temp
> file is currently busy. If the open succeeds, you copy the real file
> to it, manipulate it, then move it into place as the real file. I
> think you would be safest using this method and not killing the
> yppasswdd. I don't know for sure what the path for the ptmp file
> would be with the SunOS 4.1[.1] version of yppasswdd.
From: Bill HEELAN <email@example.com>
> As far as I can tell, yes. I did a 'strings' on /usr/etc/rpc.yppasswd and
> found the strings ".ptmp". Then I ran a shell loop looking for the file
> $DIR/passwd.ptmp while running 'passwd' from a YP client -- and it
> appeared. I don't know whether it will always be "passwd.ptmp" or if it
> will base the lock file name on the name of the YP passwd file (e.g. if
> you called it yppasswd, instead).
PS. Be careful... It's Friday... -nicky
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:12 CDT