[pppoe-server] Enable HURL and MOTD messages with custom content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here is a really simple patch to allow sending HURL and MOTD messages
after peer connection. It also adds command line support for both and
allow https as well as HURL content.

--- rp-pppoe-3.12/src/pppoe-server.c
+++ rp-pppoe-3.12_patch/src/pppoe-server.c
@@ -141,6 +141,9 @@

 static char *pppd_path = PPPD_PATH;
 static char *pppoe_path = PPPOE_PATH;
+
+static char *motd_string = NULL;
+static char *hurl_string = NULL;

 static int Debug = 0;
 static int CheckPoolSyntax = 0;
@@ -1082,6 +1085,11 @@
     pads.length = htons(plen);
     sendPacket(NULL, sock, &pads, (int) (plen + HDR_SIZE));

+    if(hurl_string != NULL)
+        sendHURLorMOTM(&conn, hurl_string, TAG_HURL);
+    if(motd_string != NULL)
+        sendHURLorMOTM(&conn, motd_string, TAG_MOTM);
+
     /* Close sock; don't need it any more */
     close(sock);

@@ -1200,9 +1208,9 @@
 #endif

 #ifndef HAVE_LINUX_KERNEL_PPPOE
-    char *options = "X:ix:hI:C:L:R:T:m:FN:f:O:o:sp:lrudPc:S:1q:Q:";
+    char *options = "X:ix:hI:C:L:R:T:m:FN:f:O:o:sp:lrudPc:S:1q:Q:H:M:";
 #else
-    char *options = "X:ix:hI:C:L:R:T:m:FN:f:O:o:skp:lrudPc:S:1q:Q:";
+    char *options = "X:ix:hI:C:L:R:T:m:FN:f:O:o:skp:lrudPc:S:1q:Q:H:M:";
 #endif

     if (getuid() != geteuid() ||
@@ -1270,6 +1278,22 @@
         }
         break;

+    case 'M':
+        motd_string = strdup(optarg);
+        if (!motd_string) {
+        fprintf(stderr, "Out of memory");
+        exit(1);
+        }
+        break;
+
+    case 'H':
+        hurl_string = strdup(optarg);
+        if (!hurl_string) {
+        fprintf(stderr, "Out of memory");
+        exit(1);
+        }
+        break;
+
     case 'c':
 #ifndef HAVE_LICENSE
         fprintf(stderr, "Clustering capability not available.\n");
@@ -2310,8 +2334,10 @@

     if (tag == TAG_HURL) {
     if (strncmp(url, "http://";, 7)) {
-        syslog(LOG_WARNING, "sendHURL(%s): URL must begin with http://";, url);
+      if (strncmp(url, "https://";, 8)) {
+        syslog(LOG_WARNING, "sendHURL(%s): URL must begin with
http:// or https://";, url);
         return;
+      }
     }
     } else {
     tag = TAG_MOTM;

Attachment: hurl_motd.patch
Description: Binary data


[Index of Archives]     [Linux Audio Users]     [Linux for Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Fedora Users]

  Powered by Linux