openbsd-compat.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. Index: netcat-openbsd-1.89/openbsd-compat/readpassphrase.c
  2. ===================================================================
  3. --- netcat-openbsd-1.89.orig/openbsd-compat/readpassphrase.c 2008-01-22 18:21:56.000000000 -0500
  4. +++ netcat-openbsd-1.89/openbsd-compat/readpassphrase.c 2008-01-22 18:22:58.000000000 -0500
  5. @@ -31,6 +31,12 @@
  6. #include <unistd.h>
  7. #include <readpassphrase.h>
  8. +#ifdef TCSASOFT
  9. +# define _T_FLUSH (TCSAFLUSH|TCSASOFT)
  10. +#else
  11. +# define _T_FLUSH (TCSAFLUSH)
  12. +#endif
  13. +
  14. static volatile sig_atomic_t signo;
  15. static void handler(int);
  16. @@ -92,9 +98,11 @@
  17. memcpy(&term, &oterm, sizeof(term));
  18. if (!(flags & RPP_ECHO_ON))
  19. term.c_lflag &= ~(ECHO | ECHONL);
  20. +#ifdef VSTATUS
  21. if (term.c_cc[VSTATUS] != _POSIX_VDISABLE)
  22. term.c_cc[VSTATUS] = _POSIX_VDISABLE;
  23. - (void)tcsetattr(input, TCSAFLUSH|TCSASOFT, &term);
  24. +#endif
  25. + (void)tcsetattr(input, _T_FLUSH, &term);
  26. } else {
  27. memset(&term, 0, sizeof(term));
  28. term.c_lflag |= ECHO;
  29. @@ -129,7 +137,7 @@
  30. /* Restore old terminal settings and signals. */
  31. if (memcmp(&term, &oterm, sizeof(term)) != 0) {
  32. - while (tcsetattr(input, TCSAFLUSH|TCSASOFT, &oterm) == -1 &&
  33. + while (tcsetattr(input, _T_FLUSH, &oterm) == -1 &&
  34. errno == EINTR)
  35. continue;
  36. }
  37. @@ -164,14 +172,6 @@
  38. return(nr == -1 ? NULL : buf);
  39. }
  40. -char *
  41. -getpass(const char *prompt)
  42. -{
  43. - static char buf[_PASSWORD_LEN + 1];
  44. -
  45. - return(readpassphrase(prompt, buf, sizeof(buf), RPP_ECHO_OFF));
  46. -}
  47. -
  48. static void handler(int s)
  49. {