Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Mar 1997 04:00:07 -0600 (CST)
From:      Tim Tsai <tim@futuresouth.com>
To:        freebsd-questions@freebsd.org
Subject:   poppassd & passwd problems (2.2)
Message-ID:  <199703281000.EAA22595@shell.futuresouth.com>

next in thread | raw e-mail | index | archive | help
  We had recently upgraded to 2.2 and our www->passwd interface stopped
working.  Turns out that a few things had changed in passwd that caused
a number of problems.  First, passwd -y sends this message:

"Changing NIS password for tim on tim.blah.com."
"Old Password: "

  Where the second line is different than the standard "Old password:".
This is the first thing that confused poppassd.  It'd be nice if these
messages do not change from version to version.

  Second, the new passwd program calls getlogin() which fails when
called by poppassd which is in turned called by inetd.  I am not
familiar enough with the issues to give any explaination but a
setlogin() at the appropriate place fixed the problem.

  I am enclosing a diff to the popassd.c.orig in the ports collection if
anybody cares.  I have tested the program for both local passwords and
NIS passwords.  Please let me know if there are any problems with any of
this.

  Thanks,

  Tim

-- poppassd.diff --
16c16
<  * password, new password) and executes /usr/bin/passwd, talking to it over
---
>  * password, new password) and executes /bin/passwd, talking to it over
20c20
<  * protocol /usr/bin/passwd and cohorts may use (and which isn't documented).
---
>  * protocol /bin/passwd and cohorts may use (and which isn't documented).
32c32
<  * happens when you run /usr/bin/passwd while connected via telnet or rlogin.
---
>  * happens when you run /bin/passwd while connected via telnet or rlogin.
50c50
<  * by W. Richard Stevens). The code to report /usr/bin/passwd error messages
---
>  * by W. Richard Stevens). The code to report /bin/passwd error messages
146,148c146,150
<    {
<     "Changing local password for *.\nOld password:",
<     "Changing NIS password for * on *.\nOld Password: ",
---
>    {"Old password:",
>     "Changing password for *.\nOld password:",
>     "Changing password for * on *.\nOld password:",
>     "Changing NIS password for * on *.\nOld password:",
>     "Changing password for *\n*'s Old password:",
152,153c154,155
<    {
<     "\nNew password:",
---
>    {"\nNew password:",
>     "\n*'s New password:",
157c159
<    {
---
>    {"\nRe-enter new password:",
158a161,163
>     "\nEnter the new password again:",
>     "\n*Re-enter *'s new password:",
>     "\nVerify:",
162,164c167,168
<    {
<     "\npasswd: rebuilding the database...\npasswd: done\n",
<     "\n\nNIS password has been changed on *\n",
---
>    {"\n",
>     "NIS entry changed on *\n",
166a171
> 
184c189,193
<      openlog("poppassd", LOG_PID, LOG_LOCAL2);
---
>      if (openlog ("poppassd", LOG_PID, LOG_LOCAL2) < 0)
>      {
> 	  WriteToClient ("500 Can't open syslog.");
> 	       exit (1);
>      }
204c213
<      if ((pw = getpwnam (user)) == NULL || setlogin(user) == -1)
---
>      if ((pw = getpwnam (user)) == NULL)
206c215
< 	  WriteToClient ("500 Invalid user, %s.", user);
---
> 	  WriteToClient ("500 Unknown user, %s.", user);
212d220
< 	  syslog(LOG_ERR, "Incorrect password from %s", user);
259c267
< 	       syslog (LOG_ERR, "wait for /usr/bin/passwd child failed: %m");
---
> 	       syslog (LOG_ERR, "wait for /bin/passwd child failed: %m");
266c274
< 	       syslog (LOG_ERR, "wrong child (/usr/bin/passwd) waited for!");
---
> 	       syslog (LOG_ERR, "wrong child (/bin/passwd waited for!");
273c281
< 	       syslog (LOG_ERR, "child (/usr/bin/passwd) killed?");
---
> 	       syslog (LOG_ERR, "child (/bin/passwd) killed?");
280c288
< 	       syslog (LOG_ERR, "child (/usr/bin/passwd) exited abnormally");
---
> 	       syslog (LOG_ERR, "child (/bin/passwd) exited abnormally");
301c309
< 	   * about to exec /usr/bin/passwd with is setuid root anyway, but this
---
> 	   * about to exec /bin/passwd with is setuid root anyway, but this
319c327
<  * Do child stuff - set up slave pty and execl /usr/bin/passwd.
---
>  * Do child stuff - set up slave pty and execl /bin/passwd.
382c390
<    /* Fork /usr/bin/passwd. */
---
>    /* Fork /bin/passwd. */
384,385c392,393
<    if (execl("/usr/bin/passwd", "passwd", user, (char*)0) < 0) {
<       syslog(LOG_ERR, "can't exec /usr/bin/passwd: %m");
---
>    if (execl("/bin/passwd", "passwd", user, (char*)0) < 0) {
>       syslog(LOG_ERR, "can't exec /bin/passwd: %m");
403,406d410
<  *
<  * Modified by Stephen Melvin to allocate local space for static character
<  * array, rather than local space to pointer to constant string, which is
<  * not kosher and was crashing FreeBSD 1.1.5.1.
412c416
<    static char line[11];
---
>    static char *line = "/dev/ptyXX";
416d419
<    strcpy(line,"/dev/ptyXX");
468d470
< 	/*printf("Matching P1\n");/**/
474d475
< 	/*printf("Matching P2\n");/**/
480d480
< 	/*printf("Matching P3\n");/**/
488d487
<      sleep(2);
490d488
< 	/*printf("Matching P4\n");/**/
517,519c515
<  
<    /*printf("\nmatching \"%s\" and \"%s\"\n\n", str, pat);/**/
< 
---
>    
558c554
<  
---
>      
571d566
< 
574d568
< /* syslog(LOG_ERR, "read from child: %s",buf); */




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703281000.EAA22595>