poppassdをNEWS-OS Release 4.2.1Rでコンパイルするためのパッチです
展開したソースがあるディレクトリでpatch < poppassd.diffを実行し て下さい。Makefileとpoppassd.cが書き変わります。
*** POPPasswd/Makefile Fri Dec 6 22:37:15 1996 --- POPPasswd.old/Makefile Fri Dec 6 11:28:07 1996 *************** *** 1,11 **** BINDIR = /usr/local/etc LIBDIR = CCM = cc -Em ! OBJECTS = poppassd.o setsid.o LIBS = # Default flags ! CFLAGS = -g -DNEWSOS LFLAGS = -g # For Ultrix --- 1,11 ---- BINDIR = /usr/local/etc LIBDIR = CCM = cc -Em ! OBJECTS = poppassd.o LIBS = # Default flags ! CFLAGS = -g LFLAGS = -g # For Ultrix *** POPPasswd/poppassd.c Fri Dec 6 23:40:57 1996 --- POPPasswd.old/poppassd.c Fri Dec 6 21:59:49 1996 *************** *** 185,193 **** #include <sys/ioctl.h> #endif - #ifdef NEWSOS - typedef int pid_t; - #endif /* Prompt strings expected from the "passwd" command. If you want * to port this program to yet another flavor of UNIX, you may need to add --- 185,190 ---- *************** *** 243,254 **** char *slavedev; struct passwd *pw, *getpwnam(); int c, master; ! pid_t pid, wpid; ! #ifdef NEWSOS ! union wait wstat; ! #else int wstat; - #endif *user = *oldpass = *newpass = 0; --- 240,247 ---- char *slavedev; struct passwd *pw, *getpwnam(); int c, master; ! int pid, wpid; int wstat; *user = *oldpass = *newpass = 0; *************** *** 302,308 **** WriteToClient ("500 New password required."); exit(1); } - /* get pty to talk to password program */ if ((master = findpty (&slavedev)) < 0) { --- 295,300 ---- *************** *** 333,344 **** exit(1); } ! #ifdef NEWSOS ! while((wpid = wait(&wstat)) >=0 && wpid != pid); ! #else ! wpid = waitpid (pid, &wstat, 0) ! #endif ! if (wpid < 0) { syslog (LOG_ERR, "wait for /bin/passwd child failed: %m"); WriteToClient ("500 Server error (wait failed), get help!"); --- 325,331 ---- exit(1); } ! if ((wpid = waitpid (pid, &wstat, 0)) < 0) { syslog (LOG_ERR, "wait for /bin/passwd child failed: %m"); WriteToClient ("500 Server error (wait failed), get help!"); *************** *** 359,369 **** exit (1); } - #ifdef NEWSOS - if (wstat.w_retcode) - #else if (WEXITSTATUS (wstat) != 0) - #endif { syslog (LOG_ERR, "child (/bin/passwd) exited abnormally"); WriteToClient ("500 Server error (abnormal exit), get help!"); --- 346,352 ---- *************** *** 419,425 **** struct termios stermios; /* Start new session - gets rid of controlling terminal. */ ! if (setsid() < 0) { syslog(LOG_ERR, "setsid failed: %m"); return(0); --- 402,408 ---- struct termios stermios; /* Start new session - gets rid of controlling terminal. */ ! if (setsid() < 0) { syslog(LOG_ERR, "setsid failed: %m"); return(0); *************** *** 460,493 **** syslog(LOG_ERR, "dup2 error to stderr: %m"); return(0); } ! if (slave > 2) close(slave); /* Set proper terminal attributes - no echo, canonical input processing, no map NL to CR/NL on output. */ - #ifdef NEWSOS - ioctl(0, TCGETS, &stermios); - #else if (tcgetattr(0, &stermios) < 0) { syslog(LOG_ERR, "tcgetattr error: %m"); return(0); } - #endif stermios.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL); stermios.c_lflag |= ICANON; stermios.c_oflag &= ~(ONLCR); - #ifdef NEWSOS - ioctl(0, TCSETS, &stermios); - #else if (tcsetattr(0, TCSANOW, &stermios) < 0) { syslog(LOG_ERR, "tcsetattr error: %m"); return(0); } - #endif /* Fork /bin/passwd. */ ! if (execl("/usr/bin/passwd", "passwd", user, (char*)0) < 0) { syslog(LOG_ERR, "can't exec /bin/passwd: %m"); return(0); } --- 443,468 ---- syslog(LOG_ERR, "dup2 error to stderr: %m"); return(0); } ! if (slave > 2) close(slave); /* Set proper terminal attributes - no echo, canonical input processing, no map NL to CR/NL on output. */ if (tcgetattr(0, &stermios) < 0) { syslog(LOG_ERR, "tcgetattr error: %m"); return(0); } stermios.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL); stermios.c_lflag |= ICANON; stermios.c_oflag &= ~(ONLCR); if (tcsetattr(0, TCSANOW, &stermios) < 0) { syslog(LOG_ERR, "tcsetattr error: %m"); return(0); } /* Fork /bin/passwd. */ ! if (execl("/bin/passwd", "passwd", user, (char*)0) < 0) { syslog(LOG_ERR, "can't exec /bin/passwd: %m"); return(0); }