summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2015-03-28 22:00:25 -0700
committerJohn Denker <jsd@av8n.com>2016-01-02 09:08:57 -0800
commit31af746f8270da9bfe6e16f9cd514c290902846d (patch)
treea7c2a0887a8b0d6588a38772a65aa133404c255e
parentb5b1107ff044f916147495548dfb7bce1c7951ce (diff)
fix bizarre bug: symptom: AUTH PLAIN authentication fails;HEADmaster
reason: waitpid is tricky
-rw-r--r--qmail-smtpd.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/qmail-smtpd.c b/qmail-smtpd.c
index aaf65e8..580be77 100644
--- a/qmail-smtpd.c
+++ b/qmail-smtpd.c
@@ -26,6 +26,12 @@
#include "wait.h"
#include "fd.h"
+#ifdef NASTY_DEBUG
+# include <stdio.h>
+#endif /* NASTY_DEBUG */
+
+void dummy() {} /* needed to make waitpid() work */
+
// AUTHCRAM is not #defined for now, because:
// 1) It requires cmd5checkpw (not just checkpassword), and
// a) cmd5checkpw requires separate administration of the poppasswed file.
@@ -577,7 +583,13 @@ int authenticate(void)
close(pi[1]);
byte_zero(pass.s,pass.len);
byte_zero(upbuf,sizeof upbuf);
- if (wait_pid(&wstat,child) == -1) return err_child();
+ if (wait_pid(&wstat,child) == -1) {
+#ifdef NASTY_DEBUG
+ fprintf(stderr, "kidpid: %d errno: %d : ", child, errno);
+ perror(0);
+#endif /* NASTY_DEBUG */
+ return err_child();
+ }
if (wait_crashed(wstat)) return err_child();
if (wait_exitcode(wstat)) { sleep(5); return 1; } /* no */
return 0; /* yes */
@@ -993,6 +1005,11 @@ void main(argc,argv)
int argc;
char **argv;
{
+/* waitpid() doesn't do what you expect
+ unless we do something nontrivial with SIGCHLD;
+ read the manpage.
+ */
+ sig_childcatch(dummy);
hostname = "";
if (argc > 1) hostname = argv[1];
childargs = 0;