1
0

cherry-pick.1.4.0-16-g0c0ad67.check-for-remote-ip-duplicates-in-pptpd-conf.patch 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. Subject: Check for remote IP duplicates in pptpd.conf
  2. Origin: 1.4.0-16-g0c0ad67
  3. Upstream-Author: Christoph Biedl <sourceforge.bnwi@manchmal.in-ulm.de>
  4. Date: Fri Jul 8 13:51:42 2016 +1000
  5. At the moment, pptpd will happily process lines like
  6. remoteip 192.168.0.234-234,192.168.0.234,192.168.0.234
  7. and afterwards state "MGR: Maximum of 3 connections available". While
  8. technically true, I guess this is never by intention but will result in
  9. interesting behaviour. [...]
  10. The patch below worked for me.
  11. Signed-off-by: James Cameron <quozl@laptop.org>
  12. --- a/pptpmanager.c
  13. +++ b/pptpmanager.c
  14. @@ -136,6 +136,13 @@
  15. void slot_set_remote(int i, char *ip)
  16. {
  17. struct slot *slot = &slots[i];
  18. + int j;
  19. + for (j = 0; j < slot_count; j++) {
  20. + if (!slots[j].remote || strcmp(slots[j].remote, ip))
  21. + continue;
  22. + syslog(LOG_ERR, "MGR: Remote IP address %s in config is a duplicate!", ip);
  23. + exit(1);
  24. + }
  25. if (slot->remote) free(slot->remote);
  26. slot->remote = strdup(ip);
  27. }