]> git.ipfire.org Git - thirdparty/freeradius-server.git/log
thirdparty/freeradius-server.git
4 years agoMinor formatting issues in xlat_tokenize.c
Arran Cudbard-Bell [Wed, 1 Dec 2021 14:32:11 +0000 (08:32 -0600)] 
Minor formatting issues in xlat_tokenize.c

4 years agoxlat_copy should actually insert the nodes it copies
Arran Cudbard-Bell [Wed, 1 Dec 2021 14:31:24 +0000 (08:31 -0600)] 
xlat_copy should actually insert the nodes it copies

4 years agoRedundant as xlat_exp_alloc_null already sets the pure flag
Arran Cudbard-Bell [Wed, 1 Dec 2021 14:30:40 +0000 (08:30 -0600)] 
Redundant as xlat_exp_alloc_null already sets the pure flag

4 years agoImprove xlat_debug by indenting nodes
Arran Cudbard-Bell [Wed, 1 Dec 2021 14:30:11 +0000 (08:30 -0600)] 
Improve xlat_debug by indenting nodes

4 years agoDescend into unresolved xlat functions too
Arran Cudbard-Bell [Wed, 1 Dec 2021 14:29:12 +0000 (08:29 -0600)] 
Descend into unresolved xlat functions too

This fixes a bug where xlat functions calls that were children of an unresolved xlat function call were never instantiated, even if that call was later resolved.

It presented with crashes when using %{expr:} as that function is registered by a module and is initially unresolved.

4 years agothe default validity for certificates is 60 days, from
Alan T. DeKok [Wed, 1 Dec 2021 15:40:20 +0000 (10:40 -0500)] 
the default validity for certificates is 60 days, from
raddb/certs/server.cnf

4 years ago%(date:...) should return FR_TYPE_DATE
Alan T. DeKok [Wed, 1 Dec 2021 15:40:20 +0000 (10:40 -0500)] 
%(date:...) should return FR_TYPE_DATE

4 years agoRevert "unify pass2_fixup_update_map() and unlang_fixup_map()"
Arran Cudbard-Bell [Tue, 30 Nov 2021 19:29:42 +0000 (13:29 -0600)] 
Revert "unify pass2_fixup_update_map() and unlang_fixup_map()"

This reverts commit 51c5635130ee088aab54dda3de3ee2399e7d0bf9.

Changes break the json and cache module tests.

4 years agoRevert "set the default dictionary"
Arran Cudbard-Bell [Tue, 30 Nov 2021 19:15:26 +0000 (13:15 -0600)] 
Revert "set the default dictionary"

The internal dictionary isn't allowed as the default as the internal dictionary is searched in most cases.

4 years agoFormatting
Arran Cudbard-Bell [Tue, 30 Nov 2021 19:08:16 +0000 (13:08 -0600)] 
Formatting

4 years agoAdd copy functions for tmpls and xlats
Arran Cudbard-Bell [Tue, 30 Nov 2021 19:00:55 +0000 (13:00 -0600)] 
Add copy functions for tmpls and xlats

4 years agoset the default dictionary
Alan T. DeKok [Tue, 30 Nov 2021 17:55:23 +0000 (12:55 -0500)] 
set the default dictionary

4 years agotets are in the RADIUS dictionary
Alan T. DeKok [Tue, 30 Nov 2021 17:11:40 +0000 (12:11 -0500)] 
tets are in the RADIUS dictionary

4 years agoadd map_list_tail
Alan T. DeKok [Tue, 30 Nov 2021 16:18:48 +0000 (11:18 -0500)] 
add map_list_tail

4 years agounify pass2_fixup_update_map() and unlang_fixup_map()
Alan T. DeKok [Tue, 30 Nov 2021 15:25:27 +0000 (10:25 -0500)] 
unify pass2_fixup_update_map() and unlang_fixup_map()

and change callers of unlang_fixup_map() to pass tmpl_rules_t
as the ctx

4 years agocopy the string values, instead of shallow copies
Alan T. DeKok [Tue, 30 Nov 2021 14:05:03 +0000 (09:05 -0500)] 
copy the string values, instead of shallow copies

we're not allowing multiple refcounts for the same string, so
the simplest solution is to just copy it whole-sale.

4 years agoshut up linker complaints on OSX
Alan T. DeKok [Mon, 29 Nov 2021 14:28:25 +0000 (09:28 -0500)] 
shut up linker complaints on OSX

4 years agoallow casts for negative numbers in strings
Alan T. DeKok [Mon, 29 Nov 2021 14:02:19 +0000 (09:02 -0500)] 
allow casts for negative numbers in strings

4 years agodate / time_delta are _signed_ integers
Alan T. DeKok [Mon, 29 Nov 2021 13:50:53 +0000 (08:50 -0500)] 
date / time_delta are _signed_ integers

4 years agoupdate comments
Alan T. DeKok [Mon, 29 Nov 2021 13:43:15 +0000 (08:43 -0500)] 
update comments

4 years agoadd SSLKEYLOGFILE capability
Alan T. DeKok [Mon, 29 Nov 2021 13:39:32 +0000 (08:39 -0500)] 
add SSLKEYLOGFILE capability

and add "keylog_file" to the TLS configuration, so that we can
distinguish SSL keys for EAP versus incoming / outgoing RadSec

4 years agocast RHS, as the types might be different
Alan T. DeKok [Sat, 27 Nov 2021 14:06:47 +0000 (09:06 -0500)] 
cast RHS, as the types might be different

4 years agorename functions and add a few more helper functions
Alan T. DeKok [Thu, 25 Nov 2021 21:30:49 +0000 (16:30 -0500)] 
rename functions and add a few more helper functions

4 years agoupdate return code
Alan T. DeKok [Thu, 25 Nov 2021 21:30:16 +0000 (16:30 -0500)] 
update return code

4 years agoadd assertion
Alan T. DeKok [Thu, 25 Nov 2021 16:53:49 +0000 (11:53 -0500)] 
add assertion

4 years agoadd recommendation from the coverity people
Alan T. DeKok [Thu, 25 Nov 2021 16:39:47 +0000 (11:39 -0500)] 
add recommendation from the coverity people

this time without extra stuff

4 years agoRevert "add recommendation from the coverity people"
Alan T. DeKok [Thu, 25 Nov 2021 16:38:43 +0000 (11:38 -0500)] 
Revert "add recommendation from the coverity people"

This reverts commit d5d2149b16656b9ed2fe29de33aef598b2526049.

nope.

4 years agoremove assert
Alan T. DeKok [Thu, 25 Nov 2021 16:27:22 +0000 (11:27 -0500)] 
remove assert

4 years agofix code broken in commit 3391575a5
Alan T. DeKok [Thu, 25 Nov 2021 16:25:55 +0000 (11:25 -0500)] 
fix code broken in commit  3391575a5

4 years agowe can get away without using "..."
Alan T. DeKok [Thu, 25 Nov 2021 16:08:09 +0000 (11:08 -0500)] 
we can get away without using "..."

This also serves as a test for the fixes in commit f0db834416

4 years agoadd recommendation from the coverity people
Alan T. DeKok [Thu, 25 Nov 2021 15:43:02 +0000 (10:43 -0500)] 
add recommendation from the coverity people

4 years agoupdate pure flags
Alan T. DeKok [Thu, 25 Nov 2021 02:29:49 +0000 (21:29 -0500)] 
update pure flags

we default to pure, and various other things will over-ride
the flag if necessary.  e.g. impure functions will set the flag
to false, as will attribute references.

4 years agorand, etc. aren't pure
Alan T. DeKok [Thu, 25 Nov 2021 02:17:17 +0000 (21:17 -0500)] 
rand, etc. aren't pure

4 years agoFixes for mruby for new instantiate / detach structures (#4319)
Nick Porter [Thu, 25 Nov 2021 13:42:18 +0000 (13:42 +0000)] 
Fixes for mruby for new instantiate / detach structures (#4319)

4 years agoRevert "reorder types"
Arran Cudbard-Bell [Wed, 24 Nov 2021 20:02:05 +0000 (15:02 -0500)] 
Revert "reorder types"

There are so many uses of the old ordering it makes visually checking whether cases are covered annoying.

The old ordering orders things by types which relate directly to C types, and then more abstract types, and system types, which is generally far more useful.

The C types are usually the ones we deal with explicitly in martialling and unmartialling functions.  It's very rare we end up needing to convert between time_delta and a native database type, but very common we need to deal with the numeric and float types.

4 years agotry a different way to shut up gcc
Alan T. DeKok [Tue, 23 Nov 2021 21:05:41 +0000 (16:05 -0500)] 
try a different way to shut up gcc

4 years agoif we allow %() and %{}, then parse both
Alan T. DeKok [Tue, 23 Nov 2021 20:46:01 +0000 (15:46 -0500)] 
if we allow %() and %{}, then parse both

4 years agoremove check for now
Alan T. DeKok [Tue, 23 Nov 2021 19:41:31 +0000 (14:41 -0500)] 
remove check for now

4 years agomark up a bunch of functions as PURE.
Alan T. DeKok [Tue, 23 Nov 2021 17:43:15 +0000 (12:43 -0500)] 
mark up a bunch of functions as PURE.

Nothing uses the flag yet, but that's coming.

Note that any function which uses 'request->foo' at runtime
is NOT pure.  However, the xlat functions MAY use RDEBUG, REDEBUG,
or other R macros

4 years agopass xlat_flags_t to xlat_register()
Alan T. DeKok [Tue, 23 Nov 2021 17:30:36 +0000 (12:30 -0500)] 
pass xlat_flags_t to xlat_register()

so that we can pass both needs_async && pure

4 years agopure functions cannot require async resolution
Alan T. DeKok [Tue, 23 Nov 2021 17:26:38 +0000 (12:26 -0500)] 
pure functions cannot require async resolution

they must operate only on things in memory

4 years agorename XLAT_LITERAL to XLAT_BOX
Alan T. DeKok [Tue, 23 Nov 2021 15:47:36 +0000 (10:47 -0500)] 
rename XLAT_LITERAL to XLAT_BOX

we already have XLAT_VIRTUAL, so we might as well avoid
XLAT_VALUE_BOX.  But that can be changed at any time.

Updated comments and functions to make it clear which things
are strings, and which things are literal values (i.e. boxes)

4 years agoadd value_box to xlat node, and make XLAT_LITERAL use it
Alan T. DeKok [Tue, 23 Nov 2021 15:19:12 +0000 (10:19 -0500)] 
add value_box to xlat node, and make XLAT_LITERAL use it

right now we don't pass (or therefore use) any tainting flag.
That should arguably be fixed.

4 years agonow that we don't mangle things, put these into a union
Alan T. DeKok [Mon, 22 Nov 2021 20:13:35 +0000 (15:13 -0500)] 
now that we don't mangle things, put these into a union

because there's no reason to have all of the field available
for all of the xlat types

4 years agowe don't need to store node->attr for virtual attributes
Alan T. DeKok [Mon, 22 Nov 2021 20:11:07 +0000 (15:11 -0500)] 
we don't need to store node->attr for virtual attributes

the function itself defines what to do

4 years agominor reformatting, and use common function
Alan T. DeKok [Mon, 22 Nov 2021 20:09:19 +0000 (15:09 -0500)] 
minor reformatting, and use common function

4 years agominor cleanups, and add calculations for booleans
Alan T. DeKok [Sun, 21 Nov 2021 22:28:17 +0000 (17:28 -0500)] 
minor cleanups, and add calculations for booleans

it's still not clear what to do for IFIDs and ethernet addresses.
IFIDs are site-local integers, and likely should just be treated
as opaque blobs.

we may want to allow editing ethernet addresses, by splitting
them into OUI, or by merging OUI and trailing bits.  But for now
the caller might as well just convert them to octets, do the
opertions, and convert them back.

4 years agoadd preliminary support for and/or
Alan T. DeKok [Sat, 20 Nov 2021 19:59:15 +0000 (14:59 -0500)] 
add preliminary support for and/or

we likely also want to allow

ipaddr AND integer -> ipv4prefix

tho that' a little more work to figure stuff out

4 years agotypo: don't NUL terminate octet strings
Alan T. DeKok [Sat, 20 Nov 2021 17:52:39 +0000 (12:52 -0500)] 
typo: don't NUL terminate octet strings

4 years agoadd cast to shut up warnings
Alan T. DeKok [Sat, 20 Nov 2021 17:38:41 +0000 (12:38 -0500)] 
add cast to shut up warnings

4 years agothis is only for clang
Alan T. DeKok [Sat, 20 Nov 2021 17:37:47 +0000 (12:37 -0500)] 
this is only for clang

4 years agotry to shut up clang
Alan T. DeKok [Sat, 20 Nov 2021 16:24:54 +0000 (11:24 -0500)] 
try to shut up clang

4 years agowe only need to clear values, not the whole thing
Alan T. DeKok [Sat, 20 Nov 2021 16:18:55 +0000 (11:18 -0500)] 
we only need to clear values, not the whole thing

4 years agosubtraction is the inverse of addition
Alan T. DeKok [Sat, 20 Nov 2021 16:09:35 +0000 (11:09 -0500)] 
subtraction is the inverse of addition

4 years agoclear the right thing
Alan T. DeKok [Sat, 20 Nov 2021 16:18:06 +0000 (11:18 -0500)] 
clear the right thing

4 years agoadd unary operation function
Alan T. DeKok [Sat, 20 Nov 2021 16:02:43 +0000 (11:02 -0500)] 
add unary operation function

4 years agoadd tests for assignment operations
Alan T. DeKok [Sat, 20 Nov 2021 14:46:00 +0000 (09:46 -0500)] 
add tests for assignment operations

4 years agoadd binary op array
Alan T. DeKok [Sat, 20 Nov 2021 14:18:14 +0000 (09:18 -0500)] 
add binary op array

4 years agoadd function to manage assignment operations
Alan T. DeKok [Sat, 20 Nov 2021 14:13:15 +0000 (09:13 -0500)] 
add function to manage assignment operations

4 years agoadd MUL and DIV
Alan T. DeKok [Sat, 20 Nov 2021 14:12:58 +0000 (09:12 -0500)] 
add MUL and DIV

and rename errors due to floating point issues

4 years agoadd and use fr_value_box_cast_to_float()
Alan T. DeKok [Fri, 19 Nov 2021 21:43:46 +0000 (16:43 -0500)] 
add and use fr_value_box_cast_to_float()

4 years agoset output on success, not on error
Alan T. DeKok [Fri, 19 Nov 2021 21:28:49 +0000 (16:28 -0500)] 
set output on success, not on error

4 years agorename function
Alan T. DeKok [Fri, 19 Nov 2021 21:12:05 +0000 (16:12 -0500)] 
rename function

we will later have unary / self-modifying functions.  So it's
best to have consistent names from the start

4 years agocreate and use T_ADD, T_SUB, T_MUL, and T_DIV
Alan T. DeKok [Fri, 19 Nov 2021 21:00:29 +0000 (16:00 -0500)] 
create and use T_ADD, T_SUB, T_MUL, and T_DIV

note that we don't (yet) add them to fr_tokens_table[]

That's because attribute names have "-" in them.  Adding "-" as
a token means that we no longer parse attribute names in the
same way.

The solution is likely to update the various pair parsers to
avoid the 1999-era gettoken() APIs, and instead use more modern
equivalents.

For now, we just define and use add/sub/mul/div for the various
calc tests.

4 years agomove T_OP_PREPEND
Alan T. DeKok [Fri, 19 Nov 2021 20:33:09 +0000 (15:33 -0500)] 
move T_OP_PREPEND

so that it's with the other assignment operators

4 years agoupdate use of T_TOKEN_LAST
Alan T. DeKok [Fri, 19 Nov 2021 20:20:52 +0000 (15:20 -0500)] 
update use of T_TOKEN_LAST

it's not part of the enum, it's the number of elements in the enum

4 years agouse token-dependent initializers.
Alan T. DeKok [Fri, 19 Nov 2021 20:16:21 +0000 (15:16 -0500)] 
use token-dependent initializers.

don't depend on implicit ordering

4 years agoT_OP_ADD / T_OP_SUB -> T_OP_ADD_EQ / T_OP_SUB_EQ
Alan T. DeKok [Fri, 19 Nov 2021 19:49:40 +0000 (14:49 -0500)] 
T_OP_ADD / T_OP_SUB -> T_OP_ADD_EQ / T_OP_SUB_EQ

because they have an equals sign, too.  This change is in preparation
for allowing many more tokens

4 years agoRevert "add debugging to see if we can find out where it's crashing"
Alan T. DeKok [Fri, 19 Nov 2021 19:42:39 +0000 (14:42 -0500)] 
Revert "add debugging to see if we can find out where it's crashing"

This reverts commit 3baea0df017f1b3ccd47472071517bab2e1fef05.

suspicions about the source of the issue were correct.

4 years agodoesn't hurt to free this
Alan T. DeKok [Fri, 19 Nov 2021 15:50:31 +0000 (10:50 -0500)] 
doesn't hurt to free this

4 years agoreturn the VP only if the allocate_update was successful
Alan T. DeKok [Fri, 19 Nov 2021 15:38:26 +0000 (10:38 -0500)] 
return the VP only if the allocate_update was successful

4 years agomore used / unused
Alan T. DeKok [Fri, 19 Nov 2021 15:05:32 +0000 (10:05 -0500)] 
more used / unused

when we cast to a fixed-size leaf type, we never allocate
memory.

4 years agoGNU Makefile can't handle directories (#4314)
Jorge Pereira [Fri, 19 Nov 2021 14:32:57 +0000 (11:32 -0300)] 
GNU Makefile can't handle directories (#4314)

4 years agorearrange to have integer tests first
Alan T. DeKok [Fri, 19 Nov 2021 14:30:12 +0000 (09:30 -0500)] 
rearrange to have integer tests first

4 years agoremove duplicate flags merge.
Alan T. DeKok [Fri, 19 Nov 2021 14:16:30 +0000 (09:16 -0500)] 
remove duplicate flags merge.

it's already done at the bottom of the loop

4 years agoprepare for pure xlats
Alan T. DeKok [Fri, 19 Nov 2021 14:11:04 +0000 (09:11 -0500)] 
prepare for pure xlats

4 years agomight as well make this larger
Alan T. DeKok [Thu, 18 Nov 2021 21:59:28 +0000 (16:59 -0500)] 
might as well make this larger

4 years agoadd debugging to see if we can find out where it's crashing
Alan T. DeKok [Thu, 18 Nov 2021 21:55:54 +0000 (16:55 -0500)] 
add debugging to see if we can find out where it's crashing

once we find it, this commit will be reverted

4 years agoshut up clang scan
Alan T. DeKok [Thu, 18 Nov 2021 20:35:17 +0000 (15:35 -0500)] 
shut up clang scan

4 years agocatch more corner cases
Alan T. DeKok [Thu, 18 Nov 2021 19:40:42 +0000 (14:40 -0500)] 
catch more corner cases

about the only time we can't handle overflow is when we do things
like

   uint64 foo - int64 INT64_MIN -> uint64

arguably the RHS should be converted to uint64.  Perhaps we'll
do that as a later step.

4 years agomore checks and add calc_integer_size
Alan T. DeKok [Thu, 18 Nov 2021 19:24:22 +0000 (14:24 -0500)] 
more checks and add calc_integer_size

4 years agomore tests and cleanups
Alan T. DeKok [Thu, 18 Nov 2021 18:37:36 +0000 (13:37 -0500)] 
more tests and cleanups

4 years agoadd integer to integer math
Alan T. DeKok [Thu, 18 Nov 2021 17:59:08 +0000 (12:59 -0500)] 
add integer to integer math

with upcasting of intermediate results to the largest integer
type which can hold the value.  And then finally cast to the
final type when we have the result.

4 years agonow that the base errors are better, rely on them
Alan T. DeKok [Thu, 18 Nov 2021 01:26:59 +0000 (20:26 -0500)] 
now that the base errors are better, rely on them

instead of doubling up on errors

4 years agoRevert "shut up clang on OSX"
Alan T. DeKok [Wed, 17 Nov 2021 22:10:09 +0000 (17:10 -0500)] 
Revert "shut up clang on OSX"

This reverts commit c9e90a0435e271e397edbbdb8971a905cff0f108.

nope.  causes all kinds of other errors

4 years agoshut up clang on OSX
Alan T. DeKok [Wed, 17 Nov 2021 21:37:40 +0000 (16:37 -0500)] 
shut up clang on OSX

4 years agoreturn correct error
Alan T. DeKok [Wed, 17 Nov 2021 19:48:46 +0000 (14:48 -0500)] 
return correct error

4 years agogive humanly readable error message
Alan T. DeKok [Wed, 17 Nov 2021 19:45:07 +0000 (14:45 -0500)] 
give humanly readable error message

4 years agouse sbuffs and check sbuff usage
Alan T. DeKok [Wed, 17 Nov 2021 19:31:57 +0000 (14:31 -0500)] 
use sbuffs and check sbuff usage

4 years agoadvance the input buffer, so we know what was parsed
Alan T. DeKok [Wed, 17 Nov 2021 19:44:16 +0000 (14:44 -0500)] 
advance the input buffer, so we know what was parsed

4 years agoremove unused assignment
Alan T. DeKok [Wed, 17 Nov 2021 19:09:01 +0000 (14:09 -0500)] 
remove unused assignment

4 years agoreorder types
Alan T. DeKok [Wed, 17 Nov 2021 18:25:16 +0000 (13:25 -0500)] 
reorder types

the ordered table in value.c didn't match the fr_type_t enum.

We now have all integer types together.  All unsigned types
together.  And all signed types together.

4 years agoparse only as much as necessary for IP addresses and prefixes
Alan T. DeKok [Wed, 17 Nov 2021 18:15:06 +0000 (13:15 -0500)] 
parse only as much as necessary for IP addresses and prefixes

4 years agoadd rules for ip addresses, hostnames, and prefixes
Alan T. DeKok [Wed, 17 Nov 2021 18:05:38 +0000 (13:05 -0500)] 
add rules for ip addresses, hostnames, and prefixes

4 years agowe don't need host name lookups
Alan T. DeKok [Wed, 17 Nov 2021 17:26:20 +0000 (12:26 -0500)] 
we don't need host name lookups

4 years agoinet_pton() on OSX doesn't accept "127.0" as 127.0.0.0
Alan T. DeKok [Wed, 17 Nov 2021 17:24:58 +0000 (12:24 -0500)] 
inet_pton() on OSX doesn't accept "127.0" as 127.0.0.0

despite what the documentation says.

But getaddrinfo() does accept it.  So when we turn off hostname
lookups, IP address parsing fails.

Work around it by just doing the work ourselves.

4 years agostart of calculation and comparison API
Alan T. DeKok [Tue, 16 Nov 2021 21:06:04 +0000 (16:06 -0500)] 
start of calculation and comparison API

4 years agofix typo: left not right
Alan T. DeKok [Tue, 16 Nov 2021 17:03:41 +0000 (12:03 -0500)] 
fix typo: left not right

4 years agouse correct name
Alan T. DeKok [Tue, 16 Nov 2021 17:03:17 +0000 (12:03 -0500)] 
use correct name

4 years agomove "parse type + value" into common function
Alan T. DeKok [Tue, 16 Nov 2021 16:26:55 +0000 (11:26 -0500)] 
move "parse type + value" into common function

in preparation for adding new functionality