summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamenim@samba.org>2010-10-01 03:29:33 +0300
committerKamen Mazdrashki <kamenim@samba.org>2010-10-03 01:24:57 +0300
commitda0f3bd2291e561fd8b6f0fafd4bf6cb52dad722 (patch)
treee7793e05c04084e132e9f43640674bed87d2fc50 /source4
parentd385d9a3178c6cc705f7cccf6688ba9b60571e96 (diff)
downloadsamba-da0f3bd2291e561fd8b6f0fafd4bf6cb52dad722.tar.gz
samba-da0f3bd2291e561fd8b6f0fafd4bf6cb52dad722.tar.bz2
samba-da0f3bd2291e561fd8b6f0fafd4bf6cb52dad722.zip
s4-getopt.py: Make Anonymous creds when no credentials
are supplied on command line and caller doesn't want us to guess credentials from environment
Diffstat (limited to 'source4')
-rw-r--r--source4/scripting/python/samba/getopt.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/source4/scripting/python/samba/getopt.py b/source4/scripting/python/samba/getopt.py
index 62c94e4411..08fe692ce0 100644
--- a/source4/scripting/python/samba/getopt.py
+++ b/source4/scripting/python/samba/getopt.py
@@ -196,13 +196,18 @@ class CredentialsOptionsDouble(CredentialsOptions):
def _set_simple_bind_dn2(self, option, opt_str, arg, parser):
self.creds2.set_bind_dn(arg)
- def get_credentials2(self, lp):
+ def get_credentials2(self, lp, guess=True):
"""Obtain the credentials set on the command-line.
:param lp: Loadparm object to use.
+ :param guess: Try guess Credentials from environment
:return: Credentials object
"""
- self.creds2.guess(lp)
+ if guess:
+ self.creds2.guess(lp)
+ elif not self.creds2.get_username():
+ self.creds2.set_anonymous()
+
if self.no_pass2:
self.creds2.set_cmdline_callbacks()
return self.creds2