]> git.ipfire.org Git - thirdparty/curl.git/commit
tool_findfile: search for a file in the homedir
authorDaniel Stenberg <daniel@haxx.se>
Fri, 19 Nov 2021 15:11:29 +0000 (16:11 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 28 Nov 2021 23:57:22 +0000 (00:57 +0100)
commit2be1aa619bca699e2850baf53c7cc3561f1c1ac2
tree0b759c0c277743c009eaabadaa2402ada108f378
parent230bb3e278877a8e99179f4df1893ee408d7baf5
tool_findfile: search for a file in the homedir

The homedir() function is now renamed into findfile() and iterates over
all the environment variables trying to access the file in question
until it finds it. Last resort is then getpwuid() if
available. Previously it would first try to find a home directory and if
that was set, insist on checking only that directory for the file. This
now returns the full file name it finds.

The Windows specific checks are now done differently too and in this
order:

1 - %USERPROFILE%
2 - %APPDATA%
3 - %USERPROFILE%\\Application Data

The windows order is modified to match how the Windows 10 ssh tool works
when it searches for .ssh/known_hosts.

Reported-by: jeffrson on github
Co-authored-by: Jay Satiro
Fixes #8033
Closes #8035
src/Makefile.inc
src/tool_findfile.c [new file with mode: 0644]
src/tool_findfile.h [moved from src/tool_homedir.h with 90% similarity]
src/tool_homedir.c [deleted file]
src/tool_operate.c
src/tool_paramhlp.c
src/tool_parsecfg.c