Nikolai Kondrashov [Wed, 1 Oct 2014 12:11:12 +0000 (15:11 +0300)]
Prefix *_ENDIAN macros with RADIUS_
Rename LITTLE_ENDIAN and BIG_ENDIAN macros to RADIUS_LITTLE_ENDIAN and
RADIUS_BIG_ENDIAN respectively to avoid clashes with
/usr/include/endian.h defines, which result in always assuming
little-endian architecture.
Alan T. DeKok [Wed, 1 Oct 2014 15:58:57 +0000 (11:58 -0400)]
More type fixes for byte / short / integer
Nikolai Kondrashov [Wed, 1 Oct 2014 15:51:51 +0000 (11:51 -0400)]
Access union value_data members consistently
Use the same, appropriate union value_data member for each access of
BOOLEAN, BYTE and SHORT PW_TYPEs, without assuming they're
interchangeable with "integer", as that is only true on little-endian
architectures.
This fixes at least this wimax unit test failure on s390x and ppc64:
Mismatch in line 11 of src/tests/unit/wimax.txt, got: 1a 0c 00 00 60 b5 01 06 00 02 03 00 expected: 1a 0c 00 00 60 b5 01 06 00 02 03 01
Nikolai Kondrashov [Tue, 30 Sep 2014 19:27:36 +0000 (22:27 +0300)]
Don't truncate 64-bit integers in do_cast_copy
Assign converted octets to vp_integer64, instead of vp_integer to avoid
truncation in do_cast_copy.
Alan T. DeKok [Wed, 1 Oct 2014 14:06:46 +0000 (10:06 -0400)]
Better error messages
Alan DeKok [Wed, 1 Oct 2014 01:27:07 +0000 (21:27 -0400)]
Merge pull request #802 from spbnick/dont_detach_without_perl_parse
perl: Don't call detach after failed perl_parse
Arran Cudbard-Bell [Tue, 30 Sep 2014 21:11:56 +0000 (17:11 -0400)]
Don't bitch if we're using references and the format config item has been removed
Alan T. DeKok [Tue, 30 Sep 2014 21:04:54 +0000 (17:04 -0400)]
Add TMPL_TYPE_ATTR_UNKNOWN
So that we can handle &Foo-Bar in pass2. And have better
parse errors, too
Alan T. DeKok [Tue, 30 Sep 2014 21:02:27 +0000 (17:02 -0400)]
Expose map_cast_from_hex()
Alan T. DeKok [Tue, 30 Sep 2014 21:02:05 +0000 (17:02 -0400)]
Use tmpl_define_unknown_attr()
Alan T. DeKok [Tue, 30 Sep 2014 21:01:30 +0000 (17:01 -0400)]
Expose tmpl_define_unknown_attr
Alan T. DeKok [Tue, 30 Sep 2014 20:24:15 +0000 (16:24 -0400)]
Better parsing for attributes defined in pass1
They are now ATTR_UNKNOWN, instead of literals
Alan T. DeKok [Tue, 30 Sep 2014 17:53:06 +0000 (13:53 -0400)]
We no longer return -2 on partial parse error
Arran Cudbard-Bell [Tue, 30 Sep 2014 18:22:40 +0000 (14:22 -0400)]
Fix const errors
Arran Cudbard-Bell [Tue, 30 Sep 2014 18:22:02 +0000 (14:22 -0400)]
Typo
Arran Cudbard-Bell [Tue, 30 Sep 2014 17:55:21 +0000 (13:55 -0400)]
Quiet doxygen
Arran Cudbard-Bell [Tue, 30 Sep 2014 16:29:13 +0000 (12:29 -0400)]
Sprinkle VERIFY_MAP in the map functions
Arran Cudbard-Bell [Tue, 30 Sep 2014 16:28:34 +0000 (12:28 -0400)]
Fix comment
Arran Cudbard-Bell [Tue, 30 Sep 2014 16:28:15 +0000 (12:28 -0400)]
Sprinkle VERIFY_TMPL in tmpl functions (to check they produce valid output)
Arran Cudbard-Bell [Tue, 30 Sep 2014 16:25:33 +0000 (12:25 -0400)]
Formatting
Arran Cudbard-Bell [Tue, 30 Sep 2014 16:24:35 +0000 (12:24 -0400)]
Add macros for VERIFY_TMPL and VERIFY_MAP
Arran Cudbard-Bell [Tue, 30 Sep 2014 16:23:29 +0000 (12:23 -0400)]
Rename some of the fields in the literal member of the union in the value_pair_tmpl_t struct, and convert more things to use the tmpl_init and tmpl_alloc functions
Arran Cudbard-Bell [Tue, 30 Sep 2014 16:19:47 +0000 (12:19 -0400)]
Change tmpl_afrom_str so that it doesn't re-use allocated tmpl structures. This was triggering the internal sanity checks in VERIFY_TMPL
Arran Cudbard-Bell [Tue, 30 Sep 2014 16:18:17 +0000 (12:18 -0400)]
Add tmpl_afrom_attrstr
Arran Cudbard-Bell [Tue, 30 Sep 2014 16:17:47 +0000 (12:17 -0400)]
Don't partially populate the tmpl and error out in tmpl_from_attr_substr
Arran Cudbard-Bell [Tue, 30 Sep 2014 16:11:23 +0000 (12:11 -0400)]
Use tmpl_alloc to initialise templates in xlat.c
Arran Cudbard-Bell [Tue, 30 Sep 2014 16:09:59 +0000 (12:09 -0400)]
Add functions to initialise tmpls, makes it easier to switch stack allocated to talloced in debug builds
Rewrite tmpl_verify function to work with stack allocated tmpls
Arran Cudbard-Bell [Tue, 30 Sep 2014 15:59:23 +0000 (11:59 -0400)]
Consistency checks should exit with an error code
Arran Cudbard-Bell [Tue, 30 Sep 2014 15:58:21 +0000 (11:58 -0400)]
Expose FR_FAULT_LOG
Arran Cudbard-Bell [Tue, 30 Sep 2014 15:57:51 +0000 (11:57 -0400)]
Formatting
Arran Cudbard-Bell [Tue, 30 Sep 2014 15:45:26 +0000 (11:45 -0400)]
Move tmpl_attribute fields out into its own type
Nikolai Kondrashov [Tue, 30 Sep 2014 13:19:47 +0000 (16:19 +0300)]
perl: Don't call detach after failed perl_parse
Don't call "detach" callback in rlm_perl, if perl_parse of the Perl
module failed.
This fixes segfault when the module file cannot be read:
Can't open perl script "/etc/raddb/mods-config/perl/example.pl": Permission denied
rlm_perl: perl_parse failed: /etc/raddb/mods-config/perl/example.pl not found or has syntax errors.
/etc/raddb/mods-enabled/perl[7]: Instantiation failed for module "perl"
Segmentation fault
Arran Cudbard-Bell [Mon, 29 Sep 2014 15:19:35 +0000 (11:19 -0400)]
Merge pull request #801 from spbnick/talloc_dummy_request
process: Talloc home_trigger dummy request
Nikolai Kondrashov [Mon, 29 Sep 2014 14:40:10 +0000 (17:40 +0300)]
process: Talloc home_trigger dummy request
Allocate the dummy request in home_trigger with talloc, instead of
allocating it on the stack, as the rest of the code expects it to be a
valid talloc context.
This fixes a talloc_abort resulting from xlat_tokenize_request invoking
talloc_typed_strdup with the dummy request as the talloc context.
Alan T. DeKok [Mon, 29 Sep 2014 12:42:29 +0000 (08:42 -0400)]
Note recent changes
Arran Cudbard-Bell [Mon, 29 Sep 2014 03:46:12 +0000 (23:46 -0400)]
Finish creating the tmpl union. value_pair_tmpl_t structs can now be ATTRIBUTES or DATA but not both (you need a map for that)
Arran Cudbard-Bell [Mon, 29 Sep 2014 03:14:31 +0000 (23:14 -0400)]
Emit debug message when map_tp_vp returns no results
Arran Cudbard-Bell [Mon, 29 Sep 2014 02:52:43 +0000 (22:52 -0400)]
No longer true
Arran Cudbard-Bell [Mon, 29 Sep 2014 00:53:14 +0000 (20:53 -0400)]
Alter tmpl_prints and vp_data_prints_value to take types in addiction DICT_ATTRs
Arran Cudbard-Bell [Sun, 28 Sep 2014 23:40:48 +0000 (19:40 -0400)]
Change pairdatacpy to take a PW_TYPE instead of a DICT_ATTR
Arran Cudbard-Bell [Sun, 28 Sep 2014 23:37:56 +0000 (19:37 -0400)]
Formatting
Arran Cudbard-Bell [Sun, 28 Sep 2014 00:07:20 +0000 (20:07 -0400)]
Rename map->src to map->rhs and map->dst to map->lhs so they make sense for conditions
Arran Cudbard-Bell [Sat, 27 Sep 2014 23:01:02 +0000 (19:01 -0400)]
Typo
Arran Cudbard-Bell [Sat, 27 Sep 2014 22:59:35 +0000 (18:59 -0400)]
Use memory within value_pair_tmpl_t structs to hold unknown dictionary attributes
This means tmpl_from_attr_str works correctly with both talloced and stack allocated VPT structs
Arran Cudbard-Bell [Sat, 27 Sep 2014 22:57:54 +0000 (18:57 -0400)]
Echo failing unittest command
Herwin Weststrate [Sat, 27 Sep 2014 09:32:16 +0000 (11:32 +0200)]
Validate availability of json on startup in rlm_rest
If the server was compiled without json support and json was requested in rlm_rest, the server would startup without any problem. However, on the first use of the module, an "assert(false)" was triggered.
This patch validates the bevahiour during the startup phase.
Alan T. DeKok [Sat, 27 Sep 2014 16:33:11 +0000 (12:33 -0400)]
Fix typos
Arran Cudbard-Bell [Sat, 27 Sep 2014 01:14:37 +0000 (21:14 -0400)]
Add tmpl_afrom_attr_substr and tmpl_from_attr_substr
These functions advance the name pointer to the end of the parsed portion of the string
Arran Cudbard-Bell [Sat, 27 Sep 2014 01:07:13 +0000 (21:07 -0400)]
':' is not a valid dictionary name character
Add row/column headers to dict_attr_allowed_chars
Arran Cudbard-Bell [Sat, 27 Sep 2014 00:52:05 +0000 (20:52 -0400)]
Modify dict_attrbytagged_name to update src string pointer
Arran Cudbard-Bell [Sat, 27 Sep 2014 00:50:48 +0000 (20:50 -0400)]
Remove another dynamically allocated vpt
Arran Cudbard-Bell [Fri, 26 Sep 2014 20:44:06 +0000 (16:44 -0400)]
Make mismatch message readable
Arran Cudbard-Bell [Fri, 26 Sep 2014 19:25:36 +0000 (15:25 -0400)]
Use a value_pair_tmpl_t in xlat_exp to store details of the attribute ref
Alan T. DeKok [Sat, 27 Sep 2014 13:50:34 +0000 (09:50 -0400)]
Ensure that the password is terminated with zero
And ensure that we can handle all password lengths
Alan T. DeKok [Fri, 26 Sep 2014 18:57:03 +0000 (14:57 -0400)]
No need to call vp_prints_value with -1
Arran Cudbard-Bell [Fri, 26 Sep 2014 16:17:21 +0000 (12:17 -0400)]
More formatting
Arran Cudbard-Bell [Fri, 26 Sep 2014 16:13:18 +0000 (12:13 -0400)]
Formatting
Arran Cudbard-Bell [Fri, 26 Sep 2014 15:56:56 +0000 (11:56 -0400)]
Add warning when sql.authorize is called and no queries have been configured/allowed
Arran Cudbard-Bell [Fri, 26 Sep 2014 02:24:49 +0000 (22:24 -0400)]
Double xlat internal buffers until we have a proper fix
Arran Cudbard-Bell [Fri, 26 Sep 2014 01:11:11 +0000 (21:11 -0400)]
Report space required for the whole %{pairs:} string.
Arran Cudbard-Bell [Fri, 26 Sep 2014 01:10:50 +0000 (21:10 -0400)]
Hmm a 1k line buffer, and a 4k filename buffer, something seems reversed there...
Arran Cudbard-Bell [Thu, 25 Sep 2014 23:23:37 +0000 (19:23 -0400)]
Mark map_verify as unused
Arran Cudbard-Bell [Thu, 25 Sep 2014 23:21:37 +0000 (19:21 -0400)]
There are *very* few places where assuming a tmpl is talloced is a good idea
There are clearly two variants of some tmpl functions, one takes a stack allocated tmpl, the other doesn't.
We don't malloc memory when we don't have to, and we don't have to for tmpls or cursors or maps.
Arran Cudbard-Bell [Thu, 25 Sep 2014 22:44:08 +0000 (18:44 -0400)]
Add pairs xlat
Alan T. DeKok [Thu, 25 Sep 2014 15:39:37 +0000 (11:39 -0400)]
More specific ifdef's
Alan T. DeKok [Thu, 25 Sep 2014 15:39:29 +0000 (11:39 -0400)]
Cast to int
Alan T. DeKok [Thu, 25 Sep 2014 15:33:59 +0000 (11:33 -0400)]
Remove unused assignment
Alan T. DeKok [Wed, 24 Sep 2014 21:42:37 +0000 (17:42 -0400)]
Be more careful about expanding conditions in the unicorn parser
Alan T. DeKok [Wed, 24 Sep 2014 15:52:14 +0000 (11:52 -0400)]
Add a smashing test
Alan T. DeKok [Wed, 24 Sep 2014 15:43:41 +0000 (11:43 -0400)]
Candyland requires sugar
Alan T. DeKok [Wed, 24 Sep 2014 15:40:26 +0000 (11:40 -0400)]
Much magic. Magical land of magical unicorns and happiness
Alan T. DeKok [Tue, 23 Sep 2014 16:14:01 +0000 (12:14 -0400)]
Mark da as UNUSED to quiet scan
Alan T. DeKok [Tue, 23 Sep 2014 14:54:58 +0000 (10:54 -0400)]
Remove unused variable
Alan T. DeKok [Tue, 23 Sep 2014 14:50:13 +0000 (10:50 -0400)]
Pre-parse insert / trim / expire, and mark them PW_TYPE_XLAT
Alan T. DeKok [Tue, 23 Sep 2014 14:44:12 +0000 (10:44 -0400)]
Reduce scope of "start" variable.
Which might un-confuse the compiler, which thinks it's unused
Alan T. DeKok [Tue, 23 Sep 2014 14:19:02 +0000 (10:19 -0400)]
Note recent changes
Alan T. DeKok [Tue, 23 Sep 2014 14:05:37 +0000 (10:05 -0400)]
Add parsing for "query" via PW_TYPE_MULTI
The default configuration is parsed. If people change the
"reference" line, they'll miss all of the pre-parsing stuff.
But... this works for now, until we have something which handles
randomly named subsections and config items.
Alan T. DeKok [Tue, 23 Sep 2014 14:02:02 +0000 (10:02 -0400)]
Add PW_TYPE_MULTI
For CONF_PAIRs which can exist multiple times in a CONF_SECTION
Alan T. DeKok [Tue, 23 Sep 2014 14:01:17 +0000 (10:01 -0400)]
Use fr_canonicalize_error()
Alan T. DeKok [Tue, 23 Sep 2014 13:50:06 +0000 (09:50 -0400)]
Add fr_canonicalize_error()
So the error messages are all of the same format, and the
code isn't duplicated all over the place
Alan T. DeKok [Tue, 23 Sep 2014 13:49:09 +0000 (09:49 -0400)]
Use %%s instead of %s
Alan T. DeKok [Tue, 23 Sep 2014 03:31:53 +0000 (23:31 -0400)]
Don't use "goto error" and variable named "error"
Alan T. DeKok [Tue, 23 Sep 2014 02:53:28 +0000 (22:53 -0400)]
Track auto-created subsections
The subsection will exist, but the "reference = foo" CONF_PAIR
won't exist. So key off of that to determine if we run the section.
We need this because the default config has no "reference"
for "post-auth" in queries.conf. So setting it to NULL is a bad
idea.
Alan T. DeKok [Tue, 23 Sep 2014 02:39:31 +0000 (22:39 -0400)]
Parse accounting && post-auth sections statically
instead of in code. This allows the pass2 compilation to check
that the "reference" config item passes xlat parsing.
It will also allow us to do a later xlat compilation checks
on the queries, too
Alan T. DeKok [Tue, 23 Sep 2014 02:04:37 +0000 (22:04 -0400)]
Add PW_TYPE_XLAT to sql queries, too
Alan T. DeKok [Tue, 23 Sep 2014 01:49:12 +0000 (21:49 -0400)]
Add PW_TYPE_XLAT to most modules
We still need to convert the SQL queries, as they are buried
inside of randomly named sections
Alan T. DeKok [Mon, 22 Sep 2014 22:18:45 +0000 (18:18 -0400)]
Call cf_section_parse_pass2() after loading all of the modules
Alan T. DeKok [Mon, 22 Sep 2014 22:17:13 +0000 (18:17 -0400)]
Added cf_section_parse_pass2() for pass2 checks of config items
and PW_TYPE_XLAT, too.
Modules can now tell the server core that config items will
be dynamically expanded. For now, this means that the server
can parse them in pass2, and complain at compile time about
syntax errors.
We will later expand this to allowing CONF_PAIRs to have compiled
xlat's, which should be faster at run time
Alan T. DeKok [Mon, 22 Sep 2014 18:00:23 +0000 (14:00 -0400)]
Simplify pre-parsing of regexes
Alan T. DeKok [Mon, 22 Sep 2014 16:50:53 +0000 (12:50 -0400)]
Precompile regexes into xlat_struct.
So that references to unknown attributes are caught at load time,
and not at run time
Alan T. DeKok [Mon, 22 Sep 2014 14:55:14 +0000 (10:55 -0400)]
Re-arrange request_finish()
So that internally proxied packets get passed through the post-auth
section.
Alan T. DeKok [Sun, 21 Sep 2014 20:32:36 +0000 (16:32 -0400)]
No need for packets to be in a packet list
They should just go into an rbtree
Alan T. DeKok [Sun, 21 Sep 2014 20:32:18 +0000 (16:32 -0400)]
Ensure structs are set to zero
Alan T. DeKok [Sun, 21 Sep 2014 20:32:09 +0000 (16:32 -0400)]
Don't use DHCP-Server-IP-Address for source IP
use Packet-Src-IP-Address instead.
And don't use server identifier for SIADDR
Alan T. DeKok [Sun, 21 Sep 2014 16:02:10 +0000 (12:02 -0400)]
comment fr_packet_cmp() a bit more
Alan T. DeKok [Fri, 19 Sep 2014 13:20:10 +0000 (09:20 -0400)]
Note recent changes
Alan T. DeKok [Thu, 18 Sep 2014 21:53:00 +0000 (17:53 -0400)]
Free dynamically allocated DA. Fixes #795
Alan T. DeKok [Thu, 18 Sep 2014 20:29:23 +0000 (16:29 -0400)]
Create dictionary entries for unknown attributes
When loading the conditions && "update" sections.
Add a new map_from_fields_unknown(), which is a copy of
map_from_fields(), but which adds the dictionary entries.
This makes the server better deal with unknown attributes
Alan T. DeKok [Thu, 18 Sep 2014 16:43:24 +0000 (12:43 -0400)]
verify da's by name, not by number in fr_verify_vp()
Because we have have multiple attributes of the same name,
but identical numbers
Alan T. DeKok [Thu, 18 Sep 2014 16:15:33 +0000 (12:15 -0400)]
Deal with map verify functions. Missed in commit
21e7594e