*BSD News Article 54576


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!chi-news.cic.net!usc!news.cerf.net!news.titan.com!usenet
From: ss@tisc.com (Steve Schossow)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Password server for Eudora
Date: Mon, 13 Nov 1995 02:04:41 GMT
Organization: Nearer piles are newer
Lines: 126
Message-ID: <48698s$497@taxis.corp.titan.com>
References: <andrew-1111952224200001@dslip3.cc.utas.edu.au>
NNTP-Posting-Host: ss.ras.tisc.titan.com

andrew@hobart.tased.edu.au (Andrew) wrote:

>Hi,

>I'm new to this but I've been trying to get poppassd-4 from
>ftp.qualcomm.com to work, so people using Eudora can change their
>passwords. The original downloaded file appeared to be a shell script. I
>ran it and it created a directory called poppassd containing:

<stuff deleted for brevity>

I took a stab at this a month ago.  You need to teach it what to expect 
from the passwd command and the FreeBSD path to the executable along with 
fixing the code's expectation of a return value from syslog().

Context diff appended below.

-------cut-here---------
hobbes# diff -c poppassd.c.orig poppassd.c
*** poppassd.c.orig     Sun Nov 12 17:55:20 1995
--- poppassd.c  Thu Oct 12 14:05:40 1995
***************
*** 145,150 ****
--- 145,151 ----
  static char *P1[] =
     {"Old password:",
      "Changing password for *.\nOld password:",
+     "Changing local password for *.\nOld password:",
      "Changing password for * on *.\nOld password:",
      "Changing NIS password for * on *.\nOld password:",
      "Changing password for *\n*'s Old password:",
***************
*** 166,171 ****
--- 167,173 ----
  static char *P4[] =
     {"\n",
      "NIS entry changed on *\n",
+     "\npasswd: rebuilding the database...\npasswd: done\n",
      ""};
 
 
***************
*** 186,196 ****
--- 188,202 ----
 
       *user = *oldpass = *newpass = 0;
 
+ #ifdef __FreeBSD__
+      openlog ("poppassd", LOG_PID, LOG_LOCAL2);
+ #else
       if (openlog ("poppassd", LOG_PID, LOG_LOCAL2) < 0)
       {
          WriteToClient ("500 Can't open syslog.");
               exit (1);
       }
+ #endif
 
       WriteToClient ("200 poppassd v%s hello, who are you?", VERSION);
       ReadFromClient (line);
***************
*** 264,291 ****
--- 270,313 ----
 
          if ((wpid = waitpid (pid, &wstat, 0)) < 0)
          {
+ #ifdef __FreeBSD__
+              syslog (LOG_ERR, "wait for /usr/bin/passwd child failed: %m");
+ #else
               syslog (LOG_ERR, "wait for /bin/passwd child failed: %m");
+ #endif
               WriteToClient ("500 Server error (wait failed), get help!");
               exit (1);
          }
 
          if (pid != wpid)
          {
+ #ifdef __FreeBSD__
+              syslog (LOG_ERR, "wrong child (/usr/bin/passwd waited for!");
+ #else
               syslog (LOG_ERR, "wrong child (/bin/passwd waited for!");
+ #endif
               WriteToClient ("500 Server error (wrong child), get help!");
               exit (1);
          }
 
          if (WIFEXITED (wstat) == 0)
          {
+ #ifdef __FreeBSD__
+              syslog (LOG_ERR, "child (/usr/bin/passwd) killed?");
+ #else
               syslog (LOG_ERR, "child (/bin/passwd) killed?");
+ #endif
               WriteToClient ("500 Server error (funny wstat), get help!");
               exit (1);
          }
 
          if (WEXITSTATUS (wstat) != 0)
          {
+ #ifdef __FreeBSD__
+              syslog (LOG_ERR, "child (/usr/bin/passwd) exited abnormally");
+ #else
               syslog (LOG_ERR, "child (/bin/passwd) exited abnormally");
+ #endif
               WriteToClient ("500 Server error (abnormal exit), get help!");
               exit (1);
          }
***************
*** 389,396 ****
--- 411,423 ----
 
     /* Fork /bin/passwd. */
 
+ #ifdef __FreeBSD__
+    if (execl("/usr/bin/passwd", "passwd", user, (char*)0) < 0) {
+       syslog(LOG_ERR, "can't exec /usr/bin/passwd: %m");
+ #else
     if (execl("/bin/passwd", "passwd", user, (char*)0) < 0) {
        syslog(LOG_ERR, "can't exec /bin/passwd: %m");
+ #endif
        return(0);
     }
  }
hobbes#
--
Steve Schossow <ss@tisc.com>