1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

256 Commits

Author SHA1 Message Date
Simo Sorce
272704e8c2 s3-dceprc: Add debug messages
Signed-off-by: Günther Deschner <gd@samba.org>
2010-07-13 14:44:11 +02:00
Simo Sorce
29a3142be8 s3-dcerpc: Remove unused functions
Signed-off-by: Günther Deschner <gd@samba.org>
2010-07-13 14:44:11 +02:00
Simo Sorce
8e235df2de s3-dcerpc: Use dcerpc_pull_ncacn_packet() to unmarshall dceprc requests
Signed-off-by: Günther Deschner <gd@samba.org>
2010-07-13 14:44:11 +02:00
Simo Sorce
77fb3649ce s3-dceprc: Store opnum in its own variable
Signed-off-by: Günther Deschner <gd@samba.org>
2010-07-13 14:44:10 +02:00
Simo Sorce
a138b3d31e s3-dceprc use a DATA_BLOB to hold the curren pdu in pipes_struct
Signed-off-by: Günther Deschner <gd@samba.org>
2010-07-13 14:44:10 +02:00
Simo Sorce
aca330a2c5 s3-dcerpc delay rpc header unmarshalling
Use dcerpc_get_frag_length() to get the whole pdu first

Signed-off-by: Günther Deschner <gd@samba.org>
2010-07-13 14:44:10 +02:00
Günther Deschner
690ed0c5e2 s3-rpc: when using rpc_pipe_open_internal, make sure to go through NDR.
Otherwise a lot of information that is usually generated in the ndr_push remains
in an uninitialized state.

Guenther
2010-07-08 16:35:26 +02:00
Volker Lendecke
b4c3f72d44 s3: Fix a segfault in the RPC server
After converting the rpc infratructure to talloc, read_from_internal_pipe freed
the outdata too early. If the last fragment was read in two pieces (as
rpcclient does it), all the outdata was freed during the read of the first
piece of the read of the last fragment. Later read&x calls, trying to read the
rest of the last fragment stepped into p->out_data.frag with non-zero offset
when this was already freed.
2010-07-06 15:11:31 +02:00
Jeremy Allison
f4e7d9d38e Convert the prs_XXX struct and functions to use talloc instead of malloc. Passes valgrind and make tests for client and server. Second version of this patch after splitting up at Simo's request. Patch to follow will delete extraneous prs_mem_free() calls.
Jeremy.

Signed-off-by: Simo Sorce <idra@samba.org>
2010-06-18 07:41:47 -04:00
Simo Sorce
405a0c558c s3:cleaunp reformatting for readability 2010-06-10 14:57:06 -04:00
Simo Sorce
446deb0082 s3:cleanup remove trailing spaces 2010-06-10 14:56:59 -04:00
Andrew Bartlett
0af2dc43ad s3:named pipe proxy Improve error messages when named pipes fail to forward
I hope this helps the next person who needs to debug this.

Andrew Bartlett
2010-06-07 23:34:29 +10:00
Andreas Schneider
15f64af8e3 s3-rpc: Create a file with all functions for a internal named pipe.
This makes it possible to use the samr rpc server in winbind without
linking in smbd.

Reviewed-by: Simo Sorce <idra@samba.org>
2010-06-04 12:12:50 -04:00
Stefan Metzmacher
85a3853249 s3:rpc_server: make use of the npa_tstream code to connect to named pipes
This way we use the newest protocol, which is able to pass
the local and remote address of the SMB connection.

And we correctly support message mode named pipes
without the hack that analyzes the content for DCERPC pdus.

metze
2010-05-27 07:13:59 +02:00
Stefan Metzmacher
9a6636a56e s3:rpc_server: pass down local and remote tsocket_address to np_open()
metze
2010-05-27 07:13:56 +02:00
Stefan Metzmacher
9a77cb247d s3:rpc_server: add np_read_in_progress() function
metze
2010-05-27 07:13:53 +02:00
Stefan Metzmacher
8c0be92044 s3:rpc_server: make sure we don't send uninitialized memory for the named_pipe_auth handshake
metze
2010-05-27 07:13:52 +02:00
Simo Sorce
8aa96566a9 s3-rpc_server: Created a per connection spoolss pipe.
This way all code can reuse the same connection to spoolss
and not have to deal with the creation of a new pipe all over the
code every time we need to ask a service off spoolss.

Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-26 15:07:57 +02:00
Jelmer Vernooij
b8268cf7b0 s3: Remove use of iconv_convenience. 2010-05-18 11:45:31 +02:00
Volker Lendecke
8e95db9eea s3: Move serverinfo_to_SamInfoX to auth/server_info.c 2010-04-11 22:59:47 +02:00
Andreas Schneider
f405503350 s3-rpc_server: Document rpc_pipe_open_internal.
Signed-off-by: Günther Deschner <gd@samba.org>
2010-03-05 21:25:54 +01:00
Simo Sorce
d14c3756e8 s3:rpc streamline memory handling 2010-02-16 19:15:56 -05:00
Jeremy Allison
d5995eec7e Second part of the fix for bug #7020 - smbd using 2G memory.
There was a second leak in the processing of the out_data.frag
prs_struct. It needs freeing once the current pdu has been returned
asynchronously.

Jeremy.
2010-01-06 13:11:00 -08:00
Volker Lendecke
e181b88978 Revert "s3: Do not reference ndr_table_<pipe> in the cli_ routines directly"
This reverts commit daa964013b.
2009-11-08 19:43:47 +01:00
Volker Lendecke
27847e8386 Revert "s3: Consolidate getting the name out of a pipes_struct"
This reverts commit 9621306351.
2009-11-08 19:43:47 +01:00
Volker Lendecke
47455b4d1a Revert "s3: Do not reference the ndr_tables in the server calls directly"
This reverts commit 98fb71782e.
2009-11-08 19:43:46 +01:00
Volker Lendecke
98fb71782e s3: Do not reference the ndr_tables in the server calls directly
This involves storing the interface table in the pipes_struct
2009-11-08 13:12:14 +01:00
Volker Lendecke
9621306351 s3: Consolidate getting the name out of a pipes_struct 2009-11-08 13:12:14 +01:00
Volker Lendecke
daa964013b s3: Do not reference ndr_table_<pipe> in the cli_ routines directly 2009-11-08 13:12:13 +01:00
Volker Lendecke
2aa0af9867 s3: get_pipe_name_from_iface -> get_pipe_name_from_syntax 2009-11-07 09:14:15 +01:00
Stefan Metzmacher
9ef39406d8 s3:rpc_server: we need to make a copy of my_name in serverinfo_to_SamInfo_base()
This is important for the case the server_info already contains a logon_server.

metze
2009-09-24 06:41:13 +02:00
Günther Deschner
44e44310d1 s3-netlogon: support validation level 6 in netr_SamLogon calls.
Guenther
2009-09-16 18:00:03 +02:00
Günther Deschner
37bc806453 s3-dcerpc: remove more obsolete or duplicate headers.
Guenther
2009-09-16 08:55:51 +02:00
Günther Deschner
313a2bfa52 s3-netlogon: remove init_netr_SamInfo functions.
Guenther
2009-06-25 12:19:17 +02:00
Günther Deschner
f62d9f5b57 s3-netlogon: fix validation level 2 support in netr_SamLogon and friends.
Guenther
2009-06-25 12:19:10 +02:00
Volker Lendecke
a8e02b591b Add "err_on_readability" to writev_send
A socket where the other side has closed only becomes readable. To catch
errors early when sitting in a pure writev, we need to also test for
readability.
2009-05-24 13:47:29 +02:00
Volker Lendecke
8bc88aae5d Move serverinfo_to_SamInfo3() to rpc_server/
Normally I hate moving around stuff, but this function is only called from the
RPC server side and it pulls in passdb when trying to link in our rpc client
routines. That seems unnecessary to me.
2009-04-22 12:33:46 +02:00
Volker Lendecke
4b88f2c17e Fix external np read after conversion to tevent_req 2009-03-27 21:12:17 +01:00
Volker Lendecke
bce98d8c03 Convert np_read to tevent_req 2009-03-17 17:31:22 +01:00
Volker Lendecke
89543d6c78 Convert np_write to tevent_req 2009-03-17 17:31:22 +01:00
Volker Lendecke
fe486d7b9f Add "queue" to writev_send
Unless higher levels queue themselves somehow, writev will *always* be queued.
So the queueing should be done at the right level.
2009-03-08 11:20:59 +01:00
Simo Sorce
67d41d0fc7 Make struct tevent_req opaque
Move struct tevent_req in tevent_internal, and ad getters and setters
for private data and the callback function.
This patch also renames 'private_state' into 'data'. What is held in this
pointer is in fact data and not a state like enum tevent_req_state.
Calling it 'state' is confusing.

The functions addedd are:
tevent_req_set_callback() - sets req->async.fn and req->async.private_data
tevent_req_set_print_fn() - sets req->private_print
tevent_req_callback_data() - gets req->async.private_data
tevent_req_data() - gets rea->data

This way it is much simpler to keep API/ABI compatibility in the future.
2009-03-02 11:02:09 -05:00
Volker Lendecke
5d653f69de Replace read_pkt by read_packet in np_read 2009-02-24 20:40:47 +01:00
Volker Lendecke
70f788ba7e Use async_writev in np_write 2009-02-24 20:40:47 +01:00
Jeremy Allison
49b52ec16f Parameterize in local.h the MAX_RPC_DATA_SIZE, and ensure
that "offered" read from the rpc packet in spoolss is under
that size. Tidyup from analysis from Veracode.
Jeremy.
2009-02-13 16:06:17 -08:00
Volker Lendecke
bbb665501a Add queueing to np_write 2009-02-10 18:29:34 +01:00
Volker Lendecke
f6e9f1e7ea Add queueing to np_read_state, simulate message-type named pipes.
The problem with msg-type pipes is that we have to return short reads when a
message ends before the read request. When reading from the unix domain socket,
the message limits are lost. So we would happily return more than a message,
which confuses for example the s4 rpc client horribly. I'd expect other np rpc
clients also to blow up over this.

The real solution is to properly implement a two-byte length field per message
on the unix domain socket, but this requires more changes there. And as we
right now only serve DCE/RPC over the named pipes, this implements a hack that
looks into the fragment headers to figure out hdr.frag_len.
2009-02-10 18:29:34 +01:00
Kai Blin
c3b9b6c8aa async_sock: Use unix errnos instead of NTSTATUS
This also switches wb_reqtrans to use wbcErr instead of NTSTATUS as it would
be pointless to convert to errno first and to wbcErr later.
2009-02-09 08:36:08 +01:00
Volker Lendecke
3a4c8cd492 Make prs_struct->out_data.current_pdu dynamically allocated
Another 4k per open pipe
2009-02-08 13:53:50 +01:00
Volker Lendecke
32a7529243 Most RPC requests do not need a full fragment, start smaller 2009-02-08 13:53:49 +01:00
Volker Lendecke
51dc7b9d82 Make current_in_pdu in pipes_struct allocated
This makes an open pipe about 4K cheaper
2009-02-07 19:25:34 +01:00
Volker Lendecke
a66828a37f Don't use recvall in the proxied np_read_send
We don't know how much we will get. Resort to a single recv syscall
2009-02-05 11:16:03 +01:00
Volker Lendecke
94d1dbbaf0 Restore correct handling of "is_data_available" for the socket transport
This fixes a valgrind error reading an uninitialized variable
2009-02-04 22:36:43 +01:00
Volker Lendecke
c14b7e648b Split up async_req into a generic and a NTSTATUS specific part 2009-02-01 19:05:39 +01:00
Volker Lendecke
7967d8c779 Move rpc_pipe_open_internal to srv_pipe_hnd.c
This is a smbd-only function
2009-02-01 14:34:23 +01:00
Volker Lendecke
53394980ad Replace pipe names in pipes_struct by ndr_syntax_id
This was mainly used for debugging output
2009-02-01 14:34:23 +01:00
Volker Lendecke
99f021d0ef Fix the build on Solaris CC 2009-02-01 00:07:16 +01:00
Volker Lendecke
fa7ddc78b8 Remove unused np_read sync wrapper 2009-01-31 17:50:18 +01:00
Volker Lendecke
8b480b52ce Remove unused np_write sync wrapper 2009-01-31 17:50:18 +01:00
Volker Lendecke
e8b2b46cae Make-np_write-handle-0-byte-writes-as-NT_STATUS_OK 2009-01-31 17:50:18 +01:00
Volker Lendecke
b797c056a6 Add an async np_read wrapper 2009-01-31 17:50:18 +01:00
Volker Lendecke
e60d69d67d Add an async np_write wrapper 2009-01-31 17:50:18 +01:00
Volker Lendecke
520f88143b Remove some unused code 2009-01-20 16:41:32 +01:00
Volker Lendecke
b8b6cddb29 Remove some smb fsp knowledge from rpc_server/
np_open/read/write don't have to know about files_struct
2009-01-20 16:41:14 +01:00
Volker Lendecke
bd4718d281 Make use of TALLOC_FREE 2009-01-20 14:34:51 +01:00
Volker Lendecke
141b76d747 Remove unused argument "vuid" from make_internal_rpc_pipe_p 2009-01-03 15:25:00 +01:00
Volker Lendecke
2bb90b7a88 Remove "conn" parameter from np_open, smb_request contains it 2008-11-28 10:06:32 +01:00
Volker Lendecke
907f126d3e Get rid of pipes_struct->pipe_user, we have server_info now --- YESSS! 2008-11-24 11:39:03 +01:00
Volker Lendecke
ace87f16c0 For proxied named pipes, connect to np/<pipe_name> and send auth info
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2008-11-06 21:39:15 +01:00
Volker Lendecke
63da08d00f Apply some const to np_write() 2008-11-01 19:41:07 +01:00
Volker Lendecke
7bea6684c2 Add proxied named pipe support
This is a central piece of the "merged build" thing: Forward named pipes from
samba3 to samba4. This patch is not finished yet, as we will have to forward
the smb-level authentication information to samba4, but I'm pushing this patch
already to demonstrate the implementation without clutter.

It adds an intermediate parameter

np:proxy = srvsvc samr winreg wkssvc ... and so on

that states which of the pipes should be forwarded to the s4 unix domain socket
DEFAULT. The parameter is intermediate because once we have a proper endpoint
mapper implementation, this information will be retrieved out of a database.

If anybody wants to try this, do the merged build and configure s4 with

server services = samba3_smb, rpc, nbt, wrepl, ldap, cldap, kdc, drepl
samba3:smbd = /data/inst/sbin/smbd

and s3 with

auth methods = guest netlogond
np:proxy = srvsvc samr winreg wkssvc netlogon ntlsa ntsvcs lsass lsarpc netdfs \
rpcecho initshutdown epmapper svcctl eventlog drsuapi

Then run rpcclient against samba4. It will fork s3, which authenticates against
s4, and then forwards the rpc requests to s4.

Volker
2008-10-25 15:42:51 +02:00
Volker Lendecke
f87219d6e6 Move the is_known_pipename check into np_open 2008-10-25 15:23:36 +02:00
Volker Lendecke
ff211be696 Remove "pipe_handle_offset" -- pipes now use "struct files_struct" 2008-10-25 12:09:58 +02:00
Volker Lendecke
2b1bef7e87 Remove the current_spoolss_pipes_open thingy.
I looked at a checkout from 2002 and even there it did not what it was supposed
to do. Sadly this also removes one of the nicest comments in the whole Samba
code :-)
2008-10-13 20:59:35 +02:00
Volker Lendecke
76dfca1569 Make the internal pipe functions static 2008-10-13 20:59:34 +02:00
Volker Lendecke
a781b78417 Remove smb_np_struct 2008-10-13 20:59:33 +02:00
Volker Lendecke
ac126ea818 Use "struct files_struct" for pipes instead of smb_np_struct 2008-10-13 20:59:32 +02:00
Volker Lendecke
756b4b6048 Revert "Make get_rpc_pipe() static"
This reverts commit f25972832e.
2008-10-12 12:16:18 +02:00
Volker Lendecke
f25972832e Make get_rpc_pipe() static 2008-10-12 11:45:33 +02:00
Volker Lendecke
6b98c1b159 Remove unused #defines 2008-10-12 11:45:26 +02:00
Jeremy Allison
e29e81624e Fix duplicate gloabl warning.
Jeremy.
(This used to be commit 6da33797b0)
2008-07-30 15:01:33 -07:00
Volker Lendecke
33cbe2f88c make read/write to internal pipes available externally
(This used to be commit e11b5cb1e0)
2008-07-26 13:20:10 +02:00
Volker Lendecke
a803f0a920 Refactoring: Make close_internal_rpc_pipe_hnd a talloc destructor
(This used to be commit 10b47a0c2c)
2008-07-26 13:20:10 +02:00
Volker Lendecke
1ee37bc9c3 Refactor make_internal_rpc_pipe_p: connection_struct is not needed
(This used to be commit defcf0eecf)
2008-07-26 13:20:10 +02:00
Volker Lendecke
aa02c3fcd5 Remove p->vuid
The users can use p->server_info.

Now pipes_struct is decoupled from the SMB transport.
(This used to be commit d4cf5a1319)
2008-06-26 13:13:23 +02:00
Volker Lendecke
747a580952 Now that we have p->server_info, use p->server_info->user_session_key
(This used to be commit aefad64e3a)
2008-06-26 13:13:23 +02:00
Volker Lendecke
d331624fdf Add server_info to pipes_struct
(This used to be commit d621867bb8)
2008-06-26 13:13:22 +02:00
Volker Lendecke
9ff4001245 Remove "conn" from pipes_struct
For spoolss, we need the client's IP address
(This used to be commit 64a4dfaa82)
2008-06-24 10:31:36 +02:00
Volker Lendecke
df905a5d77 Make pipes_struct its own talloc ctx
(This used to be commit 829b1ad469)
2008-06-21 10:34:34 +02:00
Volker Lendecke
c203de0e3a Fix a SAFE_FREE/TALLOC_FREE mixup
(This used to be commit b39852f513)
2008-06-21 10:34:34 +02:00
Volker Lendecke
82d2f07dae Remove "session_key" from "struct user_struct"
This one took a bit -- I hope I covered all data paths
(This used to be commit 74c88a4442)
2008-05-05 18:28:59 +02:00
Volker Lendecke
bb3755968f Remove "nt_user_token" from "struct user_struct"
(This used to be commit 51d5d512f2)
2008-05-05 18:28:58 +02:00
Marc VanHeyningen
e06aa46b9f Coverity fixes
(This used to be commit 3fc85d2259)
2008-03-17 20:52:25 +01:00
Volker Lendecke
02dd1f7f4c Make smb_np_struct talloc'ed
Convert "name" from string to a talloc'ed char *
(This used to be commit e82069f921)
2007-12-16 12:59:21 +01:00
Volker Lendecke
a9b6deaa05 Remove unused code
(This used to be commit fcd45ad6fb)
2007-12-16 12:59:14 +01:00
Jeremy Allison
30191d1a57 RIP BOOL. Convert BOOL -> bool. I found a few interesting
bugs in various places whilst doing this (places that assumed
BOOL == int). I also need to fix the Samba4 pidl generation
(next checkin).
Jeremy.
(This used to be commit f35a266b3c)
2007-10-18 17:40:25 -07:00
Gerald (Jerry) Carter
e5a951325a [GLUE] Rsync SAMBA_3_2_0 SVN r25598 in order to create the v3-2-test branch.
(This used to be commit 5c6c8e1fe9)
2007-10-10 15:34:30 -05:00
Jeremy Allison
d5c9d87946 r25118: More pstring elimination.
Jeremy.
(This used to be commit 7632f8fb40)
2007-10-10 12:30:41 -05:00
Jeremy Allison
fe6644fb5a r25023: Coverity #455. Not actually a bug, but this clarifies
the code a lot.
Jeremy.
(This used to be commit 5ba12eefbe)
2007-10-10 12:30:35 -05:00
Volker Lendecke
bfbd756535 r24106: Pass fnum instead of buf/offset into get_rpc_pipe_p
(This used to be commit eb353412c6)
2007-10-10 12:29:07 -05:00