[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Wed Jun 16 01:26:01 UTC 2021


The branch, master has been updated
       via  d37462d79a4 lib:ldb-samba: Migrate samba extensions to new cmdline option parser
       via  1d3af5d3363 lib:ldb-samba: Use talloc_zero_array() and use ldb as the mem context
       via  c2c7c1f50a8 lib:ldb-samba: Improve calculate_popt_array_length()
       via  a593065c7f2 lib:ldb: Use C99 initializers for builtin_popt_options[]
       via  ba32b542cdc s4:torture: Migrate masktest to new cmdline option parser
       via  caafb3cd4a2 s4:torture: Migrate locktest to new cmdline option parser
       via  c0034d309e1 s4:torture: Change -U|--user to --user1 and --user2
       via  b4c1f438455 s4:torture: Migrate gentest to new cmdline option parser
       via  2a0471df01f s4:torture: Change -U|--user to --user1 and --user2
       via  4b4fd5340a3 testprogs: Add smbtorture tests with new options
       via  a40bc1d0eec s4:torture: Migrate smbtorture to new cmdline option parser
       via  092d26af6ad s4:torture: Pass the pkinit ccache via a torture variable
       via  10caa8590c7 s4:torture: For NTLM make sure we have CRED_USE_KERBEROS_DESIRED
       via  59c97b09a82 s4:torture: Write better error on invalid cmdline option
       via  30fb11dafde s4:torture: Remove unused include
       via  48a5f934bbd s4:client: Migrate cifsdd to new cmdline option parser
       via  c01213471fe testprogs: Use new kerberos options for smbclient(4) tests
       via  b49a8605563 s4:client: Migrate smbclient4 to new cmdline option parser
       via  ea6c2fbfa97 s4:client: Use a creds helper variable
       via  db876e95b52 testprogs: Remove --debuglevel from test_kinit_trusts_mit.sh
      from  1f724a9f9bb heimdal_build: Use lib/asn1/rfc2459.opt rather than hard-coded

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit d37462d79a4063ac06d2f5e6514b7c082cc26b21
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Dec 2 18:06:24 2020 +0100

    lib:ldb-samba: Migrate samba extensions to new cmdline option parser
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Wed Jun 16 01:25:28 UTC 2021 on sn-devel-184

commit 1d3af5d336383a7511c50542f4262764309d8230
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Dec 18 08:38:22 2020 +0100

    lib:ldb-samba: Use talloc_zero_array() and use ldb as the mem context
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c2c7c1f50a8acb3169e19ba4329aa78839b66def
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 17 19:16:13 2020 +0100

    lib:ldb-samba: Improve calculate_popt_array_length()
    
    Note that memcmp() doesn't work well with padding bytes. So avoid it!
    
    (gdb) ptype/o struct poptOption
    /* offset    |  size */  type = struct poptOption {
    /*    0      |     8 */    const char *longName;
    /*    8      |     1 */    char shortName;
    /* XXX  3-byte hole  */
    /*   12      |     4 */    unsigned int argInfo;
    /*   16      |     8 */    void *arg;
    /*   24      |     4 */    int val;
    /* XXX  4-byte hole  */
    /*   32      |     8 */    const char *descrip;
    /*   40      |     8 */    const char *argDescrip;
    
                               /* total size (bytes):   48 */
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit a593065c7f22e17434f33d0132cc6a7073acf414
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 17 11:56:08 2020 +0100

    lib:ldb: Use C99 initializers for builtin_popt_options[]
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit ba32b542cdc0a8f4164012e002e519c370ba2ff2
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 17 17:12:10 2020 +0100

    s4:torture: Migrate masktest to new cmdline option parser
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit caafb3cd4a229974a88d1b355890e31b65e15e8d
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 17 17:05:51 2020 +0100

    s4:torture: Migrate locktest to new cmdline option parser
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c0034d309e18a888a93f0c42dcd0d95c35ce8bad
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 17 16:55:02 2020 +0100

    s4:torture: Change -U|--user to --user1 and --user2
    
    The '-U' option is already defined by the default cmdline parser!
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b4c1f438455c91f19957ab9b69c32947c55bdf79
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 17 16:25:08 2020 +0100

    s4:torture: Migrate gentest to new cmdline option parser
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 2a0471df01fc81b638aa4b9c61714a6181f5e980
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 17 16:24:48 2020 +0100

    s4:torture: Change -U|--user to --user1 and --user2
    
    The '-U' option is already defined by the default cmdline parser!
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 4b4fd5340a3a3472837aa72e266b688370ad5b09
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 3 08:02:58 2020 +0100

    testprogs: Add smbtorture tests with new options
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit a40bc1d0eecf46ff577ebdaa55b92a63c24f4514
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Dec 2 17:24:22 2020 +0100

    s4:torture: Migrate smbtorture to new cmdline option parser
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 092d26af6adda3d1c476e869f48a2a76065658aa
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Dec 16 15:18:26 2020 +0100

    s4:torture: Pass the pkinit ccache via a torture variable
    
    Mixing -Uuser%password and --krb5-ccache doesn't really work on the
    cmdline as -U overwrited the ccache.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 10caa8590c77ea0929327f005a912241fb4cf423
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Dec 16 10:56:23 2020 +0100

    s4:torture: For NTLM make sure we have CRED_USE_KERBEROS_DESIRED
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 59c97b09a82ba7b89b6c7570e1bdbef530775375
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Dec 9 10:49:51 2020 +0100

    s4:torture: Write better error on invalid cmdline option
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 30fb11dafdeab53608e561f7615addd3abafbf08
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Dec 2 17:16:49 2020 +0100

    s4:torture: Remove unused include
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 48a5f934bbdb6b879febeec84064660d3d4e3829
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Dec 18 13:55:59 2020 +0100

    s4:client: Migrate cifsdd to new cmdline option parser
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit c01213471fe77c6b07c1008a4b4f5153afffa71e
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Nov 19 17:43:58 2020 +0100

    testprogs: Use new kerberos options for smbclient(4) tests
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b49a8605563c90467b5e22cea755bdbf1248c846
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Nov 19 09:40:53 2020 +0100

    s4:client: Migrate smbclient4 to new cmdline option parser
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit ea6c2fbfa97cb434060ced6d0cddf048c29fb4a2
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Nov 19 09:33:53 2020 +0100

    s4:client: Use a creds helper variable
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit db876e95b52dcf9fa9f08c895768f939bbff36bb
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Jun 1 11:12:07 2021 +0200

    testprogs: Remove --debuglevel from test_kinit_trusts_mit.sh
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 lib/ldb-samba/samba_extensions.c                 |  84 ++++++--
 lib/ldb-samba/wscript_build                      |   2 +-
 lib/ldb/tools/cmdline.c                          | 252 ++++++++++++++++++++---
 nsswitch/libwbclient/tests/wbclient.c            |  44 ++--
 selftest/knownfail                               |   2 +-
 selftest/knownfail.d/ntlmv2-restrictions         |   2 +-
 selftest/knownfail.d/smb1-tests                  |   6 +-
 selftest/knownfail.d/usage                       |   6 -
 source3/script/tests/test_smbclient_krb5.sh      |   2 +-
 source3/script/tests/test_smbd_no_krb5.sh        |   6 +-
 source3/selftest/tests.py                        |   6 +-
 source4/client/cifsdd.c                          |  51 ++++-
 source4/client/cifsddio.c                        |   4 +-
 source4/client/client.c                          |  69 +++++--
 source4/client/tests/test_smbclient.sh           |   2 +-
 source4/selftest/tests.py                        |  32 +--
 source4/torture/auth/ntlmssp.c                   |   6 +-
 source4/torture/basic/misc.c                     |   4 +-
 source4/torture/dns/dlz_bind9.c                  |  10 +-
 source4/torture/drs/rpc/dssync.c                 |   6 +-
 source4/torture/drs/rpc/msds_intid.c             |   4 +-
 source4/torture/drs/wscript_build                |   2 +-
 source4/torture/gentest.c                        |  57 +++--
 source4/torture/krb5/kdc-canon-heimdal.c         |  22 +-
 source4/torture/krb5/kdc-heimdal.c               |  22 +-
 source4/torture/krb5/kdc-mit.c                   |  16 +-
 source4/torture/krb5/wscript_build               |   4 +-
 source4/torture/ldap/basic.c                     |   6 +-
 source4/torture/ldap/ldap_sort.c                 |   4 +-
 source4/torture/ldap/nested_search.c             |   4 +-
 source4/torture/ldap/schema.c                    |   4 +-
 source4/torture/ldap/session_expiry.c            |   4 +-
 source4/torture/ldap/uptodatevector.c            |   4 +-
 source4/torture/libnet/libnet_BecomeDC.c         |   4 +-
 source4/torture/libnet/libnet_domain.c           |  14 +-
 source4/torture/libnet/libnet_group.c            |   6 +-
 source4/torture/libnet/libnet_lookup.c           |  10 +-
 source4/torture/libnet/libnet_rpc.c              |   4 +-
 source4/torture/libnet/libnet_share.c            |   6 +-
 source4/torture/libnet/libnet_user.c             |   4 +-
 source4/torture/libnet/utils.c                   |   6 +-
 source4/torture/libnetapi/libnetapi.c            |   6 +-
 source4/torture/libnetapi/wscript_build          |   2 +-
 source4/torture/libsmbclient/libsmbclient.c      |  12 +-
 source4/torture/libsmbclient/wscript_build       |   2 +-
 source4/torture/local/wscript_build              |   2 +-
 source4/torture/locktest.c                       |  61 ++++--
 source4/torture/masktest.c                       |  38 +++-
 source4/torture/raw/composite.c                  |   6 +-
 source4/torture/raw/context.c                    |  16 +-
 source4/torture/raw/lock.c                       |   4 +-
 source4/torture/raw/lockbench.c                  |   4 +-
 source4/torture/raw/openbench.c                  |   4 +-
 source4/torture/raw/oplock.c                     |   4 +-
 source4/torture/raw/session.c                    |  18 +-
 source4/torture/raw/tconrate.c                   |   4 +-
 source4/torture/rpc/async_bind.c                 |   4 +-
 source4/torture/rpc/backupkey.c                  |  10 +-
 source4/torture/rpc/bind.c                       |  10 +-
 source4/torture/rpc/dfs.c                        |   6 +-
 source4/torture/rpc/dsgetinfo.c                  |   4 +-
 source4/torture/rpc/fsrvp.c                      |  10 +-
 source4/torture/rpc/iremotewinspool_driver.c     |   4 +-
 source4/torture/rpc/mdssvc.c                     |   2 +-
 source4/torture/rpc/netlogon.c                   |  18 +-
 source4/torture/rpc/remote_pac.c                 |  78 +++++--
 source4/torture/rpc/rpc.c                        |  12 +-
 source4/torture/rpc/samba3rpc.c                  |  60 +++---
 source4/torture/rpc/samlogon.c                   |  26 +--
 source4/torture/rpc/schannel.c                   |  10 +-
 source4/torture/rpc/session_key.c                |   4 +-
 source4/torture/rpc/spoolss.c                    |   6 +-
 source4/torture/rpc/spoolss_access.c             |   2 +-
 source4/torture/rpc/testjoin.c                   |  10 +-
 source4/torture/rpc/witness.c                    |   4 +-
 source4/torture/rpc/wkssvc.c                     |   8 +-
 source4/torture/shell.c                          |  24 +--
 source4/torture/smb2/acls.c                      |   4 +-
 source4/torture/smb2/create.c                    |   2 +-
 source4/torture/smb2/multichannel.c              |  22 +-
 source4/torture/smb2/notify.c                    |   2 +-
 source4/torture/smb2/notify_disabled.c           |   2 +-
 source4/torture/smb2/oplock.c                    |   4 +-
 source4/torture/smb2/replay.c                    |  14 +-
 source4/torture/smb2/scan.c                      |   6 +-
 source4/torture/smb2/session.c                   |  50 ++---
 source4/torture/smb2/util.c                      |   8 +-
 source4/torture/smb2/wscript_build               |   2 +-
 source4/torture/smbtorture.c                     | 121 ++++++-----
 source4/torture/tests/test_gentest.sh            |   2 +-
 source4/torture/tests/test_locktest.sh           |   2 +-
 source4/torture/torture.c                        |   1 -
 source4/torture/unix/unix_info2.c                |   4 +-
 source4/torture/unix/whoami.c                    |   8 +-
 source4/torture/util_smb.c                       |   6 +-
 source4/torture/vfs/acl_xattr.c                  |   4 +-
 source4/torture/vfs/fruit.c                      |   2 +-
 source4/torture/vfs/vfs.c                        |   2 +-
 source4/torture/winbind/winbind.c                |   4 +-
 source4/torture/wscript_build                    |  28 +--
 source4/utils/tests/test_smbclient.sh            |   4 +-
 source4/wscript_build                            |   4 +-
 testprogs/blackbox/test_chgdcpass.sh             |   8 +-
 testprogs/blackbox/test_client_kerberos.sh       |  33 ++-
 testprogs/blackbox/test_export_keytab_heimdal.sh |   4 +-
 testprogs/blackbox/test_export_keytab_mit.sh     |   4 +-
 testprogs/blackbox/test_kinit_heimdal.sh         |  36 ++--
 testprogs/blackbox/test_kinit_mit.sh             |  32 +--
 testprogs/blackbox/test_kinit_trusts_heimdal.sh  |  20 +-
 testprogs/blackbox/test_kinit_trusts_mit.sh      |  20 +-
 testprogs/blackbox/test_kpasswd_mit.sh           |  12 +-
 testprogs/blackbox/test_password_settings.sh     |  20 +-
 testprogs/blackbox/test_pkinit_heimdal.sh        |  26 +--
 testprogs/blackbox/test_pkinit_pac_heimdal.sh    |   2 +-
 114 files changed, 1148 insertions(+), 675 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/ldb-samba/samba_extensions.c b/lib/ldb-samba/samba_extensions.c
index 65a4079ec97..be92d982dde 100644
--- a/lib/ldb-samba/samba_extensions.c
+++ b/lib/ldb-samba/samba_extensions.c
@@ -24,7 +24,7 @@
 
 #include "includes.h"
 #include "ldb_module.h"
-#include "lib/cmdline/popt_common.h"
+#include "lib/cmdline/cmdline.h"
 #include "auth/gensec/gensec.h"
 #include "auth/auth.h"
 #include "param/param.h"
@@ -34,26 +34,35 @@
 #include "popt.h"
 
 
+static bool is_popt_table_end(const struct poptOption *o)
+{
+	if (o->longName == NULL &&
+	    o->shortName =='\0' &&
+	    o->arg == NULL) {
+		return true;
+	}
+
+	return false;
+}
 
 /*
   work out the length of a popt array
  */
-static unsigned calculate_popt_array_length(struct poptOption *opts)
+static size_t calculate_popt_array_length(struct poptOption *opts)
 {
-	unsigned i;
-	struct poptOption zero_opt = { 0 };
-	for (i=0; memcmp(&zero_opt, &opts[i], sizeof(zero_opt)) != 0; i++) ;
+	size_t i = 0;
+
+	for (i = 0; i < UINT32_MAX; i++) {
+		struct poptOption *o = &(opts[i]);
+
+		if (is_popt_table_end(o)) {
+			break;
+		}
+	}
+
 	return i;
 }
 
-static struct poptOption cmdline_extensions[] = {
-	POPT_COMMON_SAMBA
-	POPT_COMMON_CREDENTIALS
-	POPT_COMMON_CONNECTION
-	POPT_COMMON_VERSION
-	{0}
-};
-
 /*
   called to register additional command line options
  */
@@ -61,42 +70,77 @@ static int extensions_hook(struct ldb_context *ldb, enum ldb_module_hook_type t)
 {
 	switch (t) {
 	case LDB_MODULE_HOOK_CMDLINE_OPTIONS: {
-		unsigned len1, len2;
+		size_t len1, len2;
 		struct poptOption **popt_options = ldb_module_popt_options(ldb);
-		struct poptOption *new_array;
+		struct poptOption *new_array = NULL;
+		bool ok;
+
+		struct poptOption cmdline_extensions[] = {
+			POPT_COMMON_SAMBA_LDB
+			POPT_COMMON_CONNECTION
+			POPT_COMMON_CREDENTIALS
+			POPT_LEGACY_S4
+			POPT_COMMON_VERSION
+			POPT_TABLEEND
+		};
+
+		ok = samba_cmdline_init(ldb,
+					SAMBA_CMDLINE_CONFIG_CLIENT,
+					false /* require_smbconf */);
+		if (!ok) {
+			return ldb_oom(ldb);
+		}
 
 		len1 = calculate_popt_array_length(*popt_options);
 		len2 = calculate_popt_array_length(cmdline_extensions);
-		new_array = talloc_array(NULL, struct poptOption, len1+len2+1);
+		new_array = talloc_array(ldb,
+					 struct poptOption,
+					 len1 + len2 + 1);
 		if (NULL == new_array) {
 			return ldb_oom(ldb);
 		}
 
 		memcpy(new_array, *popt_options, len1*sizeof(struct poptOption));
 		memcpy(new_array+len1, cmdline_extensions, (1+len2)*sizeof(struct poptOption));
+
+#ifdef DEVELOPER
+		ok = samba_cmdline_sanity_check(new_array);
+		if (!ok) {
+			talloc_free(new_array);
+			return ldb_error(ldb,
+					 LDB_ERR_OPERATIONS_ERROR,
+					 "Duplicate cmdline options detected!");
+		}
+#endif
+
 		(*popt_options) = new_array;
 		return LDB_SUCCESS;
 	}
 
 	case LDB_MODULE_HOOK_CMDLINE_PRECONNECT: {
+		struct loadparm_context *lp_ctx = NULL;
+		struct cli_credentials *creds = NULL;
+
 		int r = ldb_register_samba_handlers(ldb);
 		if (r != LDB_SUCCESS) {
 			return ldb_operr(ldb);
 		}
 		gensec_init();
 
+		lp_ctx = samba_cmdline_get_lp_ctx();
+		creds = samba_cmdline_get_creds();
+
 		if (ldb_set_opaque(
 			ldb,
 			DSDB_SESSION_INFO,
-			system_session(cmdline_lp_ctx))) {
+			system_session(lp_ctx))) {
 
 			return ldb_operr(ldb);
 		}
-		if (ldb_set_opaque(ldb, "credentials",
-				popt_get_cmdline_credentials())) {
+		if (ldb_set_opaque(ldb, "credentials", creds)) {
 			return ldb_operr(ldb);
 		}
-		if (ldb_set_opaque(ldb, "loadparm", cmdline_lp_ctx)) {
+		if (ldb_set_opaque(ldb, "loadparm", lp_ctx)) {
 			return ldb_operr(ldb);
 		}
 
diff --git a/lib/ldb-samba/wscript_build b/lib/ldb-samba/wscript_build
index 3264757e8b7..d02bc9564de 100644
--- a/lib/ldb-samba/wscript_build
+++ b/lib/ldb-samba/wscript_build
@@ -30,7 +30,7 @@ bld.SAMBA_MODULE('ldbsamba_extensions',
                  init_function='ldb_samba_extensions_init',
                  module_init_name='ldb_init_module',
                  subsystem='ldb',
-                 deps='ldb ldbsamba POPT_SAMBA POPT_CREDENTIALS cmdline-credentials gensec',
+                 deps='ldb ldbsamba CMDLINE_S4 gensec',
                  internal_module=False)
 
 
diff --git a/lib/ldb/tools/cmdline.c b/lib/ldb/tools/cmdline.c
index c32470864d4..ff25fe05ec7 100644
--- a/lib/ldb/tools/cmdline.c
+++ b/lib/ldb/tools/cmdline.c
@@ -34,32 +34,232 @@ enum ldb_cmdline_options { CMDLINE_RELAX=1 };
 
 static struct poptOption builtin_popt_options[] = {
 	POPT_AUTOHELP
-	{ "url",       'H', POPT_ARG_STRING, &options.url, 0, "database URL", "URL" },
-	{ "basedn",    'b', POPT_ARG_STRING, &options.basedn, 0, "base DN", "DN" },
-	{ "editor",    'e', POPT_ARG_STRING, &options.editor, 0, "external editor", "PROGRAM" },
-	{ "scope",     's', POPT_ARG_STRING, NULL, 's', "search scope", "SCOPE" },
-	{ "verbose",   'v', POPT_ARG_NONE, NULL, 'v', "increase verbosity", NULL },
-	{ "trace",     0,   POPT_ARG_NONE, &options.tracing, 0, "enable tracing", NULL },
-	{ "interactive", 'i', POPT_ARG_NONE, &options.interactive, 0, "input from stdin", NULL },
-	{ "recursive", 'r', POPT_ARG_NONE, &options.recursive, 0, "recursive delete", NULL },
-	{ "modules-path", 0, POPT_ARG_STRING, &options.modules_path, 0, "modules path", "PATH" },
-	{ "num-searches", 0, POPT_ARG_INT, &options.num_searches, 0, "number of test searches", NULL },
-	{ "num-records", 0, POPT_ARG_INT, &options.num_records, 0, "number of test records", NULL },
-	{ "all", 'a',    POPT_ARG_NONE, &options.all_records, 0, "(|(objectClass=*)(distinguishedName=*))", NULL },
-	{ "nosync", 0,   POPT_ARG_NONE, &options.nosync, 0, "non-synchronous transactions", NULL },
-	{ "sorted", 'S', POPT_ARG_NONE, &options.sorted, 0, "sort attributes", NULL },
-	{ NULL,    'o', POPT_ARG_STRING, NULL, 'o', "ldb_connect option", "OPTION" },
-	{ "controls", 0, POPT_ARG_STRING, NULL, 'c', "controls", NULL },
-	{ "show-binary", 0, POPT_ARG_NONE, &options.show_binary, 0, "display binary LDIF", NULL },
-	{ "paged", 0, POPT_ARG_NONE, NULL, 'P', "use a paged search", NULL },
-	{ "show-deleted", 0, POPT_ARG_NONE, NULL, 'D', "show deleted objects", NULL },
-	{ "show-recycled", 0, POPT_ARG_NONE, NULL, 'R', "show recycled objects", NULL },
-	{ "show-deactivated-link", 0, POPT_ARG_NONE, NULL, 'd', "show deactivated links", NULL },
-	{ "reveal", 0, POPT_ARG_NONE, NULL, 'r', "reveal ldb internals", NULL },
-	{ "relax", 0, POPT_ARG_NONE, NULL, CMDLINE_RELAX, "pass relax control", NULL },
-	{ "cross-ncs", 0, POPT_ARG_NONE, NULL, 'N', "search across NC boundaries", NULL },
-	{ "extended-dn", 0, POPT_ARG_NONE, NULL, 'E', "show extended DNs", NULL },
-	{0}
+	{
+		.longName   = "url",
+		.shortName  = 'H',
+		.argInfo    = POPT_ARG_STRING,
+		.arg        = &options.url,
+		.val        = 0,
+		.descrip    = "database URL",
+		.argDescrip = "URL"
+	},
+	{
+		.longName   = "basedn",
+		.shortName  = 'b',
+		.argInfo    = POPT_ARG_STRING,
+		.arg        = &options.basedn,
+		.val        = 0,
+		.descrip    = "base DN",
+		.argDescrip = "DN"
+	},
+	{
+		.longName   = "editor",
+		.shortName  = 'e',
+		.argInfo    = POPT_ARG_STRING,
+		.arg        = &options.editor,
+		.val        = 0,
+		.descrip    = "external editor",
+		.argDescrip = "PROGRAM"
+	},
+	{
+		.longName   = "scope",
+		.shortName  = 's',
+		.argInfo    = POPT_ARG_STRING,
+		.arg        = NULL,
+		.val        = 's',
+		.descrip    = "search scope",
+		.argDescrip = "SCOPE"
+	},
+	{
+		.longName   = "verbose",
+		.shortName  = 'v',
+		.argInfo    = POPT_ARG_NONE,
+		.arg        = NULL,
+		.val        = 'v',
+		.descrip    = "increase verbosity",
+		.argDescrip = NULL
+	},
+	{
+		.longName   = "trace",
+		.shortName  = 0,
+		.argInfo    = POPT_ARG_NONE,
+		.arg        = &options.tracing,
+		.val        = 0,
+		.descrip    = "enable tracing",
+		.argDescrip = NULL
+	},
+	{
+		.longName   = "interactive",
+		.shortName  = 'i',
+		.argInfo    = POPT_ARG_NONE,
+		.arg        = &options.interactive,
+		.val        = 0,
+		.descrip    = "input from stdin",
+		.argDescrip = NULL
+	},
+	{
+		.longName   = "recursive",
+		.shortName  = 'r',
+		.argInfo    = POPT_ARG_NONE,
+		.arg        = &options.recursive,
+		.val        = 0,
+		.descrip    = "recursive delete",
+		.argDescrip = NULL
+	},
+	{
+		.longName   = "modules-path",
+		.shortName  = 0,
+		.argInfo    = POPT_ARG_STRING,
+		.arg        = &options.modules_path,
+		.val        = 0,
+		.descrip    = "modules path",
+		.argDescrip = "PATH"
+	},
+	{
+		.longName   = "num-searches",
+		.shortName  = 0,
+		.argInfo    = POPT_ARG_INT,
+		.arg        = &options.num_searches,
+		.val        = 0,
+		.descrip    = "number of test searches",
+		.argDescrip = NULL
+	},
+	{
+		.longName   = "num-records",
+		.shortName  = 0,
+		.argInfo    = POPT_ARG_INT,
+		.arg        = &options.num_records,
+		.val        = 0,
+		.descrip    = "number of test records",
+		.argDescrip = NULL
+	},
+	{
+		.longName   = "all",
+		.shortName  = 'a',
+		.argInfo    = POPT_ARG_NONE,
+		.arg        = &options.all_records,
+		.val        = 0,
+		.descrip    = "(|(objectClass=*)(distinguishedName=*))",
+		.argDescrip = NULL
+	},
+	{
+		.longName   = "nosync",
+		.shortName  = 0,
+		.argInfo    = POPT_ARG_NONE,
+		.arg        = &options.nosync,
+		.val        = 0,
+		.descrip    = "non-synchronous transactions",
+		.argDescrip = NULL
+	},
+	{
+		.longName   = "sorted",
+		.shortName  = 'S',
+		.argInfo    = POPT_ARG_NONE,
+		.arg        = &options.sorted,
+		.val        = 0,
+		.descrip    = "sort attributes",
+		.argDescrip = NULL
+	},
+	{
+		.longName   = NULL,
+		.shortName  = 'o',
+		.argInfo    = POPT_ARG_STRING,
+		.arg        = NULL,
+		.val        = 'o',
+		.descrip    = "ldb_connect option",
+		.argDescrip = "OPTION"
+	},
+	{
+		.longName   = "controls",
+		.shortName  = 0,
+		.argInfo    = POPT_ARG_STRING,
+		.arg        = NULL,
+		.val        = 'c',
+		.descrip    = "controls",
+		.argDescrip = NULL
+	},
+	{
+		.longName   = "show-binary",
+		.shortName  = 0,
+		.argInfo    = POPT_ARG_NONE,
+		.arg        = &options.show_binary,
+		.val        = 0,
+		.descrip    = "display binary LDIF",
+		.argDescrip = NULL
+	},
+	{
+		.longName   = "paged",
+		.shortName  = 0,
+		.argInfo    = POPT_ARG_NONE,
+		.arg        = NULL,
+		.val        = 'P',
+		.descrip    = "use a paged search",
+		.argDescrip = NULL
+	},
+	{
+		.longName   = "show-deleted",
+		.shortName  = 0,
+		.argInfo    = POPT_ARG_NONE,
+		.arg        = NULL,
+		.val        = 'D',
+		.descrip    = "show deleted objects",
+		.argDescrip = NULL
+	},
+	{
+		.longName   = "show-recycled",
+		.shortName  = 0,
+		.argInfo    = POPT_ARG_NONE,
+		.arg        = NULL,
+		.val        = 'R',
+		.descrip    = "show recycled objects",
+		.argDescrip = NULL
+	},
+	{
+		.longName   = "show-deactivated-link",
+		.shortName  = 0,
+		.argInfo    = POPT_ARG_NONE,
+		.arg        = NULL,
+		.val        = 'd',
+		.descrip    = "show deactivated links",
+		.argDescrip = NULL
+	},
+	{
+		.longName   = "reveal",
+		.shortName  = 0,
+		.argInfo    = POPT_ARG_NONE,
+		.arg        = NULL,
+		.val        = 'r',
+		.descrip    = "reveal ldb internals",
+		.argDescrip = NULL
+	},
+	{
+		.longName   = "relax",
+		.shortName  = 0,
+		.argInfo    = POPT_ARG_NONE,
+		.arg        = NULL,
+		.val        = CMDLINE_RELAX,
+		.descrip    = "pass relax control",
+		.argDescrip = NULL
+	},
+	{
+		.longName   = "cross-ncs",
+		.shortName  = 0,
+		.argInfo    = POPT_ARG_NONE,
+		.arg        = NULL,
+		.val        = 'N',
+		.descrip    = "search across NC boundaries",
+		.argDescrip = NULL
+	},
+	{
+		.longName   = "extended-dn",
+		.shortName  = 0,
+		.argInfo    = POPT_ARG_NONE,
+		.arg        = NULL,
+		.val        = 'E',
+		.descrip    = "show extended DNs",
+		.argDescrip = NULL
+	},
+	POPT_TABLEEND
 };
 
 void ldb_cmdline_help(struct ldb_context *ldb, const char *cmdname, FILE *f)
diff --git a/nsswitch/libwbclient/tests/wbclient.c b/nsswitch/libwbclient/tests/wbclient.c
index 6e67b8a6104..254070ed083 100644
--- a/nsswitch/libwbclient/tests/wbclient.c
+++ b/nsswitch/libwbclient/tests/wbclient.c
@@ -32,7 +32,7 @@
 #include "lib/param/param.h"
 #include "lib/util/samba_util.h"
 #include "auth/credentials/credentials.h"
-#include "lib/cmdline/popt_common.h"
+#include "lib/cmdline/cmdline.h"
 
 #include <gnutls/gnutls.h>
 #include <gnutls/crypto.h>
@@ -756,16 +756,17 @@ static bool test_wbc_authenticate_user_int(struct torture_context *tctx,
 	struct wbcAuthUserInfo *info = NULL;
 	struct wbcAuthErrorInfo *error = NULL;
 	wbcErr ret;
+	struct cli_credentials *creds = samba_cmdline_get_creds();
 
 	ret = wbcAuthenticateUser(cli_credentials_get_username(
-			popt_get_cmdline_credentials()), correct_password);
+			creds), correct_password);
 	torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
 		 "wbcAuthenticateUser of %s failed",
-		 cli_credentials_get_username(popt_get_cmdline_credentials()));
+		 cli_credentials_get_username(creds));
 
 	ZERO_STRUCT(params);
 	params.account_name		=
-		cli_credentials_get_username(popt_get_cmdline_credentials());
+		cli_credentials_get_username(creds);
 	params.level			= WBC_AUTH_USER_LEVEL_PLAIN;
 	params.password.plaintext	= correct_password;
 
@@ -794,15 +795,18 @@ static bool test_wbc_authenticate_user_int(struct torture_context *tctx,
 
 static bool test_wbc_authenticate_user(struct torture_context *tctx)
 {
+	struct cli_credentials *creds = samba_cmdline_get_creds();
+
 	return test_wbc_authenticate_user_int(tctx,
-		cli_credentials_get_password(popt_get_cmdline_credentials()));
+		cli_credentials_get_password(creds));
 }
 
 static bool test_wbc_change_password(struct torture_context *tctx)
 {
 	wbcErr ret;
+	struct cli_credentials *creds = samba_cmdline_get_creds();
 	const char *oldpass =
-		cli_credentials_get_password(popt_get_cmdline_credentials());
+		cli_credentials_get_password(creds);
 	const char *newpass = "Koo8irei%$";
 
 	struct samr_CryptPassword new_nt_password;
@@ -891,9 +895,9 @@ static bool test_wbc_change_password(struct torture_context *tctx)
 
 	params.level = WBC_CHANGE_PASSWORD_LEVEL_RESPONSE;
 	params.account_name =
-		cli_credentials_get_username(popt_get_cmdline_credentials());
+		cli_credentials_get_username(creds);
 	params.domain_name =
-		cli_credentials_get_domain(popt_get_cmdline_credentials());
+		cli_credentials_get_domain(creds);
 
 	ret = wbcChangeUserPasswordEx(&params, NULL, NULL, NULL);
 	torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
@@ -904,14 +908,14 @@ static bool test_wbc_change_password(struct torture_context *tctx)
 	}
 
 	ret = wbcChangeUserPassword(
-		cli_credentials_get_username(popt_get_cmdline_credentials()),
+		cli_credentials_get_username(creds),
 		newpass,
-		cli_credentials_get_password(popt_get_cmdline_credentials()));
+		cli_credentials_get_password(creds));
 	torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
 				 "wbcChangeUserPassword for %s failed", params.account_name);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list