Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix building when HOST is set (e.g. to hostname) #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adaugherity
Copy link

I tried building this on openSUSE Leap 15.2, and there were several failures related to reallocarray, UID_MAX, GID_MAX, setresuid, setresgid, and execvpe. Diving into to reallocarray(), I noticed configure reported it as being present, but the man page indicates it requires _GNU_SOURCE. (I have glibc 2.26, which lacks the reference to _DEFAULT_SOURCE.)

While working up a patch for that, I discovered that configure should've already set both _GNU_SOURCE and _DEFAULT_SOURCE on Linux, but was not doing so. In fact it was setting OS_CFLAGS=-D__earth.lan__, which looked suspiciously like part of my internal domain! I traced that here, and sure enough, my system has $HOST set to my FQDN (e.g. frodo.middle-earth.lan).

[open]SUSE's /etc/profile sets HOST=$(uname -n) (aka hostname), and has done so since 2010 according to the git history. This completely breaks everything the configure script derives from $HOST.

As a naïve fix, I've renamed the HOST variable to HOSTCC, and that fixed all the build issues. Perhaps doing something like unset HOST BUILD TARGET to force the user to use the configure options --host= etc. would be preferable, but I don't know...


Unrelated: Linux has long supported 32-bit UID/GIDs (which might be encountered in domain environments, e.g. sssd), but you default to UID_MAX=65535. I could of course call ./configure --uid-max=4294967295 --gid-max=4294967295, but I feel like I shouldn't have to. Does anything still use 16-bit UIDs these days?

(Actually --gid-max doesn't work, as due to a typo that sets UID_MAX again. Oops!)

Thanks for your work porting doas and for trying to take security seriously!

[open]SUSE's /etc/profile sets HOST=$(uname -n) (aka hostname), which
completely breaks everything this script derives from it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant