<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Hi Wouter,<br></div><div class="gmail_quote"><br>On Mon, Mar 23, 2015 at 9:21 PM, W.C.A. Wijngaards <span dir="ltr"><<a href="mailto:wouter@nlnetlabs.nl" target="_blank">wouter@nlnetlabs.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA1<br>
<br>
Hi Maciej,<br>
<span class=""><br>
On 03/23/2015 06:04 PM, Maciej Soltysiak wrote:<br>
> Hi,<br>
><br>
> I just took the latest 1.5.3, compiled it and ran the executable<br>
> without doing any config. Just to see what happens.<br>
><br>
> It segfaulted after saying user unbound not found.<br>
><br>
> The issue is in util/config_file.c in function<br>
> config_lookup_uid().<br>
><br>
> getpwnam() can return NULL and so subsequent referrences to pw_uid<br>
> and pw_gid are invalid.<br>
><br>
> This patch corrects the code path to assign uid and gid only if<br>
> getpwnam() is successful.<br>
><br>
> It also removes the log_err() call, because perform_setup() in<br>
> daemon/unbound.c would print it anyway in fatal_exit()<br>
><br>
> I know it's a tiny buglet, but I couldn't resist fixing a segfault<br>
> :-)<br>
<br>
</span>Thank you for the report, applied it by setting checks on the success<br>
of that lookup and continuing with the error printed.<br>
<br></blockquote><div><div><div>Thanks for reviewing and applying.<br><br>What you applied to SVN is exactly what I've done initially.<br></div>That however made it first display "user 'unbound' does not exist." twice.<br></div><div>First from util/config_file.c. That allows the code run further, until it encounters a getpwnam() call in perform_setup() of unbound.c where it has fatal_exit() with the same message.<br><br></div><div>Confirmed with gdb.<br></div><div><br></div><div>That's why I removed the duplication to allow the latter error message to show up.<br><br></div><div>I think you might want to look at it again; or maybe point me where I'm making a mistake.<br></div><div><br></div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Best regards,<br>
   Wouter<br></blockquote><div>Thanks, <br>Maciej<br></div></div><br></div></div>