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
7 files changed
tree: 0b759c0c277743c009eaabadaa2402ada108f378
  1. .circleci/
  2. .github/
  3. .lift/
  4. CMake/
  5. docs/
  6. include/
  7. lib/
  8. m4/
  9. packages/
  10. plan9/
  11. projects/
  12. scripts/
  13. src/
  14. tests/
  15. winbuild/
  16. zuul.d/
  17. .azure-pipelines.yml
  18. .cirrus.yml
  19. .dcignore
  20. .dir-locals.el
  21. .gitattributes
  22. .gitignore
  23. .lgtm.yml
  24. .mailmap
  25. acinclude.m4
  26. appveyor.yml
  27. buildconf
  28. buildconf.bat
  29. CHANGES
  30. CMakeLists.txt
  31. configure.ac
  32. COPYING
  33. curl-config.in
  34. GIT-INFO
  35. libcurl.pc.in
  36. MacOSX-Framework
  37. Makefile.am
  38. Makefile.dist
  39. maketgz
  40. README
  41. README.md
  42. RELEASE-NOTES
  43. SECURITY.md
README.md

curl logo

CII Best Practices Coverity passed AppVeyor Build Status Azure DevOps Build Status Cirrus Build Status Backers on Open Collective Sponsors on Open Collective Language Grade: C/C++ Codacy Badge Fuzzing Status

Curl is a command-line tool for transferring data specified with URL syntax. Find out how to use curl by reading the curl.1 man page or the MANUAL document. Find out how to install Curl by reading the INSTALL document.

libcurl is the library curl is using to do its job. It is readily available to be used by your software. Read the libcurl.3 man page to learn how.

You can find answers to the most frequent questions we get in the FAQ document.

Study the COPYING file for distribution terms.

Contact

If you have problems, questions, ideas or suggestions, please contact us by posting to a suitable mailing list.

All contributors to the project are listed in the THANKS document.

Commercial support

For commercial support, maybe private and dedicated help with your problems or applications using (lib)curl: https://curl.se/support.html

Website

Visit the curl website for the latest news and downloads.

Git

To download the latest source from the Git server do this:

git clone https://github.com/curl/curl.git

(you will get a directory named curl created, filled with the source code)

Security problems

Report suspected security problems via our HackerOne page and not in public!

Notice

Curl contains pieces of source code that is Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan. This notice is included here to comply with the distribution terms.

Backers

Thank you to all our backers! 🙏 [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]