s3-rpc_server remove per-element copies of auth_session_info
authorAndrew Bartlett <abartlet@samba.org>
Mon, 18 Jul 2011 03:10:30 +0000 (13:10 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 19 Jul 2011 23:17:13 +0000 (09:17 +1000)
This is not required any more now that they are the same structure,
and shows the value in having a common structure across the codebase.

In particular, now any additional state that needs to be added to the
auth_session_info will be transparently available across the named
pipe proxy, without a need to modify the mapping layer.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
source3/rpc_server/rpc_ncacn_np.c
source3/rpc_server/rpc_server.c

index b57e0be1f6aef662955682004dc923f9ed062084..a8d9608670ce2f0d2203b2610f47e57d3862bfc5 100644 (file)
@@ -628,8 +628,6 @@ struct np_proxy_state *make_external_rpc_pipe_p(TALLOC_CTX *mem_ctx,
        struct tevent_context *ev;
        struct tevent_req *subreq;
        struct auth_session_info_transport *session_info_t;
-       struct auth_session_info *session_info_npa;
-       NTSTATUS status;
        bool ok;
        int ret;
        int sys_errno;
@@ -671,27 +669,13 @@ struct np_proxy_state *make_external_rpc_pipe_p(TALLOC_CTX *mem_ctx,
                goto fail;
        }
 
-       session_info_npa = talloc_zero(talloc_tos(), struct auth_session_info);
-       if (session_info_npa == NULL) {
-               DEBUG(0, ("talloc failed\n"));
-               goto fail;
-       }
-
-       /* Send the named_pipe_auth server the user's full token */
-       session_info_npa->security_token = session_info->security_token;
-       session_info_npa->session_key = session_info->session_key;
-       session_info_npa->unix_token = session_info->unix_token;
-       session_info_npa->unix_info = session_info->unix_info;
-
-       session_info_npa->info = session_info->info;
-
        session_info_t = talloc_zero(talloc_tos(), struct auth_session_info_transport);
-       if (session_info_npa == NULL) {
+       if (session_info_t == NULL) {
                DEBUG(0, ("talloc failed\n"));
                goto fail;
        }
 
-       session_info_t->session_info = talloc_steal(session_info_t, session_info_npa);
+       session_info_t->session_info = session_info;
 
        become_root();
        subreq = tstream_npa_connect_send(talloc_tos(), ev,
index c9f2c6f68a73685295d8092ac1c1bd4b7a1a9cbb..a851bd2aed5d6f831db9a741ce7e166104e8493a 100644 (file)
 static NTSTATUS auth_anonymous_session_info(TALLOC_CTX *mem_ctx,
                                            struct auth_session_info **session_info)
 {
-       struct auth_session_info *i;
-       struct auth_session_info *s;
        NTSTATUS status;
 
-       i = talloc_zero(mem_ctx, struct auth_session_info);
-       if (i == NULL) {
-               return NT_STATUS_NO_MEMORY;
-       }
-
-       status = make_session_info_guest(i, &s);
+       status = make_session_info_guest(mem_ctx, session_info);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
 
-       i->security_token = s->security_token;
-       i->session_key    = s->session_key;
-       i->info           = s->info;
-
-       *session_info = i;
-
        return NT_STATUS_OK;
 }
 
@@ -99,18 +86,7 @@ static int make_server_pipes_struct(TALLOC_CTX *mem_ctx,
 
        if (session_info->unix_token && session_info->unix_info && session_info->security_token) {
                /* Don't call create_local_token(), we already have the full details here */
-               p->session_info = talloc_zero(p, struct auth_session_info);
-               if (p->session_info == NULL) {
-                       TALLOC_FREE(p);
-                       *perrno = ENOMEM;
-                       return -1;
-               }
-               p->session_info->security_token = talloc_move(p->session_info, &session_info->security_token);
-               p->session_info->unix_token = talloc_move(p->session_info, &session_info->unix_token);
-               p->session_info->unix_info = talloc_move(p->session_info, &session_info->unix_info);
-               p->session_info->info = talloc_move(p->session_info, &session_info->info);
-               p->session_info->session_key = session_info->session_key;
-               p->session_info->session_key.data = talloc_move(p->session_info, &session_info->session_key.data);
+               p->session_info = talloc_steal(p, session_info);
 
        } else {
                struct auth_user_info_dc *auth_user_info_dc;