You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.1 KiB

  1. From 36456071ea34546d98d3b66a696cd4c4c4643de5 Mon Sep 17 00:00:00 2001
  2. From: Willy Tarreau <w@1wt.eu>
  3. Date: Tue, 8 Sep 2015 16:01:25 +0200
  4. Subject: [PATCH 16/16] BUG/MINOR: tools: make str2sa_range() report
  5. unresolvable addresses
  6. If an environment variable is used in an address, and is not set, it's
  7. silently considered as ":" or "0.0.0.0:0" which is not correct as it
  8. can hide environment issues and lead to unexpected behaviours. Let's
  9. report this case when it happens.
  10. This fix should be backported to 1.5.
  11. (cherry picked from commit 9f69f46d1f1b1d116c00b4b0483c519747f977b7)
  12. ---
  13. src/standard.c | 5 +++++
  14. 1 file changed, 5 insertions(+)
  15. diff --git a/src/standard.c b/src/standard.c
  16. index f57724c..9299882 100644
  17. --- a/src/standard.c
  18. +++ b/src/standard.c
  19. @@ -709,6 +709,11 @@ struct sockaddr_storage *str2sa_range(const char *str, int *low, int *high, char
  20. goto out;
  21. }
  22. + if (!*str2) {
  23. + memprintf(err, "'%s' resolves to an empty address (environment variable missing?)\n", str);
  24. + goto out;
  25. + }
  26. +
  27. memset(&ss, 0, sizeof(ss));
  28. if (strncmp(str2, "unix@", 5) == 0) {
  29. --
  30. 2.4.6