krbVmodule krb5err.c, 1.2, 1.3 krb5module.c, 1.19, 1.20 krbVmodule.spec.in, 1.8, 1.9
Mike Bonnet (mikeb)
fedora-extras-commits at redhat.com
Sat Mar 25 01:02:25 UTC 2006
- Previous message (by thread): rpms/anjuta/devel anjuta-encodings.patch, 1.1, 1.2 anjuta.spec, 1.15, 1.16
- Next message (by thread): rpms/cpanspec/devel .cvsignore, 1.6, 1.7 cpanspec.spec, 1.5, 1.6 sources, 1.6, 1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: mikeb
Update of /cvs/devel/krbVmodule
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv1821
Modified Files:
krb5err.c krb5module.c krbVmodule.spec.in
Log Message:
- fixed typo
- changed the return value of recvauth() to include remote principal
- renamed RPM to be more Extras-friendly
Index: krb5err.c
===================================================================
RCS file: /cvs/devel/krbVmodule/krb5err.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- krb5err.c 7 Mar 2002 00:21:02 -0000 1.2
+++ krb5err.c 25 Mar 2006 01:02:22 -0000 1.3
@@ -42,6 +42,6 @@
PyObject *dict;
dict = PyModule_GetDict(module);
- pk_exception = PyErr_NewException("krb5.Krb5Error", NULL, NULL);
+ pk_exception = PyErr_NewException("krbV.Krb5Error", NULL, NULL);
PyDict_SetItemString(dict, "Krb5Error", pk_exception);
}
Index: krb5module.c
===================================================================
RCS file: /cvs/devel/krbVmodule/krb5module.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- krb5module.c 17 Oct 2003 18:58:35 -0000 1.19
+++ krb5module.c 25 Mar 2006 01:02:22 -0000 1.20
@@ -23,6 +23,7 @@
#include <sys/types.h>
#include <sys/signal.h>
#include <stdio.h>
+#include <arpa/inet.h>
#if !defined(_KRB5_INT_H) && defined(KRB5_PROTOTYPE)
krb5_error_code krb5_get_krbhst KRB5_PROTOTYPE((krb5_context, const krb5_data *, char ***));
@@ -798,6 +799,7 @@
krb5_auth_context ac_out = NULL;
krb5_keytab kt;
krb5_principal pserver;
+ krb5_ticket *cticket;
krb5_flags ap_req_options = 0;
krb5_error_code rc = 0;
int free_keytab = 0;
@@ -851,20 +853,42 @@
ap_req_options = PyInt_AsLong(options);
Py_BEGIN_ALLOW_THREADS
- rc = krb5_recvauth(kctx, &ac_out, fd_ptr, appl_version, pserver, ap_req_options, kt, NULL);
+ rc = krb5_recvauth(kctx, &ac_out, fd_ptr, appl_version, pserver, ap_req_options, kt, &cticket);
Py_END_ALLOW_THREADS
if(rc)
return pk_error(rc);
+ retval = PyTuple_New(2);
+
+ if (cticket->enc_part2)
+ {
+ PyObject *cprinc;
+
+ if (!(cprinc = make_principal(self, kctx, cticket->enc_part2->client)))
+ {
+ Py_DECREF(retval);
+ krb5_free_ticket(kctx, cticket);
+ return NULL;
+ }
+ PyTuple_SetItem(retval, 1, cprinc);
+ }
+ else
+ {
+ PyTuple_SetItem(retval, 1, Py_None);
+ Py_INCREF(Py_None);
+ }
+ krb5_free_ticket(kctx, cticket);
+
{
- PyObject *subargs, *mykw = NULL, *otmp;
+ PyObject *subargs, *mykw = NULL, *otmp, *auth_context;
subargs = Py_BuildValue("()");
mykw = PyDict_New();
PyDict_SetItemString(mykw, "context", self);
otmp = PyCObject_FromVoidPtrAndDesc(ac_out, kctx, destroy_ac);
PyDict_SetItemString(mykw, "ac", otmp);
- retval = PyEval_CallObjectWithKeywords(auth_context_class, subargs, mykw);
+ auth_context = PyEval_CallObjectWithKeywords(auth_context_class, subargs, mykw);
+ PyTuple_SetItem(retval, 0, auth_context);
Py_DECREF(otmp);
Py_DECREF(subargs);
Py_XDECREF(mykw);
@@ -989,6 +1013,36 @@
return retval;
}
+/* Convert a krb5_address to a string representation. */
+static PyObject *
+addr_to_str(krb5_address *kaddr)
+{
+ const char* ret = NULL;
+ char *addr = NULL;
+
+ if (kaddr->addrtype == ADDRTYPE_INET)
+ {
+ addr = alloca(INET_ADDRSTRLEN);
+ ret = inet_ntop(AF_INET, kaddr->contents,
+ addr, INET_ADDRSTRLEN);
+ }
+ else if (kaddr->addrtype == ADDRTYPE_INET6)
+ {
+ addr = alloca(INET6_ADDRSTRLEN);
+ ret = inet_ntop(AF_INET6, kaddr->contents,
+ addr, INET6_ADDRSTRLEN);
+ }
+
+ if (addr == NULL || ret == NULL)
+ {
+ return NULL;
+ }
+ else
+ {
+ return PyString_FromString(addr);
+ }
+}
+
/*********************** AuthContext **********************/
static PyObject*
AuthContext_getattr(PyObject *unself, PyObject *args)
@@ -1028,16 +1082,23 @@
}
else if(!strcmp(name, "addrs"))
{
- PyObject *ra1, *ra2;
+ PyObject *ra1, *ra2, *laddr, *raddr;
krb5_address *a1=NULL, *a2=NULL;
rc = krb5_auth_con_getaddrs(ctx, ac, &a1, &a2);
if(rc)
return pk_error(rc);
if(a1)
{
+ laddr = addr_to_str(a1);
+ if (laddr == NULL)
+ {
+ laddr = Py_None;
+ Py_INCREF(Py_None);
+ }
+
ra1 = PyTuple_New(2);
PyTuple_SetItem(ra1, 0, PyInt_FromLong(a1->addrtype));
- PyTuple_SetItem(ra1, 1, PyString_FromStringAndSize(a1->contents, a1->length));
+ PyTuple_SetItem(ra1, 1, laddr);
krb5_free_address(ctx, a1);
}
else
@@ -1047,9 +1108,16 @@
}
if(a2)
{
+ raddr = addr_to_str(a2);
+ if (raddr == NULL)
+ {
+ raddr = Py_None;
+ Py_INCREF(Py_None);
+ }
+
ra2 = PyTuple_New(2);
PyTuple_SetItem(ra2, 0, PyInt_FromLong(a2->addrtype));
- PyTuple_SetItem(ra2, 1, PyString_FromStringAndSize(a2->contents, a2->length));
+ PyTuple_SetItem(ra2, 1, raddr);
krb5_free_address(ctx, a2);
}
else
Index: krbVmodule.spec.in
===================================================================
RCS file: /cvs/devel/krbVmodule/krbVmodule.spec.in,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- krbVmodule.spec.in 14 Jan 2004 17:51:50 -0000 1.8
+++ krbVmodule.spec.in 25 Mar 2006 01:02:23 -0000 1.9
@@ -1,18 +1,18 @@
-%define pyver 2.3
+%define pyver %(%{__python} -c "import sys ; print sys.version[:3]")
Summary: Python extension module for Kerberos 5
-Name: krbV-python%{pyver}
+Name: python-krbV
Version: @VERSION@
Release: 1
-Copyright: LGPL
+License: LGPL
Group: Development/Languages
Source: krbVmodule-%{version}.tar.gz
Buildroot: /var/tmp/krb5module-root
-Requires: python2 >= %{pyver}
-BuildRequires: python2-devel >= %{pyver}
+BuildRequires: python-devel >= %{pyver}
BuildRequires: krb5-devel >= 1.2.2
-Requires: krb5-libs >= 1.2.2
BuildRequires: /bin/awk
+Requires: python-abi = %{pyver}
+Requires: krb5-libs >= 1.2.2
%description
Allows python programs to use Kerberos 5 authentication/security.
@@ -41,5 +41,10 @@
%{_libdir}/python%{pyver}/site-packages/krbVmodule.so
%changelog
+* Fri Mar 24 2006 Mike Bonnet <mikeb at redhat.com>
+- fix typo in error definition
+- change the return value of recvauth() from ac to (ac, princ), where princ is the principal sent by sendauth()
+- rename the RPM and reorganize the BuildRequires, to be more Extras-friendly
+
* Tue Sep 25 2001 Elliot Lee <sopwith at redhat.com>
- Initial version
- Previous message (by thread): rpms/anjuta/devel anjuta-encodings.patch, 1.1, 1.2 anjuta.spec, 1.15, 1.16
- Next message (by thread): rpms/cpanspec/devel .cvsignore, 1.6, 1.7 cpanspec.spec, 1.5, 1.6 sources, 1.6, 1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list