Q. on lib389 Re: Please review: #49121 ns-slapd crashes in ldif_sput due to the output buf size is less than the real size.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/12/2017 03:51 PM, Noriko Hosoi wrote:

https://pagure.io/389-ds-base/issue/49121

https://pagure.io/389-ds-base/issue/raw/files/d857ff4919940bcebeae870774896783f7b6e86ce08a2c2e924610ac2335f8de-0001-Ticket-49121-ns-slapd-crashes-in-ldif_sput-due-to-th.patch

These odd » characters are shown at some part of the patch.  I wonder what causes this display issue...  And non-ascii characters are not printed correctly although they are in the "View Raw" mode.  Please see the utf8str.txt file.

277 @@ -1499,30 +1506,36 @@ entry2str_internal_size_attrlist( const Slapi_Attr *attrlist, int entry2str_ctrl
280  »       »       /* Count the space required for the present and deleted values */
281 -»       »       elen+= entry2str_internal_size_valueset(a->a_type, &a->a_present_values,
282 -»       »       »       »       »       »       »       »       »       »       »       »       entry2str_ctrl, attribute_state,
283 -»       »       »       »       »       »       »       »       »       »       »       »       VALUE_PRESENT);

305 +»       »       elen += entry2str_internal_size_valueset(a, a->a_type, &a->a_present_values,
306 +»       »                                                entry2str_ctrl, attribute_state, VALUE_PRESENT);


Note: The test build was blessed by the bug reporter.

Thanks to William for his reviews.  I've update the patch based on his suggestion.

I also have 2 lib389 patches (attached to this email).  Is lib389 still in fedorahosted?  I cloned pagure.io/lib389.git, but I found it empty...

1) could you please review the patches?
2) if they look fine, is it ok to push them to fedorahosted git repository?

Thanks,
--noriko
>From 555887ad67c4bbc623330d5fb0c2664fcaef7029 Mon Sep 17 00:00:00 2001
From: Noriko Hosoi <nhosoi@xxxxxxxxxx>
Date: Fri, 27 Jan 2017 15:43:30 -0800
Subject: [PATCH 1/2] dbscan - Support additional options (-t truncate -R)

---
 lib389/__init__.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib389/__init__.py b/lib389/__init__.py
index c7cf0bb..bb3fe26 100644
--- a/lib389/__init__.py
+++ b/lib389/__init__.py
@@ -2773,12 +2773,14 @@ class DirSrv(SimpleLDAPObject, object):
 
         return result
 
-    def dbscan(self, bename=None, index=None, key=None):
+    def dbscan(self, bename=None, index=None, key=None, width=None, isRaw=False):
         """
         @param bename - The backend name to scan
         @param index - index name (e.g., cn or cn.db) to scan
         @param key - index key to dump
         @param id - entry id to dump
+        @param width - entry truncate size (bytes)
+        @param isRaw - dump as raw data
         @return - dumped string
         """
         DirSrvTools.lib389User(user=DEFAULT_USER)
@@ -2794,7 +2796,7 @@ class DirSrv(SimpleLDAPObject, object):
         elif '.db' in index:
             indexfile = os.path.join(self.dbdir, bename, index)
         else:
-            indexfile = os.path.join(self.dbdir, bename, index)
+            indexfile = os.path.join(self.dbdir, bename, index + '.db')
 
         option = ''
         if 'id2entry' in index:
@@ -2804,6 +2806,12 @@ class DirSrv(SimpleLDAPObject, object):
             if key:
                 option = ' -k %s' % key
 
+        if width:
+            option = option + ' -t %d' % width
+
+        if isRaw:
+            option = option + ' -R'
+
         cmd = '%s -f %s' % (prog, indexfile)
 
         if len(option) > 0:
-- 
2.9.3

>From a42b9e7b180c289698ed6147fe04ff154e1d5545 Mon Sep 17 00:00:00 2001
From: Noriko Hosoi <nhosoi@xxxxxxxxxx>
Date: Sat, 11 Feb 2017 17:05:47 -0800
Subject: [PATCH 2/2] fixing valgrind paths

---
 lib389/__init__.py | 2 ++
 lib389/utils.py    | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib389/__init__.py b/lib389/__init__.py
index bb3fe26..a38ee7f 100644
--- a/lib389/__init__.py
+++ b/lib389/__init__.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
 # --- BEGIN COPYRIGHT BLOCK ---
 # Copyright (C) 2015 Red Hat, Inc.
 # All rights reserved.
diff --git a/lib389/utils.py b/lib389/utils.py
index 0d0e261..aed46b6 100644
--- a/lib389/utils.py
+++ b/lib389/utils.py
@@ -208,7 +208,7 @@ def valgrind_enable(sbin_dir, wrapper=None):
     :raise EnvironmentError: If script is not run as 'root'
     '''
 
-    if os.geteuid() != 0:
+    if (sbin_dir == '/sbin' or sbin_dir == '/usr/sbin') and os.geteuid() != 0:
         log.error('This script must be run as root to use valgrind')
         raise EnvironmentError
 
@@ -272,7 +272,7 @@ def valgrind_disable(sbin_dir):
     :raise EnvironmentError: If script is not run as 'root'
     '''
 
-    if os.geteuid() != 0:
+    if (sbin_dir == '/sbin' or sbin_dir == '/usr/sbin') and os.geteuid() != 0:
         log.error('This script must be run as root to use valgrind')
         raise EnvironmentError
 
-- 
2.9.3

_______________________________________________
389-devel mailing list -- 389-devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to 389-devel-leave@xxxxxxxxxxxxxxxxxxxxxxx

[Index of Archives]     [Fedora Directory Announce]     [Fedora Users]     [Older Fedora Users Mail]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Review]     [Fedora Art]     [Fedora Music]     [Fedora Packaging]     [CentOS]     [Fedora SELinux]     [Big List of Linux Books]     [KDE Users]     [Fedora Art]     [Fedora Docs]

  Powered by Linux