On Nov 30, 2017, at 1:26 PM, Jonathan Anthony <jonathan.anthony@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.