rlm_sql post-auth variable bug?

Fernando Schapachnik fernando at mecon.gov.ar
Mon Aug 29 19:54:11 CEST 2005


En un mensaje anterior, Alan DeKok escribió:
> Fernando Schapachnik <fernando at mecon.gov.ar> wrote:
> > Any idea on how I can debug it?
>
>   Source code mods, and watch what it's doing, and why.

Ok, I found more details. Recalling, I have:

postauth_query = "INSERT INTO ${postauth_table} (...)  \
		VALUES (.... \
                '%{check:Auth-NAS:-0.0.0.0}', ...)"

which gets translates to garbage or 255.255.255.255 when the attribute
wasn't present. Debugging, I found that ':-' was innocent: the
attribute was there at the time of the translation, although it was
not clear who generated it. Digging further, we instrumented
valuepair2str() so after:

       da = dict_attrbyname(fmt);
       if (!da) return 0;

we added:

       search = vps;
       while (search)
       {
               printf("name: %s attr: %d value: %s\n", search->name,
			search->attribute, search->strvalue);
               search = search->next;
       }

A (now) relevant detail is that the query has other optional (and also
non-present) attribute:

                '%{check:Auth-NAS:-0.0.0.0}', %{check:Used-Port:-0, ...)"

So the debug output is:

do_xlat for attr Auth-NAS:
... <my other check attributes here, OK>
name: Auth-NAS attr: 3005 value:
...
do_xlat for attr Used-Port:
... <my other check attributes here, OK>
name: Auth-NAS attr: 3005 value: 255.255.255.255
...

	Why this is, I don't know, but it is strange enough that the
attribute appears first without value and then with some.


	Thanks.


Fernando.



More information about the Freeradius-Devel mailing list