mirror of
https://github.com/samba-team/samba.git
synced 2025-01-08 21:18:16 +03:00
s4-auth/unix_token: add new function auth_session_info_set_unix()
Used to fill the unix info in a struct auth_session_info similar to auth_session_info_fill_unix(). The new auth_session_info_set_unix() receives the uid and gid for the unix token as an parameter. It does not query the unix token from winbind (via security_token_to_unix_token()). This is useful to fill a user session info manually if winbind is not available. Bug: https://bugzilla.samba.org/show_bug.cgi?id=14400 Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
parent
d159b4c0a5
commit
bde136a280
@ -191,3 +191,38 @@ NTSTATUS auth_session_info_fill_unix(struct loadparm_context *lp_ctx,
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the given auth_user_info_unix and auth_unix_token elements in a
|
||||
* struct session_info, similar auth_session_info_fill_unix().
|
||||
* Receives the uid and gid for the unix token as parameters and does
|
||||
* not query the unix token from winbind (via security_token_to_unix_token()).
|
||||
* This is useful to fill a user session info manually if winbind is not
|
||||
* available.
|
||||
*/
|
||||
NTSTATUS auth_session_info_set_unix(struct loadparm_context *lp_ctx,
|
||||
const char *original_user_name,
|
||||
int uid,
|
||||
int gid,
|
||||
struct auth_session_info *session_info)
|
||||
{
|
||||
NTSTATUS status;
|
||||
|
||||
session_info->unix_token = talloc_zero(session_info,
|
||||
struct security_unix_token);
|
||||
if (session_info->unix_token == NULL) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
session_info->unix_token->uid = uid;
|
||||
session_info->unix_token->gid = gid;
|
||||
|
||||
status = fill_unix_info(lp_ctx,
|
||||
original_user_name,
|
||||
session_info);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user