Function Call to Get User's Attribute from Users File?
Is there a function call to get the value of an attribute for a user from the users file?
On 10/17/2012 07:27 AM, jobhunts02@aol.com wrote:
Is there a function call to get the value of an attribute for a user from the users file?
Not sure I understand what you want here. A function call where? Obviously there are function calls to handle "users" files in the source - see: src/modules/rlm_files/rlm_files.c ...however there's no single, simple call "to get the value of an attribute" because that's not how users files work. They're lists of attribute-value pairs to be checked and replied, with optional expansion and dictionary handling. Perhaps if you explain what you're trying to achieve?
I have a vendor specific attribute, Max-Data-Bytes, defined for users to set a maximum data usage for each user. I am using rlm_counter.c to keep track of how much a data usage a user has. When an Accounting-Request comes in, I update the total usage so far for the user. I would then like to compare this number to the user's Max-Data-Bytes value in the users file to determine if the user should be disconnected. On Oct 17, 2012, at 1:14 AM, Phil Mayers <p.mayers@imperial.ac.uk> wrote:
On 10/17/2012 07:27 AM, jobhunts02@aol.com wrote:
Is there a function call to get the value of an attribute for a user from the users file?
Not sure I understand what you want here. A function call where?
Obviously there are function calls to handle "users" files in the source - see:
src/modules/rlm_files/rlm_files.c
...however there's no single, simple call "to get the value of an attribute" because that's not how users files work. They're lists of attribute-value pairs to be checked and replied, with optional expansion and dictionary handling.
Perhaps if you explain what you're trying to achieve? - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/devel.html
On 17 Oct 2012, at 17:44, jobhunts02@aol.com wrote:
I have a vendor specific attribute, Max-Data-Bytes, defined for users to set a maximum data usage for each user. I am using rlm_counter.c to keep track of how much a data usage a user has. When an Accounting-Request comes in, I update the total usage so far for the user. I would then like to compare this number to the user's Max-Data-Bytes value in the users file to determine if the user should be disconnected.
counter module registers a paircompare on whatever you set counter-name to be, so just use this as a checkitem and it'll do all the magic to figure out the current value from the counter module. I think the idea behind the counter module was to record session times, thought it may work for other things, it'll require patches for data counters, else you'll probably experience counter wrap. I wouldn't attempt this on v2 as it's missing support for 64bit integers. But it shouldn't be too difficult to add 64bit counter support for v3, I suggest you start here: https://github.com/FreeRADIUS/freeradius-server/blob/master/src/modules/rlm_... You'll also need to recombine Acct-Input/Output-Octers and Acct-Input/Output-Gigawords before calling the counter module in a 64bit attribute you define. -Arran
participants (3)
-
Arran Cudbard-Bell -
jobhunts02@aol.com -
Phil Mayers