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

dnsdist: Save history to home-dir #4779

Merged
merged 1 commit into from Jan 13, 2017

Conversation

@pieterlexis
Copy link
Member

@pieterlexis pieterlexis commented Dec 16, 2016

Short description

Only use CWD as a last resort. This prevents cluttering directories with .dnsdist_history files

Closes #4562

Checklist

I have:

  • read the CONTRIBUTING.md document
  • compiled and tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added regression tests
  • added unit tests
  • checked that this code was merged to master
@pieterlexis pieterlexis force-pushed the pieterlexis:dnsdist-history-to-home branch 3 times, most recently from a4d8d99 to 936c472 Dec 16, 2016
struct passwd pwd;
struct passwd *result;
char buf[16384];
getpwuid_r(getuid(), &pwd, buf, sizeof(buf), &result);

This comment has been minimized.

@rgacogne

rgacogne Dec 20, 2016
Member

I'm wondering if we should use geteuid() instead, in the unlikely event dnsdist is started with -u while in foreground mode.

ret = string(pwd.pw_dir);
if (homedir && !ignoreHOME) // $HOME overrides what the OS tells us
ret = string(homedir);
ret.append("/.dnsdist_history");

This comment has been minimized.

@rgacogne

rgacogne Dec 20, 2016
Member

How about not setting ret to "." beforehand and testing here if it's empty? If it is (somehow $HOME or pwd.pw_dir were empty or nothing worked), we could then fallback to "." before appending "/.dnsdist_history". This would prevent trying to write in "/.dnsdist_history".

Closes #4562
@pieterlexis pieterlexis force-pushed the pieterlexis:dnsdist-history-to-home branch from 936c472 to 9364403 Dec 20, 2016
@pieterlexis pieterlexis merged commit 6f3c797 into PowerDNS:master Jan 13, 2017
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@pieterlexis pieterlexis deleted the pieterlexis:dnsdist-history-to-home branch Jan 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants