summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan DeKok <aland@freeradius.org>2017-02-08 13:15:40 -0500
committerGitHub <noreply@github.com>2017-02-08 13:15:40 -0500
commitccdbb9d43e3dc799400716c310d0c1157255c239 (patch)
treee89da54f50584419d68d725fe1e332d3da1b7a56
parent2ab3b77e3e15f73dc206906737d2f7255e166274 (diff)
parent185c87a59010bafc6cfcdfac41d8666ea32d5cc5 (diff)
downloadlibpam-radius-auth-ccdbb9d43e3dc799400716c310d0c1157255c239.tar.gz
libpam-radius-auth-ccdbb9d43e3dc799400716c310d0c1157255c239.zip
Merge pull request #19 from liske/calling-acc
Add Calling-Station-Id to accounting requests.
-rw-r--r--src/pam_radius_auth.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/pam_radius_auth.c b/src/pam_radius_auth.c
index 471c0d6..83c6754 100644
--- a/src/pam_radius_auth.c
+++ b/src/pam_radius_auth.c
@@ -1272,6 +1272,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;
@@ -1338,6 +1339,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;