libcli/auth: add netlogon_creds_cli* infrastructure
authorStefan Metzmacher <metze@samba.org>
Thu, 18 Apr 2013 17:16:42 +0000 (19:16 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 10 Dec 2013 22:29:08 +0000 (11:29 +1300)
commit80f615605eace3469a2fd28a22270bc90db1864d
tree8c7038286303fed45cdd2219a9c330f4f459d08b
parentf9d7e8f9f1094bcb8fadb4226f0d9570f2b3605a
libcli/auth: add netlogon_creds_cli* infrastructure

This provides an abstraction to hide netlogon_creds_CredentialState,
which is stored in a node local tdb.

Where the global state (netlogon_creds_CredentialState) between client and
server was only kept in memory (on the client side), we now use
the abstracted netlogon_creds_cli_context.

We now use a node specific computer name in order to establish
individual netlogon sessions per node.

If the caller wants to use some netlogon calls with credential chain
(struct netr_Authenticator), netlogon_creds_cli_lock*() is used
to get the current netlogon_creds_CredentialState in a g_lock'ed
fashion, a talloc_free() will release the lock.

The locking is needed as there might be more than one process
(multiple winbindd child, cmdline tools) which want to talk
to a specific domain controller. The usage of netlogon_creds_CredentialState
needs to be serialized as it uses sequence numbers.

LogonSamLogonEx doesn't use the credential chain, but for some operations
it needs the global session in order to de/encrypt individual fields.
It uses the lockless netlogon_creds_cli_get() and netlogon_creds_cli_validate()
functions, which just make sure the session hasn't changed between
get and validate.

This is prepares the proper fix for a large number of bugs:
https://bugzilla.samba.org/show_bug.cgi?id=6563
https://bugzilla.samba.org/show_bug.cgi?id=7944
https://bugzilla.samba.org/show_bug.cgi?id=7945
https://bugzilla.samba.org/show_bug.cgi?id=7568
https://bugzilla.samba.org/show_bug.cgi?id=8599

Signed-off-by: Stefan Metzmacher <metze@samba.org>
libcli/auth/netlogon_creds_cli.c [new file with mode: 0644]
libcli/auth/netlogon_creds_cli.h [new file with mode: 0644]
libcli/auth/wscript_build