[SSSD] [PATCH] pysss_nss_idmap: do not treat strings as sequences

Sumit Bose sbose at redhat.com
Thu May 23 07:24:27 UTC 2013


Hi,

the last patch for the libsss_nss_idmap did a bit more than expected.

bye,
Sumit
-------------- next part --------------
From e48634518e3c5e22f84a53bc5fa8aaa48c089f55 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose at redhat.com>
Date: Wed, 22 May 2013 16:36:51 +0200
Subject: [PATCH] pysss_nss_idmap: do not treat strings as sequences

The current PySequence_Check() also catches single strings with the
effect that the string is split into characters which are send as
arguments to SSSD individually.

With this patch only tuples and lists are treated as sequences.
---
 src/python/pysss_nss_idmap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/python/pysss_nss_idmap.c b/src/python/pysss_nss_idmap.c
index 0d59639..c938ff7 100644
--- a/src/python/pysss_nss_idmap.c
+++ b/src/python/pysss_nss_idmap.c
@@ -236,7 +236,7 @@ static PyObject *check_args(enum lookup_type type, PyObject *args)
         return NULL;
     }
 
-    if (PySequence_Check(obj)) {
+    if (PyList_Check(obj) || PyTuple_Check(obj)) {
         len = PySequence_Size(obj);
         for(i=0; i < len; i++) {
             py_value = PySequence_GetItem(obj, i);
-- 
1.7.7.6



More information about the sssd-devel mailing list