lib/param: Allow enum values to also be white-space insentive in comparison

This makes it easier to specify these in the --option= syntax on the command line.

Change-Id: I6b2398d79d37407c5d82cd6b540651ede1d09106
Pair-Programmed-with: Garming Sam <garming@catalyst.net.nz>
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
gse_krb5: Avoid a segfault when we can not read the dedicated keytab file

This improved code simply cleans up the memory as soon as possible,
rather than using memcmp().  Otherwise, we segfault if
krb5_kt_start_seq_get fails, as it can set the fd element in the
handle to -1.

Change-Id: Ib4821ef944a7e12cd8a891ae07dbfc0567c65495
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-programmed-with: Garming Sam <garming@catalyst.net.nz>
Signed-off-by: Garming Sam <garming@catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Nov 27 07:38:02 CET 2014 on sn-devel-104
Revert "libcli/smb: mask off SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET for version 1"

This reverts commit a6affb7bb3ff595165e708c56ede2181f0bb570f.

This is not really needed. The caller should ignore this flag.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s3:smb2_create: send interim responses after 0.5 milliseconds

We don't have to care about delayed NT_STATUS_SHARING_VIOLATION anymore
after the following commit:

    commit 4111fcfd4f570d39d46a0d414546ca62c7b609be
    Author: Jeremy Allison <jra@samba.org>
    Date:   Thu May 2 11:12:47 2013 -0700

        Only do the 1 second delay for sharing violations for SMB1, not SMB2.

        Match Windows behavior.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s4:libcli/smb_composite: use the options on the transport

These are the options which really belong to the connection
and might not be the the same as the hints given from the caller.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s4:libcli/raw: fix up the max_protocol value for the current transport connection

This allows the caller to pass PROTOCOL_DEFAULT,
which results in PROTOCOL_NT1.

As smbcli_transport_init() is about SMB1 only we downgrade
to PROTOCOL_NT1 if a higher value (for SMB2 or SMB3) was given.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s4:libcli/smb2: allow the caller to specify a specific value for max_protocol.

The default is still PROTOCOL_LATEST. As smb2_connect*() is about SMB2/3 only
we upgrade to PROTOCOL_LATEST if PROTOCOL_NT1 or lower is given.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s4:param: don't expand PROTOCOL_DEFAULT in lpcfg_smbcli_options()

We let the low-level smb1 or smb2 code assign what PROTOCOL_DEFAULT means.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s4:libcli/smb2: add new_epoch to struct smb2_lease_break

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s4:libcli/smb2: initialize ls->lease_version

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s4:torture/smb2: skip lease tests if the server doesn't support them

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s4:torture/smb2: make lease tests more reliable by calling torture_wait_for_lease_break()

They now work against w2k8r2, w2012, w2012r2.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s4:torture/smb2: lease per test fnames

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s4:torture/smb2: verify lease_flags in CHECK_LEASE_BREAK()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s4:torture/smb2: always verify the v2 lease epoch.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s4:torture/smb2: don't check the lease break connection against samba3

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s4:torture/smb2: pass the expected flags to CHECK_LEASE()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s4:torture/smb2: add smb2.lease.[v2_]complex1 tests

These tests verify the lease state is consistent between two connections
with the same client_guid.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s4:torture/smb2: add smb2.lease.v2_epoch[2|3] tests

They demonstrate that the lease version (v1 or v2) is selected
by the first open. All following opens using the other version
still get the lease version of the first open.

This implies that the server has to remember the lease version
more globaly.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
s4:torture/smb2: make it possible to skip the automatic ack of lease breaks.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>