]> git.ipfire.org Git - thirdparty/freeradius-server.git/log
thirdparty/freeradius-server.git
2 years agorlm_files are not just keyed off user names
Nick Porter [Thu, 13 Jul 2023 15:48:02 +0000 (16:48 +0100)] 
rlm_files are not just keyed off user names

2 years agoCast pointer to correct type
Nick Porter [Thu, 13 Jul 2023 15:47:26 +0000 (16:47 +0100)] 
Cast pointer to correct type

2 years agoReference the correct list for comparisons in rlm_files data
Nick Porter [Thu, 13 Jul 2023 15:21:54 +0000 (16:21 +0100)] 
Reference the correct list for comparisons in rlm_files data

If it's internal attriubtes - stay with the control list
Protocol attributes are compared in the request list

2 years agoadd and export migration flag for pair_legacy_nested
Alan T. DeKok [Thu, 13 Jul 2023 15:33:10 +0000 (11:33 -0400)] 
add and export migration flag for pair_legacy_nested

2 years agomore debugging
Alan T. DeKok [Thu, 13 Jul 2023 14:52:10 +0000 (10:52 -0400)] 
more debugging

2 years agoCheck for error return from fr_sbuff_in_bstrncpy() (CID #1503901)
James Jones [Tue, 11 Jul 2023 20:42:13 +0000 (15:42 -0500)] 
Check for error return from fr_sbuff_in_bstrncpy() (CID #1503901)

2 years agomore debug output
Alan T. DeKok [Thu, 13 Jul 2023 14:36:45 +0000 (10:36 -0400)] 
more debug output

2 years agoRewrite length check so coverity will recognize it (CID #1445221)
James Jones [Thu, 13 Jul 2023 13:49:11 +0000 (08:49 -0500)] 
Rewrite length check so coverity will recognize it (CID #1445221)

As the result of byte-swapping, coverity considers it tainted. It
appears that coverity only recognizes comparisons with the alleged
tainted value on the LHS as validation, so we rewrite the check
as an equivalent chack that coverity wil recognize.

2 years agoadd tests for DEFAULT and User-Name==
Alan T. DeKok [Thu, 13 Jul 2023 14:23:32 +0000 (10:23 -0400)] 
add tests for DEFAULT and User-Name==

The == comparison doesn't work. :(

2 years agoclean up fr_pair_list_move_op() and uses
Alan T. DeKok [Thu, 13 Jul 2023 13:50:07 +0000 (09:50 -0400)] 
clean up fr_pair_list_move_op() and uses

some users didn't free the source list.  But it should really have
been freed.  So we move the free into fr_pair_list_move_op()

and do other minor cleanups of the function and users

2 years agoIf parsing attributes fails, discard temporary list
Nick Porter [Thu, 13 Jul 2023 08:48:26 +0000 (09:48 +0100)] 
If parsing attributes fails, discard temporary list

2 years agoPacify Coverity (CID #1538294 and #1538293)
Nick Porter [Thu, 13 Jul 2023 07:35:23 +0000 (08:35 +0100)] 
Pacify Coverity (CID #1538294 and #1538293)

2 years agoadd missing file
Alan T. DeKok [Wed, 12 Jul 2023 19:11:51 +0000 (15:11 -0400)] 
add missing file

2 years agoMinor debug message improvements
Nick Porter [Wed, 12 Jul 2023 18:38:52 +0000 (19:38 +0100)] 
Minor debug message improvements

2 years agoupdate for tested VPs
Alan T. DeKok [Wed, 12 Jul 2023 18:05:34 +0000 (14:05 -0400)] 
update for tested VPs

if we set the nested flag "true" and edit the tests, they should
all now pass.

2 years agosplit out separate function
Alan T. DeKok [Wed, 12 Jul 2023 18:04:54 +0000 (14:04 -0400)] 
split out separate function

so we can create nested VPs, starting from an intermediate point

2 years agomove tmp_list to caller
Alan T. DeKok [Wed, 12 Jul 2023 13:38:02 +0000 (09:38 -0400)] 
move tmp_list to caller

because the fr_pair_list_afrom_file() function already created
a temporary list.  So there isn't much point in creating an
additional one.

2 years agoQuiet both Coverity and clang scan
Nick Porter [Wed, 12 Jul 2023 14:29:25 +0000 (15:29 +0100)] 
Quiet both Coverity and clang scan

2 years agoThe xlat is %{urlquote: } not %{urlencode: }
Nick Porter [Wed, 12 Jul 2023 14:21:58 +0000 (15:21 +0100)] 
The xlat is %{urlquote: } not %{urlencode: }

2 years agoPull side effects out of TEST_CHECK() (CID #1538288)
James Jones [Wed, 12 Jul 2023 13:13:04 +0000 (08:13 -0500)] 
Pull side effects out of TEST_CHECK() (CID #1538288)

2 years agouse correct number
Alan T. DeKok [Wed, 12 Jul 2023 12:45:02 +0000 (08:45 -0400)] 
use correct number

2 years agoparse conditional filters in attributes
Alan T. DeKok [Wed, 12 Jul 2023 12:22:51 +0000 (08:22 -0400)] 
parse conditional filters in attributes

&Foo[&bar == baz]

None of this works for a bunch of reason.  See filter.txt for a
discussion.

* filtering on leaf attributes needs to be double-checked for
  good and bad things

ok: &User-Name[&User-Name == 'bar']
better: &USer-Name[=='bar']
bad: &User-Name[&Filter-Id == 'bar]

  It's probably simplest to just allow the first syntax. It's
  redundant, but not wrong.

  We then need to update the tokenizer to walk over the condition,
  and ensure that the only attribute used in the condition is the
  leaf attribute which we are checking.

* the tests are for conditions, but we do want to allow filtering
  on group attributes:

&TLS-Certificate[&Common-Name == 'foo']

  but the conditions don't allow comparisons on groups:

&TLS-Certificate == ...

  So it makes sense to forbid

&TLS-Certificate[&Common-Name == 'foo'] == ...

  until such time as we do allow conditions on groups.

* tmpl_dcursor now has an assertion if you try to use conditions
  in filters.  We still need to write the run-time evaluation code
  which checks if the condition matches.

2 years agoAdd missing libraries to libfreeradius4 deb package
Nick Porter [Wed, 12 Jul 2023 10:56:01 +0000 (11:56 +0100)] 
Add missing libraries to libfreeradius4 deb package

And sort into alphabetical sequence

2 years agoadd tests for fr_pair_list_afrom_file()
Alan T. DeKok [Wed, 12 Jul 2023 02:59:43 +0000 (22:59 -0400)] 
add tests for fr_pair_list_afrom_file()

and update the code to produce more descriptive error messages

2 years agoframework for allowing nested attributes via internal flag
Alan T. DeKok [Wed, 12 Jul 2023 02:03:01 +0000 (22:03 -0400)] 
framework for allowing nested attributes via internal flag

which is always set to 'false' for now.

2 years agoclean up and regularize messages
Alan T. DeKok [Wed, 12 Jul 2023 01:16:20 +0000 (21:16 -0400)] 
clean up and regularize messages

2 years agoquiet coverity
Alan T. DeKok [Tue, 11 Jul 2023 20:32:04 +0000 (16:32 -0400)] 
quiet coverity

2 years agocheck returns. CID #1503939 Fixes #5103
Alan T. DeKok [Tue, 11 Jul 2023 18:35:36 +0000 (14:35 -0400)] 
check returns.  CID #1503939  Fixes #5103

2 years agouse patsubst instead of foreach / eval
Alan T. DeKok [Tue, 11 Jul 2023 18:32:38 +0000 (14:32 -0400)] 
use patsubst instead of foreach / eval

eval requires more layers of indirection

2 years agoFix 'process' dict setup by protocols
Jorge Pereira [Tue, 11 Jul 2023 17:10:49 +0000 (14:10 -0300)] 
Fix 'process' dict setup by protocols

2 years agoprocess tests don't need to listen on the network
Alan T. DeKok [Tue, 11 Jul 2023 16:28:53 +0000 (12:28 -0400)] 
process tests don't need to listen on the network

2 years agoadd support for test.process.dhcpv4, etc
Alan T. DeKok [Tue, 11 Jul 2023 16:28:10 +0000 (12:28 -0400)] 
add support for test.process.dhcpv4, etc

2 years agoremove debugging information
Alan T. DeKok [Tue, 11 Jul 2023 16:23:02 +0000 (12:23 -0400)] 
remove debugging information

2 years agotests: Add process tests for dhcpv6
Jorge Pereira [Wed, 28 Jun 2023 15:11:35 +0000 (12:11 -0300)] 
tests: Add process tests for dhcpv6

2 years agotests: Add process tests for dhcpv4
Jorge Pereira [Tue, 4 Jul 2023 01:33:55 +0000 (22:33 -0300)] 
tests: Add process tests for dhcpv4

2 years agoThe automatic state machine is now working correctly for ASCII auth
Nick Porter [Tue, 11 Jul 2023 14:59:08 +0000 (15:59 +0100)] 
The automatic state machine is now working correctly for ASCII auth

2 years agoAdd TACACS authentication type to cached attriubtes
Nick Porter [Tue, 11 Jul 2023 14:44:49 +0000 (15:44 +0100)] 
Add TACACS authentication type to cached attriubtes

It is not in Authentication-Continue packets and caching it helps with
automatic selection of Auth-Type

2 years agoCheck TACACS authentication type using pair
Nick Porter [Tue, 11 Jul 2023 13:52:49 +0000 (14:52 +0100)] 
Check TACACS authentication type using pair

The packet available here has an encrypted body - so
packet->authen_start does not point at the bytes that make up the start
of an authentication packet body.

2 years agoCopy additional attributes into the session cache on multi packet auth
Nick Porter [Tue, 11 Jul 2023 13:39:07 +0000 (14:39 +0100)] 
Copy additional attributes into the session cache on multi packet auth

2 years agoAdd debugging to session caching and restoring
Nick Porter [Tue, 11 Jul 2023 12:27:56 +0000 (13:27 +0100)] 
Add debugging to session caching and restoring

2 years agoPopulate appropirate attribute from user_message
Nick Porter [Tue, 11 Jul 2023 12:27:02 +0000 (13:27 +0100)] 
Populate appropirate attribute from user_message

We requested either user name or password with an appropriate "get"
reply - so put the replied data in where it makes sense.

2 years agoUse correct code to test for "get username" reply
Nick Porter [Tue, 11 Jul 2023 12:23:37 +0000 (13:23 +0100)] 
Use correct code to test for "get username" reply

2 years agoDon't decode optional attributes
Nick Porter [Tue, 11 Jul 2023 12:22:51 +0000 (13:22 +0100)] 
Don't decode optional attributes

Certain attributes are defined as optional, and will have zero length if
they are not present.

2 years agostupid gnu make
Alan T. DeKok [Tue, 11 Jul 2023 14:43:55 +0000 (10:43 -0400)] 
stupid gnu make

2 years agofilter based on test existence, not one process_foo modules
Alan T. DeKok [Tue, 11 Jul 2023 14:26:41 +0000 (10:26 -0400)] 
filter based on test existence, not one process_foo modules

2 years agotests: Let's use $(Q) instead of @
Jorge Pereira [Fri, 30 Jun 2023 21:51:32 +0000 (18:51 -0300)] 
tests: Let's use $(Q) instead of @

It's helpful to troubleshoot.

2 years agotests: Print out the module and test name
Jorge Pereira [Wed, 28 Jun 2023 15:11:26 +0000 (12:11 -0300)] 
tests: Print out the module and test name

2 years agowhitespace and formatting
Jorge Pereira [Tue, 4 Jul 2023 01:07:10 +0000 (22:07 -0300)] 
whitespace and formatting

2 years agoAdd comment about LDAP failing if identity is specified
Arran Cudbard-Bell [Tue, 11 Jul 2023 07:10:20 +0000 (01:10 -0600)] 
Add comment about LDAP failing if identity is specified

2 years agoswitch to assert
Alan T. DeKok [Mon, 10 Jul 2023 20:39:01 +0000 (16:39 -0400)] 
switch to assert

2 years agoremove unused assignment
Alan T. DeKok [Mon, 10 Jul 2023 20:19:34 +0000 (16:19 -0400)] 
remove unused assignment

2 years agomake encode_tlv() call extend_option()
Alan T. DeKok [Mon, 10 Jul 2023 19:32:03 +0000 (15:32 -0400)] 
make encode_tlv() call extend_option()

and do some minor cleanups

2 years agomake encode_vsio() support flat or nested attributes
Alan T. DeKok [Mon, 10 Jul 2023 18:51:03 +0000 (14:51 -0400)] 
make encode_vsio() support flat or nested attributes

2 years agorearrange in preparation for allowing nested attributes
Alan T. DeKok [Mon, 10 Jul 2023 18:22:33 +0000 (14:22 -0400)] 
rearrange in preparation for allowing nested attributes

2 years agosimplify and canonicalize encode_child()
Alan T. DeKok [Mon, 10 Jul 2023 18:16:10 +0000 (14:16 -0400)] 
simplify and canonicalize encode_child()

2 years agoconcatenate DHCPv4 options
Alan T. DeKok [Sun, 9 Jul 2023 13:55:49 +0000 (09:55 -0400)] 
concatenate DHCPv4 options

so that we don't encode a new header for TLV children when the
TLV option still has room to encode data.

2 years agoadd pair_afrom_da_nested()
Alan T. DeKok [Sat, 8 Jul 2023 19:44:50 +0000 (15:44 -0400)] 
add pair_afrom_da_nested()

which is similar to fr_pair_update_by_da_parent(), except that
function takes a parent pair.  In some cases, we need to use
separate TALLOC_CTX and fr_pair_list_t.

2 years agoadd simple test for TLV nesting
Alan T. DeKok [Sat, 8 Jul 2023 19:44:06 +0000 (15:44 -0400)] 
add simple test for TLV nesting

just in case new code generates the wrong thing

2 years agoprint out structural pairs, too
Alan T. DeKok [Fri, 7 Jul 2023 18:18:36 +0000 (14:18 -0400)] 
print out structural pairs, too

2 years agouse the correct cursor function for nested VPs
Alan T. DeKok [Fri, 7 Jul 2023 17:10:04 +0000 (13:10 -0400)] 
use the correct cursor function for nested VPs

2 years agouse the correct cursor function instead of hand-rolling it
Alan T. DeKok [Fri, 7 Jul 2023 16:56:41 +0000 (12:56 -0400)] 
use the correct cursor function instead of hand-rolling it

2 years agoclean up and rearrange in preparation for supporting nesting
Alan T. DeKok [Fri, 7 Jul 2023 16:40:16 +0000 (12:40 -0400)] 
clean up and rearrange in preparation for supporting nesting

2 years agoport OpenSSL3 fixes from v3
Alan T. DeKok [Fri, 7 Jul 2023 14:58:34 +0000 (10:58 -0400)] 
port OpenSSL3 fixes from v3

2 years agoImprove TACACS tests
Nick Porter [Mon, 10 Jul 2023 13:42:40 +0000 (14:42 +0100)] 
Improve TACACS tests

Move authentication tests into `authenticate` sections and add test of
ASCII auth to excercise Authentication-Continue

2 years agoRemove superfluous annotation
James Jones [Fri, 7 Jul 2023 19:45:41 +0000 (14:45 -0500)] 
Remove superfluous annotation

It's not associated with any current coverity defects.

2 years agoCheck return of fr_pair_value_bstrndup() (CID #1534858)
Nick Porter [Sat, 8 Jul 2023 14:53:45 +0000 (15:53 +0100)] 
Check return of fr_pair_value_bstrndup() (CID #1534858)

2 years agoRemove unused pair_find_by_ancestor functions
Nick Porter [Fri, 7 Jul 2023 14:12:44 +0000 (15:12 +0100)] 
Remove unused pair_find_by_ancestor functions

which will become irrelevant when everything uses nested attributes

2 years agoRe-work extraction of DHCPv6 client and server ID for nested or flat lists
Nick Porter [Fri, 7 Jul 2023 07:14:34 +0000 (08:14 +0100)] 
Re-work extraction of DHCPv6 client and server ID for nested or flat lists

Will be simplified to just list copies once everything is always nested.

2 years agoAdd pair_nested_tests - pair_tests using nested attributes
Nick Porter [Fri, 7 Jul 2023 07:10:40 +0000 (08:10 +0100)] 
Add pair_nested_tests - pair_tests using nested attributes

2 years agoAdd helper function for building test nested attribute lists
Nick Porter [Fri, 7 Jul 2023 07:05:53 +0000 (08:05 +0100)] 
Add helper function for building test nested attribute lists

2 years agoAllow for nested or flat attributes in fr_pair_list_copy_by_ancestor
Nick Porter [Fri, 7 Jul 2023 07:05:08 +0000 (08:05 +0100)] 
Allow for nested or flat attributes in fr_pair_list_copy_by_ancestor

Will be removed once everything is nested, and it just becomes a list
copy from the ancestor.

2 years agoCall correct function in test of fr_pair_find_by_da_idx
Nick Porter [Thu, 6 Jul 2023 18:14:19 +0000 (19:14 +0100)] 
Call correct function in test of fr_pair_find_by_da_idx

2 years agoDon't add structural pairs to flat test lists
Nick Porter [Thu, 6 Jul 2023 18:13:11 +0000 (19:13 +0100)] 
Don't add structural pairs to flat test lists

2 years agoAllow for out == NULL
Nick Porter [Thu, 6 Jul 2023 16:38:02 +0000 (17:38 +0100)] 
Allow for out == NULL

2 years agomove password.c hack to main pair function
Alan T. DeKok [Thu, 6 Jul 2023 15:40:20 +0000 (11:40 -0400)] 
move password.c hack to main pair function

and add note that the function should be removed when the nested
pairs are done

2 years agopartial "allow exec on RHS of assignments"
Alan T. DeKok [Thu, 6 Jul 2023 13:39:42 +0000 (09:39 -0400)] 
partial "allow exec on RHS of assignments"

This doesn't work for LHS lists, but it's a start.

The rest of the edit code has to be update to check for attributes
on the RHS of an exec, just the same as if we did

&request = "&Foo := bar"

2 years agoquote token so the message is easier to understand
Alan T. DeKok [Thu, 6 Jul 2023 13:39:26 +0000 (09:39 -0400)] 
quote token so the message is easier to understand

2 years agoCast nothing to string/octets yields empty string/octets
Alan T. DeKok [Thu, 6 Jul 2023 13:01:50 +0000 (09:01 -0400)] 
Cast nothing to string/octets yields empty string/octets

Because we want the following condition to work, when there is
only one of attribute Tmp-Integer-0:

if ("%{Tmp-String-0[2]}" == '') {
// always runs!
}

i.e. expanding in a string context, a reference to an attribute
which doesn't exist should result in an empty string, and not a
condition failure of "can't create LHS of condition"

2 years agoadd some debug options
Alan T. DeKok [Thu, 6 Jul 2023 12:15:59 +0000 (08:15 -0400)] 
add some debug options

2 years agoRe-enable tests
Nick Porter [Thu, 6 Jul 2023 12:06:56 +0000 (13:06 +0100)] 
Re-enable tests

2 years agoReturn correctly after first match for logical or
Nick Porter [Thu, 6 Jul 2023 12:02:56 +0000 (13:02 +0100)] 
Return correctly after first match for logical or

2 years agodon't stop on eapol_test compile warnings
Nick Porter [Thu, 6 Jul 2023 07:34:50 +0000 (08:34 +0100)] 
don't stop on eapol_test compile warnings

2 years agoAdd debian 12 to full debian CI run
Nick Porter [Thu, 6 Jul 2023 07:13:59 +0000 (08:13 +0100)] 
Add debian 12 to full debian CI run

2 years agoDebian sid now reports trixie as its release
Nick Porter [Thu, 6 Jul 2023 07:13:33 +0000 (08:13 +0100)] 
Debian sid now reports trixie as its release

2 years agomove more code to common function
Alan T. DeKok [Wed, 5 Jul 2023 12:38:05 +0000 (08:38 -0400)] 
move more code to common function

2 years agomove "create LHS vp" to common function
Alan T. DeKok [Wed, 5 Jul 2023 12:13:18 +0000 (08:13 -0400)] 
move "create LHS vp" to common function

2 years agoupdate exec_build_env() to return environment variables.
Alan T. DeKok [Wed, 5 Jul 2023 00:07:56 +0000 (20:07 -0400)] 
update exec_build_env() to return environment variables.

It wasn't doing that previously. :(

2 years agodepend on real file, not phony one
Alan T. DeKok [Tue, 4 Jul 2023 23:23:48 +0000 (19:23 -0400)] 
depend on real file, not phony one

so that we don't always re-run the mschap test

2 years agoremove dangling dependency
Alan T. DeKok [Tue, 4 Jul 2023 23:21:06 +0000 (19:21 -0400)] 
remove dangling dependency

2 years agotests and cleanups for logical and
Alan T. DeKok [Tue, 4 Jul 2023 20:46:39 +0000 (16:46 -0400)] 
tests and cleanups for logical and

2 years agouse -S tmpl_tokenize_all_nested=yes for pairs test
Alan T. DeKok [Tue, 4 Jul 2023 20:13:46 +0000 (16:13 -0400)] 
use -S tmpl_tokenize_all_nested=yes for pairs test

the test prints pairs to a string.  That format depends on the
value of the -S tmpl_tokenize_all_nested=yes flag.

However, we couldn't use logical or (||) until that issue was
first fixed.

2 years agotest and fix for logical or
Alan T. DeKok [Tue, 4 Jul 2023 20:12:40 +0000 (16:12 -0400)] 
test and fix for logical or

we temporarily disable failing tests which depend on the old
(and broken) functionality.  Those need to be tracked down, fixed,
and re-enabled

2 years agouse pair_append_by_tmpl_parent() instead of fr_pair_afrom_da()
Alan T. DeKok [Tue, 4 Jul 2023 19:14:37 +0000 (15:14 -0400)] 
use pair_append_by_tmpl_parent() instead of fr_pair_afrom_da()

as the tmpl function finds or creates all of the pairs in the
map.

The mschap tests expected that to work:

&request += {
&Vendor-Specific.Microsoft.CHAP-Challenge = 0xe96e4fff2955c4f1
&Vendor-Specific.Microsoft.CHAP-Response = 0x000100000...
}

Would create:

&request {
CHAP-Challenge = ...
CHAP-Response = ...
}

which was wrong

2 years agodon't reparent on internal grouping attributes
Alan T. DeKok [Tue, 4 Jul 2023 14:37:53 +0000 (10:37 -0400)] 
don't reparent on internal grouping attributes

and swap almost all tests over to using

-S tmpl_tokenize_all_nested=yes

The ones which don't use it failed with the flag.  I haven't had
time to investigate, so we're just moving ahead temporarily

2 years agoCheck fr_dbuff_out() returns in src/protocols/dhcpv4/encode.c
James Jones [Mon, 3 Jul 2023 14:57:56 +0000 (09:57 -0500)] 
Check fr_dbuff_out() returns in src/protocols/dhcpv4/encode.c

CIDs: #1533885, #1533886

2 years agoAdd new unit load tests for dhcpv4
Jorge Pereira [Tue, 4 Jul 2023 01:10:55 +0000 (22:10 -0300)] 
Add new unit load tests for dhcpv4

It's based on Wireshark .pcap tests
from https://wiki.wireshark.org/DHCP

e.g:

$ wget https://wiki.wireshark.org/uploads/__moin_import__/attachments/SampleCaptures/dhcp.pcap
$ ./scripts//util/pcap2decode-proto.py  -f dhcp.pcap -p dhcpv4 > src/tests/unit/protocols/dhcpv4/client-server.txt

2 years agoallow multiple attrs on the LHS
Alan T. DeKok [Tue, 4 Jul 2023 14:28:13 +0000 (10:28 -0400)] 
allow multiple attrs on the LHS

&reply.foo := { ... }

2 years agohack to allow nested attributes
Alan T. DeKok [Tue, 4 Jul 2023 14:27:13 +0000 (10:27 -0400)] 
hack to allow nested attributes

2 years agoadd basic tmpl_rules_debug() function
Alan T. DeKok [Tue, 4 Jul 2023 13:12:33 +0000 (09:12 -0400)] 
add basic tmpl_rules_debug() function

2 years agosimplify code a bit
Alan T. DeKok [Tue, 4 Jul 2023 12:11:17 +0000 (08:11 -0400)] 
simplify code a bit