summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/auth/auth_util.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index 325b05f80f..2c05f04b9b 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -721,6 +721,7 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
}
if (sid_check_is_in_our_domain(&user_sid)) {
+ BOOL ret;
/* This is a passdb user, so ask passdb */
@@ -731,7 +732,11 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
goto done;
}
- if (!pdb_getsampwsid(sam_acct, &user_sid)) {
+ become_root();
+ ret = pdb_getsampwsid(sam_acct, &user_sid);
+ unbecome_root();
+
+ if (!ret) {
DEBUG(1, ("pdb_getsampwsid(%s) for user %s failed\n",
sid_string_static(&user_sid), username));
DEBUGADD(1, ("Fall back to unix user %s\n", username));