How to set an entry in module_config[]
Alan DeKok
aland at deployingradius.com
Thu Nov 30 19:52:57 CET 2017
On Nov 30, 2017, at 1:26 PM, Jonathan Anthony <jonathan.anthony at siliconsafe.com> wrote:
>
> I have the following structure:
> typedef struct rlm_snap_t {
> uint32_t keyid;
> uint32_t port;
> uint8_t encrkey[16];
add:
char *encrkey_string;
> uint8_t signingkey[16];
> char const *ipaddr;
> uint8_t cipher;
> } rlm_snap_t;
>
> What PW types do I need for encrkey and signingkey. The arrays can contain 0s so I can not use strings
> static const CONF_PARSER module_config[] = {
> { "ipaddr", FR_CONF_OFFSET(PW_TYPE_STRING | PW_TYPE_REQUIRED, rlm_snap_t, ipaddr ), NULL },
> { "port", FR_CONF_OFFSET(PW_TYPE_INTEGER | PW_TYPE_REQUIRED, rlm_snap_t, port), "0"},
> { "keyid", FR_CONF_OFFSET(PW_TYPE_INTEGER | PW_TYPE_REQUIRED, rlm_snap_t, keyid ), "1000" },
> { " encrkey ", FR_CONF_OFFSET(?????????????????, rlm_snap_t, encrkey ), NULL },
Make it:
{ " encrkey ", FR_CONF_OFFSET(PW_TYPE_STRING | PW_TYPE_REQUIRED, rlm_snap_t, encrkey_string ), NULL },
And then call fr_hex2bin() to convert the hex "encrkey_string" to the binary "encrkey". With length checks, of course...
Alan DeKok.
More information about the Freeradius-Devel
mailing list