From 185c87a59010bafc6cfcdfac41d8666ea32d5cc5 Mon Sep 17 00:00:00 2001 From: Thomas Liske Date: Sun, 17 Jan 2016 19:21:34 +0100 Subject: Add Calling-Station-Id to accounting requests. --- src/pam_radius_auth.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/pam_radius_auth.c b/src/pam_radius_auth.c index 90d074a..65adf40 100644 --- a/src/pam_radius_auth.c +++ b/src/pam_radius_auth.c @@ -1303,6 +1303,7 @@ PAM_EXTERN int pam_sm_setcred(pam_handle_t *pamh,int flags,int argc,CONST char * static int pam_private_session(pam_handle_t *pamh, int flags, int argc, CONST char **argv, int status) { CONST char *user; + CONST char *rhost; int ctrl; int retval = PAM_AUTH_ERR; @@ -1363,6 +1364,19 @@ static int pam_private_session(pam_handle_t *pamh, int flags, int argc, CONST ch add_int_attribute(request, PW_ACCT_SESSION_TIME, time(NULL) - session_time); } + /* + * Tell the server which host the user is coming from. + * + * Note that this is NOT the IP address of the machine running PAM! + * It's the IP address of the client. + */ + retval = pam_get_item(pamh, PAM_RHOST, (CONST void **) &rhost); + PAM_FAIL_CHECK; + if (rhost) { + add_attribute(request, PW_CALLING_STATION_ID, (unsigned char *) rhost, + strlen(rhost)); + } + retval = talk_radius(&config, request, response, NULL, NULL, 1); PAM_FAIL_CHECK; -- cgit v1.2.3