diff options
author | Thomas Liske <thomas@fiasko-nw.net> | 2016-01-17 19:21:34 +0100 |
---|---|---|
committer | Thomas Liske <thomas@fiasko-nw.net> | 2016-01-17 19:21:34 +0100 |
commit | 185c87a59010bafc6cfcdfac41d8666ea32d5cc5 (patch) | |
tree | 80ac1f873853fa7ad75b121e6afaaedb718665dd /src | |
parent | 6bae92df885602b2558333bdb6d2db67d1365683 (diff) | |
download | libpam-radius-auth-185c87a59010bafc6cfcdfac41d8666ea32d5cc5.tar.gz libpam-radius-auth-185c87a59010bafc6cfcdfac41d8666ea32d5cc5.zip |
Add Calling-Station-Id to accounting requests.
Diffstat (limited to 'src')
-rw-r--r-- | src/pam_radius_auth.c | 14 |
1 files changed, 14 insertions, 0 deletions
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; |