Bug 42359 - mail/poppassd breaks with recent versions of /usr/bin/passwd
Summary: mail/poppassd breaks with recent versions of /usr/bin/passwd
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-09-03 07:10 UTC by Andrew Flury
Modified: 2002-10-06 02:40 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Flury 2002-09-03 07:10:01 UTC
The poppassd port expects output from /usr/bin/passwd that doesn't match its current output.

Fix: 

On or around line 169 of poppassd.c (after the existing freebsd patch is applied), the following line should be inserted:

"\npasswd: updating the database...\npasswd: done\n",

That is the output of /usr/bin/passwd upon success... right now poppassd looks for "rebuilding" instead of "updating".
How-To-Repeat: Try using poppassd to change a password.  It'll report failure even though it successfully changed a password.
Comment 1 Andrew Stevenson 2002-09-03 07:53:39 UTC
On Mon, 2 Sep 2002, Andrew Flury wrote:

> The poppassd port expects output from /usr/bin/passwd that doesn't match
> its current output.

I'll take a look tonight if I can.

Thanks,

Andrew
Comment 2 Andrew Stevenson 2002-09-05 07:34:42 UTC
poppassd was broken because the prompts emitted from passwd changed
apparently with revision 1.6 of src/usr.sbin/vipw/pw_util.c and revision
1.9 of src/usr.bin/passwd/local_passwd.c. I can't quite understand how it
can have been broken that long but I no longer run the program personally
so I can't swear it hasn't been. Everyone should run ports/mail/poppwd
instead as it uses what should be a much more stable interface :-)

While I'm here make the port honour CFLAGS and LDFLAGS if set, remove an
apparently extraneous space from a patch and take away the commented out
debugging code that the existing patch puts in for some reason.

Thanks,

Andrew



diff -ruN /usr/ports/mail/poppassd/Makefile poppassd/Makefile
--- /usr/ports/mail/poppassd/Makefile	Tue Feb  6 02:11:02 2001
+++ poppassd/Makefile	Thu Sep  5 16:17:48 2002
@@ -7,6 +7,7 @@

 PORTNAME=	poppassd
 PORTVERSION=	4.0
+PORTREVISION=	1
 CATEGORIES=	mail
 MASTER_SITES=	ftp://ftp.qualcomm.com/eudora/servers/unix/password/
 DISTNAME=	pwserve-4
diff -ruN /usr/ports/mail/poppassd/files/patch-aa poppassd/files/patch-aa
--- /usr/ports/mail/poppassd/files/patch-aa	Mon Nov  4 07:45:24 1996
+++ poppassd/files/patch-aa	Thu Sep  5 16:14:04 2002
@@ -1,11 +1,13 @@
---- Makefile.orig	Sun Nov  3 15:27:42 1996
-+++ Makefile	Sun Nov  3 15:31:27 1996
+--- Makefile.orig	Thu Sep  5 16:11:10 2002
++++ Makefile	Thu Sep  5 16:13:58 2002
 @@ -1,11 +1,11 @@
 -BINDIR = /usr/etc
 +BINDIR = ${PREFIX}/libexec
  LIBDIR =
- CFLAGS = -g
- LFLAGS = -g
+-CFLAGS = -g
+-LFLAGS = -g
++CFLAGS?= -g
++LFLAGS?= ${LDFLAGS}
  CCM = cc -Em

  OBJECTS = poppassd.o
diff -ruN /usr/ports/mail/poppassd/files/patch-ab poppassd/files/patch-ab
--- /usr/ports/mail/poppassd/files/patch-ab	Sat Jul 28 17:20:49 2001
+++ poppassd/files/patch-ab	Thu Sep  5 16:07:40 2002
@@ -1,5 +1,5 @@
---- poppassd.c.orig	Mon Jun  7 19:34:23 1999
-+++ poppassd.c	Mon Jun  7 19:40:00 1999
+--- poppassd.c.orig	Thu Sep  5 11:44:07 2002
++++ poppassd.c	Thu Sep  5 16:07:09 2002
 @@ -13,11 +13,11 @@
   *
   * Doesn't actually change any passwords itself.  It simply listens for
@@ -39,21 +39,22 @@
 +    "Changing local password for *.\nOld password:",
      "Changing password for * on *.\nOld password:",
 -    "Changing NIS password for * on *.\nOld password:",
-+    "Changing NIS password for * on *.\nOld Password: ",
++    "Changing NIS password for * on *.\nOld Password:",
      "Changing password for *\n*'s Old password:",
      ""};

-@@ -165,7 +166,9 @@
+@@ -165,7 +166,10 @@

  static char *P4[] =
     {"\n",
 +    "\npasswd: rebuilding the database...\npasswd: done\n",
++	"\npasswd: updating the database...\npasswd: done\n",
      "NIS entry changed on *\n",
 +    "\n\nNIS password has been changed on *.\n",
      ""};


-@@ -186,11 +189,7 @@
+@@ -186,11 +190,7 @@

       *user = *oldpass = *newpass = 0;

@@ -66,7 +67,7 @@

       WriteToClient ("200 poppassd v%s hello, who are you?", VERSION);
       ReadFromClient (line);
-@@ -212,12 +211,16 @@
+@@ -212,12 +212,16 @@

       if ((pw = getpwnam (user)) == NULL)
       {
@@ -84,7 +85,7 @@
  	  WriteToClient ("500 Old password is incorrect.");
  	  exit(1);
       }
-@@ -264,28 +267,28 @@
+@@ -264,28 +268,28 @@

  	  if ((wpid = waitpid (pid, &wstat, 0)) < 0)
  	  {
@@ -117,7 +118,7 @@
  	       WriteToClient ("500 Server error (abnormal exit), get help!");
  	       exit (1);
  	  }
-@@ -304,17 +307,19 @@
+@@ -304,17 +308,19 @@
       }
       else      /* Child */
       {
@@ -148,7 +149,7 @@
  	  setuid (pw->pw_uid);
  	  setgid (pw->pw_gid);
  	  dochild (master, slavedev, user);
-@@ -324,7 +329,7 @@
+@@ -324,7 +330,7 @@
  /*
   * dochild
   *
@@ -157,7 +158,7 @@
   *
   * Code adapted from "Advanced Programming in the UNIX Environment"
   * by W. Richard Stevens.
-@@ -338,13 +343,6 @@
+@@ -338,13 +344,6 @@
     int slave;
     struct termios stermios;

@@ -171,7 +172,7 @@
     /* Open slave pty and acquire as new controlling terminal. */

     if ((slave = open(slavedev, O_RDWR)) < 0) {
-@@ -387,10 +385,10 @@
+@@ -387,10 +386,10 @@
        return(0);
     }

@@ -185,7 +186,7 @@
        return(0);
     }
  }
-@@ -408,15 +406,20 @@
+@@ -408,15 +407,20 @@
   *
   * Modified by Norstad to remove assumptions about number of pty's allocated
   * on this UNIX box.
@@ -207,24 +208,15 @@
     dirp = opendir("/dev");
     while ((dp = readdir(dirp)) != NULL) {
        if (strncmp(dp->d_name, "pty", 3) == 0 && strlen(dp->d_name) == 5) {
-@@ -485,9 +488,11 @@
+@@ -485,8 +489,10 @@
       }

       writestring(master, pswd);
 -
 +     sleep(2);
       if (!expect(master, P4, buf)) return FAILURE;
-
-+     close(master);
 +
++     close(master);
+
       return SUCCESS;
  }
-
-@@ -566,6 +571,7 @@
- 	}
- 	n += m;
- 	buf[n] = 0;
-+/* syslog(LOG_ERR, "read from child: %s",buf); */
- 	initialSegment = 0;
-         for (s = expected; **s != 0; s++) {
-            result = match(buf, *s);
Comment 3 Christian Weisgerber freebsd_committer 2002-10-06 02:39:34 UTC
State Changed
From-To: open->closed

Fixes committed.