andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

Blame SOURCES/0070-Ticket-49121-ns-slapd-crashes-in-ldif_sput-due-to-th.patch

c9e5da
From f03bfc51387fcfe15122ee994626738f71b1935c Mon Sep 17 00:00:00 2001
c9e5da
From: Noriko Hosoi <nhosoi@redhat.com>
c9e5da
Date: Sun, 12 Feb 2017 17:26:46 -0800
c9e5da
Subject: [PATCH 70/71] Ticket #49121 - ns-slapd crashes in ldif_sput due to
c9e5da
 the output buf size is less than the real size.
c9e5da
c9e5da
Description: There were missing pieces in the entry size calculation
c9e5da
when an attribute had no a_present_values nor a_deleted_values.
c9e5da
1) There was no chance to add the size of the attribute type name since
c9e5da
   preceding entry2str_internal_size_valueset did not add any size if
c9e5da
   the value was empty.  The type name size is now explicitly added.
c9e5da
2) a_deletioncsn is added in entry2str_internal_put_attrlist by calling
c9e5da
   valueset_add_string with empty value.  The size was not included in
c9e5da
   the allocated memory to store the entire entry as a string. Now the
c9e5da
   size is added.
c9e5da
c9e5da
Adding CI test ticket49121_test.py.
c9e5da
c9e5da
https://pagure.io/389-ds-base/issue/49121
c9e5da
c9e5da
Reviewed by wibrown@redhat.com (Thank you, William!!)
c9e5da
c9e5da
(cherry picked from commit 543fe89edb0a6410a740a4fff738cace7bc57078)
c9e5da
---
c9e5da
 dirsrvtests/tests/data/ticket49121/utf8str.txt |   1 +
c9e5da
 dirsrvtests/tests/tickets/ticket49121_test.py  | 211 +++++++++++++++++++++++++
c9e5da
 ldap/servers/slapd/entry.c                     |  55 ++++---
c9e5da
 3 files changed, 244 insertions(+), 23 deletions(-)
c9e5da
 create mode 100644 dirsrvtests/tests/data/ticket49121/utf8str.txt
c9e5da
 create mode 100644 dirsrvtests/tests/tickets/ticket49121_test.py
c9e5da
c9e5da
diff --git a/dirsrvtests/tests/data/ticket49121/utf8str.txt b/dirsrvtests/tests/data/ticket49121/utf8str.txt
c9e5da
new file mode 100644
c9e5da
index 0000000..0005c4e
c9e5da
--- /dev/null
c9e5da
+++ b/dirsrvtests/tests/data/ticket49121/utf8str.txt
c9e5da
@@ -0,0 +1 @@
c9e5da
+あいうえお
c9e5da
diff --git a/dirsrvtests/tests/tickets/ticket49121_test.py b/dirsrvtests/tests/tickets/ticket49121_test.py
c9e5da
new file mode 100644
c9e5da
index 0000000..6450297
c9e5da
--- /dev/null
c9e5da
+++ b/dirsrvtests/tests/tickets/ticket49121_test.py
c9e5da
@@ -0,0 +1,211 @@
c9e5da
+# --- BEGIN COPYRIGHT BLOCK ---
c9e5da
+# Copyright (C) 2017 Red Hat, Inc.
c9e5da
+# All rights reserved.
c9e5da
+#
c9e5da
+# License: GPL (version 3 or any later version).
c9e5da
+# See LICENSE for details.
c9e5da
+# --- END COPYRIGHT BLOCK ---
c9e5da
+#
c9e5da
+import pytest
c9e5da
+import sys
c9e5da
+import codecs
c9e5da
+from lib389.tasks import *
c9e5da
+from lib389.utils import *
c9e5da
+from lib389.topologies import topology_m2
c9e5da
+
c9e5da
+DEBUGGING = os.getenv('DEBUGGING', False)
c9e5da
+
c9e5da
+if DEBUGGING:
c9e5da
+    logging.getLogger(__name__).setLevel(logging.DEBUG)
c9e5da
+else:
c9e5da
+    logging.getLogger(__name__).setLevel(logging.INFO)
c9e5da
+log = logging.getLogger(__name__)
c9e5da
+
c9e5da
+
c9e5da
+def test_ticket49121(topology_m2):
c9e5da
+    """
c9e5da
+    Creating some users.
c9e5da
+    Deleting quite a number of attributes which may or may not be in the entry.
c9e5da
+    The attribute type names are to be long.
c9e5da
+    Under the conditions, it did not estimate the size of string format entry
c9e5da
+    shorter than the real size and caused the Invalid write / server crash.
c9e5da
+    """
c9e5da
+    reload(sys)
c9e5da
+    sys.setdefaultencoding('utf-8')
c9e5da
+    log.info('DefaultEncoding: %s' % sys.getdefaultencoding())
c9e5da
+    
c9e5da
+    utf8file = os.path.join(topology_m2.ms["master1"].getDir(__file__, DATA_DIR), "ticket49121/utf8str.txt")
c9e5da
+    utf8obj = codecs.open(utf8file, 'r', 'utf-8')
c9e5da
+    utf8strorig = utf8obj.readline()
c9e5da
+    utf8str = utf8strorig.encode('utf-8').rstrip('\n')
c9e5da
+    utf8obj.close()
c9e5da
+    assert(utf8str)
c9e5da
+
c9e5da
+    # Get the sbin directory so we know where to replace 'ns-slapd'
c9e5da
+    sbin_dir = topology_m2.ms["master1"].get_sbin_dir()
c9e5da
+    log.info('sbin_dir: %s' % sbin_dir)
c9e5da
+
c9e5da
+    # stop M1 to do the next updates
c9e5da
+    topology_m2.ms["master1"].stop(30)
c9e5da
+    topology_m2.ms["master2"].stop(30)
c9e5da
+
c9e5da
+    # wait for the servers shutdown
c9e5da
+    time.sleep(5)
c9e5da
+
c9e5da
+    # Enable valgrind
c9e5da
+    if not topology_m2.ms["master1"].has_asan():
c9e5da
+        valgrind_enable(sbin_dir)
c9e5da
+
c9e5da
+    # start M1 to do the next updates
c9e5da
+    topology_m2.ms["master1"].start()
c9e5da
+    topology_m2.ms["master2"].start()
c9e5da
+
c9e5da
+    for idx in range(1, 10):
c9e5da
+        try:
c9e5da
+            USER_DN = 'CN=user%d,ou=People,%s' % (idx, DEFAULT_SUFFIX)
c9e5da
+            log.info('adding user %s...' % (USER_DN))
c9e5da
+            topology_m2.ms["master1"].add_s(Entry((USER_DN,
c9e5da
+                            {'objectclass': 'top person extensibleObject'.split(' '),
c9e5da
+                             'cn': 'user%d' % idx,
c9e5da
+                             'sn': 'SN%d-%s' % (idx, utf8str)})))
c9e5da
+        except ldap.LDAPError as e:
c9e5da
+            log.fatal('Failed to add user (%s): error %s' % (USER_DN, e.message['desc']))
c9e5da
+            assert False
c9e5da
+
c9e5da
+    for i in range(1, 3):
c9e5da
+        time.sleep(3)
c9e5da
+        for idx in range(1, 10):
c9e5da
+            try:
c9e5da
+                USER_DN = 'CN=user%d,ou=People,%s' % (idx, DEFAULT_SUFFIX)
c9e5da
+                log.info('[%d] modify user %s - replacing attrs...' % (i, USER_DN))
c9e5da
+                topology_m2.ms["master1"].modify_s(
c9e5da
+                        USER_DN, [(ldap.MOD_REPLACE, 'cn', 'user%d' % idx),
c9e5da
+                                  (ldap.MOD_REPLACE, 'ABCDEFGH_ID', ['239001ad-06dd-e011-80fa-c00000ad5174',
c9e5da
+                                                                     '240f0878-c552-e411-b0f3-000006040037']),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr1', 'NEW_ATTR'),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr20000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr30000000000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr40000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr50000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr600000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr7000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr8000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr900000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr1000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr110000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr120000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr130000000000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr140000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr150000000000000000000000000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr1600000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr17000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr18000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr1900000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr2000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr210000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr220000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr230000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr240000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr25000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr260000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr270000000000000000000000000000000000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr280000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr29000000000000000000000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr3000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr310000000000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr320000000000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr330000000000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr340000000000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr350000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr360000000000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr370000000000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr380000000000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr390000000000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr4000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr410000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr420000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr430000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr440000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr4500000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr460000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr470000000000000000000000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr480000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr49000000000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr5000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr510000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr520000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr530000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr540000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr550000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr5600000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr57000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr58000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr5900000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr6000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr6100000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr6200000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr6300000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr6400000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr65000000000000000000000000000000000000000000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr6600000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr6700000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr6800000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr690000000000000000000000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr7000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr71000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr72000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr73000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr74000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr750000000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr7600000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr77000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr78000000000000000000000000000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr79000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr800000000000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr81000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr82000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr83000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr84000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr85000000000000000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr8600000000000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr87000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr88000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr89000000000000000000000000000000000', None),
c9e5da
+                                  (ldap.MOD_REPLACE, 'attr9000000000000000000000000000000000000000000000000000', None)])
c9e5da
+            except ldap.LDAPError as e:
c9e5da
+                log.fatal('Failed to modify user - deleting attrs (%s): error %s' % (USER_DN, e.message['desc']))
c9e5da
+
c9e5da
+    if not topology_m2.ms["master1"].has_asan():
c9e5da
+        results_file = valgrind_get_results_file(topology_m2.ms["master1"])
c9e5da
+
c9e5da
+    # Stop master2
c9e5da
+    topology_m2.ms["master1"].stop(30)
c9e5da
+    topology_m2.ms["master2"].stop(30)
c9e5da
+
c9e5da
+    # Check for leak
c9e5da
+    if not topology_m2.ms["master1"].has_asan():
c9e5da
+        # Check for invalid read/write
c9e5da
+        if valgrind_check_file(results_file, VALGRIND_INVALID_STR):
c9e5da
+            log.info('Valgrind reported invalid!')
c9e5da
+            assert False
c9e5da
+        else:
c9e5da
+            log.info('Valgrind is happy!')
c9e5da
+
c9e5da
+    # Disable valgrind
c9e5da
+    if not topology_m2.ms["master1"].has_asan():
c9e5da
+        valgrind_disable(sbin_dir)
c9e5da
+
c9e5da
+    # start M1 to do the next updates
c9e5da
+    topology_m2.ms["master1"].start()
c9e5da
+    topology_m2.ms["master2"].start()
c9e5da
+
c9e5da
+    log.info('Testcase PASSED')
c9e5da
+    if DEBUGGING:
c9e5da
+        # Add debugging steps(if any)...
c9e5da
+        pass
c9e5da
+
c9e5da
+if __name__ == '__main__':
c9e5da
+    # Run isolated
c9e5da
+    # -s for DEBUG mode
c9e5da
+    CURRENT_FILE = os.path.realpath(__file__)
c9e5da
+    pytest.main("-s %s" % CURRENT_FILE)
c9e5da
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
c9e5da
index 0cd3b60..ed99a38 100644
c9e5da
--- a/ldap/servers/slapd/entry.c
c9e5da
+++ b/ldap/servers/slapd/entry.c
c9e5da
@@ -1472,7 +1472,8 @@ bail:
c9e5da
 }
c9e5da
 
c9e5da
 static size_t
c9e5da
-entry2str_internal_size_valueset( const char *attrtype, const Slapi_ValueSet *vs, int entry2str_ctrl, int attribute_state, int value_state )
c9e5da
+entry2str_internal_size_valueset( const Slapi_Attr *a, const char *attrtype, const Slapi_ValueSet *vs,
c9e5da
+                                  int entry2str_ctrl, int attribute_state, int value_state )
c9e5da
 {
c9e5da
 	size_t elen= 0;
c9e5da
 	if(!valueset_isempty(vs))
c9e5da
@@ -1485,6 +1486,12 @@ entry2str_internal_size_valueset( const char *attrtype, const Slapi_ValueSet *vs
c9e5da
 												 attribute_state, value_state );
c9e5da
 		}
c9e5da
 	}
c9e5da
+	if(entry2str_ctrl & SLAPI_DUMP_STATEINFO) {
c9e5da
+		/* ";adcsn-" + a->a_deletioncsn */
c9e5da
+		if ( a && a->a_deletioncsn ) {
c9e5da
+			elen += 1 + LDIF_CSNPREFIX_MAXLENGTH + CSN_STRSIZE;
c9e5da
+		}
c9e5da
+	}
c9e5da
 	return elen;
c9e5da
 }
c9e5da
 
c9e5da
@@ -1501,30 +1508,34 @@ entry2str_internal_size_attrlist( const Slapi_Attr *attrlist, int entry2str_ctrl
c9e5da
 			continue;
c9e5da
 
c9e5da
 		/* Count the space required for the present and deleted values */
c9e5da
-		elen+= entry2str_internal_size_valueset(a->a_type, &a->a_present_values,
c9e5da
-												entry2str_ctrl, attribute_state,
c9e5da
-												VALUE_PRESENT);
c9e5da
-		if(entry2str_ctrl & SLAPI_DUMP_STATEINFO)
c9e5da
-		{
c9e5da
-			elen+= entry2str_internal_size_valueset(a->a_type, &a->a_deleted_values,
c9e5da
-													entry2str_ctrl, attribute_state,
c9e5da
-													VALUE_DELETED);
c9e5da
-			/* ";adcsn-" + a->a_deletioncsn */
c9e5da
-			if ( a->a_deletioncsn )
c9e5da
-			{
c9e5da
-				elen += 1 + LDIF_CSNPREFIX_MAXLENGTH + CSN_STRSIZE;
c9e5da
-			}
c9e5da
-			if ( valueset_isempty(&a->a_deleted_values)) {
c9e5da
+		elen += entry2str_internal_size_valueset(a, a->a_type, &a->a_present_values,
c9e5da
+		                                         entry2str_ctrl, attribute_state, VALUE_PRESENT);
c9e5da
+		if (entry2str_ctrl & SLAPI_DUMP_STATEINFO) {
c9e5da
+			elen += entry2str_internal_size_valueset(a, a->a_type, &a->a_deleted_values,
c9e5da
+			                                         entry2str_ctrl, attribute_state, VALUE_DELETED);
c9e5da
+			if (valueset_isempty(&a->a_deleted_values) && valueset_isempty(&a->a_present_values)) {
c9e5da
 				/* this means the entry is deleted and has no more attributes,
c9e5da
 				 * when writing the attr to disk we would loose the AD-csn.
c9e5da
-				 * Add an empty value to the set of deleted values. This will 
c9e5da
-				 * never be seen by any client. It will never be moved to the 
c9e5da
+				 * Add an empty value to the set of deleted values. This will
c9e5da
+				 * never be seen by any client. It will never be moved to the
c9e5da
 				 * present values and is only used to preserve the AD-csn
c9e5da
 				 * We need to add the size for that.
c9e5da
 				 */
c9e5da
 				elen += 1 + LDIF_CSNPREFIX_MAXLENGTH + CSN_STRSIZE;
c9e5da
-                                /* need also space for ";deletedattribute;deleted" */
c9e5da
-                                elen += DELETED_ATTR_STRSIZE + DELETED_VALUE_STRSIZE;
c9e5da
+				/* need also space for ";deletedattribute;deleted" */
c9e5da
+				elen += DELETED_ATTR_STRSIZE + DELETED_VALUE_STRSIZE;
c9e5da
+				/*
c9e5da
+				 * If a_deleted_values is empty && if a_deletioncsn is NULL,
c9e5da
+				 * a_deletioncsn is initialized via valueset_add_string.
c9e5da
+				 * The size needs to be added.
c9e5da
+				 */
c9e5da
+				/* ";adcsn-" + a->a_deletioncsn */
c9e5da
+				elen += 1 + LDIF_CSNPREFIX_MAXLENGTH + CSN_STRSIZE;
c9e5da
+				/*
c9e5da
+				 * When both a_present_values & a_deleted_values are empty,
c9e5da
+				 * the type size is not added.
c9e5da
+				 */
c9e5da
+				elen += PL_strlen(a->a_type);
c9e5da
 			}
c9e5da
 		}
c9e5da
 	}
c9e5da
@@ -1811,10 +1822,8 @@ entry2str_internal_ext( Slapi_Entry *e, int *len, int entry2str_ctrl)
c9e5da
         if (NULL != slapi_entry_get_rdn_const(e))
c9e5da
         {
c9e5da
             slapi_value_set_string(&rdnvalue, slapi_entry_get_rdn_const(e));
c9e5da
-            elen += entry2str_internal_size_value("rdn", &rdnvalue,
c9e5da
-                                                  entry2str_ctrl,
c9e5da
-                                                  ATTRIBUTE_PRESENT,
c9e5da
-                                                  VALUE_PRESENT);
c9e5da
+            elen += entry2str_internal_size_value("rdn", &rdnvalue, entry2str_ctrl,
c9e5da
+                                                  ATTRIBUTE_PRESENT, VALUE_PRESENT);
c9e5da
         }
c9e5da
     
c9e5da
         /* Count the space required for the present attributes */
c9e5da
-- 
c9e5da
2.7.4
c9e5da