radcli_ctx_set_secret3
Set the radius shared secret for the configured authserver and/or acctserver.
Usage
#include <radcli/>
int radcli_ctx_set_secret(
radcli_ctx *ctx,
unsigned target_mask,
const char *secret
);
Overview
The equivalent, for the new API, of embedding a secret in the host:port:secret form of #RADCLI_OPT_AUTHSERVER/#RADCLI_OPT_ACCTSERVER's value but as a distinct call instead of a delimited string, and able to set both server types' secret at once when they share one (the usual case) via RADCLI_SECRET_AUTH | RADCLI_SECRET_ACCT, without embedding anything in the authserver/acctserver value at all.
Parameters
ctx-
a context whose #RADCLI_OPT_AUTHSERVER and/or #RADCLI_OPT_ACCTSERVER (per target_mask) is already set via radcli_ctx_set_opt_str() or radcli_ctx_read_config() before this call.
target_mask-
a bitwise OR of one or both radcli_secret_target values.
secret-
the shared secret, as a NUL-terminated string.
Return value
0 on success, -1 on failure (NULL ctx/secret, target_mask empty or carrying an unrecognised bit, or the corresponding server not yet configured).