Unbreak rwhod(8):

- It did not work with GENERIC kernel after r250603 because
  options PROCDESC was required for pdfork(2).  It now just uses fork(2)
  instead when this syscall is not available.

- Fix verify().  This function was broken in r250602 because the outermost
  "()" was removed from the condition !(isalnum() || ispunct()).
  It prevented hostnames including "-", for example.
This commit is contained in:
Hiroki Sato 2013-08-17 07:12:52 +00:00
parent 949c918635
commit 10966d45e9

View File

@ -274,6 +274,15 @@ main(int argc, char *argv[])
exit(1); exit(1);
if (!quiet_mode) { if (!quiet_mode) {
pid_child_receiver = pdfork(&fdp, 0); pid_child_receiver = pdfork(&fdp, 0);
if (pid_child_receiver == -1) {
if (errno != ENOSYS) {
syslog(LOG_ERR, "pdfork: %m");
exit(1);
} else {
pid_child_receiver = fork();
fdp = -1;
}
}
if (pid_child_receiver == 0) { if (pid_child_receiver == 0) {
receiver_process(); receiver_process();
} else if (pid_child_receiver > 0) { } else if (pid_child_receiver > 0) {
@ -328,7 +337,7 @@ verify(char *name, int maxlen)
size = 0; size = 0;
while (*name != '\0' && size < maxlen - 1) { while (*name != '\0' && size < maxlen - 1) {
if (!isascii(*name) || !isalnum(*name) || ispunct(*name)) if (!isascii(*name) || !(isalnum(*name) || ispunct(*name)))
return (0); return (0);
name++; name++;
size++; size++;