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

HTTP-6660 Fails due to faulty comparison #1537

Open
jpasher-lazor opened this issue Aug 30, 2024 · 0 comments
Open

HTTP-6660 Fails due to faulty comparison #1537

jpasher-lazor opened this issue Aug 30, 2024 · 0 comments

Comments

@jpasher-lazor
Copy link

Version

  • Distribution: Ubuntu 22.04
  • Lynis version: master

Describe the bug

The test for TraceEnable in Apache (HTTP-6660) has a comparison that is invalid in Dash (the default for /bin/sh in Debian-based distros). This is due to the way it does the string comparisons to try to compensate for an empty string (are there still shells around that need to do that?).

Line 325 in include/tests_webservers:

TRACEENABLED_SETTING=$( echo ${TRACEENABLE} | tr 'A-Z' 'a-z' )
if [ x${TRACEENABLED_SETTING} == x'off' ]; then
    ...
else
    ...
fi

It leads to this error:

./lynis: 326: [: xoff: unexpected operator

Since I'm not sure which old/obscure shells out there can't process an empty string as a parameter when in quotes, I kept the extra "x" and just wrapped the quotes properly.

if [ "x${TRACEENABLED_SETTING}" == 'xoff' ]; then

PR is here: #1536

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

No branches or pull requests

1 participant