Please check for remote IP address duplicates in /etc/pptpd.conf

Christoph Biedl <[email protected]> Thu, 7 Jul 2016 22:49:47 +0200
Newsgroups gmane.network.poptop
Message-ID <[email protected]>
Hello,

at the moment, pptpd will happily process lines like

| remoteip 192.168.0.234-234,192.168.0.234,192.168.0.234

and afterwards state "MGR: Maximum of 3 connections available". While
technically true, I guess this is never by intention but will result
in interesting behaviour. Can you please add a check for duplicate
addresses? It's not urgent at all but avoids havoc if the
administrator has a bad day.

The patch below worked for me.

    Christoph

--- a/pptpmanager.c
+++ b/pptpmanager.c
@@ -136,6 +136,13 @@ void slot_set_local(int i, char *ip)
 void slot_set_remote(int i, char *ip)
 {
   struct slot *slot = &slots[i];
+  int j;
+  for (j = 0; j < slot_count; j++) {
+    if (!slots[j].remote || strcmp(slots[j].remote, ip))
+      continue;
+    syslog(LOG_ERR, "MGR: Remote IP address %s in config file is a duplicate!", ip);
+    exit(1);
+  }
   if (slot->remote) free(slot->remote);
   slot->remote = strdup(ip);
 }

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape