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

450 Commits

Author SHA1 Message Date
Volker Lendecke
5f753e22f1 Convert rpc_pipe_bind to tevent_req 2009-03-24 13:23:41 +01:00
Volker Lendecke
fa62836839 Convert rpc_cli_transport->trans to tevent_req 2009-03-24 13:23:41 +01:00
Volker Lendecke
8e0d9d002a Convert rpc_cli_transport->write to tevent_req 2009-03-24 13:23:41 +01:00
Volker Lendecke
22badee4bf Convert rpc_cli_transport->read to tevent_req 2009-03-24 13:23:40 +01:00
Volker Lendecke
1724f2ff31 Convert rpc_api_pipe_req to tevent_req 2009-03-24 13:23:40 +01:00
Volker Lendecke
f88990ec7e Convert rpc_api_pipe to tevent_req 2009-03-24 13:23:40 +01:00
Volker Lendecke
545ed5b52e Convert cli_api_pipe to tevent_req 2009-03-24 13:23:40 +01:00
Volker Lendecke
7a429fb369 Convert get_complete_frag to tevent_req 2009-03-24 13:23:40 +01:00
Volker Lendecke
7573bb758e Convert rpc_write to tevent_req 2009-03-24 13:23:40 +01:00
Volker Lendecke
1dd0883458 Convert rpc_read to tevent_req 2009-03-24 13:23:40 +01:00
Günther Deschner
9fdeb7f7b3 s3-spoolss: remove custom syntax_spoolss and use the syntax defined in IDL.
Guenther
2009-03-18 14:18:42 +01:00
Jeremy Allison
f48a345e4a Remove pwd_cache.c, it was doing nothing. Make user_name, domain, and
password talloc'ed strings within the cli_struct.
Jeremy.
2009-03-13 17:49:24 -07:00
Volker Lendecke
0844cca1d5 Replace get_myname() with the talloc version from v3-3-test 2009-02-13 12:15:03 +01:00
Volker Lendecke
d3f9b0fab6 Next step disentangling async_req from NTSTATUS
Now I need to document this :-)
2009-02-02 20:15:03 +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
57de60a83f cli_get_pipe_name_from_interface does not really need a talloc_ctx 2009-02-01 14:34:22 +01:00
Volker Lendecke
f6d08849e1 Fix memleaks 2009-01-30 21:29:35 +01:00
Volker Lendecke
aef749b53f pass NULL to prs_give_memory, that is a pointer 2009-01-30 21:29:35 +01:00
Volker Lendecke
22e3004829 Add the "SMBD" rpc transport
The idea of this is that all client utils like smbpasswd and also for example
"net join" do not access our internal databases like passdb and secrets.tdb
directly anymore but pass everything throught the well-established RPC
interfaces.

The way you use this is the following: With rpc_cli_smbd_conn_init() or its
async variant you initialize a "struct rpc_cli_smbd_conn". This structure is
the link to a freshly forked smbd, ready to be used for RPC services. You
should only ever have one such structure in your program. More don't hurt, but
are plainly unnecessary.

If you want to use the SAMR pipe to change a passwort, you connect to that pipe
with rpc_pipe_open_local. Do you normal rpccli_samr calls on that and your
locally forked smbd will connect to passdb for you.

GD, this might make the distinction between the _l and _r calls in libnetapi
mostly unnecessary. At least it is intended to do so... :-)
2009-01-30 12:48:00 +01:00
Volker Lendecke
b7094c0b80 Abstract away the transport in cli_pipe.c
Sorry for the monster checkin, I could not really find a way to do this in
steps.
2009-01-22 22:59:54 +01:00
Volker Lendecke
031f246941 Fix a segfault: rpccli_* expect the reply_pdu to always be initialized 2009-01-22 17:54:16 +01:00
Volker Lendecke
3662c2b0f6 cli_get_pipe_name_from_iface does not need the cli_state
I leave the TALLOC_CTX in, we might have to allocate it in the future
2009-01-22 11:38:00 +01:00
Jelmer Vernooij
11a25f9050 Allow calling DCE/RPC server implementations directly using
rpc_pipe_client.
2009-01-21 14:05:51 +01:00
Volker Lendecke
0dbd396862 Add a macro async_req_setup()
This streamlines setting up a multi-step async request a bit
2009-01-18 16:45:07 +01:00
Volker Lendecke
c45b6ec29a Add code to torture the fragmentation code a bit 2009-01-18 15:40:45 +01:00
Volker Lendecke
a158ebbe49 Remove unused functions 2009-01-18 15:40:45 +01:00
Volker Lendecke
28c35b4c04 Make rpc_pipe_bind async 2009-01-18 15:40:45 +01:00
Volker Lendecke
ecb5184ce5 Fix an uninitialized variable 2009-01-18 15:40:45 +01:00
Volker Lendecke
3f9f188877 Remove sync rpc_api_pipe_req 2009-01-18 15:40:45 +01:00
Volker Lendecke
396ed3b363 Add async rpc_api_pipe_req 2009-01-18 15:40:45 +01:00
Volker Lendecke
c655f19e1f Add rpc_write_send/recv 2009-01-18 15:40:44 +01:00
Volker Lendecke
f96335afc0 Remove unused sync functions 2009-01-18 15:40:44 +01:00
Volker Lendecke
f6740aa7ad Make rpc_api_pipe async 2009-01-18 15:40:44 +01:00
Volker Lendecke
761d164420 Rename the async version of get_complete_pdu to get_complete_frag 2009-01-18 15:40:44 +01:00
Volker Lendecke
5e6f3eaae9 Move initialization of the reply prs_struct to rpc_api_pipe 2009-01-18 15:40:44 +01:00
Volker Lendecke
5987c82697 Always check the max send sizein rpc_api_pipe, not just with DEVELOPER 2009-01-18 15:40:44 +01:00
Volker Lendecke
6d47418bc1 Make cli_api_pipe async
Also move the transport switch to this routine
2009-01-18 15:40:43 +01:00
Volker Lendecke
173d6c84a6 Remove sync rpc_read wrapper 2009-01-18 15:40:43 +01:00
Volker Lendecke
5d71fe8043 Make cli_pipe_get_current_pdu async, rename it to get_current_pdu 2009-01-18 15:40:43 +01:00
Volker Lendecke
30413f12b9 Make rpc_read async 2009-01-18 15:40:43 +01:00
Volker Lendecke
9b3c38f4af Slightly simplify the paths after rpc_api_pipe() 2009-01-17 11:27:32 +01:00
Volker Lendecke
8c983af56d Make rpc_read look like a real read call
It doesn't really need to know about prs_structs
2009-01-14 17:08:40 +01:00
Volker Lendecke
e1aeb486e8 Make rpc_read() match the control flow normally used in Samba
Replace do { .. } while () with a while () { .. }
2009-01-14 17:08:40 +01:00
Volker Lendecke
11e3388083 Simplify rpc_read a bit
rpc_read always reads the whole bytes it was asked to read. So it is not really
necessary for it to update the current_pdu_offset, for clarity this can better
be done in the caller.
2009-01-14 17:08:39 +01:00
Volker Lendecke
15dd11b31e Remove an unnecessary size check
rpc_read is only ever called with at most fraglen-RPC_HEADER_SIZE length
2009-01-14 17:08:39 +01:00
Volker Lendecke
274f575b24 Check the fragment size the server has sent us 2009-01-14 17:08:39 +01:00
Volker Lendecke
583d7913c8 Slightly simplify rpc_read: It should not do the resize 2009-01-14 17:08:39 +01:00
Volker Lendecke
87f9f0b01a Always read with offset 0 from a named pipe 2009-01-14 17:08:39 +01:00
Volker Lendecke
ce5eded7e0 Move cli_api_pipe() to its only user cli_pipe.c 2009-01-11 22:53:24 +01:00
Volker Lendecke
19b783cce9 Async wrapper for open_socket_out_send/recv 2009-01-04 16:42:40 +01:00
Volker Lendecke
fafb9ecc61 open_socket_out is always used with SOCK_STREAM, remove argument "type" 2009-01-03 19:22:06 +01:00
Günther Deschner
b883bcd4ff s3: store user session key in cli_rpc_pipe_open_noauth().
Guenther
2008-12-05 14:27:03 +01:00
Günther Deschner
7f8bc6a2d9 errors: share dcerpc error function.
Guenther
2008-10-31 12:42:09 +01:00
Jelmer Vernooij
2d89b52be8 Use separate make variables for libutil and libcrypto. 2008-10-18 14:28:40 +02:00
Jeremy Allison
969a2fc4dd Don't use debug level 1 to log a trivial message.
Jeremy.
2008-10-15 18:07:15 -07:00
Volker Lendecke
29dd253e69 Tiny logic simplification: remove an else branch
(This used to be commit 9c4905ed67)
2008-09-03 13:52:13 +02:00
Günther Deschner
a77c9285b7 fix another build warning.
Guenther
(This used to be commit 43693ce6c6)
2008-08-20 22:07:40 +02:00
Volker Lendecke
a20c498310 Remove unused function rpccli_is_pipe_idx
(This used to be commit 287ffc17a0)
2008-07-21 14:36:31 +02:00
Volker Lendecke
303f98af2f Remove now unused cli_get_pipe_name
(This used to be commit ed4a447103)
2008-07-21 14:36:30 +02:00
Volker Lendecke
346a8d1bdc Remove now unused cli_get_pipe_idx
(This used to be commit e02a550527)
2008-07-21 14:36:29 +02:00
Volker Lendecke
9664f24ecf Remove now unused cli_get_iface
(This used to be commit 2e60701e8d)
2008-07-21 14:36:28 +02:00
Volker Lendecke
798b56edae Refactoring: libnetapi_open_pipe takes an interface instead of pipe_idx
(This used to be commit 726e56c72f)
2008-07-21 14:36:27 +02:00
Volker Lendecke
55f84c05bd Refactoring: Change calling conventions for cli_rpc_pipe_open_krb5
Pass in ndr_syntax_id instead of pipe_idx, return NTSTATUS
(This used to be commit f2656e5c2e)
2008-07-20 17:37:14 +02:00
Volker Lendecke
99526d391d Refactoring: Change calling conventions for cli_rpc_pipe_open_schannel
Pass in ndr_syntax_id instead of pipe_idx, return NTSTATUS
(This used to be commit 1fcfca007f)
2008-07-20 17:37:14 +02:00
Volker Lendecke
52ff49600e Refactoring: Change calling conventions for cli_rpc_pipe_open_ntlmssp_auth_schannel
Pass in ndr_syntax_id instead of pipe_idx, return NTSTATUS
(This used to be commit ff87127baf)
2008-07-20 17:37:13 +02:00
Volker Lendecke
ba2cb35ca5 Refactoring: Change calling conventions for cli_rpc_pipe_open_schannel_with_key
Pass in ndr_syntax_id instead of pipe_idx, return NTSTATUS
(This used to be commit 78e9c937ff)
2008-07-20 17:37:13 +02:00
Volker Lendecke
44bdc98823 Refactoring: Make get_schannel_session_key_auth_ntlmssp return NTSTATUS
(This used to be commit ab3d80d476)
2008-07-20 17:37:12 +02:00
Volker Lendecke
b8fc15be95 Refactoring: Make get_schannel_session_key return NTSTATUS
(This used to be commit a0793cc853)
2008-07-20 17:37:12 +02:00
Volker Lendecke
1f854d1db7 Refactoring: Make get_schannel_session_key_common return NTSTATUS
(This used to be commit 513e695076)
2008-07-20 17:37:12 +02:00
Volker Lendecke
e0be03d8d5 Refactoring: Change calling conventions for cli_rpc_pipe_open_ntlmssp
Pass in ndr_syntax_id instead of pipe_idx, return NTSTATUS
(This used to be commit a13f059955)
2008-07-20 17:37:11 +02:00
Volker Lendecke
1335da2a7c Refactoring: Change calling conventions for cli_rpc_pipe_open_noauth
Pass in ndr_syntax_id instead of pipe_idx, return NTSTATUS
(This used to be commit 9abc9dc4dc)
2008-07-20 17:37:11 +02:00
Volker Lendecke
18fb7e0977 Refactoring: Change calling conventions for cli_rpc_pipe_open
Pass in ndr_syntax_id instead of pipe_idx, return NTSTATUS
(This used to be commit 6c122457ff)
2008-07-20 17:06:22 +02:00
Volker Lendecke
eb68e95d9a Refactoring: Change calling conventions for rpc_pipe_open_np
Pass in ndr_syntax_id instead of pipe_idx, return NTSTATUS
(This used to be commit 9249fe9e91)
2008-07-20 17:06:22 +02:00
Volker Lendecke
2e905d2cd1 Allocate rpc_cli->dc in rpccli_netlogon_setup_creds()
The general cli_pipe routines should not have to know about this NETLOGON
speciality.
(This used to be commit d30237598d)
2008-07-20 17:06:21 +02:00
Volker Lendecke
65dfc40a4a Store copies of the syntax ids in rpc_pipe_client
(This used to be commit 848a3497e3)
2008-07-20 17:06:21 +02:00
Volker Lendecke
66669bad43 Simplify pipe_names: we only do ndr_transfer_syntax anyway
(This used to be commit b808403af5)
2008-07-20 17:06:21 +02:00
Volker Lendecke
867b61d0a1 The PIPE_ pipename macros are only used in cli_pipe.c
(This used to be commit 03f7af26f2)
2008-07-19 21:07:14 +02:00
Volker Lendecke
bf6c11fea3 Make the pipe_names[] array static to cli_pipe.c
(This used to be commit ab7ab35059)
2008-07-19 20:40:27 +02:00
Jeremy Allison
799252f635 Fix the non-LDAP, non-krb5 build, fix gcc -O3 warnings.
Jeremy.
(This used to be commit 9e2ab30d3c)
2008-06-26 19:46:18 -07:00
Günther Deschner
92bd665aea rpc_client: let cli_get_session_key() return talloced session key.
Thanks, Volker, for pointing this out.

Guenther
(This used to be commit b47899195e)
2008-06-25 09:51:31 +02:00
Günther Deschner
07f06eec21 rpc_client: add cli_get_session_key().
Guenther
(This used to be commit 93b56755f7)
2008-06-24 23:47:58 +02:00
Karolin Seeger
1178287eeb rpc_client: Avoid warning in builds without krb5 headers.
warning: ‘cli_auth_kerberos_data_destructor’ defined but not used

Karolin
(This used to be commit b5f9176b6c)
2008-06-24 16:30:32 +02:00
Günther Deschner
95a1f88d93 rpc_client: fix some valgrind warnings.
Guenther
(This used to be commit 0352682a35)
2008-06-11 10:47:21 +02:00
Volker Lendecke
f1d160f333 Fix a const warning
Jelmer, would it be possible to make the rpc client functions take const
pointers for pure [in] arguments?
(This used to be commit d893b2ea13)
2008-05-25 13:53:44 +02:00
Günther Deschner
1a16a2cf97 drsuapi: always use tcp for drsuapi.
cli_rpc_pipe_open() now uses tcp transport for drsuapi and named pipe
transport for all other pipes.

This finally allows rpcclient to call dscracknames on windows
(don't forget to call "seal" in advance).

Guenther
(This used to be commit b243a03602)
2008-05-24 01:29:13 +02:00
Volker Lendecke
34104dfc21 Fix a (bogus) uninitialized variable warning
(This used to be commit 6106d48a5c)
2008-05-23 15:37:05 +02:00
Michael Adam
a8045b1339 rpc_client: make rpc_pipe_open_tcp_port and rpc_pipe_get_tcp_port static.
Slim the interface...

Michael
(This used to be commit 9971118c23)
2008-05-22 11:30:04 +02:00
Michael Adam
b398a96b09 rpc_client: use endpoint mapper to get the port for rpc_pipe_open_tcp().
Michael
(This used to be commit f7db445c82)
2008-05-22 11:29:57 +02:00
Volker Lendecke
36e94197d0 rpc_client: add a destructor to close the socket for pipes over tcp.
used in rpc_pipe_open_tcp() and rpc_pipe_open_ncalrpc().
(This used to be commit a0bdd56c75)
2008-05-21 23:35:26 +02:00
Volker Lendecke
e8d25443c1 Add client support for NCACN_UNIX_STREAM
(This used to be commit 24ac40518f)
2008-05-21 23:35:25 +02:00
Volker Lendecke
78022953e7 rpccli_schannel_bind_data only needs the schannel key
(This used to be commit be5d54a363)
2008-05-21 23:35:25 +02:00
Volker Lendecke
ec70996fc7 Rename rpc_pipe_client.tcp.sock to rpc_pipe_client.sock.fd
(This used to be commit 2ff908a902)
2008-05-21 23:35:24 +02:00
Volker Lendecke
9a6b1f4b5f Fix a comment
(This used to be commit 8ae39c1339)
2008-05-21 23:35:24 +02:00
Volker Lendecke
2c00ff5407 Fix two uninitialized variable warnings
(This used to be commit 48fd7b3635)
2008-05-05 11:17:19 +02:00
Volker Lendecke
9de291e671 Attempt to fix the non-krb build
(This used to be commit 31d80a4767)
2008-04-25 12:36:39 +02:00
Volker Lendecke
79fae5082a Add basic ncacn_ip_tcp client infrastructure
(This used to be commit 11072ccc7a)
2008-04-25 11:12:52 +02:00
Volker Lendecke
63e0884df5 Introduce a redirection for ncacn_np and ncacn_ip_tcp in rpc_pipe_client
Should be no functional change, just a change in the data structure
(This used to be commit 3433f430b0)
2008-04-25 11:12:52 +02:00
Volker Lendecke
cf182c0a76 Introduce rpccli_pipe_txt(), describing a pipe for debug messages
(This used to be commit 83892d51de)
2008-04-25 11:12:52 +02:00
Volker Lendecke
eb5582d28a cli_rpc_pipe_open_noauth must take the user/domain from the smb session
(This used to be commit 6f08128cf2)
2008-04-25 11:12:52 +02:00
Volker Lendecke
324e92ea67 Make use of rpccli_xxx_bind_data
(This used to be commit f9bc336aff)
2008-04-25 11:12:51 +02:00
Volker Lendecke
253b0b8868 Create rpccli_xxx_bind_data functions
These functions create the auth data for the later bind
(This used to be commit 630b9c241c)
2008-04-25 11:12:51 +02:00
Volker Lendecke
862d7e32b9 Move user/domain from rpc_pipe_client to cli_pipe_auth_data
(This used to be commit 42de50d2cd)
2008-04-25 11:12:50 +02:00
Volker Lendecke
9e9d40d097 Refactoring: Make cli_pipe_auth_data a pointer off rpc_pipe_client
(This used to be commit f665afaaa3)
2008-04-25 11:12:50 +02:00
Volker Lendecke
b78453326b Remove the "pwd" struct from rpc_pipe_client
The only user of this was decrypt_trustdom_secret, and this only needs the NT
hash anyway.
(This used to be commit 3d8c2a47e6)
2008-04-21 23:36:05 +02:00
Volker Lendecke
712e40dad2 Fix some empty lines with just spaces
(This used to be commit f8fb9b7e37)
2008-04-20 16:23:48 +02:00
Volker Lendecke
b9cc055062 Introduce rpc_pipe_np_smb_conn()
This abstracts away all references to rpc_pipe_client->cli, the only reference
is now in cli_pipe.c.
(This used to be commit c56e1c08ce)
2008-04-20 14:08:16 +02:00
Volker Lendecke
e73e8297f5 Replace cli_rpc_pipe_close by a talloc destructor on rpc_pipe_struct
(This used to be commit 99fc3283c4)
2008-04-20 14:08:16 +02:00
Volker Lendecke
33592bdcb9 Refactoring: Move stuff around for creating a pipe
(This used to be commit 45be749ed6)
2008-04-20 14:08:10 +02:00
Volker Lendecke
f56eedb95c Remove the pipe_idx variable from rpc_pipe_client
(This used to be commit 4840febcd4)
2008-04-20 11:47:33 +02:00
Volker Lendecke
ff8aa642f3 Remove some unused code referencing pipe_names[]
(This used to be commit d8a04b798c)
2008-04-20 11:27:24 +02:00
Volker Lendecke
cf2442bdcb Use rpc_pipe_client->user_name instead of rpc_pipe_client->cli->user_name
Also make sure that rpc_pipe_client->user_name is always talloced.
(This used to be commit 3f6c5b9966)
2008-04-20 00:14:40 +02:00
Volker Lendecke
e1102b8f48 Introduce rpccli_set_timeout()
Reduce dependency on "cli" member of rpc_pipe_client struct
(This used to be commit 2e4c1ba389)
2008-04-20 00:14:26 +02:00
Volker Lendecke
9048cafbea Move srv_name_slash from cli_state to rpc_pipe_client
(This used to be commit a9061e52e1)
2008-04-20 00:14:13 +02:00
Volker Lendecke
2a2188591b Add "desthost" to rpc_pipe_client
This reduces the dependency on cli_state
(This used to be commit 783afab9c8)
2008-04-20 00:13:09 +02:00
Volker Lendecke
b46d340fd5 Refactoring: Make struct rpc_pipe_client its own talloc parent
(This used to be commit a6d74a5a56)
2008-04-20 00:12:52 +02:00
Volker Lendecke
fb73de3b92 Set the right domain\user in cli_rpc_pipe_open_ntlmssp_internal
This probably does not matter in current code, but without this it's not
possible to do the bind as a different user than the underlying smb user.

Jeremy, please check!

Thanks,

Volker
(This used to be commit b90062e33c)
2008-04-19 23:54:01 +02:00
Jelmer Vernooij
a4c60b2696 rpc_parse: Use UUIDs from librpc/gen_ndr/ when possible to reduce
duplication.
(This used to be commit 428654b473)
2008-04-17 17:54:32 +02:00
Jelmer Vernooij
28fd4f6fcb Reconcile ndr_syntax_id used by pidl-generated code and Samba3's RFC_IFACE.
(This used to be commit 7bea00dca1)
2008-04-15 20:26:52 +02:00
Günther Deschner
99d3590455 Fix NETLOGON credential chain with Windows 2008 all over the place.
In order to avoid receiving NT_STATUS_DOWNGRADE_DETECTED from a w2k8
netr_ServerAuthenticate2 reply, we need to start with the AD netlogon negotiate
flags everywhere (not only when running in security=ads). Only for NT4 we need
to do a downgrade to the returned negotiate flags.

Tested with w2k8, w2ksp4, w2k3r2 and nt4sp6.

Guenther
(This used to be commit 0970369ca0)
2008-04-02 11:12:47 +02:00
Marc VanHeyningen
e06aa46b9f Coverity fixes
(This used to be commit 3fc85d2259)
2008-03-17 20:52:25 +01:00
Steven Danneman
6fb37ae672 Closed memory leak on error path.
(This used to be commit 376de8a0e4)
2008-02-27 07:23:28 +01:00
Günther Deschner
05ff7fd46e Use generated DSSETUP client & server rpc functions and remove the hand-written ones.
Guenther
(This used to be commit d5ebfccebb)
2008-01-25 15:30:43 +01:00
Andreas Schneider
691c4b1a41 Windows 2008 (Longhorn) auth2 flag fixes.
Interop fixes for AD specific flags. Original patch from Todd Stetcher.
(This used to be commit 5aadfcdaac)
2008-01-23 14:55:22 -08:00
Michael Adam
68e65b2981 Fix a debug message: add missing space.
Michael
(This used to be commit 6a7f2a59fc)
2007-12-18 07:58:37 +01:00
Michael Adam
d9682dfb59 Do not close netlogon pipe in get_schannel_session_key_common().
This removes one forgotten call of cli_rpc_pipe_close(netlogon_pipe).
Correction of e77c4022cf.

Michael
(This used to be commit 7f6593cdde)
2007-12-17 23:27:53 +01:00
Michael Adam
7cf5c17f12 Refactoring out get_schannel_session_key logic.
Refactor the actual retrieval of the session key through the
established netlogon pipe out of get_schannel_session_key()
and get_schannel_session_key_auth_ntlmssp() into a new
function get_schannel_session_key_common().
(To avoid code duplication.)

Michael
(This used to be commit e77c4022cf)
2007-12-13 10:15:19 +01:00
Michael Adam
31f221ed93 Rename get_trust_pw() to get_trust_pw_hash().
Michael
(This used to be commit 0cde7ac9cb)
2007-12-13 10:15:19 +01:00
Michael Adam
f793c99ca5 Let get_trust_pw() determine the machine_account_name to use.
Up to now each caller used its own logic.

This eliminates code paths where there was a special treatment
of the following situation: the domain given is not our workgroup
(i.e. our own domain) and we are not a DC (i.e. it is not a typical
trusted domain situation). In situation the given domain name was
previously used as the machine account name, resulting in an account
name of DOMAIN\\DOMAIN$, which does not seem very reasonable to me.
get_trust_pw would not have obtained a password in this situation
anyways.

I hope I have not missed an important point here!

Michael
(This used to be commit 6ced4a7f88)
2007-12-13 10:15:17 +01:00
Jeremy Allison
7faee02d0d Remove the char[1024] strings from dynconfig. Replace
them with malloc'ing accessor functions. Should save a
lot of static space :-).
Jeremy.
(This used to be commit 52dc5eaef2)
2007-12-10 11:30:37 -08:00
Jeremy Allison
d2cf97aeba Remove the explicit TALLOC_CTX * from cli_struct.
Make us very explicit about how long a talloc ctx
should last.
Jeremy.
(This used to be commit ba9e2be2b5)
2007-11-29 13:24:54 -08:00
Jeremy Allison
66298d8080 More pstring elimination.
Jeremy.
(This used to be commit 15074de938)
2007-11-20 17:18:16 -08: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 Carter
5221ebb299 r25407: Revert Longhorn join patch as it is not correct for the 3.2 tree.
The translate_name() used by cli_session_setup_spnego() cann rely
Winbindd since it is needed by the join process (and hence before
Winbind can be run).
(This used to be commit 00a93ed336)
2007-10-10 12:31:03 -05:00
Gerald Carter
3529156971 r25400: Windows 2008 (Longhorn) Interop fixes for AD specific auth2 flags,
and client fixes.  Patch from Todd Stetcher <todd.stetcher@isilon.com>.
(This used to be commit 8304ccba73)
2007-10-10 12:31:02 -05:00
Michael Adam
451224166d r23850: Fix whitespacing in DEBUG output.
(This used to be commit 918aad0d8b)
2007-10-10 12:28:34 -05:00
Andrew Tridgell
153cfb9c83 r23801: The FSF has moved around a lot. This fixes their Mass Ave address.
(This used to be commit 87c91e4362)
2007-10-10 12:28:27 -05:00
Jeremy Allison
d824b98f80 r23779: Change from v2 or later to v3 or later.
Jeremy.
(This used to be commit 407e6e695b)
2007-10-10 12:28:20 -05:00
Volker Lendecke
b4a7b7a888 r22844: Introduce const DATA_BLOB data_blob_null = { NULL, 0, NULL }; and
replace all data_blob(NULL, 0) calls.
(This used to be commit 3d3d61687e)
2007-10-10 12:22:01 -05:00
Stefan Metzmacher
eceb926df9 r22092: - make spnego_parse_auth_response() more generic and
not specific for NTLMSSP
- it's possible that the server sends a mechOID and authdata
  if negResult != SPNEGO_NEG_RESULT_INCOMPLETE, but we still
  force the mechOID to be present if negResult == SPNEGO_NEG_RESULT_INCOMPLETE

metze
(This used to be commit e9f2aa22f9)
2007-10-10 12:19:10 -05:00
Stefan Metzmacher
56ba447668 r22001: change prototype of dump_data(), so that it takes unsigned char * now,
which matches what samba4 has.

also fix all the callers to prevent compiler warnings

metze
(This used to be commit fa322f0cc9)
2007-10-10 12:18:59 -05:00
Günther Deschner
ca072a9998 r21382: Important fix for winbind when using non-AD domains.
Jeremy, I'm afraid you removed the "domain->initialized" from the
set_dc_types_and_flags() call when the connect to PI_LSARPC_DS failed
(with rev. 19148).

This causes now that init_dc_connection_network is called again and
again which in turn rescans the DC each time (which of course fails each
time with NT_STATUS_BUFFER_TOO_SMALL). Just continue with the
non-PI_LSARPC_DS scan so that the domain is initialized properly.

Guenther
(This used to be commit c6f63a08f5)
2007-10-10 12:17:59 -05:00
Günther Deschner
69cee2a3ec r21240: Fix longstanding Bug #4009.
For the winbind cached ADS LDAP connection handling
(ads_cached_connection()) we were (incorrectly) assuming that the
service ticket lifetime equaled the tgt lifetime. For setups where the
service ticket just lives 10 minutes, we were leaving hundreds of LDAP
connections in CLOSE_WAIT state, until we fail to service entirely with
"Too many open files".

Also sequence_number() in winbindd_ads.c needs to delete the cached LDAP
connection after the ads_do_search_retry() has failed to submit the
search request (although the bind succeeded (returning an expired
service ticket that we cannot delete from the memory cred cache - this
will get fixed later)).

Guenther
(This used to be commit 7e1a84b722)
2007-10-10 12:17:50 -05:00
Gerald Carter
22b52b818b r16255: Fix 'net ads join' when the workgroup is set incorrectly
in smb.conf.  This did work before the join rewrite.
Samba will have problems if you try to run any of the daemons
with an incorrect workgroup but it should not fail to join.

The summary is that a member server should always use it's
own machine name when setting up schannel since that is
the only account it has.  Thanks to Volker for the discussion.
(This used to be commit 95763b94f7)
2007-10-10 11:17:28 -05:00
Günther Deschner
a6e662f556 r16253: Fix another host/ UPN case in (the currently unused)
cli_rpc_pipe_open_krb5.

Guenther
(This used to be commit fa19099112)
2007-10-10 11:17:28 -05:00
Jeremy Allison
0498f3b889 r15129: Separate out mechanism and policy for NTLMSSP auth/sign/seal.
With this change (and setting lanman auth = no in smb.conf)
we have *identical* NTLMSSP flags to W2K3 in SPNEGO auth.
Jeremy
(This used to be commit 93ca3eee55)
2007-10-10 11:16:25 -05:00
Günther Deschner
6e17934ee6 r14643: Merge dcerpc_errstr from Samba 4.
Might need to rework prs_dcerpc_status().

Guenther
(This used to be commit 38b18f428b)
2007-10-10 11:15:41 -05:00
Günther Deschner
485a286a65 r14585: Tighten argument list of kerberos_kinit_password again,
kerberos_kinit_password_ext provides access to more options.

Guenther
(This used to be commit afc519530f)
2007-10-10 11:15:38 -05:00
Gerald Carter
a199498213 r14449: fix the build (sorry everyone)
(This used to be commit e49ca3af8c)
2007-10-10 11:15:30 -05:00
Gerald Carter
0f0ad2992e r14448: * protect against NULL cli_state* pointers in cli_rpc_pipe_open()
* Fix inverted logic check for machine accounts in get_md4pw()
(This used to be commit a36529535d)
2007-10-10 11:15:30 -05:00
Jeremy Allison
dc93156fe9 r14121: We never pass NULL to the rpc_api_pipe fn so don't
trigger coverity checks by testing for NULL.
Jeremy.
(This used to be commit 6b44841592)
2007-10-10 11:11:13 -05:00
Jeremy Allison
7f59c7fcd6 r13722: Ensure we use the correct enumerated type. Bug #3558
from jason@ncac.gwu.edu.
Jeremy.
(This used to be commit 00f8b4e1aa)
2007-10-10 11:10:50 -05:00
Jeremy Allison
202bc164ca r13641: Finish fix for #3510. Don't use client schannel when told
not to, cope with a server that doesn't offer schannel also.
Jeremy
(This used to be commit 68005f6bdb)
2007-10-10 11:10:20 -05:00
Gerald Carter
0af1500fc0 r13316: Let the carnage begin....
Sync with trunk as off r13315
(This used to be commit 17e63ac4ed)
2007-10-10 11:06:23 -05:00
Jeremy Allison
76796e212c r12275: Fix memory leak found by Mikhail Kshevetskiy <kl@laska.dorms.spbu.ru>
and followed up by derrell@samba.org.
Jeremy.
(This used to be commit 5cab88f144)
2007-10-10 11:05:51 -05:00
Derrell Lipman
0dc59604f7 r12236: r11740@cabra: derrell | 2005-12-14 13:16:58 -0500
check in the DEBUG message referenced in the previous commit
(This used to be commit 6c04a8f9ad)
2007-10-10 11:05:50 -05:00
Derrell Lipman
765daab643 r12225: r11729@cabra: derrell | 2005-12-13 22:59:45 -0500
1. Fix a crash bug which should have reared its ugly head ages ago, but for
    some reason, remained dormant until recently.  The bug pertained to
    libsmbclient doing a structure assignment of a cli after having opened a
    pipe.  The pipe open code makes a copy of the cli pointer that was passed
    to it.  If the cli is later copied (and that cli pointer that was saved
    is no longer valid), the pipe code will cause a crash during shutdown or
    when the copied cli is closed.

 2. The 'type' field in enumerated shares was not being set correctly with
    the new RPC-based mechanism for enumerating shares.
(This used to be commit 62a02b8f2a)
2007-10-10 11:05:50 -05:00
Jeremy Allison
5678e4abb0 r11492: Fix bug #3224 (I hope). Correctly use machine_account_name
and client_name when doing netlogon credential setup.
Jeremy.
(This used to be commit 37e6ef9389)
2007-10-10 11:05:18 -05:00
Jeremy Allison
e12eb25793 r11491: If we get a reject ensure we're printing out the server/domain/machine
a/c we were asking for.
Jeremy.
(This used to be commit 3ba5d02cff)
2007-10-10 11:05:18 -05:00
Jeremy Allison
8d7c886671 r11137: Compile with only 2 warnings (I'm still working on that code) on a gcc4
x86_64 box.
Jeremy.
(This used to be commit d720867a78)
2007-10-10 11:05:02 -05:00
Jeremy Allison
a23b680a08 r10801: Janitor for tpot - remember to keep 3.0 in sync.
Jeremy.
(This used to be commit 92fa541f6e)
2007-10-10 11:04:54 -05:00
Jeremy Allison
6de37ee5f5 r10780: Fix typo noticed by Volker.
Jeremy.
(This used to be commit 76408ddd5b)
2007-10-10 11:04:53 -05:00
Jeremy Allison
20d36c1c8d r10778: Allow schannel setup over NTLMSSP authenticated pipes.
Jeremy.
(This used to be commit ed62720f89)
2007-10-10 11:04:53 -05:00
Jelmer Vernooij
7fe605c97e r10747: Remove overparanoid check that broke RPC function calls with no
[in] parameters.
(This used to be commit 03a3caaddd)
2007-10-10 11:04:51 -05:00
Jeremy Allison
515be57030 r10745: Fix artificial 1k restriction.
Jeremy.
(This used to be commit bb1ba9a908)
2007-10-10 11:04:51 -05:00
Gerald Carter
54abd2aa66 r10656: BIG merge from trunk. Features not copied over
* \PIPE\unixinfo
* winbindd's {group,alias}membership new functions
* winbindd's lookupsids() functionality
* swat (trunk changes to be reverted as per discussion with Deryck)
(This used to be commit 939c3cb5d7)
2007-10-10 11:04:48 -05:00
Jeremy Allison
8b2b177a8e r8805: Merge a duplicate struct. Get ready to support SPNEGO rpc binds.
Jeremy.
(This used to be commit fd6e342746)
2007-10-10 11:00:18 -05:00
Gerald Carter
fed660877c r7415: * big change -- volker's new async winbindd from trunk
(This used to be commit a0ac9a8ffd)
2007-10-10 10:57:08 -05:00
Jeremy Allison
04e07e8cc9 r7385: Rewrite the RPC bind parsing functions to follow the spec. I haven't yet
tested this so I may have screwed this up - however it now follows the
DCE spec. valgrinded tests to follow....
Jeremy.
(This used to be commit 877e0a61f5)
2007-10-10 10:57:07 -05:00
Volker Lendecke
c85d9e735c r4570: Replace cli->nt_pipe_fnum with an array of NT file numbers, one for each
supported pipe. Netlogon is still special, as we open that twice, one to do
the auth2, the other one with schannel.

The client interface is completely unchanged for those who only use a single
pie. cli->pipe_idx is used as the index for everything except the "real"
client rpc calls, which have been explicitly converted in my last commit. Next
step is to get winbind to just use a single smb connection for multiple pipes.

Volker
(This used to be commit dc294c52e0)
2007-10-10 10:53:47 -05:00
Volker Lendecke
f4ec52a097 r4561: This looks a lot larger than it is, this is to reduce the clutter on future
patches.

Pass down the pipe_idx down to all functions in cli_pipe where nt_pipe_fnum is
referenced. First step towards having multiple pipes on a cli_struct. The idea
is to not have a single nt_pipe_fnum but an array for the pipes we support.

Volker
(This used to be commit 93eab05020)
2007-10-10 10:53:47 -05:00
Gerald Carter
dda9d76264 r1380: adding debug message when encouting an ASU specific bug in an rpc_bind reply
(This used to be commit c6e73ff091)
2007-10-10 10:52:08 -05:00
Gerald Carter
9dbf2e2419 r991: Allow winbindd to use the domain trust account password
for setting up an schannel connection.  This solves the problem
of a Samba DC running winbind, trusting a native mode AD domain,
and needing to enumerate AD users via wbinfo -u.
(This used to be commit e9f109d1b3)
2007-10-10 10:51:53 -05:00
Gerald Carter
41db2016ad r704: BUG 1315: fix for schannel client connections to server's that don't support 128 bit encryption
(This used to be commit 316ba5ad89)
2007-10-10 10:51:34 -05:00
Andrew Bartlett
59572d1297 Ensure we correctly set cli->nt_pipe_fnum on failure to correctly open the
NT session.

Andrew Bartlett
(This used to be commit 01fff20e6e)
2004-03-27 05:39:19 +00:00
Gerald Carter
f2e853d345 remove unused variable
(This used to be commit 170c443b19)
2004-03-22 23:05:02 +00:00
Gerald Carter
fd312721ea missed some of Derrel's changes
(This used to be commit 3aac1e549e)
2004-03-19 17:48:08 +00:00
Gerald Carter
aad3d8aeb0 asu/syntax/pc_netlink doesn't fill in the pipe name in the rpc_bind response so dont check for it
(This used to be commit 4d68d3d5dd)
2004-03-17 17:38:38 +00:00
Volker Lendecke
a92de03d9e Add 'net rpc group [add|del]mem' for domain groups and aliases.
Volker
(This used to be commit e597420421)
2004-02-28 18:41:16 +00:00
Andrew Bartlett
425699fce7 Correctly handle per-pipe NTLMSSP inside a NULL session. Previously we
would attempt to supply a password to the 'inside' NTLMSSP, which the
remote side naturally rejected.

Andrew Bartlett
(This used to be commit da408e0d5a)
2004-01-05 04:12:40 +00:00
Andrew Bartlett
1b6e6c98ba Do not add NTLM2 to the NTLMSSP flags unconditionally - allow the
defaults specified by the caller to prevail.

Don't use NTLM2 for RPC pipes, until we know how it works in signing or sealing.

Call ntlmssp_sign_init() unconditionally in the client - we setup the
session key, why not setup the rest of the data.

Andrew Bartlett
(This used to be commit 48123f7e42)
2003-11-25 11:25:38 +00:00
Gerald Carter
4e61fcbef1 strequal() returns a BOOL, not an int like strcmp(); this fixes a bug in check_bind_response()
(This used to be commit 5e062f72ba)
2003-11-24 20:22:12 +00:00
Andrew Bartlett
fcbfc7ad06 Changes all over the shop, but all towards:
- NTLM2 support in the server
 - KEY_EXCH support in the server
 - variable length session keys.

In detail:

 - NTLM2 is an extension of NTLMv1, that is compatible with existing
domain controllers (unlike NTLMv2, which requires a DC upgrade).

 * This is known as 'NTLMv2 session security' *

(This is not yet implemented on the RPC pipes however, so there may
well still be issues for PDC setups, particuarly around password
changes.  We do not fully understand the sign/seal implications of
NTLM2 on RPC pipes.)

This requires modifications to our authentication subsystem, as we
must handle the 'challege' input into the challenge-response algorithm
being changed.  This also needs to be turned off for
'security=server', which does not support this.

- KEY_EXCH is another 'security' mechanism, whereby the session key
actually used by the server is sent by the client, rather than being
the shared-secret directly or indirectly.

- As both these methods change the session key, the auth subsystem
needed to be changed, to 'override' session keys provided by the
backend.

- There has also been a major overhaul of the NTLMSSP subsystem, to merge the 'client' and 'server' functions, so they both operate on a single structure.  This should help the SPNEGO implementation.

- The 'names blob' in NTLMSSP is always in unicode - never in ascii.
Don't make an ascii version ever.

- The other big change is to allow variable length session keys.  We
have always assumed that session keys are 16 bytes long - and padded
to this length if shorter.  However, Kerberos session keys are 8 bytes
long, when the krb5 login uses DES.

 * This fix allows SMB signging on machines not yet running MIT KRB5 1.3.1. *

- Add better DEBUG() messages to ntlm_auth, warning administrators of
misconfigurations that prevent access to the privileged pipe.  This
should help reduce some of the 'it just doesn't work' issues.

- Fix data_blob_talloc() to behave the same way data_blob() does when
passed a NULL data pointer.  (just allocate)


REMEMBER to make clean after this commit - I have changed plenty of data structures...
(This used to be commit f3bbc87b0d)
2003-11-22 13:19:38 +00:00
Volker Lendecke
5faae2df8a This fixes a bug when establishing trust against a german W2k3 AD server. In
the bind response to WKSSVC it does not send \PIPE\ntsvcs as NT4 (did not
check w2k) but \PIPE\wkssvc. I'm not sure whether we should make this check at
all, so making it a bit more liberal should hopefully not really hurt.

Volker
(This used to be commit 029dcb351b)
2003-11-17 18:00:43 +00:00
Gerald Carter
cbe69f65f6 commit sign only patch from Andrew; bug 167; tested using 2k & XP clientspreviously joined to the Samba domain
(This used to be commit 3802f5895e)
2003-10-01 21:18:32 +00:00
Andrew Bartlett
f0cd6b35e5 - Fix the kerberos downgrade problem:
- When connecting to the NETOGON pipe, we make a call to auth2, in order
   to verify our identity.  This call was being made with negotiation flags
   of 0x1ff.  This caused our account to be downgraded.  If we instead make
   the call with flags > 1ff (such as 0x701ff), then this does not occour.

 - This is *not* related to the use of kerberos for the CIFS-level connection

My theory is that Win2k has a test to see if we are sending *exactly* what
NT4 sent - setting any other flags seems to cause us to remain intact.

Also ensure that we only have 'setup schannel' code in a few places, not
scattered around cmd_netlogon too.

Andrew Bartlett
(This used to be commit e10f0529fe)
2003-08-19 20:39:32 +00:00
Herb Lewis
aa39cc37da get rid of more compiler warnings
(This used to be commit 398bd14fc6)
2003-08-15 04:42:05 +00:00
Andrew Bartlett
172766eea7 Change Samba to always use extended security for it's guest logins, (ie,
NTLMSSP with "" username, NULL password), and add --machine-pass (-P) to
all of Samba's clients.

When connecting to an Active Directory DC, you must initiate the CIFS level
session setup with Kerberos, not a guest login.  If you don't, your machine
account is demoted to NT4.

Andrew Bartlett
(This used to be commit 3547cb3def)
2003-08-14 01:08:00 +00:00
Tim Potter
cdf562f5b2 Memory leak fix for create_rpc_bind_req()
(This used to be commit 4d26feabd7)
2003-08-04 02:51:30 +00:00
Jeremy Allison
d6ee1d167c Save us from possibly uninitialised variable (caught by gcc).
Jeremy.
(This used to be commit f3f29665bd)
2003-07-30 23:33:56 +00:00
Gerald Carter
6ec2213bdb domain in schannel bind credentials must be the dest domain, not ours
(This used to be commit e12f6a8c13)
2003-07-25 18:00:57 +00:00
Andrew Bartlett
c9305f1c64 Schannel, once setup, may be used on *ANY* TCP/IP connection until the
connection that set it up has been shut down.

(Also, pipes still connected, and reconnections to the same pipe (eg SAMR)
may continue to use that session key until their TCP/IP connection is shut
down)

Allow further testing by printing out the session key, and allowing it's input
into rpcclient.

Next step is automatic storage in a TDB.

Andrew Bartlett
(This used to be commit fa4d7be161)
2003-07-25 01:26:19 +00:00
Andrew Bartlett
4c53bb6b90 In the presense of RPC fragments, schannel is not strictly request/reply,
so the shared sequence number will not be strictly odd/even.

Andrew Bartlett
(This used to be commit 77c3e69aef)
2003-07-17 01:34:05 +00:00
Andrew Bartlett
8a4577cc22 Fix up our auth_pipe code to always cope with fragmented datagrams,
in both SCHANNEL and NTLMSSP.

(Try not to deal with a general case as individual special cases...)

Andrew Bartlett
(This used to be commit 6ca77bd28f)
2003-07-16 03:22:43 +00:00
Gerald Carter
b8ddc6238b fix schannel processing on fragmented PDUs. 'net rpc vampire' works again.
(This used to be commit ff0c71148e)
2003-07-15 21:33:28 +00:00
Andrew Bartlett
0b0fa60900 Fix compile error noticed by Ken Cross, use the utility function instead
of an inline replacement...

Andrew Bartlett
(This used to be commit d941255a97)
2003-07-14 12:56:30 +00:00
Andrew Bartlett
456f51bcbe Jeremy requested that I get my NTLMSSP patch into CVS. He didn't request
the schannel code, but I've included that anyway. :-)

This patch revives the client-side NTLMSSP support for RPC named pipes
in Samba, and cleans up the client and server schannel code.  The use of the
new code is enabled by the 'sign', 'seal' and 'schannel' commands in
rpcclient.

The aim was to prove that our separate NTLMSSP client library actually
implements NTLMSSP signing and sealing as per Microsoft's NTLMv1 implementation,
in the hope that knowing this will assist us in correctly implementing
NTLMSSP signing for SMB packets.  (Still not yet functional)

This patch replaces the NTLMSSP implementation in rpc_client/cli_pipe.c with
calls to libsmb/ntlmssp.c.  In the process, we have gained the ability to
use the more secure NT password, and the ability to sign-only, instead of
having to seal the pipe connection.  (Previously we were limited to sealing,
and could only use the LM-password derived key).

Our new client-side NTLMSSP code also needed alteration to cope with our
comparatively simple server-side implementation.  A future step is to replace
it with calls to the same NTLMSSP library.

Also included in this patch is the schannel 'sign only' patch I submitted to
the team earlier.  While not enabled (and not functional, at this stage) the
work in this patch makes the code paths *much* easier to follow.  I have also
included similar hooks in rpccleint to allow the use of schannel on *any* pipe.

rpcclient now defaults to not using schannel (or any other extra per-pipe
authenticiation) for any connection.  The 'schannel' command enables schannel
for all pipes until disabled.

This code is also much more secure than the previous code, as changes to our
cli_pipe routines ensure that the authentication footer cannot be removed
by an attacker, and more error states are correctly handled.

(The same needs to be done to our server)

Andrew Bartlett
(This used to be commit 5472ddc9ea)
2003-07-14 08:46:32 +00:00
Jeremy Allison
ce72beb2b5 Removed strupper/strlower macros that automatically map to strupper_m/strlower_m.
I really want people to think about when they're using multibyte strings.
Jeremy.
(This used to be commit ff222716a0)
2003-07-03 19:11:31 +00:00
Tim Potter
627aa735fb Clarify a comment: The secure channel connection must be opened on the
same session (TCP connection) as the one the challenge was requested
from.
(This used to be commit 5cb9b99f0f)
2003-05-16 01:57:57 +00:00
Tim Potter
5b776f179a Fix two bugs that were stopping net rpc vampire from working over secure
channel:

  - If the domain name passed to create_rpc_bind_req() is empty, use
    lp_workgroup()

  - Correctly set the auth_padding field when the send_size is a multiple
    of 8 bytes

I've tested with nt4sp6 and win2ksp0 and it seems to work, although
there are no password hashes transferred from win2k.  The empty
passwords are being protected by the secure channel encryption though.
(This used to be commit a8c11e8556)
2003-05-12 07:16:21 +00:00