# Quick patch to smuggle the mac address as $MACADDY in nodogsplash. # # This patch comes with no warranty, use at your own discretion. # Matthew Gillespie, braindeadprojects.com 03/03/2011 --- nodogsplash-0.9_beta9.9.5/src/http.c 2008-09-21 15:59:01.000000000 -0400 +++ nodogsplash-0.9_beta9.9.5-patch/src/http.c 2011-03-03 17:26:10.000000000 -0500 @@ -218,7 +218,7 @@ switch(action) { case AUTH_MAKE_AUTHENTICATED: auth_client_action(ip,mac,action); - http_nodogsplash_redirect(r, redir); + http_nodogsplash_redirect(r, redir, mac); break; case AUTH_MAKE_DEAUTHENTICATED: auth_client_action(ip,mac,action); @@ -304,7 +304,7 @@ encauthaction, encredir, enctoken); - http_nodogsplash_redirect(r, remoteurl); + http_nodogsplash_redirect(r, remoteurl, NULL); free(encgateway); free(encauthaction); free(encredir); @@ -426,8 +426,22 @@ void -http_nodogsplash_redirect(request *r, char *url) { +http_nodogsplash_redirect(request *r, char *url, char *mac) { char *header; + char newurl[255]; + int index; + + + //Here we need to do a find/replace to insert the MACADDY @todo + if (mac != NULL) + { + index = strstr(url, "MACADDY"); + strncpy(newurl, url, index); + strcpy(&newurl[index], mac); + strcpy(&newurl[strlen(newurl)], &url[index+7]); + + strcpy(url, newurl); + } httpdSetResponse(r, "307 Temporary Redirect"); safe_asprintf(&header, "Location: %s",url); --- nodogsplash-0.9_beta9.9.5/src/http.h 2007-10-25 15:35:48.000000000 -0400 +++ nodogsplash-0.9_beta9.9.5-patch/src/http.h 2011-03-03 19:32:38.000000000 -0500 @@ -63,7 +63,7 @@ /**@brief Add client identified in request to client list. */ t_client* http_nodogsplash_add_client(request *r); /**@brief Serve a 307 Temporary Redirect */ -void http_nodogsplash_redirect(request *r, char *url); +void http_nodogsplash_redirect(request *r, char *url, char *mac); /**@brief Redirect to remote auth server */ void http_nodogsplash_redirect_remote_auth(request *r, t_auth_target *authtarget); /**@brief Serve the splash page from its file */