[SSSD] [PATCH] Compare full service name

Sumit Bose sbose at redhat.com
Mon May 31 12:23:49 UTC 2010


Hi,

I have made the same error a second time and forget to check the length
before calling strncmp(). This patch should fix it and applies to 1.2
and master.

bye,
Sumit
-------------- next part --------------
From 813a4f808aec3168547c266f7506f0059f8d8485 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose at redhat.com>
Date: Mon, 31 May 2010 12:57:46 +0200
Subject: [PATCH] Compare full service name

---
 src/providers/ipa/ipa_access.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/providers/ipa/ipa_access.c b/src/providers/ipa/ipa_access.c
index bd32451..01e4fff 100644
--- a/src/providers/ipa/ipa_access.c
+++ b/src/providers/ipa/ipa_access.c
@@ -1518,7 +1518,8 @@ static errno_t get_service_data(const char *cn, size_t count,
             return ENOENT;
         } else {
             for (j = 0; j < el->num_values; j++) {
-                if (strncmp(cn, (const char *) el->values[j].data,
+                if (strlen(cn) == el->values[j].length &&
+                    strncmp(cn, (const char *) el->values[j].data,
                             el->values[j].length) == 0) {
 
                     ret = sysdb_attrs_get_string(list[i], SYSDB_ORIG_DN, dn);
-- 
1.7.0.1



More information about the sssd-devel mailing list