Hi, I am not able to use %RAD_PERLCONF during parsing phase of radius.pm. I understand why, because section config (rlm_perl) is parsed after parsing radius.pm itself. Therefore i am able to set up global constant based on freeradius configuration. Is it correct behaviour ? Piece of radius.pm code: ... # Hashes with request / reply parameters use vars qw(%RAD_PERLCONF %RAD_REQUEST %RAD_REPLY %RAD_CHECK %RAD_REQUEST_PROXY %RAD_REQUEST_PROXY_REPLY); use constant LOG_DIR => $RAD_PERLCONF{'logdir'}; (line 47) use constant LOG_FILENAME => LOG_DIR().$RAD_PERLCONF{'name'}.'.gen'; use constant RADIUS_RADDB_DIR => $RAD_PERLCONF{'confdir'}; ... Debug output (freeradius 3.0.7): .... radiusd: #### Instantiating modules #### instantiate { # Loaded module rlm_perl # Instantiating module "perl" from file ./mods-enabled/perl perl { filename = "./mods-config/perl/radius.pm" func_authorize = "authorize" func_authenticate = "authenticate" func_post_auth = "post_auth" func_accounting = "accounting" func_preacct = "preacct" func_checksimul = "checksimul" func_detach = "detach" func_xlat = "xlat" func_pre_proxy = "pre_proxy" func_post_proxy = "post_proxy" func_recv_coa = "recv_coa" func_send_coa = "send_coa" } Use of uninitialized value in concatenation (.) or string at ./mods-config/perl/radius.pm line 47, <DATA> line 751. rlm_perl (perl): parsing 'config' section... config { logdir = /app_log/radius/auth/ confdir = ./ name = auth } rlm_perl (perl): done parsing 'config'.
On 18 Apr 2015, at 12:05, Peter Balsianok <balsianok.peter@gmail.com> wrote:
Hi,
I am not able to use %RAD_PERLCONF during parsing phase of radius.pm. I understand why, because section config (rlm_perl) is parsed after parsing radius.pm itself. Therefore i am able to set up global constant based on freeradius configuration.
Is it correct behaviour ?
I'd say no, but I don't know enough about the perl API to say for sure. For example, i'm not sure of the earliest point at which you could inject globals. If no one else answers, could you add an issue on GitHub so we can track this, and i'll look at it in a few days. -Arran Arran Cudbard-Bell <a.cudbardb@freeradius.org> FreeRADIUS development team FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2
That's correct. You cannot do this because %RAD_PERLCONF hash is only available in the context of a request. Additionally, to use this hash you need to declare it in the perl script (this is not the case in the default example.pl provided). (maybe it should ?) For example: # Bring the global hashes into the package scope our (%RAD_REQUEST, %RAD_REPLY, %RAD_CONFIG, %RAD_PERLCONF);
Hi,
I am not able to use %RAD_PERLCONF during parsing phase of radius.pm. I understand why, because section config (rlm_perl) is parsed after parsing radius.pm itself. Therefore i am able to set up global constant based on freeradius configuration.
Is it correct behaviour ?
Piece of radius.pm code: ... # Hashes with request / reply parameters use vars qw(%RAD_PERLCONF %RAD_REQUEST %RAD_REPLY %RAD_CHECK %RAD_REQUEST_PROXY %RAD_REQUEST_PROXY_REPLY);
use constant LOG_DIR => $RAD_PERLCONF{'logdir'}; (line 47) use constant LOG_FILENAME => LOG_DIR().$RAD_PERLCONF{'name'}.'.gen'; use constant RADIUS_RADDB_DIR => $RAD_PERLCONF{'confdir'}; ...
Debug output (freeradius 3.0.7): .... radiusd: #### Instantiating modules #### instantiate { # Loaded module rlm_perl # Instantiating module "perl" from file ./mods-enabled/perl perl { filename = "./mods-config/perl/radius.pm" func_authorize = "authorize" func_authenticate = "authenticate" func_post_auth = "post_auth" func_accounting = "accounting" func_preacct = "preacct" func_checksimul = "checksimul" func_detach = "detach" func_xlat = "xlat" func_pre_proxy = "pre_proxy" func_post_proxy = "post_proxy" func_recv_coa = "recv_coa" func_send_coa = "send_coa" } Use of uninitialized value in concatenation (.) or string at ./mods-config/perl/radius.pm line 47, <DATA> line 751. rlm_perl (perl): parsing 'config' section... config { logdir = /app_log/radius/auth/ confdir = ./ name = auth } rlm_perl (perl): done parsing 'config'. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
Hi, You are not right. %RAD_PERLCONF is available also during 'Instantiation'. The question is: Would it be available also during compilation phase (like radiusd::radlog) Peter On Tue, Apr 21, 2015 at 9:52 AM, Chaigneau, Nicolas < nicolas.chaigneau@capgemini.com> wrote:
That's correct.
You cannot do this because %RAD_PERLCONF hash is only available in the context of a request.
Additionally, to use this hash you need to declare it in the perl script (this is not the case in the default example.pl provided). (maybe it should ?)
For example:
# Bring the global hashes into the package scope our (%RAD_REQUEST, %RAD_REPLY, %RAD_CONFIG, %RAD_PERLCONF);
Hi,
I am not able to use %RAD_PERLCONF during parsing phase of radius.pm. I understand why, because section config (rlm_perl) is parsed after parsing radius.pm itself. Therefore i am able to set up global constant based on freeradius configuration.
Is it correct behaviour ?
Piece of radius.pm code: ... # Hashes with request / reply parameters use vars qw(%RAD_PERLCONF %RAD_REQUEST %RAD_REPLY %RAD_CHECK %RAD_REQUEST_PROXY %RAD_REQUEST_PROXY_REPLY);
use constant LOG_DIR => $RAD_PERLCONF{'logdir'}; (line 47) use constant LOG_FILENAME => LOG_DIR().$RAD_PERLCONF{'name'}.'.gen'; use constant RADIUS_RADDB_DIR => $RAD_PERLCONF{'confdir'}; ...
Debug output (freeradius 3.0.7): .... radiusd: #### Instantiating modules #### instantiate { # Loaded module rlm_perl # Instantiating module "perl" from file ./mods-enabled/perl perl { filename = "./mods-config/perl/radius.pm" func_authorize = "authorize" func_authenticate = "authenticate" func_post_auth = "post_auth" func_accounting = "accounting" func_preacct = "preacct" func_checksimul = "checksimul" func_detach = "detach" func_xlat = "xlat" func_pre_proxy = "pre_proxy" func_post_proxy = "post_proxy" func_recv_coa = "recv_coa" func_send_coa = "send_coa" } Use of uninitialized value in concatenation (.) or string at ./mods-config/perl/radius.pm line 47, <DATA> line 751. rlm_perl (perl): parsing 'config' section... config { logdir = /app_log/radius/auth/ confdir = ./ name = auth } rlm_perl (perl): done parsing 'config'. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On 21 Apr 2015, at 11:11, Peter Balsianok <balsianok.peter@gmail.com> wrote:
Hi,
You are not right. %RAD_PERLCONF is available also during 'Instantiation'.
Yeah, but that's still calling a perl subroutine, just without a request pointer.
The question is: Would it be available also during compilation phase (like radiusd::radlog)
For that to work you'd need to get it into the perl environment as a global, before parsing the perl file. It'd also have to be made constant to prevent people from doing stupid things. I'll take a look at it and see if it's doable. I just... feel so dirty after looking at perl... or the embedding API... or the documentation for the embedding API. It's like digging in to a big bowl of chocolate pudding, to discover it's actually dog shit. -Arran Arran Cudbard-Bell <a.cudbardb@freeradius.org> FreeRADIUS development team FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2
You're right. I didn't realize the whole perl body is actually an "instantiate" section. My mistake, sorry. Well.. good luck with the chocolate pudding... or something ;) Nicolas.
Hi,
You are not right. %RAD_PERLCONF is available also during 'Instantiation'. The question is: Would it be available also during compilation phase (like radiusd::radlog)
Peter
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
You're right. I didn't realize the whole perl body is actually an "instantiate" section. My mistake, sorry.
Yeah. The perl script gets 'run' for instantiation. Ugh. Even in the mod_instantiate is messed up, with parts of different operations all interleaved. I'm guessing historically people have been too scared to touch the code, in case of angering the perl interpreter.
Well.. good luck with the chocolate pudding... or something ;)
Seeking help from the stack overflow gods... http://stackoverflow.com/questions/29778257/making-global-values-available-t... The embedding perl page was not useful. -Arran Arran Cudbard-Bell <a.cudbardb@freeradius.org> FreeRADIUS development team FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2
participants (3)
-
Arran Cudbard-Bell -
Chaigneau, Nicolas -
Peter Balsianok