summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ipa-admintools/ipa-adduser2
-rw-r--r--ipa-admintools/ipa-passwd2
-rw-r--r--ipa-client/configure.ac2
-rw-r--r--ipa-python/ipautil.py18
-rw-r--r--ipa-server/configure.ac2
-rw-r--r--ipa-server/ipa-gui/ipagui/forms/delegate.py2
-rw-r--r--ipa-server/ipa-gui/ipagui/forms/group.py2
-rw-r--r--ipa-server/ipa-gui/ipagui/forms/ipapolicy.py4
-rw-r--r--ipa-server/ipa-gui/ipagui/forms/user.py2
-rw-r--r--ipa-server/ipaserver/dsinstance.py27
-rw-r--r--ipa-server/ipaserver/httpinstance.py2
-rw-r--r--ipa-server/ipaserver/krbinstance.py10
-rw-r--r--ipa-server/xmlrpc-server/funcs.py11
13 files changed, 51 insertions, 35 deletions
diff --git a/ipa-admintools/ipa-adduser b/ipa-admintools/ipa-adduser
index e993bee5e..96b43e0d5 100644
--- a/ipa-admintools/ipa-adduser
+++ b/ipa-admintools/ipa-adduser
@@ -228,7 +228,7 @@ def main():
# Set the User's password
if password is not None:
try:
- client.modifyPassword(principal, None, password)
+ client.modifyPassword(principal, '', password)
except ipa.ipaerror.IPAError, e:
print "User added but setting the password failed."
print "%s" % (e.message)
diff --git a/ipa-admintools/ipa-passwd b/ipa-admintools/ipa-passwd
index 93cb5f72c..ec656fdb8 100644
--- a/ipa-admintools/ipa-passwd
+++ b/ipa-admintools/ipa-passwd
@@ -98,7 +98,7 @@ def main():
try:
client = ipaclient.IPAClient()
- client.modifyPassword(principal, None, password)
+ client.modifyPassword(principal, '', password)
except xmlrpclib.Fault, fault:
if fault.faultCode == errno.ECONNREFUSED:
print "The IPA XML-RPC service is not responding."
diff --git a/ipa-client/configure.ac b/ipa-client/configure.ac
index 9d060d9a8..b50928dab 100644
--- a/ipa-client/configure.ac
+++ b/ipa-client/configure.ac
@@ -1,4 +1,4 @@
-AC_PREREQ(2.59c)
+AC_PREREQ(2.59)
AC_INIT([ipa-client],
[0.5.0],
[https://hosted.fedoraproject.org/projects/freeipa/newticket])
diff --git a/ipa-python/ipautil.py b/ipa-python/ipautil.py
index df9231884..9b8412d23 100644
--- a/ipa-python/ipautil.py
+++ b/ipa-python/ipautil.py
@@ -33,6 +33,22 @@ from string import lower
import re
import xmlrpclib
import datetime
+try:
+ from subprocess import CalledProcessError
+ class CalledProcessError(subprocess.CalledProcessError):
+ def __init__(self, returncode, cmd):
+ super(CalledProcessError, self).__init__(returncode, cmd)
+except ImportError:
+ # Python 2.4 doesn't implement CalledProcessError
+ class CalledProcessError(Exception):
+ """This exception is raised when a process run by check_call() returns
+ a non-zero exit status. The exit status will be stored in the
+ returncode attribute."""
+ def __init__(self, returncode, cmd):
+ self.returncode = returncode
+ self.cmd = cmd
+ def __str__(self):
+ return "Command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode)
def realm_to_suffix(realm_name):
s = realm_name.split(".")
@@ -63,7 +79,7 @@ def run(args, stdin=None):
logging.info(stderr)
if p.returncode != 0:
- raise subprocess.CalledProcessError(p.returncode, ' '.join(args))
+ raise self.CalledProcessError(p.returncode, ' '.join(args))
def file_exists(filename):
try:
diff --git a/ipa-server/configure.ac b/ipa-server/configure.ac
index 1e62a2f82..7492d4cf7 100644
--- a/ipa-server/configure.ac
+++ b/ipa-server/configure.ac
@@ -1,4 +1,4 @@
-AC_PREREQ(2.59c)
+AC_PREREQ(2.59)
AC_INIT([ipa-server],
[0.5],
[https://hosted.fedoraproject.org/projects/freeipa/newticket])
diff --git a/ipa-server/ipa-gui/ipagui/forms/delegate.py b/ipa-server/ipa-gui/ipagui/forms/delegate.py
index 419df4fc7..d9d5d727c 100644
--- a/ipa-server/ipa-gui/ipagui/forms/delegate.py
+++ b/ipa-server/ipa-gui/ipagui/forms/delegate.py
@@ -43,7 +43,7 @@ aci_checkbox_attrs = [(field.name, field.label) for field in aci_attrs]
aci_name_to_label = dict(aci_checkbox_attrs)
-class DelegateFields():
+class DelegateFields(object):
name = widgets.TextField(name="name", label="Delegation Name")
source_group_dn = widgets.HiddenField(name="source_group_dn")
diff --git a/ipa-server/ipa-gui/ipagui/forms/group.py b/ipa-server/ipa-gui/ipagui/forms/group.py
index b67156641..fa3a0988a 100644
--- a/ipa-server/ipa-gui/ipagui/forms/group.py
+++ b/ipa-server/ipa-gui/ipagui/forms/group.py
@@ -2,7 +2,7 @@ import turbogears
from turbogears import validators, widgets
from tg_expanding_form_widget.tg_expanding_form_widget import ExpandingForm
-class GroupFields():
+class GroupFields(object):
cn = widgets.TextField(name="cn", label="Name")
gidnumber = widgets.TextField(name="gidnumber", label="GID")
description = widgets.TextField(name="description", label="Description")
diff --git a/ipa-server/ipa-gui/ipagui/forms/ipapolicy.py b/ipa-server/ipa-gui/ipagui/forms/ipapolicy.py
index ec0e8c6f8..6cd967a97 100644
--- a/ipa-server/ipa-gui/ipagui/forms/ipapolicy.py
+++ b/ipa-server/ipa-gui/ipagui/forms/ipapolicy.py
@@ -1,9 +1,9 @@
import turbogears
from turbogears import validators, widgets
-class IPAPolicyFields():
+class IPAPolicyFields(object):
# From cn=ipaConfig
- ipausersearchfields = widgets.TextField(name="ipausersearchfields", label="User Search Fields")
+ ipausersearchfields = widgets.TextField(name="ipausersearchfields", label="User Search Fields", attrs=dict(size=50))
ipagroupsearchfields = widgets.TextField(name="ipagroupsearchfields", label="Group Search Fields")
ipasearchtimelimit = widgets.TextField(name="ipasearchtimelimit", label="Search Time Limit (sec.)", attrs=dict(size=6,maxlength=6))
ipasearchrecordslimit = widgets.TextField(name="ipasearchrecordslimit", label="Search Records Limit", attrs=dict(size=6,maxlength=6))
diff --git a/ipa-server/ipa-gui/ipagui/forms/user.py b/ipa-server/ipa-gui/ipagui/forms/user.py
index 7d3d37193..f1bf48365 100644
--- a/ipa-server/ipa-gui/ipagui/forms/user.py
+++ b/ipa-server/ipa-gui/ipagui/forms/user.py
@@ -2,7 +2,7 @@ import turbogears
from turbogears import validators, widgets
from tg_expanding_form_widget.tg_expanding_form_widget import ExpandingForm
-class UserFields():
+class UserFields(object):
givenname = widgets.TextField(name="givenname", label="Given Name")
sn = widgets.TextField(name="sn", label="Family Name")
cn = widgets.TextField(name="cn", label="Common Names")
diff --git a/ipa-server/ipaserver/dsinstance.py b/ipa-server/ipaserver/dsinstance.py
index 79a57182f..8735ebdaa 100644
--- a/ipa-server/ipaserver/dsinstance.py
+++ b/ipa-server/ipaserver/dsinstance.py
@@ -29,7 +29,6 @@ import sys
from ipa.ipautil import *
import service
-
import installutils
SERVER_ROOT_64 = "/usr/lib64/dirsrv"
@@ -188,7 +187,7 @@ class DsInstance(service.Service):
try:
run(args)
logging.debug("done adding user")
- except subprocess.CalledProcessError, e:
+ except ipautil.CalledProcessError, e:
logging.critical("failed to add user %s" % e)
def __create_instance(self):
@@ -206,13 +205,13 @@ class DsInstance(service.Service):
try:
run(args)
logging.debug("completed creating ds instance")
- except subprocess.CalledProcessError, e:
+ except ipautil.CalledProcessError, e:
logging.critical("failed to restart ds instance %s" % e)
logging.debug("restarting ds instance")
try:
self.restart()
logging.debug("done restarting ds instance")
- except subprocess.CalledProcessError, e:
+ except ipautil.CalledProcessError, e:
print "failed to restart ds instance", e
logging.debug("failed to restart ds instance %s" % e)
@@ -233,7 +232,7 @@ class DsInstance(service.Service):
memberof_fd = write_tmp_file(memberof_txt)
try:
ldap_mod(memberof_fd, "cn=Directory Manager", self.dm_password)
- except subprocess.CalledProcessError, e:
+ except ipautil.CalledProcessError, e:
logging.critical("Failed to load memberof-conf.ldif: %s" % str(e))
memberof_fd.close()
@@ -243,7 +242,7 @@ class DsInstance(service.Service):
memberof_fd = write_tmp_file(memberof_txt)
try:
ldap_mod(memberof_fd, "cn=Directory Manager", self.dm_password)
- except subprocess.CalledProcessError, e:
+ except ipautil.CalledProcessError, e:
logging.critical("Failed to load memberof-conf.ldif: %s" % str(e))
memberof_fd.close()
@@ -253,7 +252,7 @@ class DsInstance(service.Service):
referint_fd = write_tmp_file(referint_txt)
try:
ldap_mod(referint_fd, "cn=Directory Manager", self.dm_password)
- except subprocess.CalledProcessError, e:
+ except ipautil.CalledProcessError, e:
print "Failed to load referint-conf.ldif", e
referint_fd.close()
@@ -263,7 +262,7 @@ class DsInstance(service.Service):
dna_fd = write_tmp_file(dna_txt)
try:
ldap_mod(dna_fd, "cn=Directory Manager", self.dm_password)
- except subprocess.CalledProcessError, e:
+ except ipautil.CalledProcessError, e:
print "Failed to load dna-conf.ldif", e
dna_fd.close()
@@ -273,7 +272,7 @@ class DsInstance(service.Service):
dna_fd = write_tmp_file(dna_txt)
try:
ldap_mod(dna_fd, "cn=Directory Manager", self.dm_password)
- except subprocess.CalledProcessError, e:
+ except ipautil.CalledProcessError, e:
print "Failed to configure Posix uid/gid generation with dna-posix.ldif", e
dna_fd.close()
@@ -283,7 +282,7 @@ class DsInstance(service.Service):
master_fd = write_tmp_file(master_txt)
try:
ldap_mod(master_fd, "cn=Directory Manager", self.dm_password)
- except subprocess.CalledProcessError, e:
+ except ipautil.CalledProcessError, e:
print "Failed to add master-entry.ldif", e
master_fd.close()
@@ -295,7 +294,7 @@ class DsInstance(service.Service):
try:
run(args)
logging.debug("done configuring ssl for ds instance")
- except subprocess.CalledProcessError, e:
+ except ipautil.CalledProcessError, e:
logging.critical("Failed to configure ssl in ds instance %s" % e)
def __add_default_layout(self):
@@ -308,7 +307,7 @@ class DsInstance(service.Service):
try:
run(args)
logging.debug("done adding default ds layout")
- except subprocess.CalledProcessError, e:
+ except ipautil.CalledProcessError, e:
print "Failed to add default ds layout", e
logging.critical("Failed to add default ds layout %s" % e)
@@ -322,7 +321,7 @@ class DsInstance(service.Service):
try:
run(args)
logging.debug("done adding/updating indeces")
- except subprocess.CalledProcessError, e:
+ except ipautil.CalledProcessError, e:
logging.critical("Failed to add/update indeces %s" % str(e))
def __certmap_conf(self):
@@ -347,7 +346,7 @@ class DsInstance(service.Service):
try:
run(args)
logging.debug("ldappasswd done")
- except subprocess.CalledProcessError, e:
+ except ipautil.CalledProcessError, e:
print "Unable to set admin password", e
logging.debug("Unable to set admin password %s" % e)
diff --git a/ipa-server/ipaserver/httpinstance.py b/ipa-server/ipaserver/httpinstance.py
index 60d33eedc..301035130 100644
--- a/ipa-server/ipaserver/httpinstance.py
+++ b/ipa-server/ipaserver/httpinstance.py
@@ -86,7 +86,7 @@ class HTTPInstance(service.Service):
if (os.path.exists('/usr/sbin/selinuxenabled')):
run(["/usr/sbin/selinuxenabled"])
selinux=1
- except subprocess.CalledProcessError:
+ except ipautil.CalledProcessError:
# selinuxenabled returns 1 if not enabled
pass
diff --git a/ipa-server/ipaserver/krbinstance.py b/ipa-server/ipaserver/krbinstance.py
index c83002f73..fe5042a02 100644
--- a/ipa-server/ipaserver/krbinstance.py
+++ b/ipa-server/ipaserver/krbinstance.py
@@ -33,7 +33,6 @@ import time
import shutil
import service
-from ipa.ipautil import *
from ipa import ipaerror
import ipaldap
@@ -47,6 +46,7 @@ import pyasn1.codec.ber.encoder
import pyasn1.codec.ber.decoder
import struct
import base64
+from ipa.ipautil import *
def host_to_domain(fqdn):
s = fqdn.split(".")
@@ -245,7 +245,7 @@ class KrbInstance(service.Service):
kerberos_fd = write_tmp_file(kerberos_txt)
try:
ldap_mod(kerberos_fd, "cn=Directory Manager", self.admin_password)
- except subprocess.CalledProcessError, e:
+ except ipautil.CalledProcessError, e:
logging.critical("Failed to load kerberos.ldif: %s" % str(e))
kerberos_fd.close()
@@ -254,7 +254,7 @@ class KrbInstance(service.Service):
aci_fd = write_tmp_file(aci_txt)
try:
ldap_mod(aci_fd, "cn=Directory Manager", self.admin_password)
- except subprocess.CalledProcessError, e:
+ except ipautil.CalledProcessError, e:
logging.critical("Failed to load default-aci.ldif: %s" % str(e))
aci_fd.close()
@@ -291,7 +291,7 @@ class KrbInstance(service.Service):
args = ["/usr/kerberos/sbin/kdb5_ldap_util", "-D", "uid=kdc,cn=sysaccounts,cn=etc,"+self.suffix, "-w", self.kdc_password, "create", "-s", "-P", self.master_password, "-r", self.realm, "-subtrees", self.suffix, "-sscope", "sub"]
try:
run(args)
- except subprocess.CalledProcessError, e:
+ except ipautil.CalledProcessError, e:
print "Failed to populate the realm structure in kerberos", e
def __write_stash_from_ds(self):
@@ -322,7 +322,7 @@ class KrbInstance(service.Service):
extop_fd = write_tmp_file(extop_txt)
try:
ldap_mod(extop_fd, "cn=Directory Manager", self.admin_password)
- except subprocess.CalledProcessError, e:
+ except ipautil.CalledProcessError, e:
logging.critical("Failed to load pwd-extop-conf.ldif: %s" % str(e))
extop_fd.close()
diff --git a/ipa-server/xmlrpc-server/funcs.py b/ipa-server/xmlrpc-server/funcs.py
index 2e218ac93..032f6b422 100644
--- a/ipa-server/xmlrpc-server/funcs.py
+++ b/ipa-server/xmlrpc-server/funcs.py
@@ -1270,11 +1270,12 @@ class IPAServer:
conn = self.getConnection(opts)
try:
- results = conn.getListAsync(self.basedn, self.scope,
- filter, attr_list, 0, None, None, timelimit,
- searchlimit)
- except ipaerror.exception_for(ipaerror.LDAP_NOT_FOUND):
- results = [0]
+ try:
+ results = conn.getListAsync(self.basedn, self.scope,
+ filter, attr_list, 0, None, None, timelimit,
+ searchlimit)
+ except ipaerror.exception_for(ipaerror.LDAP_NOT_FOUND):
+ results = [0]
finally:
self.releaseConnection(conn)