debug only for rlm_xxx (rlm_perl)

Doug Hardie bc979 at lafn.org
Wed Mar 17 23:15:20 CET 2010


Only one of those errors references the code you added.  There should have been a line in my earlier email like:

	struct stat sb;

The other errors indicate a problem with the normal build includes.  How did you try and rebuild it?  I suspect there is a way to just rebuild rlm_perl, but I haven't tried to do that on version 2.  I suspect you may need to rebuild the entire freeradius.


On 17 March 2010, at 14:46, <bitte at antworte.me> <bitte at antworte.me> wrote:

> 
> Hi Doug,
> i tried to apply this to rlm_perl (on freeradius 2.1.8) but then
> rlm_perl.c does not compile. Can you provide me an example how to
> integrate this? Or - where is my fault?
> 
> ###
> @@ -587,6 +587,10 @@
>        char            *val;
>        VALUE_PAIR      *vpp;
> 
> +       /* tiri */
> +       int rdebug;
> +       rdebug = !stat("/var/log/freeradius/rlm_perl.log", &sb);
> +
>        if (SvOK(sv)) {
>                val = SvPV_nolen(sv);
>                vpp = pairmake(key, val, operator);
> @@ -594,11 +598,13 @@
>                        pairadd(vp, vpp);
>                        radlog(L_DBG,
>                          "rlm_perl: Added pair %s = %s", key, val);
> +                       if (rdebug) radlog (L_AUTH, "Added pair %s = %s",
> key, val);
>                       return 1;
>                } else {
>                        radlog(L_DBG,
>                          "rlm_perl: ERROR: Failed to create pair %s =
> %s",
>                          key, val);
> +                       if (rdebug) radlog (L_AUTH, "Added pair %s = %s",
> key, val);
>                }
>         }
>        return 0;
> ###
> 
> 
> 
> In file included from rlm_perl.c:39:
> /usr/lib/perl/5.10/CORE/perl.h:1318: warning: redundant redeclaration of
> 'strerror'
> /usr/include/string.h:256: warning: previous declaration of 'strerror' was
> here
> In file included from rlm_perl.c:39:
> /usr/lib/perl/5.10/CORE/perl.h:3499: warning: redundant redeclaration of
> 'getuid'
> /usr/include/unistd.h:642: warning: previous declaration of 'getuid' was
> here
> /usr/lib/perl/5.10/CORE/perl.h:3500: warning: redundant redeclaration of
> 'geteuid'
> /usr/include/unistd.h:645: warning: previous declaration of 'geteuid' was
> here
> /usr/lib/perl/5.10/CORE/perl.h:3501: warning: redundant redeclaration of
> 'getgid'
> /usr/include/unistd.h:648: warning: previous declaration of 'getgid' was
> here
> /usr/lib/perl/5.10/CORE/perl.h:3502: warning: redundant redeclaration of
> 'getegid'
> /usr/include/unistd.h:651: warning: previous declaration of 'getegid' was
> here
> /usr/lib/perl/5.10/CORE/perl.h:3811: warning: redundant redeclaration of
> 'mktemp'
> /usr/include/stdlib.h:583: warning: previous declaration of 'mktemp' was
> here
> /usr/lib/perl/5.10/CORE/perl.h:3813: warning: redundant redeclaration of
> 'atof'
> /usr/include/stdlib.h:280: warning: previous definition of 'atof' was here
> In file included from rlm_perl.c:39:
> /usr/lib/perl/5.10/CORE/perl.h:3904: warning: redundant redeclaration of
> 'crypt'
> /usr/include/crypt.h:33: warning: previous declaration of 'crypt' was here
> /usr/lib/perl/5.10/CORE/perl.h:3910: warning: redundant redeclaration of
> 'getenv'
> /usr/include/stdlib.h:545: warning: previous declaration of 'getenv' was
> here
> /usr/lib/perl/5.10/CORE/perl.h:3921: warning: redundant redeclaration of
> 'getlogin'
> /usr/include/unistd.h:815: warning: previous declaration of 'getlogin' was
> here
> /usr/lib/perl/5.10/CORE/perl.h:4075: warning: redundant redeclaration of
> 'environ'
> /usr/include/unistd.h:498: warning: previous declaration of 'environ' was
> here
> In file included from /usr/lib/perl/5.10/CORE/perl.h:4701,
>                 from rlm_perl.c:39:
> /usr/lib/perl/5.10/CORE/proto.h:1842: warning: redundant redeclaration of
> 'Perl_regdump'
> /usr/lib/perl/5.10/CORE/proto.h:1839: warning: previous declaration of
> 'Perl_regdump' was here
> rlm_perl.c: In function 'rlm_perl_destruct':
> rlm_perl.c:217: warning: declaration of 'my_perl' shadows a previous local
> rlm_perl.c:208: warning: shadowed declaration is here
> rlm_perl.c: In function 'rlm_perl_make_key':
> rlm_perl.c:246: warning: passing argument 2 of 'pthread_key_create' from
> incompatible pointer type
> rlm_perl.c: In function 'rlm_perl_clone':
> rlm_perl.c:274: warning: format '%d' expects type 'int', but argument 3
> has type 'pthread_t'
> rlm_perl.c: In function 'xs_init':
> rlm_perl.c:282: warning: initialization discards qualifiers from pointer
> target type
> rlm_perl.c: In function 'perl_xlat':
> rlm_perl.c:368: warning: value computed is not used
> rlm_perl.c:375: warning: format '%d' expects type 'int', but argument 3
> has type 'size_t'
> rlm_perl.c:375: warning: format '%d' expects type 'int', but argument 5
> has type 'size_t'
> rlm_perl.c: In function 'perl_instantiate':
> rlm_perl.c:447: warning: assignment discards qualifiers from pointer
> target type
> rlm_perl.c:451: warning: assignment discards qualifiers from pointer
> target type
> rlm_perl.c: In function 'perl_store_vps':
> rlm_perl.c:543: warning: assignment discards qualifiers from pointer
> target type
> rlm_perl.c:556: warning: value computed is not used
> rlm_perl.c:568: warning: value computed is not used
> rlm_perl.c: In function 'pairadd_sv':
> rlm_perl.c:592: error: 'sb' undeclared (first use in this function)
> rlm_perl.c:592: error: (Each undeclared identifier is reported only once
> rlm_perl.c:592: error: for each function it appears in.)
> rlm_perl.c: In function 'rlmperl_call':
> rlm_perl.c:729: warning: value computed is not used
> 
> 
> On Thu, 11 Mar 2010 11:35:24 -0800, Doug Hardie <bc979 at lafn.org> wrote:
>> On 11 March 2010, at 03:43, <bitte at antworte.me> <bitte at antworte.me>
> wrote:
>> 
>>> 
>>> Hello list,
>>> 
>>> is there an option in radiusd.conf how to enable debug logging only for
>>> several rlm_modules,
>>> e.g. I have rlm_perl and I only want debug messages for this.
>>> 
>>> Thanks for your reply in advance.
>> 
>> 
>> It can be done via some modifications to the module source.  Here is the
>> approach I use in my modules:
>> 
>> At the top of each function:
>> 
>> 	int rdebug;
>> 
>>        rdebug = !stat("/var/log/radacct/radius_debug", &sb);
>> 
>> 
>> Then after each DEBUG entry add:
>> 
>> 	if (rdebug) radlog (L_AUTH, "%s", auth_msg); 
>> 
>> Note the L_AUTH is the level, the auth_msg is the message in the DEBUG
>> statement.  You can also add our own debugging that way that goes beyond
>> that provided in the original module.
>> 
>> To turn on this debugging just touch the filename listed in the stat
>> command above.  Debugging for that module will start.  Disable it by
>> deleting that file.  You can change the file name to anything convenient
>> for you.
>> -
>> List info/subscribe/unsubscribe? See
>> http://www.freeradius.org/list/users.html
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
> 





More information about the Freeradius-Users mailing list