mirror of
https://github.com/samba-team/samba.git
synced 2025-01-27 14:04:05 +03:00
s3-auth: Added a function to get the server_info from the system user.
Signed-off-by: Günther Deschner <gd@samba.org>
This commit is contained in:
parent
87037006bd
commit
93ac516e15
@ -756,6 +756,27 @@ static NTSTATUS make_new_server_info_guest(struct auth_serversupplied_info **ser
|
|||||||
return NT_STATUS_OK;
|
return NT_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
Make (and fill) a user_info struct for a system user login.
|
||||||
|
This *must* succeed for smbd to start.
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
static NTSTATUS make_new_server_info_system(TALLOC_CTX *mem_ctx,
|
||||||
|
struct auth_serversupplied_info **server_info)
|
||||||
|
{
|
||||||
|
struct passwd *pwd;
|
||||||
|
|
||||||
|
pwd = getpwuid_alloc(mem_ctx, sec_initial_uid());
|
||||||
|
if (pwd == NULL) {
|
||||||
|
return NT_STATUS_NO_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
return make_serverinfo_from_username(mem_ctx,
|
||||||
|
pwd->pw_name,
|
||||||
|
false,
|
||||||
|
server_info);
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
Fake a auth_serversupplied_info just from a username
|
Fake a auth_serversupplied_info just from a username
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -888,6 +909,24 @@ NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,
|
|||||||
return (*server_info != NULL) ? NT_STATUS_OK : NT_STATUS_NO_MEMORY;
|
return (*server_info != NULL) ? NT_STATUS_OK : NT_STATUS_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct auth_serversupplied_info *system_info = NULL;
|
||||||
|
|
||||||
|
bool init_system_info(void)
|
||||||
|
{
|
||||||
|
if (system_info != NULL)
|
||||||
|
return True;
|
||||||
|
|
||||||
|
return NT_STATUS_IS_OK(make_new_server_info_system(talloc_autofree_context(), &system_info));
|
||||||
|
}
|
||||||
|
|
||||||
|
NTSTATUS make_server_info_system(TALLOC_CTX *mem_ctx,
|
||||||
|
struct auth_serversupplied_info **server_info)
|
||||||
|
{
|
||||||
|
if (system_info == NULL) return NT_STATUS_UNSUCCESSFUL;
|
||||||
|
*server_info = copy_serverinfo(mem_ctx, system_info);
|
||||||
|
return (*server_info != NULL) ? NT_STATUS_OK : NT_STATUS_NO_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
bool copy_current_user(struct current_user *dst, struct current_user *src)
|
bool copy_current_user(struct current_user *dst, struct current_user *src)
|
||||||
{
|
{
|
||||||
gid_t *groups;
|
gid_t *groups;
|
||||||
|
@ -133,10 +133,13 @@ NTSTATUS make_serverinfo_from_username(TALLOC_CTX *mem_ctx,
|
|||||||
struct auth_serversupplied_info *copy_serverinfo(TALLOC_CTX *mem_ctx,
|
struct auth_serversupplied_info *copy_serverinfo(TALLOC_CTX *mem_ctx,
|
||||||
const struct auth_serversupplied_info *src);
|
const struct auth_serversupplied_info *src);
|
||||||
bool init_guest_info(void);
|
bool init_guest_info(void);
|
||||||
|
bool init_system_info(void);
|
||||||
bool server_info_set_session_key(struct auth_serversupplied_info *info,
|
bool server_info_set_session_key(struct auth_serversupplied_info *info,
|
||||||
DATA_BLOB session_key);
|
DATA_BLOB session_key);
|
||||||
NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,
|
NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,
|
||||||
struct auth_serversupplied_info **server_info);
|
struct auth_serversupplied_info **server_info);
|
||||||
|
NTSTATUS make_server_info_system(TALLOC_CTX *mem_ctx,
|
||||||
|
struct auth_serversupplied_info **server_info);
|
||||||
bool copy_current_user(struct current_user *dst, struct current_user *src);
|
bool copy_current_user(struct current_user *dst, struct current_user *src);
|
||||||
struct passwd *smb_getpwnam( TALLOC_CTX *mem_ctx, char *domuser,
|
struct passwd *smb_getpwnam( TALLOC_CTX *mem_ctx, char *domuser,
|
||||||
fstring save_username, bool create );
|
fstring save_username, bool create );
|
||||||
|
@ -1318,6 +1318,11 @@ extern void build_options(bool screen);
|
|||||||
exit(1);
|
exit(1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (!init_system_info()) {
|
||||||
|
DEBUG(0,("ERROR: failed to setup system user info.\n"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!print_backend_init(smbd_messaging_context()))
|
if (!print_backend_init(smbd_messaging_context()))
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user