$NetBSD: patch-aj,v 1.1.1.1 2000/10/21 18:41:54 rh Exp $

--- modules/pam_filter/pam_filter.c.orig	Sat Oct 21 11:39:55 2000
+++ modules/pam_filter/pam_filter.c
@@ -18,13 +18,18 @@
 
 #include <stdio.h>
 #include <sys/types.h>
+#include <sys/param.h>
 #include <sys/wait.h>
 #include <sys/time.h>
 #include <sys/file.h>
 #include <sys/stat.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
-#include <termio.h>
+#include <termios.h>
+
+#if (defined(BSD) && BSD >= 199306)
+#define	termio	termios
+#endif
 
 #include <signal.h>
 
@@ -310,7 +315,7 @@
 
 	/* this is termio terminal handling... */
 
-	if (ioctl(STDIN_FILENO, TCGETA, (char *) &stored_mode ) < 0) {
+	if (tcgetattr(STDIN_FILENO, &stored_mode ) < 0) {
 	    /* in trouble, so close down */
 	    close(fd[0]);
 	    _pam_log(LOG_CRIT, "couldn't copy terminal mode");
@@ -322,14 +327,18 @@
 	    t_mode.c_oflag &= ~OPOST;      /* no ouput post processing */
 
 	    /* no signals, canonical input, echoing, upper/lower output */
+#ifdef XCASE
 	    t_mode.c_lflag &= ~(ISIG|ICANON|ECHO|XCASE);
+#else
+	    t_mode.c_lflag &= ~(ISIG|ICANON|ECHO);
+#endif
 	    t_mode.c_cflag &= ~(CSIZE|PARENB);  /* no parity */
 	    t_mode.c_cflag |= CS8;              /* 8 bit chars */
 
 	    t_mode.c_cc[VMIN] = 1; /* number of chars to satisfy a read */
 	    t_mode.c_cc[VTIME] = 0;          /* 0/10th second for chars */
 
-	    if (ioctl(STDIN_FILENO, TCSETA, (char *) &t_mode) < 0) {
+	    if (tcsetattr(STDIN_FILENO, TCSANOW, &t_mode ) < 0) {
 		close(fd[0]);
 		_pam_log(LOG_WARNING, "couldn't put terminal in RAW mode");
 		return PAM_ABORT;
@@ -359,7 +368,7 @@
 
 	_pam_log(LOG_WARNING,"first fork failed");
 	if (aterminal) {
-	    (void) ioctl(STDIN_FILENO, TCSETA, (char *) &stored_mode);
+	    (void) tcsetattr(STDIN_FILENO, TCSANOW, &stored_mode);
 	}
 
 	return PAM_AUTH_ERR;
@@ -401,7 +410,7 @@
 	    /* initialize the child's terminal to be the way the
 	       parent's was before we set it into RAW mode */
 
-	    if (ioctl(fd[1], TCSETA, (char *) &stored_mode) < 0) {
+	    if (tcsetattr(fd[1], TCSANOW, &stored_mode) < 0) {
 		_pam_log(LOG_WARNING,"cannot set slave terminal mode; %s"
 			 ,terminal);
 		close(fd[1]);
@@ -575,7 +584,7 @@
 
     if (aterminal) {
 	/* reset to initial terminal mode */
-	(void) ioctl(STDIN_FILENO, TCSETA, (char *) &stored_mode);
+	(void) tcsetattr(STDIN_FILENO, TCSANOW, &stored_mode);
     }
 
     if (ctrl & FILTER_DEBUG) {
