summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-01-10 15:14:08 +0100
committerStefan Metzmacher <metze@samba.org>2012-01-12 23:58:11 +0100
commit15cdbba25469d65fc0b74d1a8ada3f5f35bd7c29 (patch)
tree63f8f490f550b207de8223ea1985dac2751d2ad2 /source4
parent5efe29baed70b0cbe732350a02b24fc23016e552 (diff)
downloadsamba-15cdbba25469d65fc0b74d1a8ada3f5f35bd7c29.tar.gz
samba-15cdbba25469d65fc0b74d1a8ada3f5f35bd7c29.tar.bz2
samba-15cdbba25469d65fc0b74d1a8ada3f5f35bd7c29.zip
s4:repl_cleartext_pwd.py: add optional 'clear_utf16_name' parameter
Not all cleartext password (machine passwords) can be converted to utf8, let's export the raw uint16_t array. metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Thu Jan 12 23:58:12 CET 2012 on sn-devel-104
Diffstat (limited to 'source4')
-rwxr-xr-xsource4/scripting/devel/repl_cleartext_pwd.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/source4/scripting/devel/repl_cleartext_pwd.py b/source4/scripting/devel/repl_cleartext_pwd.py
index d4ad6f0846..840d281a6e 100755
--- a/source4/scripting/devel/repl_cleartext_pwd.py
+++ b/source4/scripting/devel/repl_cleartext_pwd.py
@@ -76,7 +76,7 @@ def attid_equal(a1,a2):
########### main code ###########
if __name__ == "__main__":
- parser = OptionParser("repl_cleartext_pwd.py [options] server dn cookie_file cleartext_name [attid attname attmode]")
+ parser = OptionParser("repl_cleartext_pwd.py [options] server dn cookie_file clear_utf8_name [attid attname attmode] [clear_utf16_name")
sambaopts = options.SambaOptions(parser)
credopts = options.CredentialsOptions(parser)
parser.add_option_group(credopts)
@@ -85,7 +85,9 @@ if __name__ == "__main__":
if len(args) == 4:
pass
- elif len(args) >= 7:
+ elif len(args) == 7:
+ pass
+ elif len(args) >= 8:
pass
else:
parser.error("more arguments required - given=%d" % (len(args)))
@@ -95,7 +97,7 @@ if __name__ == "__main__":
cookie_file = args[2]
if len(cookie_file) == 0:
cookie_file = None
- cleartext_name = args[3]
+ clear_utf8_name = args[3]
if len(args) >= 7:
try:
attid = int(args[4], 16)
@@ -109,6 +111,10 @@ if __name__ == "__main__":
attid = -1
attname = None
attmode = "raw"
+ if len(args) >= 8:
+ clear_utf16_name = args[7]
+ else:
+ clear_utf16_name = None
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp)
@@ -313,10 +319,14 @@ if __name__ == "__main__":
if cleartext_hex is not None:
cleartext_utf16 = binascii.a2b_hex(cleartext_hex)
- cleartext_unicode = unicode(cleartext_utf16, 'utf-16-le')
- cleartext_utf8 = cleartext_unicode.encode('utf-8')
-
- gls.add_attr(obj.identifier.dn, cleartext_name, [cleartext_utf8])
+ if clear_utf16_name is not None:
+ gls.add_attr(obj.identifier.dn, clear_utf16_name, [cleartext_utf16])
+ try:
+ cleartext_unicode = unicode(cleartext_utf16, 'utf-16-le')
+ cleartext_utf8 = cleartext_unicode.encode('utf-8')
+ gls.add_attr(obj.identifier.dn, clear_utf8_name, [cleartext_utf8])
+ except:
+ pass
if attvals is not None:
gls.add_attr(obj.identifier.dn, attname, attvals)