radcli_avp_add_username(3)

radcli_avp_add_username3

Append a user-name avp, appending a realm as "username@realm" unless username already contains one.

Usage

#include <radcli/>

int radcli_avp_add_username(
    radcli_avp_list   *list,
    const radcli_ctx  *ctx,
    const char        *username,
    const char        *realm
);

Overview

Written for callers (e.g. an application reading its own "default_realm" config knob) that need to send "username@realm" only when the caller- supplied username didn't already come with a realm attached. Passing realm as NULL reaches for ctx's own "default_realm" configuration option, so an application whose realm policy is just "whatever this

ctx's config file says" never needs to read that option out itself.

Parameters

list

destination list.

ctx

a context with a dictionary defining User-Name (any radcli_ctx_new()/radcli_ctx_read_config() context qualifies).

username

the username; used as-is if it already contains '@'.

realm

realm to append if username has no '@': NULL uses ctx's own "default_realm" configuration option (no realm appended if that option is unset or empty); "" explicitly suppresses appending a realm even if "default_realm" is configured; any other string is used verbatim.

Return value

0 on success, -1 on failure (no User-Name attribute in ctx's dictionary, allocation failure, or as radcli_avp_add_str()).

From radcli 2.0.1-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.