From 0ae3e22361c9d7a7ff1cc8532095f5f3975448b5 Mon Sep 17 00:00:00 2001 From: venaas Date: Wed, 17 Sep 2008 12:57:49 +0000 Subject: [PATCH] logging of replymsg, patch from Arne Schwabe git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@389 e88ac4ed-0b26-0410-9574-a7f39faa03bf --- radsecproxy.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/radsecproxy.c b/radsecproxy.c index 5775f0c..4a02197 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 @@ -1890,7 +1895,7 @@ void replyh(struct server *server, unsigned char *buf) { struct rqout *rqout; int sublen; unsigned char *subattrs; - uint8_t *username, *stationid; + uint8_t *username, *stationid, *replymsg; struct radmsg *msg = NULL; struct tlv *attr; struct list_node *node; @@ -1965,12 +1970,25 @@ void replyh(struct server *server, unsigned char *buf) { username = radattr2ascii(radmsg_gettype(rqout->rq->msg, RAD_Attr_User_Name)); if (username) { stationid = radattr2ascii(radmsg_gettype(rqout->rq->msg, RAD_Attr_Calling_Station_Id)); + replymsg = radattr2ascii(radmsg_gettype(msg, RAD_Attr_Reply_Message)); if (stationid) { - debug(DBG_INFO, "%s for user %s stationid %s from %s", - radmsgtype2string(msg->code), username, stationid, server->conf->host); + if (replymsg) { + debug(DBG_INFO, "%s for user %s stationid %s from %s (%s)", + radmsgtype2string(msg->code), username, stationid, server->conf->host, replymsg); + free(replymsg); + } else + debug(DBG_INFO, "%s for user %s stationid %s from %s", + radmsgtype2string(msg->code), username, stationid, server->conf->host); free(stationid); - } else - debug(DBG_INFO, "%s for user %s from %s", radmsgtype2string(msg->code), username, server->conf->host); + } else { + if (replymsg) { + debug(DBG_INFO, "%s for user %s from %s (%s)", + radmsgtype2string(msg->code), username, server->conf->host, replymsg); + free(replymsg); + } else + debug(DBG_INFO, "%s for user %s from %s", + radmsgtype2string(msg->code), username, server->conf->host); + } free(username); } } -- 2.1.4