summaryrefslogtreecommitdiff
path: root/source3/lib/msrpc-client.c
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-12-06 00:44:32 +0000
committerLuke Leighton <lkcl@samba.org>1999-12-06 00:44:32 +0000
commita0ba234cf9b40adf6b5390e4e67730163a42883f (patch)
treefea2f70b2ac98de4e2c7fd218e06ea7a38f2d04d /source3/lib/msrpc-client.c
parent7c53f158bab61bca704340ce70f4039a178d0fde (diff)
downloadsamba-a0ba234cf9b40adf6b5390e4e67730163a42883f.tar.gz
samba-a0ba234cf9b40adf6b5390e4e67730163a42883f.tar.bz2
samba-a0ba234cf9b40adf6b5390e4e67730163a42883f.zip
the first independent msrpc daemon - lsarpcd.
one horrible cut / paste job from smbd, plus a code split of shared components between the two. the job is not _yet_ complete, as i need to be able to do a become_user() call for security reasons. i picked lsarpcd first because you don't _need_ security on it (microsoft botched so badly on this one, it's not real. at least they fixed this in nt5 with restrictanonymous=0x2). fixing this involves sending the current smb and unix credentials down the unix pipe so that the daemon it eventually goes to can pick them up at the other end. i can't believe this all worked!!! (This used to be commit 2245b0c6d13c7c5886e81f9137b05df883598c26)
Diffstat (limited to 'source3/lib/msrpc-client.c')
-rw-r--r--source3/lib/msrpc-client.c56
1 files changed, 51 insertions, 5 deletions
diff --git a/source3/lib/msrpc-client.c b/source3/lib/msrpc-client.c
index eacc25341e..fb82c54700 100644
--- a/source3/lib/msrpc-client.c
+++ b/source3/lib/msrpc-client.c
@@ -37,6 +37,54 @@ BOOL msrpc_receive(struct msrpc_state *msrpc)
/****************************************************************************
send an smb to a fd and re-establish if necessary
****************************************************************************/
+BOOL msrpc_send_prs(struct msrpc_state *msrpc, prs_struct *ps)
+{
+ size_t len = mem_buf_len(ps->data);
+
+ _smb_setlen(msrpc->outbuf, len);
+ mem_buf_copy(&msrpc->outbuf[4], ps->data, 0, len);
+
+ if (msrpc_send(msrpc, True))
+ {
+ prs_mem_free(ps);
+ return True;
+ }
+ return False;
+}
+
+/****************************************************************************
+ receive msrpc packet
+****************************************************************************/
+BOOL msrpc_receive_prs(struct msrpc_state *msrpc, prs_struct *ps)
+{
+ int len;
+ char *data;
+
+ if (!msrpc_receive(msrpc))
+ {
+ return False;
+ }
+
+ len = smb_len(msrpc->inbuf);
+
+ dump_data(10, msrpc->inbuf, len+4);
+
+ prs_init(ps, len, 4, 0, False);
+ ps->offset = len;
+ data = mem_data(&ps->data, 0);
+ if (data == NULL || len <= 0)
+ {
+ return False;
+ }
+
+ memcpy(data, smb_base(msrpc->inbuf), len);
+
+ return True;
+}
+
+/****************************************************************************
+ send an smb to a fd and re-establish if necessary
+****************************************************************************/
BOOL msrpc_send(struct msrpc_state *msrpc, BOOL show)
{
size_t len;
@@ -62,8 +110,6 @@ BOOL msrpc_send(struct msrpc_state *msrpc, BOOL show)
return True;
}
-
-
/****************************************************************************
open the msrpcent sockets
****************************************************************************/
@@ -115,7 +161,7 @@ void msrpc_sockopt(struct msrpc_state *msrpc, char *options)
}
-static int msrpc_init_redirect(struct msrpc_state *msrpc,
+static BOOL msrpc_init_redirect(struct msrpc_state *msrpc,
const char* pipe_name,
const struct user_credentials *usr)
{
@@ -135,7 +181,7 @@ static int msrpc_init_redirect(struct msrpc_state *msrpc,
if (sock < 0)
{
- return sock;
+ return False;
}
ZERO_STRUCT(data);
@@ -196,7 +242,7 @@ static int msrpc_init_redirect(struct msrpc_state *msrpc,
msrpc->fd = sock;
msrpc->usr.reuse = False;
- return sock;
+ return True;
}
BOOL msrpc_connect_auth(struct msrpc_state *msrpc,