Changeset 264 in openpam
- Timestamp:
- Jul 14, 2003, 2:17:47 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/configure.in
r254 r264 1 dnl $P4: //depot/projects/openpam/configure.in# 2$1 dnl $P4: //depot/projects/openpam/configure.in#3 $ 2 2 3 3 AC_PREREQ(2.53) … … 7 7 8 8 AC_CANONICAL_SYSTEM 9 AC_C_VOLATILE 9 10 AC_DISABLE_STATIC 10 11 AC_PROG_LIBTOOL … … 64 65 AM_CONDITIONAL(WITH_PAM_UNIX, test "x$with_pam_unix" = "xyes") 65 66 67 AC_PROG_INSTALL 68 66 69 AC_CHECK_HEADERS(crypt.h) 67 70 68 AC_ PROG_INSTALL71 AC_CHECK_FUNCS(fpurge) 69 72 70 73 DL_LIBS= -
trunk/include/security/openpam.h
r245 r264 32 32 * SUCH DAMAGE. 33 33 * 34 * $P4: //depot/projects/openpam/include/security/openpam.h#2 4$34 * $P4: //depot/projects/openpam/include/security/openpam.h#25 $ 35 35 */ 36 36 … … 178 178 struct pam_response **_resp, 179 179 void *_data); 180 181 extern int openpam_ttyconv_timeout; 180 182 181 183 /* -
trunk/lib/openpam_ttyconv.c
r250 r264 32 32 * SUCH DAMAGE. 33 33 * 34 * $P4: //depot/projects/openpam/lib/openpam_ttyconv.c#2 1$34 * $P4: //depot/projects/openpam/lib/openpam_ttyconv.c#22 $ 35 35 */ 36 36 … … 38 38 39 39 #include <ctype.h> 40 #include <errno.h> 40 41 #include <setjmp.h> 41 42 #include <signal.h> … … 51 52 52 53 int openpam_ttyconv_timeout = 0; 53 static jmp_buf jmpenv;54 static int timed_out;55 54 56 55 static void 57 56 timeout(int sig) 58 57 { 59 timed_out = 1; 60 longjmp(jmpenv, sig);58 59 (void)sig; 61 60 } 62 61 … … 68 67 sigset_t saved_sigset, sigset; 69 68 unsigned int saved_alarm; 69 int eof, error, fd, timed_out; 70 70 size_t len; 71 71 char *retval; 72 char ch; 72 73 73 74 sigemptyset(&sigset); … … 80 81 sigaction(SIGALRM, &action, &saved_action); 81 82 fputs(msg, stdout); 83 fflush(stdout); 84 #ifdef HAVE_FPURGE 85 fpurge(stdin); 86 #endif 87 fd = fileno(stdin); 82 88 buf[0] = '\0'; 83 89 timed_out = 0; 90 eof = error = timed_out = 0; 84 91 saved_alarm = alarm(openpam_ttyconv_timeout); 85 if (setjmp(jmpenv) == 0) 86 fgets(buf, sizeof buf, stdin); 87 else 88 fputs(" timeout!\n", stderr); 92 ch = '\0'; 93 for (len = 0; ch != '\n' && !eof && !error; ++len) { 94 switch (read(fd, &ch, 1)) { 95 case 1: 96 if (len < PAM_MAX_RESP_SIZE - 1) { 97 buf[len + 1] = '\0'; 98 buf[len] = ch; 99 } 100 break; 101 case 0: 102 eof = 1; 103 break; 104 default: 105 error = errno; 106 break; 107 } 108 } 89 109 alarm(0); 90 110 sigaction(SIGALRM, &saved_action, NULL); 91 111 sigprocmask(SIG_SETMASK, &saved_sigset, NULL); 92 112 alarm(saved_alarm); 93 if (timed_out || ferror(stdin) || feof(stdin)) { 113 if (error == EINTR) 114 fputs(" timeout!", stderr); 115 if (error || eof) { 116 fputs("\n", stderr); 94 117 memset(buf, 0, sizeof(buf)); 95 118 return (NULL);
Note: See TracChangeset
for help on using the changeset viewer.