#include "nsswitch/libwbclient/wbclient.h"
#include "libcli/security/dom_sid.h"
-static NTSTATUS get_info3_from_ndr(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, struct winbindd_response *response, struct netr_SamInfo3 *info3)
+static NTSTATUS get_info3_from_ndr(TALLOC_CTX *mem_ctx, struct winbindd_response *response, struct netr_SamInfo3 *info3)
{
size_t len = response->length - sizeof(struct winbindd_response);
if (len > 4) {
blob.data = (uint8_t *)(((char *)response->extra_data.data) + 4);
ndr_err = ndr_pull_struct_blob(&blob, mem_ctx,
- iconv_convenience, info3,
+ info3,
(ndr_pull_flags_fn_t)ndr_pull_netr_SamInfo3);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return ndr_map_error2ntstatus(ndr_err);
}
static NTSTATUS get_info3_from_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
- struct smb_iconv_convenience *ic,
struct wbcAuthUserInfo *info,
struct netr_SamInfo3 *info3)
{
info3->base.allow_password_change = info->pass_can_change_time;
info3->base.force_password_change = info->pass_must_change_time;
- if (info->account_name != NULL) {
- convert_string_talloc_convenience(mem_ctx, ic,
- CH_UNIX, CH_UTF16, info->account_name,
- strlen(info->account_name),
- discard_const(&info3->base.account_name.string),
- NULL, false);
- }
-
- if (info->full_name != NULL) {
- convert_string_talloc_convenience(mem_ctx, ic,
- CH_UNIX, CH_UTF16, info->full_name,
- strlen(info->full_name),
- discard_const(&info3->base.full_name.string),
- NULL, false);
- }
-
- if (info->logon_script != NULL) {
- convert_string_talloc_convenience(mem_ctx, ic,
- CH_UNIX, CH_UTF16, info->logon_script,
- strlen(info->logon_script),
- discard_const(&info3->base.logon_script.string),
- NULL, false);
- }
-
- if (info->profile_path != NULL) {
- convert_string_talloc_convenience(mem_ctx, ic,
- CH_UNIX, CH_UTF16, info->profile_path,
- strlen(info->profile_path),
- discard_const(&info3->base.profile_path.string),
- NULL, false);
- }
-
- if (info->home_directory != NULL) {
- convert_string_talloc_convenience(mem_ctx, ic,
- CH_UNIX, CH_UTF16, info->home_directory,
- strlen(info->home_directory),
- discard_const(&info3->base.home_directory.string),
- NULL, false);
- }
-
- if (info->home_drive != NULL) {
- convert_string_talloc_convenience(mem_ctx, ic,
- CH_UNIX, CH_UTF16, info->home_drive,
- strlen(info->home_drive),
- discard_const(&info3->base.home_drive.string),
- NULL, false);
- }
-
- if (info->logon_server != NULL) {
- convert_string_talloc_convenience(mem_ctx, ic,
- CH_UNIX, CH_UTF16, info->logon_server,
- strlen(info->logon_server),
- discard_const(&info3->base.logon_server.string),
- NULL, false);
- }
-
- if (info->domain_name != NULL) {
- convert_string_talloc_convenience(mem_ctx, ic,
- CH_UNIX, CH_UTF16, info->domain_name,
- strlen(info->domain_name),
- discard_const(&info3->base.domain.string),
- NULL, false);
- }
+ info3->base.account_name.string = talloc_strdup(mem_ctx,
+ info->account_name);
+ info3->base.full_name.string = talloc_strdup(mem_ctx,
+ info->full_name);
+ info3->base.logon_script.string = talloc_strdup(mem_ctx,
+ info->logon_script);
+ info3->base.profile_path.string = talloc_strdup(mem_ctx,
+ info->profile_path);
+ info3->base.home_directory.string = talloc_strdup(mem_ctx,
+ info->home_directory);
+ info3->base.home_drive.string = talloc_strdup(mem_ctx,
+ info->home_drive);
+ info3->base.logon_server.string = talloc_strdup(mem_ctx,
+ info->logon_server);
+ info3->base.domain.string = talloc_strdup(mem_ctx,
+ info->domain_name);
info3->base.logon_count = info->logon_count;
info3->base.bad_password_count = info->bad_password_count;
if (result == NSS_STATUS_SUCCESS && response.extra_data.data) {
union netr_Validation validation;
- nt_status = get_info3_from_ndr(mem_ctx, lp_iconv_convenience(ctx->auth_ctx->lp_ctx), &response, &info3);
+ nt_status = get_info3_from_ndr(mem_ctx, &response, &info3);
SAFE_FREE(response.extra_data.data);
NT_STATUS_NOT_OK_RETURN(nt_status);
s->req.in.logon.password= password_info;
} else {
struct netr_NetworkInfo *network_info;
- const uint8_t *challenge;
+ uint8_t chal[8];
status = encrypt_user_info(s, ctx->auth_ctx, AUTH_PASSWORD_RESPONSE,
user_info, &user_info_new);
network_info = talloc(s, struct netr_NetworkInfo);
NT_STATUS_HAVE_NO_MEMORY(network_info);
- status = auth_get_challenge(ctx->auth_ctx, &challenge);
+ status = auth_get_challenge(ctx->auth_ctx, chal);
NT_STATUS_NOT_OK_RETURN(status);
- memcpy(network_info->challenge, challenge, sizeof(network_info->challenge));
+ memcpy(network_info->challenge, chal, sizeof(network_info->challenge));
network_info->nt.length = user_info->password.response.nt.length;
network_info->nt.data = user_info->password.response.nt.data;
wbcFreeMemory(err);
NT_STATUS_NOT_OK_RETURN(nt_status);
}
- nt_status = get_info3_from_wbcAuthUserInfo(mem_ctx,
- lp_iconv_convenience(ctx->auth_ctx->lp_ctx),
- info, &info3);
+ nt_status = get_info3_from_wbcAuthUserInfo(mem_ctx, info, &info3);
wbcFreeMemory(info);
NT_STATUS_NOT_OK_RETURN(nt_status);