yppasswd() return values

yppasswd() return values

Post by Matt Schro » Fri, 16 Jul 1993 01:00:59



Under SunOS 4.1.2 with patched rpc.yppasswdd:

We're expecting lots of people to try to change their passwords when
they get back in the fall.  If two people try to change their password
within a relatively short period of time (with yppasswd), an error
message, stating that the password file is "busy", is produced.

The yppasswd() library routine returns 0 on success, according to
yppasswd(3).  How about on failure?  How is yppasswd(1) able to
distinguish between a "busy" password file and an incorrect password
error?  How does rpc.yppasswdd lock the password file?  I've traced it
and seen it create and then remove /etc/ptmp--is this it?  I've also
gotten the password file busy message after /etc/ptmp has been
removed.  Do all of the programs in the NIS Makefile that read from
the password file also use /etc/ptmp?

Finally, I'm sure other sites have had problems with many users trying
to change their password at once.  One solution I've thought of is to
create some sort of server application that has exclusive access to
the password file (and is the only program that will ever do a make in
/var/yp) but this doesn't seem like a good solution.

Any advice is welcome.  Please answer via email; if there is interest,
I'll summarize responses.

Matt

 
 
 

yppasswd() return values

Post by Gary Mil » Fri, 16 Jul 1993 14:43:24



Quote:>Under SunOS 4.1.2 with patched rpc.yppasswdd:
>The yppasswd() library routine returns 0 on success, according to
>yppasswd(3).  How about on failure?

It returns numbers between 1 and 20, which can be used to index into
an array of error messages.  Do a strings on /bin/passwd to see the
messages.  Here are the first few:

No error
Error from pre 4.1 version
Password incorrect
No changeable fields were changed

Quote:>     How does rpc.yppasswdd lock the password file?  I've traced it
>and seen it create and then remove /etc/ptmp--is this it?

All versions use PASSWDFILE.ptmp as a lock file and a temporary file.
Recent patches for yppasswdd also use /etc/ptmp as a lock file.
`vipw' respects /etc/ptmp.

Quote:>                                                    I've also
>gotten the password file busy message after /etc/ptmp has been
>removed.  Do all of the programs in the NIS Makefile that read from
>the password file also use /etc/ptmp?

Nothing in the NIS Makefile does locking.  If you do a second make while
the first one is running, you will wind up with an empty passwd map.
The recently-patched yppasswdd will check to see if its own make has completed.
It won't protect against another process doing the make.

Quote:>Any advice is welcome.  Please answer via email; if there is interest,

Oops, too late.
--
-Gary Mills-         -Networking Group-          -U of M Computer Services-

 
 
 

1. Default return value for when return() is not explicitly used on SC5.0

I wrote the routine below to test some code in one of our
applications. This snippet exactly mirrors what is happening in our
real code. It was compiled on a sun-4 ultra platfrom using SC5.0 under
Solaris 5.6. If I pass the integer value of 2 as the first arguement
then control falls through the switch statement, and out of the
routine without explicitly returning any value. The compiler does not
report this as either a warning or an error. So far I have not been
unable to find anywhere in the documentation that specifies what the
return value from a routine will be if it is not explicitly given a
value to return. In my test, I wrote a short main to pass the values
(1,1), (1,2), and(2,1) to switchTest(int, int). The first 2 calls
returned the predictable results of TRUE and FALSE. The third call
also returned a FALSE, but that does not satisfy me that the return
value will always be FALSE.

bool switchTest(int num, int num2)
{
  switch(num) {
    case 1:
      switch(num2) {
      case 1:
        printf("CASE 1: Num = %d, Num2 = %d\n", num, num2);
        return(TRUE);
        break;
      default:
        printf("DEFAULT CASE: Num = %d, Num2 = %d\n", num, num2);
        return(FALSE);
      }
  }

Does anybody have the precise information on what the behaviour for
this compiler is defined to be for this situation?

Nick

2. 2 NIC in same Server

3. reliability of ftp return value

4. Linux and OPTI 486DX2-66 chipset

5. Analyzing return value

6. AMANDA setup

7. Return Value 255 in Shells

8. HELP Wiped Out /etc/conf.modules

9. getting the return value of a command executed on another host

10. Returning values to a shell script?

11. can a script return a value other than exit status

12. hard_start_transmit return value and oops

13. return value