]> git.ipfire.org Git - thirdparty/freeradius-server.git/log
thirdparty/freeradius-server.git
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.

3 years agoadd missing upcasts for comparisons
Alan T. DeKok [Fri, 27 May 2022 19:42:29 +0000 (15:42 -0400)] 
add missing upcasts for comparisons

3 years agoprint "true" and "false" in more situations
Alan T. DeKok [Fri, 27 May 2022 19:01:46 +0000 (15:01 -0400)] 
print "true" and "false" in more situations

3 years agodisallow lists and structural types in comparisons
Alan T. DeKok [Thu, 26 May 2022 19:19:22 +0000 (15:19 -0400)] 
disallow lists and structural types in comparisons

3 years agoxlat_instantiate_ephemeral() will now call xlat_resolve()
Alan T. DeKok [Thu, 26 May 2022 18:37:50 +0000 (14:37 -0400)] 
xlat_instantiate_ephemeral() will now call xlat_resolve()

if needed

3 years agoallow comparisons to print "true" and "false"
Alan T. DeKok [Thu, 26 May 2022 18:14:54 +0000 (14:14 -0400)] 
allow comparisons to print "true" and "false"

instead of "yes" and "no".

this doesn't *always* work.  A bare

(bool) true

will result in a box of FR_TYPE_BOOL, with no enumv, and will thus
print as "yes".  But we blame value.c for that.

3 years agocleanups, fixes, and tests to handle many condition tests
Alan T. DeKok [Thu, 26 May 2022 17:50:35 +0000 (13:50 -0400)] 
cleanups, fixes, and tests to handle many condition tests

Some of the results are different due to minor implementation
differences.  Others are omitted because we're no longer doing that.
Others are marked up with a "@todo", because they're arguably wrong.

3 years agosuppress useless casts.
Alan T. DeKok [Thu, 26 May 2022 14:47:21 +0000 (10:47 -0400)] 
suppress useless casts.

3 years agominor fixes for printing
Alan T. DeKok [Thu, 26 May 2022 14:19:47 +0000 (10:19 -0400)] 
minor fixes for printing

once we've moved the arguments into our own array, we have to
print spaces ourselves.

3 years agoprint &Foo instead of %{Foo}, which is less confusing
Alan T. DeKok [Thu, 26 May 2022 13:28:17 +0000 (09:28 -0400)] 
print &Foo instead of %{Foo}, which is less confusing

3 years agoparse lists as attributes.
Alan T. DeKok [Thu, 26 May 2022 13:12:34 +0000 (09:12 -0400)] 
parse lists as attributes.

Which fixes &Reply-Message getting parsed as

&Reply - Message

3 years agoalign message and offset with other parts of the code
Alan T. DeKok [Thu, 26 May 2022 11:30:29 +0000 (07:30 -0400)] 
align message and offset with other parts of the code

3 years agoCert validity period is 60 days now
Arran Cudbard-Bell [Thu, 2 Jun 2022 19:29:43 +0000 (15:29 -0400)] 
Cert validity period is 60 days now

3 years agoCan't really check the serial value easily
Arran Cudbard-Bell [Thu, 2 Jun 2022 18:48:23 +0000 (14:48 -0400)] 
Can't really check the serial value easily

3 years agoMove libcurl init to global_lib framework
Arran Cudbard-Bell [Thu, 2 Jun 2022 18:14:16 +0000 (14:14 -0400)] 
Move libcurl init to global_lib framework

3 years agoHaving pre-generated certificates saves very little time and breaks CI regularly
Arran Cudbard-Bell [Thu, 2 Jun 2022 17:57:06 +0000 (13:57 -0400)] 
Having pre-generated certificates saves very little time and breaks CI regularly

3 years agoRename some more global_lib functions
Arran Cudbard-Bell [Thu, 2 Jun 2022 17:41:31 +0000 (13:41 -0400)] 
Rename some more global_lib functions

3 years agoTable formatting in libldap
Arran Cudbard-Bell [Thu, 2 Jun 2022 17:40:20 +0000 (13:40 -0400)] 
Table formatting in libldap

3 years agoMove global_lib_init and instantiation calls inside the module code
Arran Cudbard-Bell [Thu, 2 Jun 2022 17:10:31 +0000 (13:10 -0400)] 
Move global_lib_init and instantiation calls inside the module code

3 years agoMinor fixes
Arran Cudbard-Bell [Thu, 2 Jun 2022 16:51:34 +0000 (12:51 -0400)] 
Minor fixes

3 years agov4: Framework for configuring, initialising and freeing libraries (#4541)
Nick Porter [Thu, 2 Jun 2022 16:50:31 +0000 (17:50 +0100)] 
v4: Framework for configuring, initialising and freeing libraries (#4541)

* Add endforeach macro to close code blocks opened by foreach macros

* Define framework for initialising and freeing libraries

Reading library configuration from a subsection of a global {} config
section.

* Initialise global list of libraries

* Register handlers for "lib" symbols to auto initialise and free libraries

3 years agoScheduled fuzzing: Update src/tests/fuzzer-corpus/dhcpv6.tar
github-actions[bot] [Thu, 2 Jun 2022 09:51:19 +0000 (09:51 +0000)] 
Scheduled fuzzing: Update src/tests/fuzzer-corpus/dhcpv6.tar

3 years agoScheduled fuzzing: Update src/tests/fuzzer-corpus/dhcpv4.tar
github-actions[bot] [Thu, 2 Jun 2022 09:51:16 +0000 (09:51 +0000)] 
Scheduled fuzzing: Update src/tests/fuzzer-corpus/dhcpv4.tar

3 years agoScheduled fuzzing: Update src/tests/fuzzer-corpus/radius.tar
github-actions[bot] [Thu, 2 Jun 2022 09:51:13 +0000 (09:51 +0000)] 
Scheduled fuzzing: Update src/tests/fuzzer-corpus/radius.tar