54 struct wbcContext *wb_ctx;
55 struct wbcAuthUserParams authparams;
57 struct wbcAuthUserInfo *info = NULL;
58 struct wbcAuthErrorInfo *error = NULL;
65 memset(&authparams, 0,
sizeof(authparams));
72 authparams.account_name = env->
username.vb_strvalue;
75 authparams.domain_name = env->
domain.vb_strvalue;
77 RWDEBUG2(
"No domain specified; authentication may fail because of this");
84 authparams.level = WBC_AUTH_USER_LEVEL_PLAIN;
85 authparams.password.plaintext = env->
password.vb_strvalue;
91 authparams.parameter_control |= WBC_MSV1_0_CLEARTEXT_PASSWORD_ALLOWED |
92 WBC_MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT |
93 WBC_MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT;
98 wbctx = winbind_slab_reserve(t->
slab);
100 RERROR(
"Unable to get winbind context");
105 RDEBUG2(
"Sending authentication request user='%s' domain='%s'", authparams.account_name,
106 authparams.domain_name);
108 err = wbcCtxAuthenticateUserEx(wb_ctx, &authparams, &info, &error);
110 winbind_slab_release(wbctx);
117 case WBC_ERR_SUCCESS:
119 RDEBUG2(
"Authenticated successfully");
122 case WBC_ERR_WINBIND_NOT_AVAILABLE:
123 RERROR(
"Unable to contact winbindd");
124 RDEBUG2(
"Check that winbind is running and that FreeRADIUS has");
125 RDEBUG2(
"permission to connect to the winbind privileged socket");
128 case WBC_ERR_DOMAIN_NOT_FOUND:
132 case WBC_ERR_AUTH_ERROR:
141 if (error->nt_status == NT_STATUS_PASSWORD_EXPIRED ||
142 error->nt_status == NT_STATUS_PASSWORD_MUST_CHANGE) {
149 if (error->display_string) {
150 REDEBUG2(
"%s [0x%X]", error->display_string, error->nt_status);
152 REDEBUG2(
"Unknown authentication failure [0x%X]", error->nt_status);
163 if (error && error->display_string) {
164 REDEBUG2(
"Failed authenticating user: %s (%s)", error->display_string, wbcErrorString(
err));
166 REDEBUG2(
"Failed authenticating user: Winbind error (%s)", wbcErrorString(
err));
173 if (info) wbcFreeMemory(info);
174 if (error) wbcFreeMemory(error);
int do_auth_wbclient_pap(request_t *request, winbind_auth_call_env_t *env, rlm_winbind_thread_t *t)
PAP authentication direct to winbind via Samba's libwbclient library.