summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-05-06 17:47:26 +0200
committerVolker Lendecke <vl@samba.org>2008-05-10 11:17:00 +0200
commitb446bb05d0438cd5f831a738c59cd37975e25b67 (patch)
treeb739930ce33bdc0a8acd3ff74abfabdffe79ad1b
parent0283e95a7c20bb0aeedbdd0b657a1293e449a62d (diff)
downloadsamba-b446bb05d0438cd5f831a738c59cd37975e25b67.tar.gz
samba-b446bb05d0438cd5f831a738c59cd37975e25b67.tar.bz2
samba-b446bb05d0438cd5f831a738c59cd37975e25b67.zip
Add function make_serverinfo_from_username()
This will be used for 'security=share' and 'force user' (This used to be commit 88e43097cafcd2849d9f1200a377357fde4cce99)
-rw-r--r--source3/auth/auth_util.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index bb3dc78e83..e07d687d35 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -1152,6 +1152,44 @@ static NTSTATUS make_new_server_info_guest(auth_serversupplied_info **server_inf
return NT_STATUS_OK;
}
+/****************************************************************************
+ Fake a auth_serversupplied_info just from a username
+****************************************************************************/
+
+NTSTATUS make_serverinfo_from_username(TALLOC_CTX *mem_ctx,
+ const char *username,
+ bool is_guest,
+ struct auth_serversupplied_info **presult)
+{
+ struct auth_serversupplied_info *result;
+ NTSTATUS status;
+
+ result = make_server_info(mem_ctx);
+ if (result == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ result->nss_token = true;
+ result->guest = is_guest;
+
+ result->unix_name = talloc_strdup(result, username);
+ if (result->unix_name == NULL) {
+ TALLOC_FREE(result);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ status = create_local_token(result);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(result);
+ return status;
+ }
+
+ *presult = result;
+ return NT_STATUS_OK;
+}
+
+
struct auth_serversupplied_info *copy_serverinfo(TALLOC_CTX *mem_ctx,
auth_serversupplied_info *src)
{