From bb7854afea47699be32f5331fe5f8f05e469cb96 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 24 Mar 2010 19:26:02 +1100 Subject: s4:cmdline Add --sign and --encrypt options to our common command line This allows ldbsearch to accept --sign and --encrypt. I'll soon work to integrate with the --signing= option in smbclient. Andrew Bartlett --- source4/lib/cmdline/popt_credentials.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/cmdline/popt_credentials.c b/source4/lib/cmdline/popt_credentials.c index 42ecac1eaa..80f71eb417 100644 --- a/source4/lib/cmdline/popt_credentials.c +++ b/source4/lib/cmdline/popt_credentials.c @@ -39,7 +39,7 @@ static bool dont_ask; -enum opt { OPT_SIMPLE_BIND_DN, OPT_PASSWORD, OPT_KERBEROS }; +enum opt { OPT_SIMPLE_BIND_DN, OPT_PASSWORD, OPT_KERBEROS, OPT_SIGN, OPT_ENCRYPT }; /* disable asking for a password @@ -66,6 +66,7 @@ static void popt_common_credentials_callback(poptContext con, cli_credentials_set_cmdline_callbacks(cmdline_credentials); } return; + } switch(opt->val) { @@ -119,9 +120,33 @@ static void popt_common_credentials_callback(poptContext con, } case OPT_SIMPLE_BIND_DN: + { cli_credentials_set_bind_dn(cmdline_credentials, arg); break; } + case OPT_SIGN: + { + uint32_t gensec_features; + + gensec_features = cli_credentials_get_gensec_features(cmdline_credentials); + + gensec_features |= GENSEC_FEATURE_SIGN; + cli_credentials_set_gensec_features(cmdline_credentials, + gensec_features); + break; + } + case OPT_ENCRYPT: + { + uint32_t gensec_features; + + gensec_features = cli_credentials_get_gensec_features(cmdline_credentials); + + gensec_features |= GENSEC_FEATURE_SEAL; + cli_credentials_set_gensec_features(cmdline_credentials, + gensec_features); + break; + } + } } @@ -135,5 +160,7 @@ struct poptOption popt_common_credentials[] = { { "machine-pass", 'P', POPT_ARG_NONE, NULL, 'P', "Use stored machine account password (implies -k)" }, { "simple-bind-dn", 0, POPT_ARG_STRING, NULL, OPT_SIMPLE_BIND_DN, "DN to use for a simple bind" }, { "kerberos", 'k', POPT_ARG_STRING, NULL, OPT_KERBEROS, "Use Kerberos" }, + { "sign", 'S', POPT_ARG_NONE, NULL, OPT_SIGN, "Sign connection to prevent modification in transit" }, + { "encrypt", 'e', POPT_ARG_NONE, NULL, OPT_ENCRYPT, "Encrypt connection for privacy" }, { NULL } }; -- cgit