|
|
bec1a9 |
From 0eb6274aacc95601cb9a94922a8176935f336f92 Mon Sep 17 00:00:00 2001
|
|
|
bec1a9 |
From: Andreas Schneider <asn@samba.org>
|
|
|
bec1a9 |
Date: Tue, 20 Jun 2017 10:27:07 +0200
|
|
|
bec1a9 |
Subject: [PATCH] s3:winbind: Fix 'winbind normalize names' in wb_getpwsid()
|
|
|
bec1a9 |
|
|
|
bec1a9 |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12851
|
|
|
bec1a9 |
|
|
|
bec1a9 |
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
|
bec1a9 |
Reviewed-by: Volker Lendecke <vl@samba.org>
|
|
|
bec1a9 |
---
|
|
|
bec1a9 |
source3/winbindd/wb_getpwsid.c | 34 +++++++++++++++++++++++++++++++---
|
|
|
bec1a9 |
1 file changed, 31 insertions(+), 3 deletions(-)
|
|
|
bec1a9 |
|
|
|
bec1a9 |
diff --git a/source3/winbindd/wb_getpwsid.c b/source3/winbindd/wb_getpwsid.c
|
|
|
bec1a9 |
index 8c764f77b08..b0bf6784ba6 100644
|
|
|
bec1a9 |
--- a/source3/winbindd/wb_getpwsid.c
|
|
|
bec1a9 |
+++ b/source3/winbindd/wb_getpwsid.c
|
|
|
bec1a9 |
@@ -63,7 +63,9 @@ static void wb_getpwsid_queryuser_done(struct tevent_req *subreq)
|
|
|
bec1a9 |
req, struct wb_getpwsid_state);
|
|
|
bec1a9 |
struct winbindd_pw *pw = state->pw;
|
|
|
bec1a9 |
struct wbint_userinfo *info;
|
|
|
bec1a9 |
+ struct winbindd_domain *domain = NULL;
|
|
|
bec1a9 |
fstring acct_name, output_username;
|
|
|
bec1a9 |
+ char *mapped_name = NULL;
|
|
|
bec1a9 |
char *tmp;
|
|
|
bec1a9 |
NTSTATUS status;
|
|
|
bec1a9 |
|
|
|
bec1a9 |
@@ -83,8 +85,34 @@ static void wb_getpwsid_queryuser_done(struct tevent_req *subreq)
|
|
|
bec1a9 |
return;
|
|
|
bec1a9 |
}
|
|
|
bec1a9 |
|
|
|
bec1a9 |
- fill_domain_username(output_username, info->domain_name,
|
|
|
bec1a9 |
- acct_name, true);
|
|
|
bec1a9 |
+ domain = find_domain_from_name_noinit(info->domain_name);
|
|
|
bec1a9 |
+ if (tevent_req_nomem(domain, req)) {
|
|
|
bec1a9 |
+ return;
|
|
|
bec1a9 |
+ }
|
|
|
bec1a9 |
+
|
|
|
bec1a9 |
+ /*
|
|
|
bec1a9 |
+ * TODO:
|
|
|
bec1a9 |
+ * This function should be called in 'idmap winbind child'. It shouldn't
|
|
|
bec1a9 |
+ * be a blocking call, but for this we need to add a new function for
|
|
|
bec1a9 |
+ * winbind.idl. This is a fix which can be backported for now.
|
|
|
bec1a9 |
+ */
|
|
|
bec1a9 |
+ status = normalize_name_map(state,
|
|
|
bec1a9 |
+ domain,
|
|
|
bec1a9 |
+ acct_name,
|
|
|
bec1a9 |
+ &mapped_name);
|
|
|
bec1a9 |
+ if (NT_STATUS_IS_OK(status)) {
|
|
|
bec1a9 |
+ fill_domain_username(output_username,
|
|
|
bec1a9 |
+ info->domain_name,
|
|
|
bec1a9 |
+ mapped_name, true);
|
|
|
bec1a9 |
+ fstrcpy(acct_name, mapped_name);
|
|
|
bec1a9 |
+ } else if (NT_STATUS_EQUAL(status, NT_STATUS_FILE_RENAMED)) {
|
|
|
bec1a9 |
+ fstrcpy(acct_name, mapped_name);
|
|
|
bec1a9 |
+ } else {
|
|
|
bec1a9 |
+ fill_domain_username(output_username,
|
|
|
bec1a9 |
+ info->domain_name,
|
|
|
bec1a9 |
+ acct_name, true);
|
|
|
bec1a9 |
+ }
|
|
|
bec1a9 |
+
|
|
|
bec1a9 |
strlcpy(pw->pw_name, output_username, sizeof(pw->pw_name));
|
|
|
bec1a9 |
|
|
|
bec1a9 |
strlcpy(pw->pw_gecos, info->full_name ? info->full_name : "",
|
|
|
bec1a9 |
@@ -101,7 +129,7 @@ static void wb_getpwsid_queryuser_done(struct tevent_req *subreq)
|
|
|
bec1a9 |
TALLOC_FREE(tmp);
|
|
|
bec1a9 |
|
|
|
bec1a9 |
tmp = talloc_sub_specified(
|
|
|
bec1a9 |
- state, info->shell, info->acct_name,
|
|
|
bec1a9 |
+ state, info->shell, acct_name,
|
|
|
bec1a9 |
info->primary_group_name, info->domain_name,
|
|
|
bec1a9 |
pw->pw_uid, pw->pw_gid);
|
|
|
bec1a9 |
if (tevent_req_nomem(tmp, req)) {
|
|
|
bec1a9 |
--
|
|
|
bec1a9 |
2.13.1
|
|
|
bec1a9 |
|