summaryrefslogtreecommitdiff
path: root/source3/auth
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-07-15 12:45:17 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-07-20 09:17:10 +1000
commitf16d8f4eb86ecc4741c25e5ed87b2ea4c6717a31 (patch)
treebd839288be389cbfe84852e0a114b3ee77589462 /source3/auth
parentd7d8a5ed94a2b572b6818008a858f8c6b529dd03 (diff)
downloadsamba-f16d8f4eb86ecc4741c25e5ed87b2ea4c6717a31.tar.gz
samba-f16d8f4eb86ecc4741c25e5ed87b2ea4c6717a31.tar.bz2
samba-f16d8f4eb86ecc4741c25e5ed87b2ea4c6717a31.zip
s3-auth Use struct auth3_session_info outside the auth subsystem
This seperation between the structure used inside the auth modules and in the wider codebase allows for a gradual migration from struct auth_serversupplied_info -> struct auth_session_info (from auth.idl) The idea here is that we keep a clear seperation between the structure before and after the local groups, local user lookup and the session key modifications have been processed, as the lack of this seperation has caused issues in the past. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
Diffstat (limited to 'source3/auth')
-rw-r--r--source3/auth/auth_ntlmssp.c2
-rw-r--r--source3/auth/auth_util.c37
-rw-r--r--source3/auth/proto.h16
-rw-r--r--source3/auth/user_krb5.c2
4 files changed, 33 insertions, 24 deletions
diff --git a/source3/auth/auth_ntlmssp.c b/source3/auth/auth_ntlmssp.c
index 2d1aef18f0..057f9d09e5 100644
--- a/source3/auth/auth_ntlmssp.c
+++ b/source3/auth/auth_ntlmssp.c
@@ -29,7 +29,7 @@
NTSTATUS auth_ntlmssp_steal_session_info(TALLOC_CTX *mem_ctx,
struct auth_ntlmssp_state *auth_ntlmssp_state,
- struct auth_serversupplied_info **session_info)
+ struct auth3_session_info **session_info)
{
NTSTATUS nt_status = create_local_token(mem_ctx,
auth_ntlmssp_state->server_info,
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index a8c737dd88..70df256042 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -458,13 +458,13 @@ static NTSTATUS log_nt_token(struct security_token *token)
NTSTATUS create_local_token(TALLOC_CTX *mem_ctx,
const struct auth_serversupplied_info *server_info,
DATA_BLOB *session_key,
- struct auth_serversupplied_info **session_info_out)
+ struct auth3_session_info **session_info_out)
{
struct security_token *t;
NTSTATUS status;
size_t i;
struct dom_sid tmp_sid;
- struct auth_serversupplied_info *session_info;
+ struct auth3_session_info *session_info;
struct wbcUnixId *ids;
/* Ensure we can't possible take a code path leading to a
@@ -473,7 +473,7 @@ NTSTATUS create_local_token(TALLOC_CTX *mem_ctx,
return NT_STATUS_LOGON_FAILURE;
}
- session_info = copy_serverinfo(mem_ctx, server_info);
+ session_info = copy_serverinfo_session_info(mem_ctx, server_info);
if (!session_info) {
return NT_STATUS_NO_MEMORY;
@@ -767,7 +767,7 @@ static NTSTATUS get_guest_info3(TALLOC_CTX *mem_ctx,
left as-is for now.
***************************************************************************/
-static NTSTATUS make_new_server_info_guest(struct auth_serversupplied_info **session_info)
+static NTSTATUS make_new_session_info_guest(struct auth3_session_info **session_info)
{
struct auth_serversupplied_info *server_info;
static const char zeros[16] = {0};
@@ -838,7 +838,7 @@ done:
***************************************************************************/
static NTSTATUS make_new_session_info_system(TALLOC_CTX *mem_ctx,
- struct auth_serversupplied_info **session_info)
+ struct auth3_session_info **session_info)
{
struct passwd *pwd;
NTSTATUS status;
@@ -872,7 +872,7 @@ static NTSTATUS make_new_session_info_system(TALLOC_CTX *mem_ctx,
}
/****************************************************************************
- Fake a auth_serversupplied_info just from a username (as a
+ Fake a auth3_session_info just from a username (as a
session_info structure, with create_local_token() already called on
it.
****************************************************************************/
@@ -880,7 +880,7 @@ static NTSTATUS make_new_session_info_system(TALLOC_CTX *mem_ctx,
NTSTATUS make_session_info_from_username(TALLOC_CTX *mem_ctx,
const char *username,
bool is_guest,
- struct auth_serversupplied_info **session_info)
+ struct auth3_session_info **session_info)
{
struct auth_serversupplied_info *result;
struct passwd *pwd;
@@ -1150,7 +1150,7 @@ struct auth3_session_info *copy_session_info(TALLOC_CTX *mem_ctx,
* SMB level session key with SystemLibraryDTC
*/
-bool session_info_set_session_key(struct auth_serversupplied_info *info,
+bool session_info_set_session_key(struct auth3_session_info *info,
DATA_BLOB session_key)
{
TALLOC_FREE(info->session_key.data);
@@ -1161,24 +1161,31 @@ bool session_info_set_session_key(struct auth_serversupplied_info *info,
return (info->session_key.data != NULL);
}
-static struct auth_serversupplied_info *guest_info = NULL;
+static struct auth3_session_info *guest_info = NULL;
bool init_guest_info(void)
{
if (guest_info != NULL)
return True;
- return NT_STATUS_IS_OK(make_new_server_info_guest(&guest_info));
+ return NT_STATUS_IS_OK(make_new_session_info_guest(&guest_info));
}
NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,
struct auth_serversupplied_info **server_info)
{
- *server_info = copy_serverinfo(mem_ctx, guest_info);
+ *server_info = copy_session_info_serverinfo(mem_ctx, guest_info);
return (*server_info != NULL) ? NT_STATUS_OK : NT_STATUS_NO_MEMORY;
}
-static struct auth_serversupplied_info *system_info = NULL;
+NTSTATUS make_session_info_guest(TALLOC_CTX *mem_ctx,
+ struct auth3_session_info **session_info)
+{
+ *session_info = copy_session_info(mem_ctx, guest_info);
+ return (*session_info != NULL) ? NT_STATUS_OK : NT_STATUS_NO_MEMORY;
+}
+
+static struct auth3_session_info *system_info = NULL;
NTSTATUS init_system_info(void)
{
@@ -1189,14 +1196,14 @@ NTSTATUS init_system_info(void)
}
NTSTATUS make_session_info_system(TALLOC_CTX *mem_ctx,
- struct auth_serversupplied_info **session_info)
+ struct auth3_session_info **session_info)
{
if (system_info == NULL) return NT_STATUS_UNSUCCESSFUL;
- *session_info = copy_serverinfo(mem_ctx, system_info);
+ *session_info = copy_session_info(mem_ctx, system_info);
return (*session_info != NULL) ? NT_STATUS_OK : NT_STATUS_NO_MEMORY;
}
-const struct auth_serversupplied_info *get_session_info_system(void)
+const struct auth3_session_info *get_session_info_system(void)
{
return system_info;
}
diff --git a/source3/auth/proto.h b/source3/auth/proto.h
index 8bc2c6e458..9f497a48e3 100644
--- a/source3/auth/proto.h
+++ b/source3/auth/proto.h
@@ -71,7 +71,7 @@ NTSTATUS auth_netlogond_init(void);
NTSTATUS auth_ntlmssp_steal_session_info(TALLOC_CTX *mem_ctx,
struct auth_ntlmssp_state *auth_ntlmssp_state,
- struct auth_serversupplied_info **session_info);
+ struct auth3_session_info **session_info);
NTSTATUS auth_ntlmssp_start(const struct tsocket_address *remote_address,
struct auth_ntlmssp_state **auth_ntlmssp_state);
@@ -150,7 +150,7 @@ NTSTATUS make_server_info_sam(struct auth_serversupplied_info **server_info,
NTSTATUS create_local_token(TALLOC_CTX *mem_ctx,
const struct auth_serversupplied_info *server_info,
DATA_BLOB *session_key,
- struct auth_serversupplied_info **session_info_out);
+ struct auth3_session_info **session_info_out);
NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
bool is_guest,
uid_t *uid, gid_t *gid,
@@ -165,20 +165,22 @@ NTSTATUS make_server_info_pw(struct auth_serversupplied_info **server_info,
NTSTATUS make_session_info_from_username(TALLOC_CTX *mem_ctx,
const char *username,
bool is_guest,
- struct auth_serversupplied_info **session_info);
+ struct auth3_session_info **session_info);
struct auth_serversupplied_info *copy_serverinfo(TALLOC_CTX *mem_ctx,
const struct auth_serversupplied_info *src);
struct auth3_session_info *copy_session_info(TALLOC_CTX *mem_ctx,
const struct auth3_session_info *src);
bool init_guest_info(void);
NTSTATUS init_system_info(void);
-bool session_info_set_session_key(struct auth_serversupplied_info *info,
+bool session_info_set_session_key(struct auth3_session_info *info,
DATA_BLOB session_key);
NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,
struct auth_serversupplied_info **server_info);
+NTSTATUS make_session_info_guest(TALLOC_CTX *mem_ctx,
+ struct auth3_session_info **server_info);
NTSTATUS make_session_info_system(TALLOC_CTX *mem_ctx,
- struct auth_serversupplied_info **session_info);
-const struct auth_serversupplied_info *get_session_info_system(void);
+ struct auth3_session_info **session_info);
+const struct auth3_session_info *get_session_info_system(void);
bool copy_current_user(struct current_user *dst, struct current_user *src);
struct passwd *smb_getpwnam( TALLOC_CTX *mem_ctx, const char *domuser,
char **p_save_username, bool create );
@@ -319,6 +321,6 @@ NTSTATUS make_session_info_krb5(TALLOC_CTX *mem_ctx,
struct PAC_LOGON_INFO *logon_info,
bool mapped_to_guest, bool username_was_mapped,
DATA_BLOB *session_key,
- struct auth_serversupplied_info **session_info);
+ struct auth3_session_info **session_info);
#endif /* _AUTH_PROTO_H_ */
diff --git a/source3/auth/user_krb5.c b/source3/auth/user_krb5.c
index db73c6dfc0..054cb39252 100644
--- a/source3/auth/user_krb5.c
+++ b/source3/auth/user_krb5.c
@@ -187,7 +187,7 @@ NTSTATUS make_session_info_krb5(TALLOC_CTX *mem_ctx,
struct PAC_LOGON_INFO *logon_info,
bool mapped_to_guest, bool username_was_mapped,
DATA_BLOB *session_key,
- struct auth_serversupplied_info **session_info)
+ struct auth3_session_info **session_info)
{
NTSTATUS status;
struct auth_serversupplied_info *server_info;