argh. had to add a "minimalist" creds interface back in. reason:
authorLuke Leighton <lkcl@samba.org>
Mon, 7 Feb 2000 03:08:57 +0000 (03:08 +0000)
committerLuke Leighton <lkcl@samba.org>
Mon, 7 Feb 2000 03:08:57 +0000 (03:08 +0000)
pass-through (rpcclient->smbd->msrpcdaemon) doesn't know anything about
how to let msrpcdaemon "inherit" the credentials of the smbd process.

i forgot about that.

source/lib/msrpc-client.c
source/msrpc/msrpcd_process.c
source/rpc_server/srv_pipe_srv.c

index 3d5435b6449b936a0700a331635b33f663170c60..e47de6e766484f3d84108425d85ee7d3ed5f2083 100644 (file)
@@ -207,17 +207,16 @@ static BOOL msrpc_authenticate(struct msrpc_state *msrpc,
 {
        int sock = msrpc->fd;
        uint32 len;
-#if 0
        char *data;
        prs_struct ps;
-#endif
+
        char *in = msrpc->inbuf;
        char *out = msrpc->outbuf;
 
-       msrpc->nt.key = *key;
-#if 0
        uint16 command;
 
+       msrpc->nt.key = *key;
+
        command = usr != NULL ? AGENT_CMD_CON : AGENT_CMD_CON_ANON;
 
        if (!create_user_creds(&ps, msrpc->pipe_name, 0x0, command,
@@ -243,7 +242,6 @@ static BOOL msrpc_authenticate(struct msrpc_state *msrpc,
                DEBUG(0,("write failed\n"));
                return False;
        }
-#endif
        if (msrpc->redirect)
        {
                struct msrpc_state msrpc_redir;
@@ -263,12 +261,10 @@ static BOOL msrpc_authenticate(struct msrpc_state *msrpc,
        }
        else
        {
-#if 0
                uint32 status;
                len = read(sock, &status, sizeof(status));
 
                return len == sizeof(status) && status == 0x0;
-#endif
        }
        return True;
 }
@@ -292,7 +288,7 @@ static BOOL msrpc_init_redirect(struct msrpc_state *msrpc,
 
        msrpc->fd = sock;
 
-       if (!msrpc_authenticate(msrpc, key, usr))
+       if (!msrpc_authenticate(msrpc, key, NULL))
        {
                DEBUG(0,("authenticate failed\n"));
                close(msrpc->fd);
@@ -421,7 +417,7 @@ BOOL msrpc_establish_connection(struct msrpc_state *msrpc,
                }
        }
 
-       if (!msrpc_authenticate(msrpc, key, &msrpc->usr))
+       if (!msrpc_authenticate(msrpc, key, NULL))
        {
                DEBUG(0,("authenticate failed\n"));
                close(msrpc->fd);
index 7cb8dc7812cb1f1540ebd7794b99da5b51457f1d..afb4cd1e394d1cabcf3f1e0c6a9ffe2b41b3a9b1 100644 (file)
@@ -334,7 +334,6 @@ void add_srv_auth_fn(rpcsrv_struct *l, srv_auth_fns *fn)
 ****************************************************************************/
 BOOL msrpcd_init(int c, msrpc_pipes_struct *p)
 {
-#if 0
        struct user_creds usr;
        vuser_key uk;
        user_struct *vuser;
@@ -364,20 +363,17 @@ BOOL msrpcd_init(int c, msrpc_pipes_struct *p)
        {
                return False;
        }
-#endif
+
        p->l = malloc(sizeof(*p->l));
        if (p->l == NULL)
        {
-#if 0
                vuid_free_user_struct(vuser);
                safe_free(vuser);
-#endif
                return False;
        }
 
        ZERO_STRUCTP(p->l);
 
-#if 0
        p->l->key = uk;
 
        if (!vuser->guest)
@@ -399,7 +395,7 @@ BOOL msrpcd_init(int c, msrpc_pipes_struct *p)
 
        vuid_free_user_struct(vuser);
        safe_free(vuser);
-#endif
+
        return True;
 }
 
index 2020301b2187cca61056d7ecc569bd0d19ce1985..78b45983609f36e235621d77fcb96064c6e4bf98 100644 (file)
@@ -213,7 +213,11 @@ static BOOL srv_pipe_bind_and_alt_req(rpcsrv_struct *l,
        if (l->data_i.offset == 0) return False;
 
        assoc_gid = l->hdr_rb.bba.assoc_gid;
-       l->key.pid = assoc_gid;
+
+       if (assoc_gid != 0)
+       {
+               l->key.pid = assoc_gid;
+       }
 
        if (l->hdr.auth_len != 0)
        {
@@ -247,7 +251,10 @@ static BOOL srv_pipe_bind_and_alt_req(rpcsrv_struct *l,
                l->auth_info = NULL;
                
                assoc_gid = l->hdr_rb.bba.assoc_gid;
-               l->key.pid = assoc_gid;
+               if (assoc_gid != 0)
+               {
+                       l->key.pid = assoc_gid;
+               }
        }
 
        if (l->auth != NULL)
@@ -502,7 +509,10 @@ static BOOL rpc_redir_local(rpcsrv_struct *l, prs_struct *req, prs_struct *resp,
                                reply = smb_io_rpc_hdr_req("req", &(l->hdr_req), &l->data_i, 0);
                                if (reply)
                                {
-                                       l->key.vuid = l->hdr_req.context_id;
+                                       if (l->hdr_req.context_id != 0)
+                                       {
+                                               l->key.vuid = l->hdr_req.context_id;
+                                       }
                                        reply = become_vuser(&l->key) ||
                                                become_guest();