5 Copyright (C) 2012 Augusto Bott
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
21 #ifndef PPTP_CONNECTED
22 #define PPTP_CONNECTED "/tmp/pptp_connected"
35 void asp_pptpd_userol(int argc
, char **argv
) {
40 char clientusername
[32+1];
41 char clientlocalip
[INET6_ADDRSTRLEN
+1];
42 char clientremoteip
[INET6_ADDRSTRLEN
+1];
43 char interface
[IF_SIZE
+1];
47 web_puts("\n\npptpd_online=[");
50 fp
= fopen(PPTP_CONNECTED
, "r");
52 while (fgets(line
, sizeof(line
), fp
) != NULL
) {
53 if (sscanf(line
, "%d %s %s %s %s %d", &ppppid
, interface
, clientlocalip
, clientremoteip
, clientusername
, &clientuptime
) != 6) continue;
54 web_printf("%c['%d', '%s', '%s', '%s', '%s', '%d']",
55 comma
, ppppid
, interface
, clientlocalip
, clientremoteip
, clientusername
, clientuptime
);
64 void wo_pptpdcmd(char *url
) {
67 // do we really need to output anything?
68 web_puts("\npptd_result = [\n");
69 if ((p
= webcgi_get("disconnect")) != NULL
) {
70 while ((kill(atoi(p
), SIGTERM
) == 0) && (n
> 1)) {