Manage clients allowed to communicate with the server.  
More...
#include <freeradius-devel/protocol/freeradius/freeradius.internal.h>
#include <freeradius-devel/server/cf_file.h>
#include <freeradius-devel/server/cf_parse.h>
#include <freeradius-devel/server/client.h>
#include <freeradius-devel/server/main_config.h>
#include <freeradius-devel/server/module.h>
#include <freeradius-devel/server/virtual_servers.h>
#include <freeradius-devel/unlang/call.h>
#include <freeradius-devel/util/base16.h>
#include <freeradius-devel/util/misc.h>
#include <freeradius-devel/util/trie.h>
#include <fcntl.h>
#include <sys/stat.h>
Go to the source code of this file.
|  | 
| #define | namecmp(a)   ((!old->a && !client->a) || (old->a && client->a && (strcmp(old->a, client->a) == 0))) | 
|  | 
| #define | TLS_UNUSED   UNUSED | 
|  | Create a list of clients from a client section. 
 | 
|  | 
|  | 
| bool | client_add (fr_client_list_t *clients, fr_client_t *client) | 
|  | Add a client to a fr_client_list_t. 
 | 
|  | 
| fr_client_t * | client_afrom_cs (TALLOC_CTX *ctx, CONF_SECTION *cs, CONF_SECTION *server_cs, size_t extra) | 
|  | Allocate a new client from a config section. 
 | 
|  | 
| fr_client_t * | client_afrom_request (TALLOC_CTX *ctx, request_t *request) | 
|  | Create a new client, consuming all attributes in the control list of the request. 
 | 
|  | 
| static int8_t | client_cmp (void const *one, void const *two) | 
|  | 
| void | client_delete (fr_client_list_t *clients, fr_client_t *client) | 
|  | 
| fr_client_t * | client_find (fr_client_list_t const *clients, fr_ipaddr_t const *ipaddr, int proto) | 
|  | 
| fr_client_t * | client_findbynumber (UNUSED const fr_client_list_t *clients, UNUSED int number) | 
|  | 
| void | client_free (fr_client_t *client) | 
|  | Free a client. 
 | 
|  | 
| fr_client_t * | client_from_request (request_t *request) | 
|  | Search up a list of requests trying to locate one which has a client. 
 | 
|  | 
| void | client_list_free (void) | 
|  | 
| fr_client_list_t * | client_list_init (CONF_SECTION *cs) | 
|  | Return a new client list. 
 | 
|  | 
| fr_client_list_t * | client_list_parse_section (CONF_SECTION *section, int proto, TLS_UNUSED bool tls_required) | 
|  | 
| int | client_map_section (CONF_SECTION *out, CONF_SECTION const *map, client_value_cb_t func, void *data) | 
|  | Create a client CONF_SECTION using a mapping section to map values from a result set to client attributes. 
 | 
|  | 
| fr_client_t * | client_read (char const *filename, CONF_SECTION *server_cs, bool check_dns) | 
|  | Read a single client from a file. 
 | 
|  | 
Manage clients allowed to communicate with the server. 
- Id
- 0b8c9ab7361640f52e48fcb40be284bdc22f4652 
- Copyright
- 2015 Arran Cudbard-Bell (a.cud.nosp@m.bard.nosp@m.b@fre.nosp@m.erad.nosp@m.ius.o.nosp@m.rg) 
- 
2000,2006 The FreeRADIUS server project 
- 
2000 Alan DeKok (aland.nosp@m.@fre.nosp@m.eradi.nosp@m.us.o.nosp@m.rg) 
- 
2000 Miquel van Smoorenburg (mique.nosp@m.ls@c.nosp@m.istro.nosp@m.n.nl) 
Definition in file client.c.
◆ fr_client_list_s
Group of clients. 
Definition at line 50 of file client.c.
| Data Fields | 
|---|
| char const  * | name | Name of the client list. | 
| fr_rb_tree_t * | tree[129] |  | 
 
 
◆ namecmp
      
        
          | #define namecmp | ( |  | a | ) | ((!old->a && !client->a) || (old->a && client->a && (strcmp(old->a, client->a) == 0))) | 
      
 
 
◆ TLS_UNUSED
Create a list of clients from a client section. 
Iterates over all client definitions in the specified section, adding them to a client list. 
Definition at line 468 of file client.c.
 
 
◆ client_add()
Add a client to a fr_client_list_t. 
- Parameters
- 
  
    | clients | list to add client to, may be NULL if global client list is being used. |  | client | to add. |  
 
- Returns
- 
- true on success.
- false on failure. 
 
Definition at line 182 of file client.c.
 
 
◆ client_afrom_cs()
Allocate a new client from a config section. 
- Parameters
- 
  
    | ctx | to allocate new clients in. |  | cs | to process as a client. |  | server_cs | The virtual server that this client belongs to. |  | extra | 0 allocate sizeof(fr_client_t) bytes >sizeof(client_t) number of bytes to allocate |  
 
- Returns
- new fr_client_t struct. 
Definition at line 701 of file client.c.
 
 
◆ client_afrom_request()
Create a new client, consuming all attributes in the control list of the request. 
- Parameters
- 
  
    | ctx | the talloc context |  | request | containing the client attributes. |  
 
- Returns
- 
- New client on success.
- NULL on error. 
 
Definition at line 923 of file client.c.
 
 
◆ client_cmp()
  
  | 
        
          | static int8_t client_cmp | ( | void const * | one, |  
          |  |  | void const * | two |  
          |  | ) |  |  |  | static | 
 
 
◆ client_delete()
◆ client_find()
◆ client_findbynumber()
◆ client_free()
Free a client. 
It's up to the caller to ensure that it's deleted from any fr_client_list_t. 
Definition at line 93 of file client.c.
 
 
◆ client_from_request()
Search up a list of requests trying to locate one which has a client. 
Definition at line 1105 of file client.c.
 
 
◆ client_list_free()
      
        
          | void client_list_free | ( | void |  | ) |  | 
      
 
 
◆ client_list_init()
Return a new client list. 
- Note
- The container won't contain any clients.
- Returns
- 
- New client list on success.
- NULL on error (OOM). 
 
Definition at line 108 of file client.c.
 
 
◆ client_list_parse_section()
◆ client_map_section()
Create a client CONF_SECTION using a mapping section to map values from a result set to client attributes. 
If we hit a CONF_SECTION we recurse and process its CONF_PAIRS too.
- Note
- Caller should free CONF_SECTION passed in as out, on error. Contents of that section will be in an undefined state.
- Parameters
- 
  
    | [in,out] | out | Section to perform mapping on. Either the root of the client config, or a parent section (when this function is called recursively). Should be alloced with cf_section_alloc, or if there's a separate template section, the result of calling cf_section_dup on that section. |  | [in] | map | section. |  | [in] | func | to call to retrieve CONF_PAIR values. Must return a talloced buffer containing the value. |  | [in] | data | to pass to func, usually a result pointer. |  
 
- Returns
- 
- 0 on success.
- -1 on failure. 
 
Definition at line 619 of file client.c.
 
 
◆ client_read()
Read a single client from a file. 
This function supports asynchronous runtime loading of clients.
- Parameters
- 
  
    | [in] | filename | To read clients from. |  | [in] | server_cs | of virtual server clients should be added to. |  | [in] | check_dns | Check reverse lookup of IP address matches filename. |  
 
- Returns
- 
- The new client on success.
- NULL on failure. 
 
Definition at line 1053 of file client.c.
 
 
◆ cl_ipaddr
◆ cl_srcipaddr
  
  | 
        
          | char const* cl_srcipaddr = NULL |  | static | 
 
 
◆ client_config
◆ hs_proto
  
  | 
        
          | char const* hs_proto = NULL |  | static | 
 
 
◆ limit_config
Initial value:= {
 
 
}
#define CONF_PARSER_TERMINATOR
#define FR_CONF_OFFSET(_name, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Describes a host allowed to send packets to the server.
Definition at line 420 of file client.c.
 
 
◆ root_clients
Global client list. 
Definition at line 62 of file client.c.