0002-Install-conffile-as-proxychains4.conf.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. From: Boyuan Yang <073plan@gmail.com>
  2. Date: Fri, 29 Jun 2018 16:23:37 +0800
  3. Subject: Install conffile as proxychains4.conf
  4. Forwarded: not-needed
  5. In order to co-exist with old proxychains package, we
  6. will need to prevent conffile collision. The best solution
  7. in my mind is to use another name for conffile.
  8. With this patch, program will search for $SYSCONFDIR/proxychains4.conf
  9. and /etc/proxychains4.conf as a fallback. The conffile provided
  10. will be installed as /etc/proxychains4.conf.
  11. ---
  12. README | 4 +++-
  13. src/common.c | 10 ++++++++++
  14. src/common.h | 1 +
  15. 3 files changed, 14 insertions(+), 1 deletion(-)
  16. diff --git a/README b/README
  17. index a0c336b..f767d43 100644
  18. --- a/README
  19. +++ b/README
  20. @@ -186,8 +186,10 @@ proxychains looks for config file in following order:
  21. 2) ./proxychains.conf
  22. 3) $(HOME)/.proxychains/proxychains.conf
  23. 4) $(sysconfdir)/proxychains.conf **
  24. +5) $(sysconfdir)/proxychains4.conf ***
  25. -** usually /etc/proxychains.conf
  26. +** usually /etc/proxychains.conf
  27. +*** usually /etc/proxychains4.conf
  28. Usage Example:
  29. diff --git a/src/common.c b/src/common.c
  30. index c126ecf..4621b1f 100644
  31. --- a/src/common.c
  32. +++ b/src/common.c
  33. @@ -89,6 +89,16 @@ char *get_config_path(char* default_path, char* pbuf, size_t bufsize) {
  34. if(check_path(path))
  35. goto have;
  36. + // priority 6: $SYSCONFDIR/proxychains4.conf
  37. + path = SYSCONFDIR "/" PROXYCHAINS_CONF_FILE_FALLBACK;
  38. + if(check_path(path))
  39. + goto have;
  40. +
  41. + // priority 7: /etc/proxychains4.conf
  42. + path = "/etc/" PROXYCHAINS_CONF_FILE_FALLBACK;
  43. + if(check_path(path))
  44. + goto have;
  45. +
  46. perror("couldnt find configuration file");
  47. exit(1);
  48. diff --git a/src/common.h b/src/common.h
  49. index 5335bd1..39773c2 100644
  50. --- a/src/common.h
  51. +++ b/src/common.h
  52. @@ -4,6 +4,7 @@
  53. #define PROXYCHAINS_CONF_FILE_ENV_VAR "PROXYCHAINS_CONF_FILE"
  54. #define PROXYCHAINS_QUIET_MODE_ENV_VAR "PROXYCHAINS_QUIET_MODE"
  55. #define PROXYCHAINS_CONF_FILE "proxychains.conf"
  56. +#define PROXYCHAINS_CONF_FILE_FALLBACK "proxychains4.conf"
  57. #define LOG_PREFIX "[proxychains] "
  58. #ifndef SYSCONFDIR
  59. #define SYSCONFDIR "/etc"