root/wifidog/patches/patch.20061116-1218

Revision 117, 16.3 kB (checked in by florida, 2 years ago)

--

Line 
1 Index: src/conf.c
2 ===================================================================
3 --- src/conf.c  (revision 112)
4 +++ src/conf.c  (revision 98)
5 @@ -84,12 +84,7 @@
6         oSyslogFacility,
7         oFirewallRule,
8         oFirewallRuleSet,
9 -       oTrustedMACList,
10 -       oProprietary,
11 -       oNetwork,
12 -       oLat,
13 -       oLon,
14 -       oTinyproxyPort,
15 +       oTrustedMACList
16  } OpCodes;
17  
18  /** @internal
19 @@ -121,11 +116,6 @@
20         { "firewallruleset",    oFirewallRuleSet },
21         { "firewallrule",           oFirewallRule },
22         { "trustedmaclist",         oTrustedMACList },
23 -       { "proprietary",        oProprietary },
24 -       { "network",            oNetwork },
25 -       { "lat",                oLat },
26 -       { "lon",                oLon },
27 -       { "tinyproxyport",      oTinyproxyPort },
28         { NULL,                 oBadOption },
29  };
30  
31 @@ -164,11 +154,6 @@
32         config.internal_sock = safe_strdup(DEFAULT_INTERNAL_SOCK);
33         config.rulesets = NULL;
34         config.trustedmaclist = NULL;
35 -       config.Proprietary = NULL;
36 -       config.Network = DEFAULT_NETWORK;
37 -       config.Lat = "0";
38 -       config.Lon = "0";
39 -       config.tinyproxy_port = 0;
40  }
41  
42  /**
43 @@ -663,18 +648,6 @@
44                                 case oHTTPDName:
45                                         config.httpdname = safe_strdup(p1);
46                                         break;
47 -                               case oProprietary:
48 -                                 config.Proprietary = safe_strdup(p1);
49 -                                 break;
50 -                               case oNetwork:
51 -                                 config.Network = safe_strdup(p1);
52 -                                 break;
53 -                               case oLat:
54 -                                 config.Lat = safe_strdup(p1);
55 -                                 break;
56 -                               case oLon:
57 -                                 config.Lon = safe_strdup(p1);
58 -                                 break;
59                                 case oHTTPDMaxConn:
60                                         sscanf(p1, "%d", &config.httpdmaxconn);
61                                         break;
62 @@ -698,9 +671,6 @@
63                                 case oSyslogFacility:
64                                         sscanf(p1, "%d", &config.syslog_facility);
65                                         break;
66 -                               case oTinyproxyPort:
67 -                                       sscanf(p1, "%d", &config.tinyproxy_port);
68 -                                       break;
69                                 }
70                         }
71                 }
72 Index: src/fw_iptables.c
73 ===================================================================
74 --- src/fw_iptables.c   (revision 112)
75 +++ src/fw_iptables.c   (revision 98)
76 @@ -190,7 +190,6 @@
77          char * ext_interface = NULL;
78          int gw_port = 0;
79       t_trusted_mac *p;
80 -     int tinyproxy_port;
81    
82      fw_quiet = 0;
83  
84 @@ -246,14 +245,7 @@
85                         iptables_do_command("-t nat -A " TABLE_WIFIDOG_WIFI_TO_ROUTER " -j ACCEPT");
86  
87                         iptables_do_command("-t nat -A " TABLE_WIFIDOG_OUTGOING " -j " TABLE_WIFIDOG_WIFI_TO_INTERNET);
88 -                       
89 -                       if((tinyproxy_port=config_get_config()->tinyproxy_port) != 0){
90 -                         debug(LOG_INFO,"Tinyproxy port set, setting tinyproxy rule");
91 -                         iptables_do_command("-t nat -A " TABLE_WIFIDOG_WIFI_TO_INTERNET " -p tcp --dport 80 -m mark --mark 0x%u -j REDIRECT --to-port %u", FW_MARK_KNOWN, tinyproxy_port);
92 -                       } else {
93 -                         iptables_do_command("-t nat -A " TABLE_WIFIDOG_WIFI_TO_INTERNET " -m mark --mark 0x%u -j ACCEPT", FW_MARK_KNOWN);
94 -                       }
95 -
96 +                       iptables_do_command("-t nat -A " TABLE_WIFIDOG_WIFI_TO_INTERNET " -m mark --mark 0x%u -j ACCEPT", FW_MARK_KNOWN);
97                         iptables_do_command("-t nat -A " TABLE_WIFIDOG_WIFI_TO_INTERNET " -m mark --mark 0x%u -j ACCEPT", FW_MARK_PROBATION);
98                         iptables_do_command("-t nat -A " TABLE_WIFIDOG_WIFI_TO_INTERNET " -j " TABLE_WIFIDOG_UNKNOWN);
99  
100 Index: src/http.c
101 ===================================================================
102 --- src/http.c  (revision 112)
103 +++ src/http.c  (revision 98)
104 @@ -22,7 +22,6 @@
105  /** @file http.c
106    @brief HTTP IO functions
107    @author Copyright (C) 2004 Philippe April <papril777@yahoo.com>
108 -  @author 2006 Pascal Rullier <pascal.rullier@wireless-fr.org>
109   */
110  
111  #define _GNU_SOURCE
112 @@ -80,20 +79,20 @@
113  
114         if (!is_online()) {
115                 /* The internet connection is down at the moment  - apologize and do not redirect anywhere */
116 -               http_wifidog_header(r, "L'accés internet est indisponible");
117 -               httpdOutput(r, "<p>Nous sommes désolés, mais il semble que la connexion internet est temporairement indisponible.</p>");
118 -               httpdOutput(r, "<p>Si cela est possible, veuillez avertir les propriétaires de ce point d'accés.</p>");
119 -               httpdOutput(r, "<p>Les administrateurs de ce réseau sont au courant de cette interruption. Nous espèrons que cette situation sera résolue bientôt.</p>");
120 -               httpdPrintf(r, "<p>Dans un moment, veuillez <a href='%s'>cliquer ici</a> pour relancer votre requète.</p>", tmp_url);
121 +               http_wifidog_header(r, "<h2>Uh oh! Internet access unavailable</h2>");
122 +               httpdOutput(r, "<p>We apologize, but it seems that the internet connection that powers this hotspot is temporarily unavailable.</p>");
123 +               httpdOutput(r, "<p>If at all possible, please notify the owners of this hotspot that the internet connection is out of service.</p>");
124 +               httpdOutput(r, "<p>The maintainers of this network are aware of this disruption.  We hope that this situation will be resolved soon.</p>");
125 +               httpdPrintf(r, "<p>In a while please <a href='%s'>click here</a> to try your request again.</p>", tmp_url);
126                 http_wifidog_footer(r);
127                 debug(LOG_INFO, "Sent %s an apology since I am not online - no point sending them to auth server", r->clientAddr);
128         }
129         else if (!is_auth_online()) {
130                 /* The auth server is down at the moment - apologize and do not redirect anywhere */
131 -               http_wifidog_header(r, "L'écran de connexion est indisponible");
132 -               httpdOutput(r, "<p>Nous sommes désolés, mais il semble que nous sommes actuellement incapables de vous rediriger sur la page de connexion.</p>");
133 -               httpdOutput(r, "<p>Les administrateurs de ce réseau sont au courant de cette interruption. Nous espèrons que cette situation sera bientôt résolue.</p>");
134 -               httpdPrintf(r, "<p>Dans un moment, veuillez <a href='%s'>cliquer ici</a> pour relancer votre requète.</p>", tmp_url);
135 +               http_wifidog_header(r, "<h2>Uh oh! Login screen unavailable</h2>");
136 +               httpdOutput(r, "<p>We apologize, but it seems that we are currently unable to re-direct you to the login screen.</p>");
137 +               httpdOutput(r, "<p>The maintainers of this network are aware of this disruption.  We hope that this situation will be resolved soon.</p>");
138 +               httpdPrintf(r, "<p>In a couple of minutes please <a href='%s'>click here</a> to try your request again.</p>", tmp_url);
139                 http_wifidog_footer(r);
140                 debug(LOG_INFO, "Sent %s an apology since auth server not online - no point sending them to auth server", r->clientAddr);
141         }
142 @@ -139,8 +138,8 @@
143  void
144  http_callback_about(httpd *webserver, request *r)
145  {
146 -       http_wifidog_header(r, "A propos de WiFiDog");
147 -       httpdOutput(r, "WiFiDog version <b>" VERSION "</b>");
148 +       http_wifidog_header(r, "About WiFiDog");
149 +       httpdOutput(r, "This is WiFiDog version <b>" VERSION "</b>");
150         http_wifidog_footer(r);
151  }
152  
153 @@ -148,8 +147,8 @@
154  http_callback_status(httpd *webserver, request *r)
155  {
156         char * status = NULL;
157 -       status = get_status_text(0);
158 -       http_wifidog_header(r, "Etat WiFiDog");
159 +       status = get_status_text();
160 +       http_wifidog_header(r, "WiFiDog Status");
161         httpdOutput(r, "<pre>");
162         httpdOutput(r, status);
163         httpdOutput(r, "</pre>");
164 @@ -209,50 +208,49 @@
165      httpdOutput(r, "body {\n");
166      httpdOutput(r, "  margin: 10px 60px 0 60px; \n");
167      httpdOutput(r, "  font-family : bitstream vera sans, sans-serif;\n");
168 -    // httpdOutput(r, "  color: #46a43a;\n");
169 -    httpdOutput(r, "  color: #2222ff;\n");
170 +    httpdOutput(r, "  color: #46a43a;\n");
171      httpdOutput(r, "}\n");
172  
173      httpdOutput(r, "a {\n");
174 -    httpdOutput(r, "  color: #00f;\n");
175 +    httpdOutput(r, "  color: #46a43a;\n");
176      httpdOutput(r, "}\n");
177  
178      httpdOutput(r, "a:active {\n");
179 -    httpdOutput(r, "  color: #00f;\n");
180 +    httpdOutput(r, "  color: #46a43a;\n");
181      httpdOutput(r, "}\n");
182  
183      httpdOutput(r, "a:link {\n");
184 -    httpdOutput(r, "  color: #00f;\n");
185 +    httpdOutput(r, "  color: #46a43a;\n");
186      httpdOutput(r, "}\n");
187  
188      httpdOutput(r, "a:visited {\n");
189 -    httpdOutput(r, "  color: #00f;\n");
190 +    httpdOutput(r, "  color: #46a43a;\n");
191      httpdOutput(r, "}\n");
192  
193      httpdOutput(r, "#header {\n");
194      httpdOutput(r, "  height: 30px;\n");
195 -    httpdOutput(r, "  background-color: #eeeeff;\n");
196 +    httpdOutput(r, "  background-color: #B4F663;\n");
197      httpdOutput(r, "  padding: 20px;\n");
198      httpdOutput(r, "  font-size: 20pt;\n");
199      httpdOutput(r, "  text-align: center;\n");
200 -    httpdOutput(r, "  border: 2px solid #2481ff;\n");
201 +    httpdOutput(r, "  border: 2px solid #46a43a;\n");
202      httpdOutput(r, "  border-bottom: 0;\n");
203      httpdOutput(r, "}\n");
204  
205      httpdOutput(r, "#menu {\n");
206      httpdOutput(r, "  width: 200px;\n");
207      httpdOutput(r, "  float: right;\n");
208 -    httpdOutput(r, "  background-color: #eeeeff;\n");
209 -    httpdOutput(r, "  border: 2px solid #2481ff;\n");
210 +    httpdOutput(r, "  background-color: #B4F663;\n");
211 +    httpdOutput(r, "  border: 2px solid #46a43a;\n");
212      httpdOutput(r, "  font-size: 80%;\n");
213      httpdOutput(r, "  min-height: 300px;\n");
214      httpdOutput(r, "}\n");
215  
216      httpdOutput(r, "#menu h2 {\n");
217      httpdOutput(r, "  margin: 0;\n");
218 -    httpdOutput(r, "  background-color: #2481ff;\n");
219 +    httpdOutput(r, "  background-color: #46a43a;\n");
220      httpdOutput(r, "  text-align: center;\n");
221 -    httpdOutput(r, "  color: #fff;\n");
222 +    httpdOutput(r, "  color: #B4F663;\n");
223      httpdOutput(r, "}\n");
224  
225      httpdOutput(r, "#copyright {\n");
226 @@ -260,7 +258,7 @@
227  
228      httpdOutput(r, "#content {\n");
229      httpdOutput(r, "  padding: 20px;\n");
230 -    httpdOutput(r, "  border: 2px solid #2481ff;\n");
231 +    httpdOutput(r, "  border: 2px solid #46a43a;\n");
232      httpdOutput(r, "  min-height: 300px;\n");
233      httpdOutput(r, "}\n");
234      httpdOutput(r, "</style>\n");
235 @@ -280,17 +278,14 @@
236      httpdOutput(r, "    <ul>\n");
237      httpdOutput(r, "    <li>Version: " VERSION "\n");
238      httpdPrintf(r, "    <li>Node ID: %s\n", config_get_config()->gw_id);
239 -    httpdPrintf(r, "    <li>Réseau : %s\n", config_get_config()->Network);
240 -    httpdPrintf(r, "    <li>Propriétaire : %s\n", config_get_config()->Proprietary);
241      httpdOutput(r, "    </ul>\n");
242      httpdOutput(r, "    <br>\n");
243  
244      httpdOutput(r, "    <h2>Menu</h2>\n");
245      httpdOutput(r, "    <ul>\n");
246 -    httpdOutput(r, "    <li><a href='/wifidog/status'>Etat WiFiDog</a>\n");
247 -    httpdOutput(r, "    <li><a href='/wifidog/about'>A propos de WiFiDog</a>\n");
248 -    httpdOutput(r, "    <li><a href='http://www.wifidog.org/'>Page d'accueil WiFiDog</a>\n");
249 -    httpdOutput(r, "    <li><a href='http://www.wireless-fr.org/'>Page d'accueil France Wireless</a>\n");
250 +    httpdOutput(r, "    <li><a href='/wifidog/status'>WiFiDog Status</a>\n");
251 +    httpdOutput(r, "    <li><a href='/wifidog/about'>About WiFiDog</a>\n");
252 +    httpdOutput(r, "    <li><a href='http://www.wifidog.org'>WiFiDog's homepage</a>\n");
253      httpdOutput(r, "    </ul>\n");
254      httpdOutput(r, "</div>\n");
255  
256 @@ -304,7 +299,7 @@
257         httpdOutput(r, "</div>\n");
258  
259      httpdOutput(r, "<div id=\"copyright\">\n");
260 -    httpdOutput(r, "Copyright (C) 2004-2006 Wifidog/France Wireless.  Ce logiciel est sous la license GNU GPL.\n");
261 +    httpdOutput(r, "Copyright (C) 2004-2005.  This software is released under the GNU GPL license.\n");
262      httpdOutput(r, "</div>\n");
263  
264  
265 Index: src/ping_thread.c
266 ===================================================================
267 --- src/ping_thread.c   (revision 112)
268 +++ src/ping_thread.c   (revision 98)
269 @@ -140,22 +140,18 @@
270         /*
271          * Prep & send request
272          */
273 -       snprintf(request, sizeof(request) - 1, "GET %sping/?gw_id=%s&sys_uptime=%lu&sys_memfree=%u&sys_load=%.2f&wifidog_uptime=%lu&prop=%s&network_id=%s&lat=%s&lon=%s HTTP/1.0\r\n"
274 -                "User-Agent: WiFiDog %s\r\n"
275 -                "Host: %s\r\n"
276 -                "\r\n",
277 -                config_get_config()->auth_servers->authserv_path,
278 -                config_get_config()->gw_id,
279 -                sys_uptime,
280 -                sys_memfree,
281 -                sys_load,
282 -                (long unsigned int)((long unsigned int)time(NULL) - (long unsigned int)started_time),
283 -                config_get_config()->Proprietary,
284 -                config_get_config()->Network,
285 -                config_get_config()->Lat,
286 -                config_get_config()->Lon,
287 -                VERSION,
288 -                config_get_config()->auth_servers->authserv_hostname);
289 +       snprintf(request, sizeof(request) - 1, "GET %sping/?gw_id=%s&sys_uptime=%lu&sys_memfree=%u&sys_load=%.2f&wifidog_uptime=%lu HTTP/1.0\r\n"
290 +                       "User-Agent: WiFiDog %s\r\n"
291 +                       "Host: %s\r\n"
292 +                       "\r\n",
293 +                       config_get_config()->auth_servers->authserv_path,
294 +                       config_get_config()->gw_id,
295 +                       sys_uptime,
296 +                       sys_memfree,
297 +                       sys_load,
298 +                       (long unsigned int)((long unsigned int)time(NULL) - (long unsigned int)started_time),
299 +                       VERSION,
300 +                       config_get_config()->auth_servers->authserv_hostname);
301  
302         debug(LOG_DEBUG, "HTTP Request to Server: [%s]", request);
303        
304 Index: src/util.c
305 ===================================================================
306 --- src/util.c  (revision 112)
307 +++ src/util.c  (revision 98)
308 @@ -331,7 +331,7 @@
309  /*
310   * @return A string containing human-readable status text. MUST BE free()d by caller
311   */
312 -char * get_status_text(int showtrusted) {
313 +char * get_status_text() {
314         char buffer[STATUS_BUF_SIZ];
315         ssize_t len;
316         s_config *config;
317 @@ -341,7 +341,6 @@
318         unsigned long int uptime = 0;
319         unsigned int days = 0, hours = 0, minutes = 0, seconds = 0;
320       t_trusted_mac *p;
321 -     int tinyproxyport;
322        
323         len = 0;
324         snprintf(buffer, (sizeof(buffer) - len), "WiFiDog status\n\n");
325 @@ -379,34 +378,9 @@
326         snprintf((buffer + len), (sizeof(buffer) - len), "Auth server reachable: %s\n", (is_auth_online() ? "yes" : "no"));
327         len = strlen(buffer);
328  
329 -       snprintf((buffer + len), (sizeof(buffer) - len), "Node ID: %s\n", config_get_config()->gw_id);
330 -       len = strlen(buffer);
331 -
332 -       snprintf((buffer + len), (sizeof(buffer) - len), "Proprietary: %s\n", config_get_config()->Proprietary);
333 -       len = strlen(buffer);
334 -
335 -       snprintf((buffer + len), (sizeof(buffer) - len), "Network : %s\n", config_get_config()->Network);
336 -       len = strlen(buffer);
337 -
338 -       if(showtrusted)
339 -         {
340 -           if((tinyproxyport = config_get_config()->tinyproxy_port) != 0)
341 -             {
342 -               snprintf((buffer + len), (sizeof(buffer) - len), "TinyproxyPort : %u\n", tinyproxyport);
343 -               len = strlen(buffer);
344 -             }
345 -
346 -           snprintf((buffer + len), (sizeof(buffer) - len), "Lat : %s\nLon : %s\n",
347 -                    config_get_config()->Lat, config_get_config()->Lon);
348 -           len = strlen(buffer);
349 -         }
350 -       
351         snprintf((buffer + len), (sizeof(buffer) - len), "Clients served this session: %lu\n\n", served_this_session);
352         len = strlen(buffer);
353  
354 -
355 -
356 -
357         LOCK_CLIENT_LIST();
358        
359         first = client_get_first_client();
360 @@ -447,20 +421,17 @@
361  
362         UNLOCK_CLIENT_LIST();
363  
364 -       config = config_get_config();
365 +    config = config_get_config();
366 +   
367 +    if (config->trustedmaclist != NULL) {
368 +        snprintf((buffer + len), (sizeof(buffer) - len), "\nTrusted MAC addresses:\n");
369 +        len = strlen(buffer);
370  
371 -       if(showtrusted)
372 -         {
373 -           if (config->trustedmaclist != NULL) {
374 -             snprintf((buffer + len), (sizeof(buffer) - len), "\nTrusted MAC addresses:\n");
375 -             len = strlen(buffer);
376 -             
377 -             for (p = config->trustedmaclist; p != NULL; p = p->next) {
378 -               snprintf((buffer + len), (sizeof(buffer) - len), "  %s\n", p->mac);
379 -               len = strlen(buffer);
380 -             }
381 -           }
382 -         }
383 +        for (p = config->trustedmaclist; p != NULL; p = p->next) {
384 +            snprintf((buffer + len), (sizeof(buffer) - len), "  %s\n", p->mac);
385 +            len = strlen(buffer);
386 +        }
387 +    }
388  
389      snprintf((buffer + len), (sizeof(buffer) - len), "\nAuthentication servers:\n");
390      len = strlen(buffer);
391 Index: src/wdctl_thread.c
392 ===================================================================
393 --- src/wdctl_thread.c  (revision 112)
394 +++ src/wdctl_thread.c  (revision 98)
395 @@ -209,7 +209,7 @@
396         char * status = NULL;
397         int len = 0;
398  
399 -       status = get_status_text(1);
400 +       status = get_status_text();
401         len = strlen(status);
402  
403         write(fd, status, len);
404 Index: src/conf.h
405 ===================================================================
406 --- src/conf.h  (revision 112)
407 +++ src/conf.h  (revision 98)
408 @@ -48,7 +48,6 @@
409  #define DEFAULT_AUTHSERVSSLAVAILABLE 0
410  /** Note:  The path must be prefixed by /, and must be suffixed /.  Put / for the server root.*/
411  #define DEFAULT_AUTHSERVPATH "/wifidog/"
412 -#define DEFAULT_NETWORK "default-network"
413  /*@}*/
414  
415  /**
416 @@ -126,11 +125,6 @@
417                                      logging */
418      t_firewall_ruleset *rulesets;      /**< @brief firewall rules */
419      t_trusted_mac *trustedmaclist; /**< @brief list of trusted macs */
420 -  char *Proprietary;
421 -  char *Network;       /* Name of network */
422 -  char *Lat;
423 -  char *Lon;
424 -  int tinyproxy_port;
425  } s_config;
426  
427  /** @brief Get the current gateway configuration */
428 Index: src/util.h
429 ===================================================================
430 --- src/util.h  (revision 112)
431 +++ src/util.h  (revision 98)
432 @@ -60,7 +60,7 @@
433  /*
434   * @brief Creates a human-readable paragraph of the status of wifidog
435   */
436 -char * get_status_text(int showtrusted);
437 +char * get_status_text();
438  
439  #define LOCK_GHBN() do { \
440         debug(LOG_DEBUG, "Locking wd_gethostbyname()"); \
Note: See TracBrowser for help on using the browser.