27 RCSID(
"$Id: cb91a2ea9766e04cf8a3acb1a2aa31b84f8fbf41 $")
29 #include <freeradius-devel/server/base.h>
30 #include <freeradius-devel/util/debug.h>
33 #include <core/ntstatus.h>
53 struct wbcContext *wb_ctx;
54 struct wbcAuthUserParams authparams;
56 struct wbcAuthUserInfo *info = NULL;
57 struct wbcAuthErrorInfo *error = NULL;
64 memset(&authparams, 0,
sizeof(authparams));
71 authparams.account_name = env->
username.vb_strvalue;
74 authparams.domain_name = env->
domain.vb_strvalue;
76 RWDEBUG2(
"No domain specified; authentication may fail because of this");
83 authparams.level = WBC_AUTH_USER_LEVEL_PLAIN;
84 authparams.password.plaintext = env->
password.vb_strvalue;
90 authparams.parameter_control |= WBC_MSV1_0_CLEARTEXT_PASSWORD_ALLOWED |
91 WBC_MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT |
92 WBC_MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT;
99 RERROR(
"Unable to get winbind connection from pool");
103 RDEBUG2(
"Sending authentication request user='%s' domain='%s'", authparams.account_name,
104 authparams.domain_name);
106 err = wbcCtxAuthenticateUserEx(wb_ctx, &authparams, &info, &error);
116 case WBC_ERR_SUCCESS:
118 RDEBUG2(
"Authenticated successfully");
121 case WBC_ERR_WINBIND_NOT_AVAILABLE:
122 RERROR(
"Unable to contact winbindd");
123 RDEBUG2(
"Check that winbind is running and that FreeRADIUS has");
124 RDEBUG2(
"permission to connect to the winbind privileged socket");
127 case WBC_ERR_DOMAIN_NOT_FOUND:
131 case WBC_ERR_AUTH_ERROR:
140 if (error->nt_status == NT_STATUS_PASSWORD_EXPIRED ||
141 error->nt_status == NT_STATUS_PASSWORD_MUST_CHANGE) {
148 if (error->display_string) {
149 REDEBUG2(
"%s [0x%X]", error->display_string, error->nt_status);
151 REDEBUG2(
"Unknown authentication failure [0x%X]", error->nt_status);
162 if (error && error->display_string) {
163 REDEBUG2(
"Failed authenticating user: %s (%s)", error->display_string, wbcErrorString(
err));
165 REDEBUG2(
"Failed authenticating user: Winbind error (%s)", wbcErrorString(
err));
172 if (info) wbcFreeMemory(info);
173 if (error) wbcFreeMemory(error);
int do_auth_wbclient_pap(rlm_winbind_t const *inst, request_t *request, winbind_auth_call_env_t *env)
PAP authentication direct to winbind via Samba's libwbclient library.
#define RWDEBUG2(fmt,...)
#define REDEBUG2(fmt,...)
@ FR_TYPE_STRING
String of printable characters.
void fr_pool_connection_release(fr_pool_t *pool, request_t *request, void *conn)
Release a connection.
void * fr_pool_connection_get(fr_pool_t *pool, request_t *request)
Reserve a connection in the connection pool.
eap_aka_sim_process_conf_t * inst