From 6c87f831806af51539824244d684c2431b8e7af7 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Mon, 19 May 2008 14:31:02 -0400 Subject: Don't pass the Directory Manager password on the command-line to ldapmodify. 446865 --- ipa-server/ipaserver/krbinstance.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'ipa-server/ipaserver/krbinstance.py') diff --git a/ipa-server/ipaserver/krbinstance.py b/ipa-server/ipaserver/krbinstance.py index 50250f63..7ad03e1c 100644 --- a/ipa-server/ipaserver/krbinstance.py +++ b/ipa-server/ipaserver/krbinstance.py @@ -211,13 +211,20 @@ class KrbInstance(service.Service): txt = ipautil.template_file(ipautil.SHARE_DIR + ldif, self.sub_dict) fd = ipautil.write_tmp_file(txt) + [pw_fd, pw_name] = tempfile.mkstemp() + os.write(pw_fd, self.admin_password) + os.close(pw_fd) + args = ["/usr/bin/ldapmodify", "-h", "127.0.0.1", "-xv", - "-D", "cn=Directory Manager", "-w", self.admin_password, "-f", fd.name] + "-D", "cn=Directory Manager", "-y", pw_name, "-f", fd.name] try: - ipautil.run(args) - except ipautil.CalledProcessError, e: - logging.critical("Failed to load %s: %s" % (ldif, str(e))) + try: + ipautil.run(args) + except ipautil.CalledProcessError, e: + logging.critical("Failed to load %s: %s" % (ldif, str(e))) + finally: + os.remove(pw_name) fd.close() -- cgit