From 977aeaa206964b7590c18dce1088d6f89745165b Mon Sep 17 00:00:00 2001 From: venaas Date: Wed, 17 Sep 2008 12:57:49 +0000 Subject: logging of replymsg, patch from Arne Schwabe git-svn-id: https://svn.testnett.uninett.no/radsecproxy/branches/release-1.1@389 e88ac4ed-0b26-0410-9574-a7f39faa03bf --- radsecproxy.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'radsecproxy.c') diff --git a/radsecproxy.c b/radsecproxy.c index 924434c..f2d8346 100644 --- a/radsecproxy.c +++ b/radsecproxy.c @@ -6,6 +6,11 @@ * copyright notice and this permission notice appear in all copies. */ +/* Code contributions from: + * + * Arne Schwabe + */ + /* For UDP there is one server instance consisting of udpserverrd and udpserverth * rd is responsible for init and launching wr * For TLS there is a server instance that launches tlsserverrd for each TLS peer @@ -1992,7 +1997,7 @@ int replyh(struct server *server, unsigned char *buf) { int i, len, sublen; unsigned char *messageauth, *subattrs, *attrs, *attr, *username; struct sockaddr_storage fromsa; - char tmp[760], stationid[760]; + char tmp[760], stationid[760], replymsg[760]; server->connectionok = 1; server->lostrqs = 0; @@ -2108,10 +2113,23 @@ int replyh(struct server *server, unsigned char *buf) { attr = attrget(rq->buf + 20, RADLEN(rq->buf) - 20, RAD_Attr_Calling_Station_Id); if (attr) { radattr2ascii(stationid, sizeof(stationid), attr); - debug(DBG_INFO, "%s for user %s stationid %s from %s", - radmsgtype2string(*buf), tmp, stationid, server->conf->host); - } else - debug(DBG_INFO, "%s for user %s from %s", radmsgtype2string(*buf), tmp, server->conf->host); + attr = attrget(buf + 20, RADLEN(buf) - 20, RAD_Attr_Reply_Message); + if (attr) { + radattr2ascii(replymsg, sizeof(replymsg), attr); + debug(DBG_INFO, "%s for user %s stationid %s from %s (%s)", + radmsgtype2string(*buf), tmp, stationid, server->conf->host, replymsg); + } else + debug(DBG_INFO, "%s for user %s stationid %s from %s", + radmsgtype2string(*buf), tmp, stationid, server->conf->host); + } else { + attr = attrget(buf + 20, RADLEN(buf) - 20, RAD_Attr_Reply_Message); + if (attr) { + radattr2ascii(replymsg, sizeof(replymsg), attr); + debug(DBG_INFO, "%s for user %s from %s (%s)", + radmsgtype2string(*buf), tmp, server->conf->host, replymsg); + } else + debug(DBG_INFO, "%s for user %s from %s", radmsgtype2string(*buf), tmp, server->conf->host); + } } } -- cgit v1.1