12#include <radcli/radcli.h>
15main (
int argc,
char **argv)
19 char passwd[AUTH_PASS_LEN + 1];
30 strcpy(username,
"my-username");
31 strcpy(passwd,
"my-password");
50 service = PW_AUTHENTICATE_ONLY;
54 result =
rc_auth(rh, 0, send, &received, NULL);
56 if (result == OK_RC) {
61 fprintf(stderr,
"\"%s\" RADIUS Authentication OK\n", username);
65 if (
rc_avpair_tostr(rh, vp, name,
sizeof(name), value,
sizeof(value)) == 0) {
66 fprintf(stderr,
"%s:\t%s\n", name, value);
71 fprintf(stderr,
"\"%s\" RADIUS Authentication failure (RC=%i)\n", username, result);
void rc_openlog(char const *ident)
int rc_auth(rc_handle *rh, uint32_t nas_port, VALUE_PAIR *send, VALUE_PAIR **received, char *msg)
int rc_avpair_tostr(rc_handle const *rh, VALUE_PAIR *pair, char *name, int ln, char *value, int lv)
rc_handle * rc_read_config(char const *filename)
VALUE_PAIR * rc_avpair_add(rc_handle const *rh, VALUE_PAIR **list, uint32_t attrid, void const *pval, int len, uint32_t vendorspec)
@ PW_SERVICE_TYPE
Its type is integer.
@ PW_USER_NAME
Its type is string.
@ PW_USER_PASSWORD
Its type is string.