Changeset 1432

Show
Ignore:
Timestamp:
11/25/09 14:00:21 (2 years ago)
Author:
gbastien
Message:

* Fix #667, add the mac address as parameter to the login page request

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog/src/http.c

    r1373 r1432  
    6464http_callback_404(httpd *webserver, request *r) 
    6565{ 
    66         char            tmp_url[MAX_BUF], 
    67                         *url; 
     66        char tmp_url[MAX_BUF], 
     67                        *url, 
     68                        *mac; 
    6869        s_config        *config = config_get_config(); 
    6970        t_auth_serv     *auth_server = get_auth_server(); 
     
    116117                        config->gw_id, 
    117118                        url); 
     119 
     120                if (!(mac = arp_get(r->clientAddr))) { 
     121                        /* We could not get their MAC address */ 
     122                        debug(LOG_INFO, "Failed to retrieve MAC address for ip %s, so not putting in the login request", r->clientAddr); 
     123                } else { 
     124                        debug(LOG_INFO, "Got client MAC address for ip %s: %s", r->clientAddr, mac); 
     125                        safe_asprintf(&urlFragment, "%s&mac=%s", urlFragment, mac); 
     126                } 
     127 
    118128                debug(LOG_INFO, "Captured %s requesting [%s] and re-directing them to login page", r->clientAddr, url); 
    119129                http_send_redirect_to_auth(r, urlFragment, "Redirect to login page");