UndernetIRC / ircu2

Undernet IRC Daemon
Other
52 stars 20 forks source link

execvp result gets swallowed in s_auth #2

Closed staticfox closed 5 years ago

staticfox commented 7 years ago

The result of execvp(iauth->i_argv[0], iauth->i_argv) should probably (really) be captured and checked to see if -1 was returned. If it was, let the opers know by sending a message + strerror(errno) (and write to log). This all happens while we're still setting file descriptors though, so maybe it'd be kind of hairy to do.

In my case, the only indication that something went wrong was IRCu saying "IAuth crashed fast" when in reality, it was not even being ran at all since execvp returned -1 with errno being set to ENOENT.

(untested) Maybe something like:

res = execvp(iauth->i_argv[0], iauth->i_argv);
if (res == -1) {
  log_write(LS_IAUTH, L_ERROR, 0, "IAuth execvp() failed: %s", strerror(errno));
}
entrope commented 7 years ago

Thanks, I'll add something for that. We can't use log_write() at that point, because the close_connections() call just before the execvp() will close every file descriptor after stderr, but I think stderr is wired up to report things like that.

entrope commented 5 years ago

Fixed in commit d0f081b96dc815e53b52b9820d09e1472225610e.