]> git.ipfire.org Git - thirdparty/freeradius-server.git/log
thirdparty/freeradius-server.git
3 years agoDHCPv4: add back Lease-Query support (#4555) 4557/head
Max Khon [Sun, 12 Jun 2022 14:09:53 +0000 (17:09 +0300)] 
DHCPv4: add back Lease-Query support (#4555)

3 years agoJust use the standard fr_ipaddr_cmp function
Arran Cudbard-Bell [Fri, 10 Jun 2022 23:59:44 +0000 (18:59 -0500)] 
Just use the standard fr_ipaddr_cmp function

3 years agoInitialise ipaddr types correctly in fr_value_box_init
Arran Cudbard-Bell [Fri, 10 Jun 2022 23:59:02 +0000 (18:59 -0500)] 
Initialise ipaddr types correctly in fr_value_box_init

3 years agoFix garbage test that leads to bad pairs in the test pair list
Arran Cudbard-Bell [Fri, 10 Jun 2022 23:58:29 +0000 (18:58 -0500)] 
Fix garbage test that leads to bad pairs in the test pair list

3 years agoMake fr_ipaddr_cmp more efficient by only comparing used bytes
Arran Cudbard-Bell [Fri, 10 Jun 2022 23:58:02 +0000 (18:58 -0500)] 
Make fr_ipaddr_cmp more efficient by only comparing used bytes

3 years agoMore magic WASM flags
Arran Cudbard-Bell [Thu, 9 Jun 2022 04:09:12 +0000 (23:09 -0500)] 
More magic WASM flags

3 years agoon dup, increment both
Alan T. DeKok [Sat, 11 Jun 2022 22:11:39 +0000 (18:11 -0400)] 
on dup, increment both

3 years agomore "order array"
Alan T. DeKok [Sat, 11 Jun 2022 22:11:27 +0000 (18:11 -0400)] 
more "order array"

3 years agoAlways verify fr_sbuff_term_t order when using WITH_VERIFY_PTR
Alan T. DeKok [Sat, 11 Jun 2022 19:35:54 +0000 (15:35 -0400)] 
Always verify fr_sbuff_term_t order when using WITH_VERIFY_PTR

and remove calls to qsort.  Since the input arrays must be sorted,
we can simple do an O(n+m) walk over the input arrays

3 years agoorder terminals
Alan T. DeKok [Sat, 11 Jun 2022 19:00:16 +0000 (15:00 -0400)] 
order terminals

3 years agocompare fields, and don't use memcmp()
Alan T. DeKok [Fri, 10 Jun 2022 13:50:38 +0000 (09:50 -0400)] 
compare fields, and don't use memcmp()

3 years agomake it clearer what we're doing
Alan T. DeKok [Fri, 10 Jun 2022 13:49:16 +0000 (09:49 -0400)] 
make it clearer what we're doing

hex numbers look more like IP addresses than decimal numbers

3 years agoMake Coverity happy with encode_nas_filter_rule() (CID #1503928) (#4554)
James Jones [Fri, 10 Jun 2022 01:32:20 +0000 (20:32 -0500)] 
Make Coverity happy with encode_nas_filter_rule() (CID #1503928) (#4554)

encode_nas_filter_rule() is never passed a cursor for which
fr_dcursor_current() returns NULL, so the check at the top
of the loop can be eliminated. Coverity should see the assertions
and not complain about the FR_DBUFF_IN_BYTES_RETURN().O

3 years agofix clang scan issues
Alan T. DeKok [Thu, 9 Jun 2022 18:48:41 +0000 (14:48 -0400)] 
fix clang scan issues

no need to do quicksort on the input, we can just check that it's
already ordered.  TBH, if both inputs are already ordered, we can
just walk down both lists doing comparisons in order.

Use clearer variable names.

Simplify the loops so that there are fewer edge cases

3 years agoadd padding to make v4 the same size as v6.
Alan T. DeKok [Thu, 9 Jun 2022 14:22:01 +0000 (10:22 -0400)] 
add padding to make v4 the same size as v6.

So that when we initialize structures, omitted fields are set to
zero.  If we don't have a padding field, then because v4 addresses
are smaller than v6 addresses, the remaining bytes after the v4
addresses are undefined.

3 years agoAdd optional code to catch out of order terminal inputs
Arran Cudbard-Bell [Tue, 7 Jun 2022 16:46:01 +0000 (12:46 -0400)] 
Add optional code to catch out of order terminal inputs

3 years agoTest and fix for correct merging of duplicated terminal sequences
Arran Cudbard-Bell [Tue, 7 Jun 2022 16:45:37 +0000 (12:45 -0400)] 
Test and fix for correct merging of duplicated terminal sequences

3 years agomove "" to be first, as expected.
Alan T. DeKok [Tue, 7 Jun 2022 15:50:20 +0000 (11:50 -0400)] 
move "" to be first, as expected.

3 years agodisable develer debugging, and fix compiler warning
Alan T. DeKok [Tue, 7 Jun 2022 13:20:21 +0000 (09:20 -0400)] 
disable develer debugging, and fix compiler warning

3 years agoremove UNUSED
Nick Porter [Tue, 7 Jun 2022 12:51:30 +0000 (13:51 +0100)] 
remove UNUSED

3 years agoNetwork and worker contexts already freed by the threads
Nick Porter [Tue, 7 Jun 2022 12:47:21 +0000 (13:47 +0100)] 
Network and worker contexts already freed by the threads

Commit 3791b97d60c19e05b218969641164e9384fce7b3 added freeing to the
worker and network threads

3 years agolet's use the enum
Alan T. DeKok [Mon, 6 Jun 2022 20:32:16 +0000 (16:32 -0400)] 
let's use the enum

3 years agoadd ipv6 prefix calculations
Alan T. DeKok [Mon, 6 Jun 2022 19:39:17 +0000 (15:39 -0400)] 
add ipv6 prefix calculations

3 years agoRemove rlm_expr, and replace with %{expr:...} as a built-in
Alan T. DeKok [Mon, 6 Jun 2022 19:01:24 +0000 (15:01 -0400)] 
Remove rlm_expr, and replace with %{expr:...} as a built-in

and update the docs and tests to match.

3 years agoupdate fr_calc_unary_op(), add xlat ~, -, !, cleanups, and tests
Alan T. DeKok [Mon, 6 Jun 2022 17:04:37 +0000 (13:04 -0400)] 
update fr_calc_unary_op(), add xlat ~, -, !, cleanups, and tests

3 years agoadd support for unary "-" and "~"
Alan T. DeKok [Mon, 6 Jun 2022 16:27:30 +0000 (12:27 -0400)] 
add support for unary "-" and "~"

3 years agoadd "~" operator
Alan T. DeKok [Mon, 6 Jun 2022 16:25:00 +0000 (12:25 -0400)] 
add "~" operator

3 years agoomit optional arguments entirely, instead of passing the wrong type
Alan T. DeKok [Sun, 5 Jun 2022 13:54:15 +0000 (09:54 -0400)] 
omit optional arguments entirely, instead of passing the wrong type

if an optional argument is missing (i.e. source list is empty),
then we can pass it to the function ONLY if the function accepts
type VOID for that argument.

Otherwise, we have to omit that argument, and all subsequent ones.
Otherwise, we'll pass the wrong data type to a function which
expects to be able to dereference the type-specific field of that
value box, and who knows what will happen.

As a result, any function which takes an optional argument has to
check for non-existence, not for NULL type.

We will reserve NULL types for "error", not for normal usage.

3 years agosimply omit optional arguments, rather than making them FR_TYPE_NULL
Alan T. DeKok [Fri, 3 Jun 2022 22:29:49 +0000 (18:29 -0400)] 
simply omit optional arguments, rather than making them FR_TYPE_NULL

We want FR_TYPE_NULL to mean something else, and we don't want to
use it as a normal result.

3 years agoadd xlat_is_truthy(), to replace COND_TYPE_TRUE and COND_TYPE_FALSE
Alan T. DeKok [Fri, 3 Jun 2022 19:59:52 +0000 (15:59 -0400)] 
add xlat_is_truthy(), to replace COND_TYPE_TRUE and COND_TYPE_FALSE

3 years agoadd fr_value_box_is_truthy() function
Alan T. DeKok [Fri, 3 Jun 2022 12:18:54 +0000 (08:18 -0400)] 
add fr_value_box_is_truthy() function

as "cast to bool" will parse "yes / no" for strings into true / false
booleans.

Instead for conditions, we want zero-length strings to be false,
and non-zero length strings to be true.

3 years agodebug_condition is no longer used
Alan T. DeKok [Fri, 3 Jun 2022 12:04:11 +0000 (08:04 -0400)] 
debug_condition is no longer used

3 years agoLDAP library changes in preparation for LDAP sync (#4549)
Nick Porter [Mon, 6 Jun 2022 18:51:34 +0000 (19:51 +0100)] 
LDAP library changes in preparation for LDAP sync (#4549)

* Typo

* Retrieve namingContexts from LDAP directories when establishing their type

* Correct file name

* Define fr_ldap_attrs_check() - check if an LDAP attribute is in a list

* Define structures and enums for parsed LDAP filters

* Move common LDAP config items to a library header

* Move validation of LDAP server conf items to library

* Add OIDs for bit-wise LDAP match rules

* Define functions for parsing LDAP filters

* Add filter.c to ldap library sources

* Define functions for evaluating LDAP filters

3 years agoAmend building of test certs to avoid `openssl ca` race condition (#4548)
Nick Porter [Mon, 6 Jun 2022 16:39:51 +0000 (17:39 +0100)] 
Amend building of test certs to avoid `openssl ca` race condition (#4548)

* Amend building of test certs to avoid `openssl ca` race condition

* Ensure vrfy targets have all their dependencies

3 years agoCast to void calla that never fail or where we care only about side effects. (#4547)
James Jones [Mon, 6 Jun 2022 14:26:45 +0000 (09:26 -0500)] 
Cast to void calla that never fail or where we care only about side effects. (#4547)

This branch deals with the following Coverity defect reports:
150400115039911504025 (#2 of 2), 150327615041851504279,
1504281

3 years agoEnsure arrays are zero alloced
Nick Porter [Mon, 6 Jun 2022 13:04:42 +0000 (14:04 +0100)] 
Ensure arrays are zero alloced

3 years agoSet the right output buffer
Arran Cudbard-Bell [Mon, 6 Jun 2022 02:40:54 +0000 (22:40 -0400)] 
Set the right output buffer

3 years agoAdd macro for populating CONF_PARSER with functions
Arran Cudbard-Bell [Mon, 6 Jun 2022 00:25:22 +0000 (20:25 -0400)] 
Add macro for populating CONF_PARSER with functions

3 years agoNeed atexit in sbuff code
Arran Cudbard-Bell [Mon, 6 Jun 2022 00:24:03 +0000 (20:24 -0400)] 
Need atexit in sbuff code

3 years agoSplit out time and time delta printing functions
Arran Cudbard-Bell [Mon, 6 Jun 2022 00:22:49 +0000 (20:22 -0400)] 
Split out time and time delta printing functions

3 years agoUnused in debug builds
Arran Cudbard-Bell [Sun, 5 Jun 2022 20:06:48 +0000 (16:06 -0400)] 
Unused in debug builds

3 years agoUse accessors for parsed status
Arran Cudbard-Bell [Sun, 5 Jun 2022 20:06:00 +0000 (16:06 -0400)] 
Use accessors for parsed status

3 years agoPrint file check errors in the context of the pair that specified the file
Arran Cudbard-Bell [Sun, 5 Jun 2022 17:22:53 +0000 (13:22 -0400)] 
Print file check errors in the context of the pair that specified the file

3 years agoWhitespace
Arran Cudbard-Bell [Sun, 5 Jun 2022 17:13:01 +0000 (13:13 -0400)] 
Whitespace

3 years agoRefactor parsing code to shut up clang scan
Arran Cudbard-Bell [Sun, 5 Jun 2022 17:11:50 +0000 (13:11 -0400)] 
Refactor parsing code to shut up clang scan

3 years agoCheck all the bits...
Arran Cudbard-Bell [Sun, 5 Jun 2022 09:34:16 +0000 (05:34 -0400)] 
Check all the bits...

3 years agoconst
Arran Cudbard-Bell [Sun, 5 Jun 2022 09:07:13 +0000 (05:07 -0400)] 
const

3 years agoBreak out parse functions more
Arran Cudbard-Bell [Sun, 5 Jun 2022 09:01:37 +0000 (05:01 -0400)] 
Break out parse functions more

3 years agoHelps to use the correct type
Arran Cudbard-Bell [Sun, 5 Jun 2022 09:00:51 +0000 (05:00 -0400)] 
Helps to use the correct type

3 years agoUse cf_pair_debug everywhere
Arran Cudbard-Bell [Sun, 5 Jun 2022 06:20:07 +0000 (02:20 -0400)] 
Use cf_pair_debug everywhere

3 years agoAdd support for dynamically allocating default values
Arran Cudbard-Bell [Sun, 5 Jun 2022 06:00:35 +0000 (02:00 -0400)] 
Add support for dynamically allocating default values

This allows us to pull defaults from 3rd party libraries, and have them correctly represented in the config tree.

3 years agoExpand multi type support to all value types
Arran Cudbard-Bell [Sun, 5 Jun 2022 05:58:13 +0000 (01:58 -0400)] 
Expand multi type support to all value types

3 years agoUse valuebox code to parse config items
Arran Cudbard-Bell [Sun, 5 Jun 2022 01:51:51 +0000 (21:51 -0400)] 
Use valuebox code to parse config items

Removes a significant amount of code and adds support for a large number of additional configuration types

3 years agoActually define tacacs max attributes
Arran Cudbard-Bell [Sun, 5 Jun 2022 01:40:48 +0000 (21:40 -0400)] 
Actually define tacacs max attributes

3 years agoFormatting
Arran Cudbard-Bell [Sun, 5 Jun 2022 01:28:38 +0000 (21:28 -0400)] 
Formatting

3 years agoUpdate autoconf srcs in libraries
Arran Cudbard-Bell [Sat, 4 Jun 2022 19:40:23 +0000 (15:40 -0400)] 
Update autoconf srcs in libraries

3 years agoMove libldap init to global_lib framework (#4546)
Nick Porter [Fri, 3 Jun 2022 16:42:30 +0000 (17:42 +0100)] 
Move libldap init to global_lib framework (#4546)

* Define libldap global config options and init / free callbacks

* Move libldap global options to global {} section

* Switch rlm_ldap to use autoinit of ldap library

* Clear old instance tracking from libldap

* Ensure global.d directory is handled correctly by packages

* Allow per module test global library settings

* Move global ldap library settings to correct location for tests

* Include global.d in list of raddb files to install

* WS

* Newline

Co-authored-by: Arran Cudbard-Bell <a.cudbardb@freeradius.org>
3 years agolast few compiler fixes
Alan T. DeKok [Fri, 3 Jun 2022 01:33:13 +0000 (21:33 -0400)] 
last few compiler fixes

3 years agotypos
Alan T. DeKok [Fri, 3 Jun 2022 00:09:35 +0000 (20:09 -0400)] 
typos

3 years agoforbid !* and =* in conditions.
Alan T. DeKok [Thu, 2 Jun 2022 20:35:55 +0000 (16:35 -0400)] 
forbid !* and =* in conditions.

They're only accepted for backwards compatibility, and there is
newer syntax which does the same thing, and is better.

3 years agoinitialize variable.
Alan T. DeKok [Thu, 2 Jun 2022 20:35:04 +0000 (16:35 -0400)] 
initialize variable.

maybe this helps with CI crashes?

3 years agouse bracket rules for terminals
Alan T. DeKok [Thu, 2 Jun 2022 20:13:13 +0000 (16:13 -0400)] 
use bracket rules for terminals

so that we don't confuse the flag parser when parsing

if (foo =~ /bar/i)

and the final ')' is NOT a flag.

3 years agoresolve strings at parse time, where they're static strings
Alan T. DeKok [Thu, 2 Jun 2022 19:17:11 +0000 (15:17 -0400)] 
resolve strings at parse time, where they're static strings

which don't contain exec, xlat, etc.

3 years agospecial handlers for module return codes
Alan T. DeKok [Thu, 2 Jun 2022 17:09:01 +0000 (13:09 -0400)] 
special handlers for module return codes

which evalute to "true" if they match.

3 years agodon't expand structural types when used in "truthy" context
Alan T. DeKok [Thu, 2 Jun 2022 13:23:17 +0000 (09:23 -0400)] 
don't expand structural types when used in "truthy" context

&reply || ...

should NOT get a list of value-boxes out of the reply.  Instead,
it should just check for the "truthiness" of &reply.

We still need to add a special case for when a list is used by
itself, as in

if (&reply) { ...

but that can be handled with a few lines of code in the condition
evaluation code.

3 years agoupdate truthiness for value-box groups
Alan T. DeKok [Thu, 2 Jun 2022 13:03:22 +0000 (09:03 -0400)] 
update truthiness for value-box groups

empty groups are false.  non-empty groups are true.

Any other structural types cannot exist in a value-box group.

3 years agomake exec work, and add tests for it.
Alan T. DeKok [Wed, 1 Jun 2022 20:00:06 +0000 (16:00 -0400)] 
make exec work, and add tests for it.

Right now we have a hard-coded timeout of 1 second, and no
pairs passed as environment variables.

There isn't really a way to configure global ior per-use settings
for these parameters.

3 years agodon't treat exec as xlat
Alan T. DeKok [Wed, 1 Jun 2022 19:59:33 +0000 (15:59 -0400)] 
don't treat exec as xlat

3 years agofixes and tests for run-time regular expressions
Alan T. DeKok [Wed, 1 Jun 2022 14:23:58 +0000 (10:23 -0400)] 
fixes and tests for run-time regular expressions

3 years agoadd packet && src/dst IP to xlat tests
Alan T. DeKok [Wed, 1 Jun 2022 14:23:39 +0000 (10:23 -0400)] 
add packet && src/dst IP to xlat tests

3 years agoadd "const"
Alan T. DeKok [Wed, 1 Jun 2022 14:05:06 +0000 (10:05 -0400)] 
add "const"

3 years agoadd run-time evaluation of regular expressions.
Alan T. DeKok [Wed, 1 Jun 2022 13:44:29 +0000 (09:44 -0400)] 
add run-time evaluation of regular expressions.

and more error checks, and tests

3 years agodoc cleanups and fixes
Alan T. DeKok [Wed, 1 Jun 2022 13:21:44 +0000 (09:21 -0400)] 
doc cleanups and fixes

3 years agoremove unnecessary "const"
Alan T. DeKok [Wed, 1 Jun 2022 12:56:22 +0000 (08:56 -0400)] 
remove unnecessary "const"

3 years agofirst pass at regex operators.
Alan T. DeKok [Wed, 1 Jun 2022 12:41:39 +0000 (08:41 -0400)] 
first pass at regex operators.

* no resolution yet
* no run-time compliation

3 years agorename to follow naming scheme
Alan T. DeKok [Wed, 1 Jun 2022 11:20:09 +0000 (07:20 -0400)] 
rename to follow naming scheme

3 years agoenable more tests
Alan T. DeKok [Wed, 1 Jun 2022 11:12:08 +0000 (07:12 -0400)] 
enable more tests

3 years agoupdate for recent changes
Alan T. DeKok [Wed, 1 Jun 2022 01:18:00 +0000 (21:18 -0400)] 
update for recent changes

3 years agomore purify for logical operations
Alan T. DeKok [Wed, 1 Jun 2022 00:09:40 +0000 (20:09 -0400)] 
more purify for logical operations

3 years agoexpose xlat_purify_list() for use in node->func.purify() callbacks
Alan T. DeKok [Wed, 1 Jun 2022 00:08:29 +0000 (20:08 -0400)] 
expose xlat_purify_list() for use in node->func.purify() callbacks

3 years agomore "set flags properly"
Alan T. DeKok [Tue, 31 May 2022 21:14:50 +0000 (17:14 -0400)] 
more "set flags properly"

3 years agoprint head flags, too
Alan T. DeKok [Tue, 31 May 2022 21:13:12 +0000 (17:13 -0400)] 
print head flags, too

3 years agoadd purify callback for || and &&
Alan T. DeKok [Tue, 31 May 2022 14:23:15 +0000 (10:23 -0400)] 
add purify callback for || and &&

3 years agoset flags correctly on n-ary ops
Alan T. DeKok [Tue, 31 May 2022 14:15:00 +0000 (10:15 -0400)] 
set flags correctly on n-ary ops

3 years agoadd set purify callback, and use it in xlat_purify()
Alan T. DeKok [Tue, 31 May 2022 14:14:10 +0000 (10:14 -0400)] 
add set purify callback, and use it in xlat_purify()

3 years agoadd function to convert XLAT_FUNC to other type
Alan T. DeKok [Mon, 30 May 2022 20:49:59 +0000 (16:49 -0400)] 
add function to convert XLAT_FUNC to other type

only in limited situations, and only if we can't leak memory.

3 years agostart of regex parsing and tests.
Alan T. DeKok [Sat, 28 May 2022 14:46:17 +0000 (10:46 -0400)] 
start of regex parsing and tests.

We'll need regex instantiate / print, but this is a start.

3 years agogeneralize rules
Alan T. DeKok [Sat, 28 May 2022 14:46:09 +0000 (10:46 -0400)] 
generalize rules

3 years agoadd precendence definitions for =~ and !~
Alan T. DeKok [Sat, 28 May 2022 14:05:33 +0000 (10:05 -0400)] 
add precendence definitions for =~ and !~

3 years agorespect t_rules->at_runtime for regex parsing
Alan T. DeKok [Sat, 28 May 2022 13:18:33 +0000 (09:18 -0400)] 
respect t_rules->at_runtime for regex parsing

3 years agotypo
Alan T. DeKok [Sat, 28 May 2022 13:11:02 +0000 (09:11 -0400)] 
typo

3 years ago|| and && now return their "truthy" values
Alan T. DeKok [Sat, 28 May 2022 12:38:27 +0000 (08:38 -0400)] 
|| and && now return their "truthy" values

2 || 5           --> 2, not "true"
(1 < 2) || (...) --> true

Or later,

&Foo = (&Bar || &Baz)

which assigns to Foo whatever value exists.

and since we now have tests for this, update the code to correctly
implement && and ||

3 years agostructural and NULL types are logically false.
Alan T. DeKok [Fri, 27 May 2022 21:43:46 +0000 (17:43 -0400)] 
structural and NULL types are logically false.

3 years agoNULL types on input yield NULL types on output.
Alan T. DeKok [Fri, 27 May 2022 21:41:22 +0000 (17:41 -0400)] 
NULL types on input yield NULL types on output.

3 years agoupdate comments
Alan T. DeKok [Fri, 27 May 2022 20:48:07 +0000 (16:48 -0400)] 
update comments

3 years agobetter errors for invalid casts
Alan T. DeKok [Fri, 27 May 2022 20:22:35 +0000 (16:22 -0400)] 
better errors for invalid casts

3 years agoon error, add box of FR_TYPE_NULL, instead of returning XLAT_ACTION_FAIL
Alan T. DeKok [Fri, 27 May 2022 19:48:42 +0000 (15:48 -0400)] 
on error, add box of FR_TYPE_NULL, instead of returning XLAT_ACTION_FAIL

so that the calculation can proceed, instead of dying part-way thru.

There should be some discussion around perhaps a better approach.
One is that xlats which can't be purified are invalid, and cause
higher-level parse errors.

For now, this addresses a few more 'todo' in the tests

3 years agoprint data types just to be helpful
Alan T. DeKok [Fri, 27 May 2022 19:48:18 +0000 (15:48 -0400)] 
print data types just to be helpful

3 years agoattribute expansions aren't pure.
Alan T. DeKok [Fri, 27 May 2022 19:47:58 +0000 (15:47 -0400)] 
attribute expansions aren't pure.

3 years agofix typo which shouldn't change much.
Alan T. DeKok [Fri, 27 May 2022 19:47:08 +0000 (15:47 -0400)] 
fix typo which shouldn't change much.