Patch proposal: Logging of CSID in radiusd/auth.c

Maurice Makaay <[email protected]> Wed, 19 Nov 2003 13:36:49 +0100
Newsgroups gmane.comp.gnu.radius.bugs
Organization InterNLnet BV
Message-ID <[email protected]>
Hi,

Our users use a wide range of dial-in PoPs. Each PoP is used for a certain
type of user. If a user dials in on a wrong number, he/she will get an
authentication failure. For our servicedesk it's therefore very useful to
have insight in the PoP a user is using, in case there are problems
authenticating. Now only the CLID is logged in the authentication logging.

The proposed patch adds the CSID to it. I think this patch is useful in 
general, so I haven't made CSID logging configurable option. Let me know
if this patch can be added or if you'd rather have stuff like this 
configurable in the server configuration file.


Regards,

-- Maurice Makaay

_______________________________________________
Bug-gnu-radius mailing list
[email protected]
http://mail.gnu.org/mailman/listinfo/bug-gnu-radius
CVS-patch-logCSID (text/plain, 1.8 KB)
Index: radiusd/auth.c
===================================================================
RCS file: /cvsroot/radius/radius/radiusd/auth.c,v
retrieving revision 1.97
diff -u -r1.97 auth.c
--- radiusd/auth.c	14 Nov 2003 10:50:06 -0000	1.97
+++ radiusd/auth.c	19 Nov 2003 12:26:37 -0000
@@ -497,6 +497,7 @@
         struct obstack msg_stack;
         
         const char *clid;
+        const char *csid;
         enum auth_state state;
 } AUTH_MACH;
 
@@ -586,22 +587,22 @@
 {
         if (reason)
                 radlog_req(L_NOTICE, m->req,
-			   "%s [%s%s%s]: %s%s, CLID %s",
+			   "%s [%s%s%s]: %s%s, CLID %s, CSID %s",
 			   diag,
 			   m->namepair->avp_strvalue,
 			   pass ? "/" : "",
 			   pass ? pass : "",
 			   reason,
 			   addstr ? addstr : "",
-			   m->clid);
+			   m->clid, m->csid);
         else
                 radlog_req(L_NOTICE, m->req,
-			   "%s [%s%s%s], CLID %s",
+			   "%s [%s%s%s], CLID %s, CSID %s",
 			   diag,
 			   m->namepair->avp_strvalue,
 			   pass ? "/" : "",
 			   pass ? pass : "",
-			   m->clid);
+			   m->clid, m->csid);
 }
 
 int
@@ -804,6 +805,11 @@
         else
                 m->clid = _("unknown");
 
+        if (pair_ptr = avl_find(radreq->request, DA_CALLED_STATION_ID)) 
+                m->csid = pair_ptr->avp_strvalue;
+        else
+                m->csid = _("unknown");
+
         /*
          * Get the user from the database
          */
@@ -970,11 +976,11 @@
                         MSG_MULTIPLE_LOGIN : MSG_SECOND_LOGIN);
 
         radlog_req(L_WARN, m->req,
-		   _("Multiple logins: [%s] max. %ld%s, CLID %s"),
+		   _("Multiple logins: [%s] max. %ld%s, CLID %s, CSID %s"),
                m->namepair->avp_strvalue,
                m->check_pair->avp_lvalue,
 		   rc == 2 ? _(" [MPP attempt]") : "",
-		   m->clid);
+		   m->clid, m->csid);
         newstate(as_reject_cleanup);
 }