the processing stage _should_ be things like "recv Access-Request".
Due to various re-architecture issues, it's now hard-coded by the
src/process functions to be the name of the protocol.
Nick Porter [Mon, 28 Aug 2023 16:12:34 +0000 (17:12 +0100)]
SASL user binds do not need to look up the user DN
This means that if user binds use SASL, and the LDAP module has not
already been called to retrieve the user object, there is no need to
perform the initial lookup of the DN.
So, in the case that LDAP's sole purpose is to perform authentication
this reduces the number of LDAP calls made.
James Jones [Mon, 28 Aug 2023 15:44:37 +0000 (10:44 -0500)]
Skip fr_assert() for static analysis (CID #1414423)
For static analysis, fr_assert() is plain assert...but otherwise,
for non-debugging versions, it just logs. That means that to
coverity, the mutex won't be unlocked, while in production it
will always be unlocked.
Alan T. DeKok [Mon, 28 Aug 2023 12:44:09 +0000 (08:44 -0400)]
update unit tests to only use new conditions
which resulted in a number of changes
* the xlats need to be instantiated (and they're not), so we can't
print regexes. As a reuslt, regex parsing tests are omitted
* escape tests are omitted, as the old code automatically purifies
them, and the new ones don't do that
* the only code purifies a lot of things automatically. The new
code doesn't, so many tests changed
* the old code reordered conditions to put the attribute on the LHS
the new code doesn't.
* the old code printed many casts, which are suppressed in the
new code
* the old code printed rcodes and existence checks as-is. The new
code printes them as functions. If we care to fix this, we can
add a "print" callback which just prints them in the correct
format. However, because the xlats aren't instantiated, the
print routine won't really work the way we expect.
* the output files have a bunch of "@todo" sprinkled through them
these are things which could likely be fixed without too much
work, but which aren't critical, and don't affect behavior
Alan T. DeKok [Sun, 27 Aug 2023 12:34:11 +0000 (08:34 -0400)]
move paircmp() to rlm_sql
and drastically simplify it. The behavior is similar enough for
most cases, except:
* regular expression operators are no longer supported. It's not
hard to re-add them. As they're not needed right now, they can
be temporarily removed
* virtual attributes like Packet-Src-IP-Address are not supported
Again, this isn't terribly difficult to re-add. But once the
Packet-* attributes are moved to Net.* attributes, then any
virtual attribute comparisons become much less useful.
The remainder are Virtual-Server, Request-Processing-Stage,
and Module-Return-Code. Those could arguably all be moved to
realized attributes in the control list. And be made immutable,
so that "unlang" can't change them.
Coverity claims the fr_nbo_to_foo() functions taint the pointer
passed to it. Thereafter, any data accessed via that pointer is
considered tainted, and any copy of the pointer has the same
issue.
Something like this (copying the passed pointer to a local--with
any optimization, register coalescence will mean this has zero
overhead, BTW--is the only thing that comes to mind to work around
the issue.
Alan T. DeKok [Fri, 25 Aug 2023 14:51:09 +0000 (10:51 -0400)]
remove Client-IP-Address, and replace with Packet-Src-IP-Address
this is made more problematic by the fact that DHCPv4 defines its
own Client-IP-Address, which is something different.
And there are also FreeRADIUS-Client-IP-Address for dynamic clients,
and FreeRADIUS-Stats-Client-IP-Address for statistics. Both of
those should be replaced with better names, and nested TLVs
The latter issue was interesting; the dbuff is set to use ether.addr,
but fr_value_box_ethernet_addr() is passed ðer, which looks like
it will put random garbage in the value box until you notice that
the address is the only member of the type. We'll see whether coverity
considers (fr_ethernet_t * const) fr_dbuff_start(&dbuff) a dangerous
downcast (whatever that means in C) and still complains. I hope not,
because the only reason that comes to mind for it is alignment issues,
which shouldn't happen here.