summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2011-04-05 10:33:50 +0200
committerLinus Nordberg <linus@nordu.net>2011-04-05 10:33:50 +0200
commitefccefde3e17d3202dff7714491ed85bcd56d371 (patch)
tree6c8eeb0f8a1a198455bf73b00b978d8321890cae
parentdb02df7229ba28df37677cb1bab66749b513d943 (diff)
Log MAC as "undisclosed" for config FTicksMac Static.
Also, log empty string if no Calling-Station-Id attribute is found.
-rw-r--r--fticks.c70
1 files changed, 33 insertions, 37 deletions
diff --git a/fticks.c b/fticks.c
index 7cbbb46..fd9a57d 100644
--- a/fticks.c
+++ b/fticks.c
@@ -163,49 +163,45 @@ fticks_log(const struct options *options,
}
memset(visinst, 0, sizeof(visinst));
- if (options->fticks_reporting == RSP_FTICKS_REPORTING_FULL)
+ if (options->fticks_reporting == RSP_FTICKS_REPORTING_FULL) {
snprintf((char *) visinst, sizeof(visinst), "VISINST=%s#",
client->conf->name);
+ }
-#define BOGUS_MAC "00:00:00:00:00:00" /* FIXME: Is there a standard
- * for bogus MAC addresses? */
memset(macout, 0, sizeof(macout));
- strncpy((char *) macout, BOGUS_MAC, sizeof(macout) - 1);
- if (options->fticks_mac != RSP_FTICKS_MAC_STATIC) {
+ if (options->fticks_mac == RSP_FTICKS_MAC_STATIC) {
+ strncpy((char *) macout, "undisclosed", sizeof(macout) - 1);
+ }
+ else {
macin = radattr2ascii(radmsg_gettype(rqout->rq->msg,
RAD_Attr_Calling_Station_Id));
- }
-#if RS_TESTING || 1
- if (macin == NULL)
- macin = (uint8_t *) strdup(BOGUS_MAC);
-#endif /* RS_TESTING */
-
- switch (options->fticks_mac)
- {
- case RSP_FTICKS_MAC_STATIC:
- memcpy(macout, BOGUS_MAC, sizeof(BOGUS_MAC));
- break;
- case RSP_FTICKS_MAC_ORIGINAL:
- memcpy(macout, macin, sizeof(macout));
- break;
- case RSP_FTICKS_MAC_VENDOR_HASHED:
- memcpy(macout, macin, 9);
- fticks_hashmac(macin + 9, NULL, sizeof(macout) - 9, macout + 9);
- break;
- case RSP_FTICKS_MAC_VENDOR_KEY_HASHED:
- memcpy(macout, macin, 9);
- fticks_hashmac(macin + 9, options->fticks_key,
- sizeof(macout) - 9, macout + 9);
- break;
- case RSP_FTICKS_MAC_FULLY_HASHED:
- fticks_hashmac(macin, NULL, sizeof(macout), macout);
- break;
- case RSP_FTICKS_MAC_FULLY_KEY_HASHED:
- fticks_hashmac(macin, options->fticks_key, sizeof(macout), macout);
- break;
- default:
- debugx(2, DBG_ERR, "invalid fticks mac configuration: %d",
- options->fticks_mac);
+ if (macin) {
+ switch (options->fticks_mac)
+ {
+ case RSP_FTICKS_MAC_ORIGINAL:
+ memcpy(macout, macin, sizeof(macout));
+ break;
+ case RSP_FTICKS_MAC_VENDOR_HASHED:
+ memcpy(macout, macin, 9);
+ fticks_hashmac(macin + 9, NULL, sizeof(macout) - 9, macout + 9);
+ break;
+ case RSP_FTICKS_MAC_VENDOR_KEY_HASHED:
+ memcpy(macout, macin, 9);
+ fticks_hashmac(macin + 9, options->fticks_key,
+ sizeof(macout) - 9, macout + 9);
+ break;
+ case RSP_FTICKS_MAC_FULLY_HASHED:
+ fticks_hashmac(macin, NULL, sizeof(macout), macout);
+ break;
+ case RSP_FTICKS_MAC_FULLY_KEY_HASHED:
+ fticks_hashmac(macin, options->fticks_key, sizeof(macout),
+ macout);
+ break;
+ default:
+ debugx(2, DBG_ERR, "invalid fticks mac configuration: %d",
+ options->fticks_mac);
+ }
+ }
}
debug(0xff,
"F-TICKS/eduroam/1.0#REALM=%s#VISCOUNTRY=%s#%sCSI=%s#RESULT=%s#",