summaryrefslogtreecommitdiffstats
path: root/ipa-python
diff options
context:
space:
mode:
authorKarl MacMillan <kmacmill@redhat.com>2007-12-18 16:25:46 -0500
committerKarl MacMillan <kmacmill@redhat.com>2007-12-18 16:25:46 -0500
commit6575aa606f18f8d998dcad5552e4f770e9addcdf (patch)
treed75cb650b3b9f27cad0786d7aa40a5cd3f188061 /ipa-python
parenta0eacec8e587c0fbc7e24378cef58fa7835ae64a (diff)
parent4814c0d3f6c11971b841eb6eedcd7925d8840f26 (diff)
downloadfreeipa-6575aa606f18f8d998dcad5552e4f770e9addcdf.tar.gz
freeipa-6575aa606f18f8d998dcad5552e4f770e9addcdf.tar.xz
freeipa-6575aa606f18f8d998dcad5552e4f770e9addcdf.zip
Merge.
Diffstat (limited to 'ipa-python')
-rwxr-xr-xipa-python/ipa-python.spec5
-rwxr-xr-xipa-python/ipa-python.spec.in5
-rw-r--r--ipa-python/ipaclient.py4
-rw-r--r--ipa-python/ipaerror.py6
-rw-r--r--ipa-python/ipautil.py1
-rw-r--r--ipa-python/radius_util.py2
-rw-r--r--ipa-python/rpcclient.py35
-rw-r--r--ipa-python/setup.py2
8 files changed, 16 insertions, 44 deletions
diff --git a/ipa-python/ipa-python.spec b/ipa-python/ipa-python.spec
index 2837a2832..1c838821b 100755
--- a/ipa-python/ipa-python.spec
+++ b/ipa-python/ipa-python.spec
@@ -14,8 +14,6 @@ Requires: PyKerberos
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
-%define pkgpythondir %{python_sitelib}/ipa
-
%description
Ipa is a server for identity, policy, and audit.
@@ -33,8 +31,7 @@ rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
-%dir %{pkgpythondir}
-%{pkgpythondir}/*
+%{python_sitelib}/*
%config(noreplace) %{_sysconfdir}/ipa/ipa.conf
%changelog
diff --git a/ipa-python/ipa-python.spec.in b/ipa-python/ipa-python.spec.in
index bd8ac0da6..9eb2e11c2 100755
--- a/ipa-python/ipa-python.spec.in
+++ b/ipa-python/ipa-python.spec.in
@@ -14,8 +14,6 @@ Requires: PyKerberos
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
-%define pkgpythondir %{python_sitelib}/ipa
-
%description
Ipa is a server for identity, policy, and audit.
@@ -33,8 +31,7 @@ rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
-%dir %{pkgpythondir}
-%{pkgpythondir}/*
+%{python_sitelib}/*
%config(noreplace) %{_sysconfdir}/ipa/ipa.conf
%changelog
diff --git a/ipa-python/ipaclient.py b/ipa-python/ipaclient.py
index d815afa7b..bd1fb235a 100644
--- a/ipa-python/ipaclient.py
+++ b/ipa-python/ipaclient.py
@@ -19,14 +19,10 @@
#!/usr/bin/python
-import sys
-
import ipa.rpcclient as rpcclient
import entity
import user
import group
-import ipa
-import config
import radius_util
class IPAClient:
diff --git a/ipa-python/ipaerror.py b/ipa-python/ipaerror.py
index e34963365..59e262018 100644
--- a/ipa-python/ipaerror.py
+++ b/ipa-python/ipaerror.py
@@ -129,14 +129,14 @@ LDAP_NO_CONFIG = gen_error_code(
"IPA configuration not found")
#
-# Input errors (sample - replace me)
+# Function input errors
#
INPUT_CATEGORY = 0x0002
-INPUT_INVALID_ERROR = gen_error_code(
+INPUT_INVALID_PARAMETER = gen_error_code(
INPUT_CATEGORY,
0x0001,
- "Illegal input")
+ "Invalid parameter(s)")
#
# Connection errors
diff --git a/ipa-python/ipautil.py b/ipa-python/ipautil.py
index 3c2b37f73..c617854e5 100644
--- a/ipa-python/ipautil.py
+++ b/ipa-python/ipautil.py
@@ -18,6 +18,7 @@
#
SHARE_DIR = "/usr/share/ipa/"
+PLUGINS_SHARE_DIR = "/usr/share/ipa/plugins"
import string
import tempfile
diff --git a/ipa-python/radius_util.py b/ipa-python/radius_util.py
index e1401fb7b..fb3e581e6 100644
--- a/ipa-python/radius_util.py
+++ b/ipa-python/radius_util.py
@@ -79,7 +79,7 @@ RADIUS_USER = 'radiusd'
RADIUS_IPA_KEYTAB_FILEPATH = os.path.join(RADIUS_PKG_CONFIG_DIR, 'ipa.keytab')
RADIUS_LDAP_ATTR_MAP_FILEPATH = os.path.join(RADIUS_PKG_CONFIG_DIR, 'ldap.attrmap')
RADIUSD_CONF_FILEPATH = os.path.join(RADIUS_PKG_CONFIG_DIR, 'radiusd.conf')
-RADIUSD_CONF_TEMPLATE_FILEPATH = os.path.join(ipautil.SHARE_DIR, 'radius.radiusd.conf.template')
+RADIUSD_CONF_TEMPLATE_FILEPATH = os.path.join(ipautil.PLUGINS_SHARE_DIR, 'radius.radiusd.conf.template')
RADIUSD = '/usr/sbin/radiusd'
diff --git a/ipa-python/rpcclient.py b/ipa-python/rpcclient.py
index 5656b99d9..c993ac991 100644
--- a/ipa-python/rpcclient.py
+++ b/ipa-python/rpcclient.py
@@ -24,11 +24,8 @@ import socket
import config
from krbtransport import KerbTransport
from kerberos import GSSError
-import os
-import base64
-import user
-import ipa
from ipa import ipaerror, ipautil
+from ipa import config
# Some errors to catch
# http://cvs.fedora.redhat.com/viewcvs/ldapserver/ldap/servers/plugins/pam_passthru/README?root=dirsec&rev=1.6&view=auto
@@ -36,7 +33,7 @@ from ipa import ipaerror, ipautil
class RPCClient:
def __init__(self):
- ipa.config.init_config()
+ config.init_config()
def server_url(self):
"""Build the XML-RPC server URL from our configuration"""
@@ -47,25 +44,6 @@ class RPCClient:
authentication"""
return xmlrpclib.ServerProxy(self.server_url(), KerbTransport())
- def convert_entry(self,ent):
- # Convert into a dict. We need to handle multi-valued attributes as well
- # so we'll convert those into lists.
- obj={}
- for (k) in ent:
- k = k.lower()
- if obj.get(k) is not None:
- if isinstance(obj[k],list):
- obj[k].append(ent[k].strip())
- else:
- first = obj[k]
- obj[k] = ()
- obj[k].append(first)
- obj[k].append(ent[k].strip())
- else:
- obj[k] = ent[k]
-
- return obj
-
# Higher-level API
def get_aci_entry(self, sattrs=None):
@@ -168,7 +146,8 @@ class RPCClient:
def get_user_by_email(self,email,sattrs=None):
"""Get a specific user's entry. Return as a dict of values.
- Multi-valued fields are represented as lists.
+ Multi-valued fields are represented as lists. The result is a
+ dict.
"""
server = self.setup_server()
if sattrs is None:
@@ -245,7 +224,7 @@ class RPCClient:
return ipautil.unwrap_binary_data(result)
def get_all_users (self):
- """Return a list containing a User object for each existing user."""
+ """Return a list containing a dict for each existing user."""
server = self.setup_server()
try:
@@ -258,7 +237,7 @@ class RPCClient:
return ipautil.unwrap_binary_data(result)
def find_users (self, criteria, sattrs=None, searchlimit=0, timelimit=-1):
- """Return a list: counter followed by a User object for each user that
+ """Return a list: counter followed by a dict for each user that
matches the criteria. If the results are truncated, counter will
be set to -1"""
@@ -381,6 +360,8 @@ class RPCClient:
except socket.error, (value, msg):
raise xmlrpclib.Fault(value, msg)
+ return ipautil.unwrap_binary_data(result)
+
def find_groups (self, criteria, sattrs=None, searchlimit=0, timelimit=-1):
"""Return a list containing a Group object for each group that matches
the criteria."""
diff --git a/ipa-python/setup.py b/ipa-python/setup.py
index 3a5a6f4eb..deb84f293 100644
--- a/ipa-python/setup.py
+++ b/ipa-python/setup.py
@@ -34,7 +34,7 @@ def setup_package():
try:
setup(
- name = "freeipa-python",
+ name = "ipa",
version = "0.5.0",
license = "GPL",
author = "Karl MacMillan, et.al.",