logging of replymsg, patch from Arne Schwabe
authorvenaas <venaas>
Wed, 17 Sep 2008 12:57:49 +0000 (12:57 +0000)
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>
Wed, 17 Sep 2008 12:57:49 +0000 (12:57 +0000)
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@389 e88ac4ed-0b26-0410-9574-a7f39faa03bf

radsecproxy.c

index 5775f0c..4a02197 100644 (file)
@@ -6,6 +6,11 @@
  * copyright notice and this permission notice appear in all copies.
  */
 
+/* Code contributions from:
+ *
+ * Arne Schwabe <schwabe at uni-paderborn.de>
+ */
+
 /* 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);
        }
     }