ldap/servers
by Noriko Hosoi
ldap/servers/slapd/conntable.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit bca0908b1e10ada69cdc051d4aaceda73a940597
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Jul 7 12:54:38 2015 -0700
Ticket #48203 - Fix coverity issues - 07/07/2015
Description:
1. Defect type: CLANG_WARNING
389-ds-base-1.3.4.0/ldap/servers/slapd/conntable.c:161:11: warning:
Access to field 'c_ct' results in a dereference of a null pointer
(loaded from variable 'c')
Thanks to rmeggins(a)redhat.com for the advice:
> PR_NewLock() returns NULL then the server is severely out of some
> resource (like RAM, stack space, etc.) and probably should just exit.
https://fedorahosted.org/389/ticket/48203#comment:8
diff --git a/ldap/servers/slapd/conntable.c b/ldap/servers/slapd/conntable.c
index 0364d94..d5b9058 100644
--- a/ldap/servers/slapd/conntable.c
+++ b/ldap/servers/slapd/conntable.c
@@ -147,7 +147,7 @@ connection_table_get_connection(Connection_Table *ct, int sd)
c->c_mutex = NULL;
c->c_pdumutex = NULL;
LDAPDebug( LDAP_DEBUG_ANY,"PR_NewLock failed\n",0, 0, 0 );
- c= NULL;
+ exit(1);
}
}
/* Let's make sure there's no cruft left on there from the last time this connection was used. */
8 years, 9 months
Branch '389-ds-base-1.3.4' - ldap/admin
by Noriko Hosoi
ldap/admin/src/scripts/Inf.pm | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
New commits:
commit 5bd7119d8529e1c0b763c45e3ec7d1fb497da6c8
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Mon Jul 6 15:55:43 2015 -0400
Ticket 48119 - setup-ds.pl does not log invalid --file path errors the same way as other errors.
Bug Description: Errors occuring from Inf.pm are only written to STDERR
Fix Description: Write errors from Inf.pm using the debug function
https://fedorahosted.org/389/ticket/48119
Reviewed by: nhosoi(Thanks!)
(cherry picked from commit 6306fc4e8eb2fb5973360f550c83e3c9b220df5c)
diff --git a/ldap/admin/src/scripts/Inf.pm b/ldap/admin/src/scripts/Inf.pm
index 98649ac..ec433e2 100644
--- a/ldap/admin/src/scripts/Inf.pm
+++ b/ldap/admin/src/scripts/Inf.pm
@@ -12,6 +12,7 @@
package Inf;
+use DSUtil;
use File::Temp qw(tempfile tempdir);
#require Exporter;
@@ -59,7 +60,7 @@ sub read {
$inffh = \*STDIN;
} else {
if (!open(INF, $filename)) {
- print STDERR "Error: could not open inf file $filename: $!\n";
+ debug(0, "Error: could not open inf file $filename: $!\n");
return;
}
$inffh = \*INF;
@@ -124,7 +125,7 @@ sub section {
my $key = shift;
if (!exists($self->{$key})) {
- print "Error: unknown inf section $key\n";
+ debug(0, "Error: unknown inf section $key\n");
return undef;
}
@@ -187,7 +188,7 @@ sub write {
my $savemask = umask(0077);
if (!$fh) {
if (!open(INF, ">$filename")) {
- print STDERR "Error: could not write inf file $filename: $!\n";
+ debug(0, "Error: could not write inf file $filename: $!\n");
umask($savemask);
return;
}
@@ -232,7 +233,7 @@ sub updateFromArgs {
$argsinf->{$sec}->{$parm} = $val;
}
} else { # error
- print STDERR "Error: unknown command line option $arg\n";
+ debug(0, "Error: unknown command line option $arg\n");
return;
}
}
8 years, 9 months
ldap/admin
by Mark Reynolds
ldap/admin/src/scripts/Inf.pm | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
New commits:
commit 6306fc4e8eb2fb5973360f550c83e3c9b220df5c
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Mon Jul 6 15:55:43 2015 -0400
Ticket 48119 - setup-ds.pl does not log invalid --file path errors the same way as other errors.
Bug Description: Errors occuring from Inf.pm are only written to STDERR
Fix Description: Write errors from Inf.pm using the debug function
https://fedorahosted.org/389/ticket/48119
Reviewed by: nhosoi(Thanks!)
diff --git a/ldap/admin/src/scripts/Inf.pm b/ldap/admin/src/scripts/Inf.pm
index 98649ac..ec433e2 100644
--- a/ldap/admin/src/scripts/Inf.pm
+++ b/ldap/admin/src/scripts/Inf.pm
@@ -12,6 +12,7 @@
package Inf;
+use DSUtil;
use File::Temp qw(tempfile tempdir);
#require Exporter;
@@ -59,7 +60,7 @@ sub read {
$inffh = \*STDIN;
} else {
if (!open(INF, $filename)) {
- print STDERR "Error: could not open inf file $filename: $!\n";
+ debug(0, "Error: could not open inf file $filename: $!\n");
return;
}
$inffh = \*INF;
@@ -124,7 +125,7 @@ sub section {
my $key = shift;
if (!exists($self->{$key})) {
- print "Error: unknown inf section $key\n";
+ debug(0, "Error: unknown inf section $key\n");
return undef;
}
@@ -187,7 +188,7 @@ sub write {
my $savemask = umask(0077);
if (!$fh) {
if (!open(INF, ">$filename")) {
- print STDERR "Error: could not write inf file $filename: $!\n";
+ debug(0, "Error: could not write inf file $filename: $!\n");
umask($savemask);
return;
}
@@ -232,7 +233,7 @@ sub updateFromArgs {
$argsinf->{$sec}->{$parm} = $val;
}
} else { # error
- print STDERR "Error: unknown command line option $arg\n";
+ debug(0, "Error: unknown command line option $arg\n");
return;
}
}
8 years, 9 months
Branch '389-ds-base-1.2.11' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/opshared.c | 22 ++++++++++++++++------
ldap/servers/slapd/pagedresults.c | 24 +++++++++++++++++++++++-
ldap/servers/slapd/proto-slap.h | 1 +
3 files changed, 40 insertions(+), 7 deletions(-)
New commits:
commit 81733602478133b3847914f30733440d1d1608b2
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Mon Jul 6 14:06:11 2015 -0700
Ticket #48192 - Individual abandoned simple paged results request has no chance to be cleaned up
Description: There was a small window that the search on the next page
after the previous page abandoned referred the cleaned up simple paged
object.
This patch introduces a pagedresults_is_abandoned helper function to
check the simple paged results was abandoned or not with some improvements
based upon the comments by rmeggins(a)redhat.com (Thank you!!):
1) adding locking when getting a simplepaged object in pagedresults_is_
abandoned_or_notavailable as well as in pagedresults_{un}lock.
2) sending "Simple Paged Results Search abandoned" if the previous page
with the same cookie in the same connection was abandoned.
https://fedorahosted.org/389/ticket/48192
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!!)
(cherry picked from commit e4d83c91fc88fcf9e6c823c608c629ac10e362f8)
(cherry picked from commit b513a502250f93cfb43df000c2140b27c4ef0d39)
(cherry picked from commit 7a05195020124690111cd27724efe0bf6d2d63c9)
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index 28fe066..31d41e8 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/ldap/servers/slapd/opshared.c
@@ -702,12 +702,20 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
*/
pr_search_result = pagedresults_get_search_result(pb->pb_conn, operation, pr_idx);
if (pr_search_result) {
- slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, pr_search_result );
- rc = send_results_ext (pb, 1, &pnentries, pagesize, &pr_stat);
+ if (pagedresults_is_abandoned_or_notavailable(pb->pb_conn, pr_idx)) {
+ pagedresults_unlock(pb->pb_conn, pr_idx);
+ /* Previous operation was abandoned and the simplepaged object is not in use. */
+ send_ldap_result(pb, 0, NULL, "Simple Paged Results Search abandoned", 0, NULL);
+ rc = LDAP_SUCCESS;
+ goto free_and_return;
+ } else {
+ slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, pr_search_result );
+ rc = send_results_ext (pb, 1, &pnentries, pagesize, &pr_stat);
- /* search result could be reset in the backend/dse */
- slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_SET, &sr);
- pagedresults_set_search_result(pb->pb_conn, operation, sr, 0, pr_idx);
+ /* search result could be reset in the backend/dse */
+ slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_SET, &sr);
+ pagedresults_set_search_result(pb->pb_conn, operation, sr, 0, pr_idx);
+ }
} else {
pr_stat = PAGEDRESULTS_SEARCH_END;
}
@@ -737,7 +745,9 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
if (PAGEDRESULTS_SEARCH_END == pr_stat) {
pagedresults_lock(pb->pb_conn, pr_idx);
slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_SET, NULL);
- pagedresults_free_one(pb->pb_conn, operation, pr_idx);
+ if (!pagedresults_is_abandoned_or_notavailable(pb->pb_conn, pr_idx)) {
+ pagedresults_free_one(pb->pb_conn, operation, pr_idx);
+ }
pagedresults_unlock(pb->pb_conn, pr_idx);
if (next_be) {
/* no more entries, but at least another backend */
diff --git a/ldap/servers/slapd/pagedresults.c b/ldap/servers/slapd/pagedresults.c
index a7fe2cd..010e5c1 100644
--- a/ldap/servers/slapd/pagedresults.c
+++ b/ldap/servers/slapd/pagedresults.c
@@ -890,6 +890,8 @@ pagedresults_reset_processing(Connection *conn, int index)
* If there are multiple slots, the connection may be a permanent one.
* Do not return timed out here. But let the next request take care the
* timedout slot(s).
+ *
+ * must be called within conn->c_mutex
*/
int
pagedresults_is_timedout_nolock(Connection *conn)
@@ -918,7 +920,10 @@ pagedresults_is_timedout_nolock(Connection *conn)
return 0;
}
-/* reset all timeout */
+/*
+ * reset all timeout
+ * must be called within conn->c_mutex
+ */
int
pagedresults_reset_timedout_nolock(Connection *conn)
{
@@ -981,7 +986,9 @@ pagedresults_lock( Connection *conn, int index )
if (!conn || (index < 0) || (index >= conn->c_pagedresults.prl_maxlen)) {
return;
}
+ PR_Lock(conn->c_mutex);
prp = conn->c_pagedresults.prl_list + index;
+ PR_Unlock(conn->c_mutex);
if (prp->pr_mutex) {
PR_Lock(prp->pr_mutex);
}
@@ -995,9 +1002,24 @@ pagedresults_unlock( Connection *conn, int index )
if (!conn || (index < 0) || (index >= conn->c_pagedresults.prl_maxlen)) {
return;
}
+ PR_Lock(conn->c_mutex);
prp = conn->c_pagedresults.prl_list + index;
+ PR_Unlock(conn->c_mutex);
if (prp->pr_mutex) {
PR_Unlock(prp->pr_mutex);
}
return;
}
+
+int
+pagedresults_is_abandoned_or_notavailable( Connection *conn, int index )
+{
+ PagedResults *prp;
+ if (!conn || (index < 0) || (index >= conn->c_pagedresults.prl_maxlen)) {
+ return 1; /* not abandoned, but do not want to proceed paged results op. */
+ }
+ PR_Lock(conn->c_mutex);
+ prp = conn->c_pagedresults.prl_list + index;
+ PR_Unlock(conn->c_mutex);
+ return prp->pr_flags & CONN_FLAG_PAGEDRESULTS_ABANDONED;
+}
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 55d53bd..7a1ab46 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -1480,6 +1480,7 @@ int pagedresults_cleanup_all(Connection *conn, int needlock);
void op_set_pagedresults(Operation *op);
void pagedresults_lock(Connection *conn, int index);
void pagedresults_unlock(Connection *conn, int index);
+int pagedresults_is_abandoned_or_notavailable(Connection *conn, int index);
/*
* sort.c
8 years, 9 months
Branch '389-ds-base-1.3.3' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/opshared.c | 22 ++++++++++++++++------
ldap/servers/slapd/pagedresults.c | 24 +++++++++++++++++++++++-
ldap/servers/slapd/proto-slap.h | 1 +
3 files changed, 40 insertions(+), 7 deletions(-)
New commits:
commit 7a05195020124690111cd27724efe0bf6d2d63c9
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Mon Jul 6 14:06:11 2015 -0700
Ticket #48192 - Individual abandoned simple paged results request has no chance to be cleaned up
Description: There was a small window that the search on the next page
after the previous page abandoned referred the cleaned up simple paged
object.
This patch introduces a pagedresults_is_abandoned helper function to
check the simple paged results was abandoned or not with some improvements
based upon the comments by rmeggins(a)redhat.com (Thank you!!):
1) adding locking when getting a simplepaged object in pagedresults_is_
abandoned_or_notavailable as well as in pagedresults_{un}lock.
2) sending "Simple Paged Results Search abandoned" if the previous page
with the same cookie in the same connection was abandoned.
https://fedorahosted.org/389/ticket/48192
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!!)
(cherry picked from commit e4d83c91fc88fcf9e6c823c608c629ac10e362f8)
(cherry picked from commit b513a502250f93cfb43df000c2140b27c4ef0d39)
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index 9a5a141..fa506b3 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/ldap/servers/slapd/opshared.c
@@ -709,12 +709,20 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
*/
pr_search_result = pagedresults_get_search_result(pb->pb_conn, operation, pr_idx);
if (pr_search_result) {
- slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, pr_search_result );
- rc = send_results_ext (pb, 1, &pnentries, pagesize, &pr_stat);
+ if (pagedresults_is_abandoned_or_notavailable(pb->pb_conn, pr_idx)) {
+ pagedresults_unlock(pb->pb_conn, pr_idx);
+ /* Previous operation was abandoned and the simplepaged object is not in use. */
+ send_ldap_result(pb, 0, NULL, "Simple Paged Results Search abandoned", 0, NULL);
+ rc = LDAP_SUCCESS;
+ goto free_and_return;
+ } else {
+ slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, pr_search_result );
+ rc = send_results_ext (pb, 1, &pnentries, pagesize, &pr_stat);
- /* search result could be reset in the backend/dse */
- slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_SET, &sr);
- pagedresults_set_search_result(pb->pb_conn, operation, sr, 0, pr_idx);
+ /* search result could be reset in the backend/dse */
+ slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_SET, &sr);
+ pagedresults_set_search_result(pb->pb_conn, operation, sr, 0, pr_idx);
+ }
} else {
pr_stat = PAGEDRESULTS_SEARCH_END;
}
@@ -744,7 +752,9 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
if (PAGEDRESULTS_SEARCH_END == pr_stat) {
pagedresults_lock(pb->pb_conn, pr_idx);
slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_SET, NULL);
- pagedresults_free_one(pb->pb_conn, operation, pr_idx);
+ if (!pagedresults_is_abandoned_or_notavailable(pb->pb_conn, pr_idx)) {
+ pagedresults_free_one(pb->pb_conn, operation, pr_idx);
+ }
pagedresults_unlock(pb->pb_conn, pr_idx);
if (next_be) {
/* no more entries, but at least another backend */
diff --git a/ldap/servers/slapd/pagedresults.c b/ldap/servers/slapd/pagedresults.c
index a7fe2cd..010e5c1 100644
--- a/ldap/servers/slapd/pagedresults.c
+++ b/ldap/servers/slapd/pagedresults.c
@@ -890,6 +890,8 @@ pagedresults_reset_processing(Connection *conn, int index)
* If there are multiple slots, the connection may be a permanent one.
* Do not return timed out here. But let the next request take care the
* timedout slot(s).
+ *
+ * must be called within conn->c_mutex
*/
int
pagedresults_is_timedout_nolock(Connection *conn)
@@ -918,7 +920,10 @@ pagedresults_is_timedout_nolock(Connection *conn)
return 0;
}
-/* reset all timeout */
+/*
+ * reset all timeout
+ * must be called within conn->c_mutex
+ */
int
pagedresults_reset_timedout_nolock(Connection *conn)
{
@@ -981,7 +986,9 @@ pagedresults_lock( Connection *conn, int index )
if (!conn || (index < 0) || (index >= conn->c_pagedresults.prl_maxlen)) {
return;
}
+ PR_Lock(conn->c_mutex);
prp = conn->c_pagedresults.prl_list + index;
+ PR_Unlock(conn->c_mutex);
if (prp->pr_mutex) {
PR_Lock(prp->pr_mutex);
}
@@ -995,9 +1002,24 @@ pagedresults_unlock( Connection *conn, int index )
if (!conn || (index < 0) || (index >= conn->c_pagedresults.prl_maxlen)) {
return;
}
+ PR_Lock(conn->c_mutex);
prp = conn->c_pagedresults.prl_list + index;
+ PR_Unlock(conn->c_mutex);
if (prp->pr_mutex) {
PR_Unlock(prp->pr_mutex);
}
return;
}
+
+int
+pagedresults_is_abandoned_or_notavailable( Connection *conn, int index )
+{
+ PagedResults *prp;
+ if (!conn || (index < 0) || (index >= conn->c_pagedresults.prl_maxlen)) {
+ return 1; /* not abandoned, but do not want to proceed paged results op. */
+ }
+ PR_Lock(conn->c_mutex);
+ prp = conn->c_pagedresults.prl_list + index;
+ PR_Unlock(conn->c_mutex);
+ return prp->pr_flags & CONN_FLAG_PAGEDRESULTS_ABANDONED;
+}
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 3f88f55..c6cd4ed 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -1524,6 +1524,7 @@ int pagedresults_cleanup_all(Connection *conn, int needlock);
void op_set_pagedresults(Operation *op);
void pagedresults_lock(Connection *conn, int index);
void pagedresults_unlock(Connection *conn, int index);
+int pagedresults_is_abandoned_or_notavailable(Connection *conn, int index);
/*
* sort.c
8 years, 9 months
Branch '389-ds-base-1.3.4' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/opshared.c | 22 ++++++++++++++++------
ldap/servers/slapd/pagedresults.c | 24 +++++++++++++++++++++++-
ldap/servers/slapd/proto-slap.h | 1 +
3 files changed, 40 insertions(+), 7 deletions(-)
New commits:
commit b513a502250f93cfb43df000c2140b27c4ef0d39
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Mon Jul 6 14:06:11 2015 -0700
Ticket #48192 - Individual abandoned simple paged results request has no chance to be cleaned up
Description: There was a small window that the search on the next page
after the previous page abandoned referred the cleaned up simple paged
object.
This patch introduces a pagedresults_is_abandoned helper function to
check the simple paged results was abandoned or not with some improvements
based upon the comments by rmeggins(a)redhat.com (Thank you!!):
1) adding locking when getting a simplepaged object in pagedresults_is_
abandoned_or_notavailable as well as in pagedresults_{un}lock.
2) sending "Simple Paged Results Search abandoned" if the previous page
with the same cookie in the same connection was abandoned.
https://fedorahosted.org/389/ticket/48192
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!!)
(cherry picked from commit e4d83c91fc88fcf9e6c823c608c629ac10e362f8)
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index 177daa6..dcdbb04 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/ldap/servers/slapd/opshared.c
@@ -677,12 +677,20 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
*/
pr_search_result = pagedresults_get_search_result(pb->pb_conn, operation, pr_idx);
if (pr_search_result) {
- slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, pr_search_result );
- rc = send_results_ext (pb, 1, &pnentries, pagesize, &pr_stat);
+ if (pagedresults_is_abandoned_or_notavailable(pb->pb_conn, pr_idx)) {
+ pagedresults_unlock(pb->pb_conn, pr_idx);
+ /* Previous operation was abandoned and the simplepaged object is not in use. */
+ send_ldap_result(pb, 0, NULL, "Simple Paged Results Search abandoned", 0, NULL);
+ rc = LDAP_SUCCESS;
+ goto free_and_return;
+ } else {
+ slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, pr_search_result );
+ rc = send_results_ext (pb, 1, &pnentries, pagesize, &pr_stat);
- /* search result could be reset in the backend/dse */
- slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_SET, &sr);
- pagedresults_set_search_result(pb->pb_conn, operation, sr, 0, pr_idx);
+ /* search result could be reset in the backend/dse */
+ slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_SET, &sr);
+ pagedresults_set_search_result(pb->pb_conn, operation, sr, 0, pr_idx);
+ }
} else {
pr_stat = PAGEDRESULTS_SEARCH_END;
}
@@ -712,7 +720,9 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
if (PAGEDRESULTS_SEARCH_END == pr_stat) {
pagedresults_lock(pb->pb_conn, pr_idx);
slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_SET, NULL);
- pagedresults_free_one(pb->pb_conn, operation, pr_idx);
+ if (!pagedresults_is_abandoned_or_notavailable(pb->pb_conn, pr_idx)) {
+ pagedresults_free_one(pb->pb_conn, operation, pr_idx);
+ }
pagedresults_unlock(pb->pb_conn, pr_idx);
if (next_be) {
/* no more entries, but at least another backend */
diff --git a/ldap/servers/slapd/pagedresults.c b/ldap/servers/slapd/pagedresults.c
index fdbfa41..d0c93cd 100644
--- a/ldap/servers/slapd/pagedresults.c
+++ b/ldap/servers/slapd/pagedresults.c
@@ -877,6 +877,8 @@ pagedresults_reset_processing(Connection *conn, int index)
* If there are multiple slots, the connection may be a permanent one.
* Do not return timed out here. But let the next request take care the
* timedout slot(s).
+ *
+ * must be called within conn->c_mutex
*/
int
pagedresults_is_timedout_nolock(Connection *conn)
@@ -905,7 +907,10 @@ pagedresults_is_timedout_nolock(Connection *conn)
return 0;
}
-/* reset all timeout */
+/*
+ * reset all timeout
+ * must be called within conn->c_mutex
+ */
int
pagedresults_reset_timedout_nolock(Connection *conn)
{
@@ -968,7 +973,9 @@ pagedresults_lock( Connection *conn, int index )
if (!conn || (index < 0) || (index >= conn->c_pagedresults.prl_maxlen)) {
return;
}
+ PR_Lock(conn->c_mutex);
prp = conn->c_pagedresults.prl_list + index;
+ PR_Unlock(conn->c_mutex);
if (prp->pr_mutex) {
PR_Lock(prp->pr_mutex);
}
@@ -982,9 +989,24 @@ pagedresults_unlock( Connection *conn, int index )
if (!conn || (index < 0) || (index >= conn->c_pagedresults.prl_maxlen)) {
return;
}
+ PR_Lock(conn->c_mutex);
prp = conn->c_pagedresults.prl_list + index;
+ PR_Unlock(conn->c_mutex);
if (prp->pr_mutex) {
PR_Unlock(prp->pr_mutex);
}
return;
}
+
+int
+pagedresults_is_abandoned_or_notavailable( Connection *conn, int index )
+{
+ PagedResults *prp;
+ if (!conn || (index < 0) || (index >= conn->c_pagedresults.prl_maxlen)) {
+ return 1; /* not abandoned, but do not want to proceed paged results op. */
+ }
+ PR_Lock(conn->c_mutex);
+ prp = conn->c_pagedresults.prl_list + index;
+ PR_Unlock(conn->c_mutex);
+ return prp->pr_flags & CONN_FLAG_PAGEDRESULTS_ABANDONED;
+}
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 57a2ce7..e8673e1 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -1487,6 +1487,7 @@ int pagedresults_cleanup_all(Connection *conn, int needlock);
void op_set_pagedresults(Operation *op);
void pagedresults_lock(Connection *conn, int index);
void pagedresults_unlock(Connection *conn, int index);
+int pagedresults_is_abandoned_or_notavailable(Connection *conn, int index);
/*
* sort.c
8 years, 9 months
ldap/servers
by Noriko Hosoi
ldap/servers/slapd/opshared.c | 22 ++++++++++++++++------
ldap/servers/slapd/pagedresults.c | 24 +++++++++++++++++++++++-
ldap/servers/slapd/proto-slap.h | 1 +
3 files changed, 40 insertions(+), 7 deletions(-)
New commits:
commit e4d83c91fc88fcf9e6c823c608c629ac10e362f8
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Mon Jul 6 14:06:11 2015 -0700
Ticket #48192 - Individual abandoned simple paged results request has no chance to be cleaned up
Description: There was a small window that the search on the next page
after the previous page abandoned referred the cleaned up simple paged
object.
This patch introduces a pagedresults_is_abandoned helper function to
check the simple paged results was abandoned or not with some improvements
based upon the comments by rmeggins(a)redhat.com (Thank you!!):
1) adding locking when getting a simplepaged object in pagedresults_is_
abandoned_or_notavailable as well as in pagedresults_{un}lock.
2) sending "Simple Paged Results Search abandoned" if the previous page
with the same cookie in the same connection was abandoned.
https://fedorahosted.org/389/ticket/48192
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!!)
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index 177daa6..dcdbb04 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/ldap/servers/slapd/opshared.c
@@ -677,12 +677,20 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
*/
pr_search_result = pagedresults_get_search_result(pb->pb_conn, operation, pr_idx);
if (pr_search_result) {
- slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, pr_search_result );
- rc = send_results_ext (pb, 1, &pnentries, pagesize, &pr_stat);
+ if (pagedresults_is_abandoned_or_notavailable(pb->pb_conn, pr_idx)) {
+ pagedresults_unlock(pb->pb_conn, pr_idx);
+ /* Previous operation was abandoned and the simplepaged object is not in use. */
+ send_ldap_result(pb, 0, NULL, "Simple Paged Results Search abandoned", 0, NULL);
+ rc = LDAP_SUCCESS;
+ goto free_and_return;
+ } else {
+ slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, pr_search_result );
+ rc = send_results_ext (pb, 1, &pnentries, pagesize, &pr_stat);
- /* search result could be reset in the backend/dse */
- slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_SET, &sr);
- pagedresults_set_search_result(pb->pb_conn, operation, sr, 0, pr_idx);
+ /* search result could be reset in the backend/dse */
+ slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_SET, &sr);
+ pagedresults_set_search_result(pb->pb_conn, operation, sr, 0, pr_idx);
+ }
} else {
pr_stat = PAGEDRESULTS_SEARCH_END;
}
@@ -712,7 +720,9 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
if (PAGEDRESULTS_SEARCH_END == pr_stat) {
pagedresults_lock(pb->pb_conn, pr_idx);
slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_SET, NULL);
- pagedresults_free_one(pb->pb_conn, operation, pr_idx);
+ if (!pagedresults_is_abandoned_or_notavailable(pb->pb_conn, pr_idx)) {
+ pagedresults_free_one(pb->pb_conn, operation, pr_idx);
+ }
pagedresults_unlock(pb->pb_conn, pr_idx);
if (next_be) {
/* no more entries, but at least another backend */
diff --git a/ldap/servers/slapd/pagedresults.c b/ldap/servers/slapd/pagedresults.c
index fdbfa41..d0c93cd 100644
--- a/ldap/servers/slapd/pagedresults.c
+++ b/ldap/servers/slapd/pagedresults.c
@@ -877,6 +877,8 @@ pagedresults_reset_processing(Connection *conn, int index)
* If there are multiple slots, the connection may be a permanent one.
* Do not return timed out here. But let the next request take care the
* timedout slot(s).
+ *
+ * must be called within conn->c_mutex
*/
int
pagedresults_is_timedout_nolock(Connection *conn)
@@ -905,7 +907,10 @@ pagedresults_is_timedout_nolock(Connection *conn)
return 0;
}
-/* reset all timeout */
+/*
+ * reset all timeout
+ * must be called within conn->c_mutex
+ */
int
pagedresults_reset_timedout_nolock(Connection *conn)
{
@@ -968,7 +973,9 @@ pagedresults_lock( Connection *conn, int index )
if (!conn || (index < 0) || (index >= conn->c_pagedresults.prl_maxlen)) {
return;
}
+ PR_Lock(conn->c_mutex);
prp = conn->c_pagedresults.prl_list + index;
+ PR_Unlock(conn->c_mutex);
if (prp->pr_mutex) {
PR_Lock(prp->pr_mutex);
}
@@ -982,9 +989,24 @@ pagedresults_unlock( Connection *conn, int index )
if (!conn || (index < 0) || (index >= conn->c_pagedresults.prl_maxlen)) {
return;
}
+ PR_Lock(conn->c_mutex);
prp = conn->c_pagedresults.prl_list + index;
+ PR_Unlock(conn->c_mutex);
if (prp->pr_mutex) {
PR_Unlock(prp->pr_mutex);
}
return;
}
+
+int
+pagedresults_is_abandoned_or_notavailable( Connection *conn, int index )
+{
+ PagedResults *prp;
+ if (!conn || (index < 0) || (index >= conn->c_pagedresults.prl_maxlen)) {
+ return 1; /* not abandoned, but do not want to proceed paged results op. */
+ }
+ PR_Lock(conn->c_mutex);
+ prp = conn->c_pagedresults.prl_list + index;
+ PR_Unlock(conn->c_mutex);
+ return prp->pr_flags & CONN_FLAG_PAGEDRESULTS_ABANDONED;
+}
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
index 57a2ce7..e8673e1 100644
--- a/ldap/servers/slapd/proto-slap.h
+++ b/ldap/servers/slapd/proto-slap.h
@@ -1487,6 +1487,7 @@ int pagedresults_cleanup_all(Connection *conn, int needlock);
void op_set_pagedresults(Operation *op);
void pagedresults_lock(Connection *conn, int index);
void pagedresults_unlock(Connection *conn, int index);
+int pagedresults_is_abandoned_or_notavailable(Connection *conn, int index);
/*
* sort.c
8 years, 9 months
Branch '389-ds-base-1.3.4' - 2 commits - dirsrvtests/tickets ldap/servers
by Noriko Hosoi
dirsrvtests/tickets/ticket48214_test.py | 171 ++++++++++++++++++++++++++++++++
ldap/servers/slapd/libglobs.c | 9 +
2 files changed, 178 insertions(+), 2 deletions(-)
New commits:
commit 7c73adc28c8877eb3b0d30a91f7fa8a964fb3fd2
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Jul 2 16:07:14 2015 -0700
Ticket #48214 - CI test: added test cases for ticket 48213
Description: ldapsearch on nsslapd-maxbersize returns 0 instead of
current value
https://fedorahosted.org/389/ticket/48214
(cherry picked from commit b7b663c0e20c2f9bf8885bd7633570dc8d34f394)
diff --git a/dirsrvtests/tickets/ticket48214_test.py b/dirsrvtests/tickets/ticket48214_test.py
new file mode 100644
index 0000000..afbef22
--- /dev/null
+++ b/dirsrvtests/tickets/ticket48214_test.py
@@ -0,0 +1,171 @@
+import os
+import sys
+import time
+import ldap
+import logging
+import pytest
+from lib389 import DirSrv, Entry, tools, tasks
+from lib389.tools import DirSrvTools
+from lib389._constants import *
+from lib389.properties import *
+from lib389.tasks import *
+from ldap.controls import SimplePagedResultsControl
+
+log = logging.getLogger(__name__)
+
+installation_prefix = None
+
+MYSUFFIX = 'dc=example,dc=com'
+MYSUFFIXBE = 'userRoot'
+
+class TopologyStandalone(object):
+ def __init__(self, standalone):
+ standalone.open()
+ self.standalone = standalone
+
+
+(a)pytest.fixture(scope="module")
+def topology(request):
+ '''
+ This fixture is used to standalone topology for the 'module'.
+ '''
+ global installation_prefix
+
+ if installation_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation_prefix
+
+ standalone = DirSrv(verbose=False)
+
+ # Args for the standalone instance
+ args_instance[SER_HOST] = HOST_STANDALONE
+ args_instance[SER_PORT] = PORT_STANDALONE
+ args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
+ args_standalone = args_instance.copy()
+ standalone.allocate(args_standalone)
+
+ # Get the status of the instance and restart it if it exists
+ instance_standalone = standalone.exists()
+
+ # Remove the instance
+ if instance_standalone:
+ standalone.delete()
+
+ # Create the instance
+ standalone.create()
+
+ # Used to retrieve configuration information (dbdir, confdir...)
+ standalone.open()
+
+ # clear the tmp directory
+ standalone.clearTmpDir(__file__)
+
+ # Here we have standalone instance up and running
+ return TopologyStandalone(standalone)
+
+def getMaxBerSizeFromDseLdif(topology):
+ topology.standalone.log.info(" +++++ Get maxbersize from dse.ldif +++++\n")
+ dse_ldif = topology.standalone.confdir + '/dse.ldif'
+ grepMaxBerCMD = "egrep nsslapd-maxbersize " + dse_ldif
+ topology.standalone.log.info(" Run CMD: %s\n" % grepMaxBerCMD)
+ grepMaxBerOUT = os.popen(grepMaxBerCMD, "r")
+ running = True
+ maxbersize = -1
+ while running:
+ l = grepMaxBerOUT.readline()
+ if l == "":
+ topology.standalone.log.info(" Empty: %s\n" % l)
+ running = False
+ elif "nsslapd-maxbersize:" in l.lower():
+ running = False
+ fields = l.split()
+ if len(fields) >= 2:
+ maxbersize = fields[1]
+ topology.standalone.log.info(" Right format - %s %s\n" % (fields[0], fields[1]))
+ else:
+ topology.standalone.log.info(" Wrong format - %s\n" % l)
+ else:
+ topology.standalone.log.info(" Else?: %s\n" % l)
+ return maxbersize
+
+def checkMaxBerSize(topology):
+ topology.standalone.log.info(" +++++ Check Max Ber Size +++++\n")
+ maxbersizestr = getMaxBerSizeFromDseLdif(topology)
+ maxbersize = int(maxbersizestr)
+ isdefault = True
+ defaultvalue = 2097152
+ if maxbersize < 0:
+ topology.standalone.log.info(" No nsslapd-maxbersize found in dse.ldif\n")
+ elif maxbersize == 0:
+ topology.standalone.log.info(" nsslapd-maxbersize: %d\n" % maxbersize)
+ else:
+ isdefault = False
+ topology.standalone.log.info(" nsslapd-maxbersize: %d\n" % maxbersize)
+
+ try:
+ entry = topology.standalone.search_s('cn=config', ldap.SCOPE_BASE,
+ "(cn=*)",
+ ['nsslapd-maxbersize'])
+ if entry:
+ searchedsize = entry[0].getValue('nsslapd-maxbersize')
+ topology.standalone.log.info(" ldapsearch returned nsslapd-maxbersize: %s\n" % searchedsize)
+ else:
+ topology.standalone.log.fatal('ERROR: cn=config is not found?')
+ assert False
+ except ldap.LDAPError, e:
+ topology.standalone.log.error('ERROR: Failed to search for user entry: ' + e.message['desc'])
+ assert False
+
+ if isdefault:
+ topology.standalone.log.info(" Checking %d vs %d\n" % (int(searchedsize), defaultvalue))
+ assert int(searchedsize) == defaultvalue
+
+
+def test_ticket48214_run(topology):
+ """
+ Check ldapsearch returns the correct maxbersize when it is not explicitly set.
+ """
+ log.info('Testing Ticket 48214 - ldapsearch on nsslapd-maxbersize returns 0 instead of current value')
+
+ # bind as directory manager
+ topology.standalone.log.info("Bind as %s" % DN_DM)
+ topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+
+ topology.standalone.log.info("\n\n######################### Out of Box ######################\n")
+ checkMaxBerSize(topology)
+
+ topology.standalone.log.info("\n\n######################### Add nsslapd-maxbersize: 0 ######################\n")
+ topology.standalone.modify_s('cn=config', [(ldap.MOD_REPLACE, 'nsslapd-maxbersize', '0')])
+ checkMaxBerSize(topology)
+
+ topology.standalone.log.info("\n\n######################### Add nsslapd-maxbersize: 10000 ######################\n")
+ topology.standalone.modify_s('cn=config', [(ldap.MOD_REPLACE, 'nsslapd-maxbersize', '10000')])
+ checkMaxBerSize(topology)
+
+ topology.standalone.log.info("ticket48214 was successfully verified.")
+
+
+def test_ticket48214_final(topology):
+ topology.standalone.delete()
+ log.info('Testcase PASSED')
+
+
+def run_isolated():
+ '''
+ run_isolated is used to run these test cases independently of a test scheduler (xunit, py.test..)
+ To run isolated without py.test, you need to
+ - edit this file and comment '@pytest.fixture' line before 'topology' function.
+ - set the installation prefix
+ - run this program
+ '''
+ global installation_prefix
+ installation_prefix = None
+
+ topo = topology(True)
+ test_ticket48214_run(topo)
+
+ test_ticket48214_final(topo)
+
+
+if __name__ == '__main__':
+ run_isolated()
+
commit b83c2554fad0bb2a08055c5105bcfa4c9d44af8f
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Jul 2 16:44:09 2015 -0700
Ticket #48214 - ldapsearch on nsslapd-maxbersize returns 0 instead of current value
Description: If nsslapd-maxbersize is not explicitely set in cn=config
or the value is 0, the default value is assigned. Internally, it was.
But ldapsearch did not return the default value.
https://fedorahosted.org/389/ticket/48214
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!)
(cherry picked from commit 7d0689aaadfa66a8f8a481b0c1bb70b2465c4986)
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index 24de4f3..a3c4243 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -821,7 +821,7 @@ static struct config_get_and_set {
{CONFIG_MAXBERSIZE_ATTRIBUTE, config_set_maxbersize,
NULL, 0,
(void**)&global_slapdFrontendConfig.maxbersize,
- CONFIG_INT, NULL, DEFAULT_MAX_BERSIZE},
+ CONFIG_INT, NULL, STRINGIFYDEFINE(DEFAULT_MAXBERSIZE)},
{CONFIG_MAXSASLIOSIZE_ATTRIBUTE, config_set_maxsasliosize,
NULL, 0,
(void**)&global_slapdFrontendConfig.maxsasliosize,
@@ -1540,6 +1540,7 @@ FrontendConfig_init () {
init_cn_uses_dn_syntax_in_dns = cfg->cn_uses_dn_syntax_in_dns = LDAP_OFF;
init_global_backend_local = LDAP_OFF;
cfg->maxsimplepaged_per_conn = DEFAULT_MAXSIMPLEPAGED_PER_CONN;
+ cfg->maxbersize = DEFAULT_MAXBERSIZE;
#ifdef ENABLE_NUNC_STANS
init_enable_nunc_stans = cfg->enable_nunc_stans = LDAP_OFF;
#endif
@@ -5713,6 +5714,9 @@ config_set_maxbersize( const char *attrname, char *value, char *errorbuf, int ap
return retVal;
}
+ if (size == 0) {
+ size = DEFAULT_MAXBERSIZE;
+ }
CFG_LOCK_WRITE(slapdFrontendConfig);
slapdFrontendConfig->maxbersize = size;
@@ -5728,8 +5732,9 @@ config_get_maxbersize()
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
maxbersize = slapdFrontendConfig->maxbersize;
- if(maxbersize==0)
+ if (maxbersize == 0) {
maxbersize = DEFAULT_MAXBERSIZE;
+ }
return maxbersize;
}
8 years, 10 months
2 commits - dirsrvtests/tickets ldap/servers
by Noriko Hosoi
dirsrvtests/tickets/ticket48214_test.py | 171 ++++++++++++++++++++++++++++++++
ldap/servers/slapd/libglobs.c | 9 +
2 files changed, 178 insertions(+), 2 deletions(-)
New commits:
commit b7b663c0e20c2f9bf8885bd7633570dc8d34f394
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Jul 2 16:07:14 2015 -0700
Ticket #48214 - CI test: added test cases for ticket 48213
Description: ldapsearch on nsslapd-maxbersize returns 0 instead of
current value
https://fedorahosted.org/389/ticket/48214
diff --git a/dirsrvtests/tickets/ticket48214_test.py b/dirsrvtests/tickets/ticket48214_test.py
new file mode 100644
index 0000000..afbef22
--- /dev/null
+++ b/dirsrvtests/tickets/ticket48214_test.py
@@ -0,0 +1,171 @@
+import os
+import sys
+import time
+import ldap
+import logging
+import pytest
+from lib389 import DirSrv, Entry, tools, tasks
+from lib389.tools import DirSrvTools
+from lib389._constants import *
+from lib389.properties import *
+from lib389.tasks import *
+from ldap.controls import SimplePagedResultsControl
+
+log = logging.getLogger(__name__)
+
+installation_prefix = None
+
+MYSUFFIX = 'dc=example,dc=com'
+MYSUFFIXBE = 'userRoot'
+
+class TopologyStandalone(object):
+ def __init__(self, standalone):
+ standalone.open()
+ self.standalone = standalone
+
+
+(a)pytest.fixture(scope="module")
+def topology(request):
+ '''
+ This fixture is used to standalone topology for the 'module'.
+ '''
+ global installation_prefix
+
+ if installation_prefix:
+ args_instance[SER_DEPLOYED_DIR] = installation_prefix
+
+ standalone = DirSrv(verbose=False)
+
+ # Args for the standalone instance
+ args_instance[SER_HOST] = HOST_STANDALONE
+ args_instance[SER_PORT] = PORT_STANDALONE
+ args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
+ args_standalone = args_instance.copy()
+ standalone.allocate(args_standalone)
+
+ # Get the status of the instance and restart it if it exists
+ instance_standalone = standalone.exists()
+
+ # Remove the instance
+ if instance_standalone:
+ standalone.delete()
+
+ # Create the instance
+ standalone.create()
+
+ # Used to retrieve configuration information (dbdir, confdir...)
+ standalone.open()
+
+ # clear the tmp directory
+ standalone.clearTmpDir(__file__)
+
+ # Here we have standalone instance up and running
+ return TopologyStandalone(standalone)
+
+def getMaxBerSizeFromDseLdif(topology):
+ topology.standalone.log.info(" +++++ Get maxbersize from dse.ldif +++++\n")
+ dse_ldif = topology.standalone.confdir + '/dse.ldif'
+ grepMaxBerCMD = "egrep nsslapd-maxbersize " + dse_ldif
+ topology.standalone.log.info(" Run CMD: %s\n" % grepMaxBerCMD)
+ grepMaxBerOUT = os.popen(grepMaxBerCMD, "r")
+ running = True
+ maxbersize = -1
+ while running:
+ l = grepMaxBerOUT.readline()
+ if l == "":
+ topology.standalone.log.info(" Empty: %s\n" % l)
+ running = False
+ elif "nsslapd-maxbersize:" in l.lower():
+ running = False
+ fields = l.split()
+ if len(fields) >= 2:
+ maxbersize = fields[1]
+ topology.standalone.log.info(" Right format - %s %s\n" % (fields[0], fields[1]))
+ else:
+ topology.standalone.log.info(" Wrong format - %s\n" % l)
+ else:
+ topology.standalone.log.info(" Else?: %s\n" % l)
+ return maxbersize
+
+def checkMaxBerSize(topology):
+ topology.standalone.log.info(" +++++ Check Max Ber Size +++++\n")
+ maxbersizestr = getMaxBerSizeFromDseLdif(topology)
+ maxbersize = int(maxbersizestr)
+ isdefault = True
+ defaultvalue = 2097152
+ if maxbersize < 0:
+ topology.standalone.log.info(" No nsslapd-maxbersize found in dse.ldif\n")
+ elif maxbersize == 0:
+ topology.standalone.log.info(" nsslapd-maxbersize: %d\n" % maxbersize)
+ else:
+ isdefault = False
+ topology.standalone.log.info(" nsslapd-maxbersize: %d\n" % maxbersize)
+
+ try:
+ entry = topology.standalone.search_s('cn=config', ldap.SCOPE_BASE,
+ "(cn=*)",
+ ['nsslapd-maxbersize'])
+ if entry:
+ searchedsize = entry[0].getValue('nsslapd-maxbersize')
+ topology.standalone.log.info(" ldapsearch returned nsslapd-maxbersize: %s\n" % searchedsize)
+ else:
+ topology.standalone.log.fatal('ERROR: cn=config is not found?')
+ assert False
+ except ldap.LDAPError, e:
+ topology.standalone.log.error('ERROR: Failed to search for user entry: ' + e.message['desc'])
+ assert False
+
+ if isdefault:
+ topology.standalone.log.info(" Checking %d vs %d\n" % (int(searchedsize), defaultvalue))
+ assert int(searchedsize) == defaultvalue
+
+
+def test_ticket48214_run(topology):
+ """
+ Check ldapsearch returns the correct maxbersize when it is not explicitly set.
+ """
+ log.info('Testing Ticket 48214 - ldapsearch on nsslapd-maxbersize returns 0 instead of current value')
+
+ # bind as directory manager
+ topology.standalone.log.info("Bind as %s" % DN_DM)
+ topology.standalone.simple_bind_s(DN_DM, PASSWORD)
+
+ topology.standalone.log.info("\n\n######################### Out of Box ######################\n")
+ checkMaxBerSize(topology)
+
+ topology.standalone.log.info("\n\n######################### Add nsslapd-maxbersize: 0 ######################\n")
+ topology.standalone.modify_s('cn=config', [(ldap.MOD_REPLACE, 'nsslapd-maxbersize', '0')])
+ checkMaxBerSize(topology)
+
+ topology.standalone.log.info("\n\n######################### Add nsslapd-maxbersize: 10000 ######################\n")
+ topology.standalone.modify_s('cn=config', [(ldap.MOD_REPLACE, 'nsslapd-maxbersize', '10000')])
+ checkMaxBerSize(topology)
+
+ topology.standalone.log.info("ticket48214 was successfully verified.")
+
+
+def test_ticket48214_final(topology):
+ topology.standalone.delete()
+ log.info('Testcase PASSED')
+
+
+def run_isolated():
+ '''
+ run_isolated is used to run these test cases independently of a test scheduler (xunit, py.test..)
+ To run isolated without py.test, you need to
+ - edit this file and comment '@pytest.fixture' line before 'topology' function.
+ - set the installation prefix
+ - run this program
+ '''
+ global installation_prefix
+ installation_prefix = None
+
+ topo = topology(True)
+ test_ticket48214_run(topo)
+
+ test_ticket48214_final(topo)
+
+
+if __name__ == '__main__':
+ run_isolated()
+
commit 7d0689aaadfa66a8f8a481b0c1bb70b2465c4986
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Jul 2 16:44:09 2015 -0700
Ticket #48214 - ldapsearch on nsslapd-maxbersize returns 0 instead of current value
Description: If nsslapd-maxbersize is not explicitely set in cn=config
or the value is 0, the default value is assigned. Internally, it was.
But ldapsearch did not return the default value.
https://fedorahosted.org/389/ticket/48214
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!)
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index 24de4f3..a3c4243 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -821,7 +821,7 @@ static struct config_get_and_set {
{CONFIG_MAXBERSIZE_ATTRIBUTE, config_set_maxbersize,
NULL, 0,
(void**)&global_slapdFrontendConfig.maxbersize,
- CONFIG_INT, NULL, DEFAULT_MAX_BERSIZE},
+ CONFIG_INT, NULL, STRINGIFYDEFINE(DEFAULT_MAXBERSIZE)},
{CONFIG_MAXSASLIOSIZE_ATTRIBUTE, config_set_maxsasliosize,
NULL, 0,
(void**)&global_slapdFrontendConfig.maxsasliosize,
@@ -1540,6 +1540,7 @@ FrontendConfig_init () {
init_cn_uses_dn_syntax_in_dns = cfg->cn_uses_dn_syntax_in_dns = LDAP_OFF;
init_global_backend_local = LDAP_OFF;
cfg->maxsimplepaged_per_conn = DEFAULT_MAXSIMPLEPAGED_PER_CONN;
+ cfg->maxbersize = DEFAULT_MAXBERSIZE;
#ifdef ENABLE_NUNC_STANS
init_enable_nunc_stans = cfg->enable_nunc_stans = LDAP_OFF;
#endif
@@ -5713,6 +5714,9 @@ config_set_maxbersize( const char *attrname, char *value, char *errorbuf, int ap
return retVal;
}
+ if (size == 0) {
+ size = DEFAULT_MAXBERSIZE;
+ }
CFG_LOCK_WRITE(slapdFrontendConfig);
slapdFrontendConfig->maxbersize = size;
@@ -5728,8 +5732,9 @@ config_get_maxbersize()
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
maxbersize = slapdFrontendConfig->maxbersize;
- if(maxbersize==0)
+ if (maxbersize == 0) {
maxbersize = DEFAULT_MAXBERSIZE;
+ }
return maxbersize;
}
8 years, 10 months
Branch '389-ds-base-1.2.11' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/back-ldbm/ldbm_attr.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
New commits:
commit 84b03a890b7773fce0adb79e692b6e4d9c70d574
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Jul 1 18:16:20 2015 -0700
Ticket #48212 - Dynamic nsMatchingRule changes had no effect on the attrinfo thus following reindexing, as well.
Description: When nsMatchingRule was dynamically updated in an index entry,
the value was set to the configuration but was not applied to the attribute
info. On-line reindexing following the nsMatchingRule change actually ignored
the setting. On the other hand, the standalone utility dbverify independently
picked up the nsMatchingRule from the configuration and generated the attribute
info, which expected the index reindexed based upon the new nsMatchingRule. But
it was actually not and dbverify reported the index corruption.
This patch applies the changes to the attribute info when nsMatchingRule is
modified.
https://fedorahosted.org/389/ticket/48212
Reviewed by rmeggins(a)redhat.com (Thank you, Rich!)
(cherry picked from commit d9679725e69df1d191864ca00bad6b79b13e7362)
(cherry picked from commit d15beff66fd28902bd8ca80af12ad76a7ecbe57d)
(cherry picked from commit 96cb1511b46e35f93ff47a0ad56d6e19a8e06227)
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_attr.c b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
index 1992174..db087fe 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_attr.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
@@ -156,7 +156,16 @@ ainfo_dup(
attrinfo_delete_idlistinfo(&a->ai_idlistinfo);
a->ai_idlistinfo = b->ai_idlistinfo;
b->ai_idlistinfo = NULL;
-
+
+ /* copy cmp functions and substr lengths */
+ a->ai_key_cmp_fn = b->ai_key_cmp_fn;
+ a->ai_dup_cmp_fn = b->ai_dup_cmp_fn;
+ if (b->ai_substr_lens) {
+ size_t substrlen = sizeof(int) * INDEX_SUBSTRLEN;
+ a->ai_substr_lens = (int *)slapi_ch_calloc(1, substrlen);
+ memcpy(a->ai_substr_lens, b->ai_substr_lens, substrlen);
+ }
+
return( 1 );
}
8 years, 10 months