wrappers/systemd.group.in wrappers/systemd.template.asan.service.in wrappers/systemd.template.service.in
by William Brown
wrappers/systemd.group.in | 2 +-
wrappers/systemd.template.asan.service.in | 2 +-
wrappers/systemd.template.service.in | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 40c2aa6b3a7cadea72de842b8418fec3c4f1eaab
Author: William Brown <firstyear(a)redhat.com>
Date: Fri May 27 12:44:53 2016 +1000
Ticket 48747 - dirsrv service fails to start when nsslapd-listenhost is configured
Thanks for the discussions to
According to these discussion with Lukas Slebodnik <lslebodn(a)redhat.com> [1] and
William Brown <wibrown(a)redhat.com> [2], replacing network.service with network.target
and network-online.target.
[1] https://fedorahosted.org/389/ticket/48747#comment:6
[2] https://fedorahosted.org/389/ticket/48747#comment:10
Also, let systemd.group.in have the same After= line as the individual service.
Finally, this changes the dependencies of network.target to network-online.target
which in some cases may be a stricter requirement.
https://fedorahosted.org/389/ticket/48747
Author: nhosoi, wibrown
Review by: nhosoi (Thanks!)
diff --git a/wrappers/systemd.group.in b/wrappers/systemd.group.in
index 135affc..53abc13 100644
--- a/wrappers/systemd.group.in
+++ b/wrappers/systemd.group.in
@@ -1,6 +1,6 @@
[Unit]
Description=@capbrand@ Directory Server
-After=syslog.target network.target ntpd.service
+After=chronyd.service ntpd.service network-online.target syslog.target
[Install]
WantedBy=multi-user.target
diff --git a/wrappers/systemd.template.asan.service.in b/wrappers/systemd.template.asan.service.in
index af91f16..dd361b4 100644
--- a/wrappers/systemd.template.asan.service.in
+++ b/wrappers/systemd.template.asan.service.in
@@ -15,7 +15,7 @@
[Unit]
Description=@capbrand@ Directory Server with ASAN %i.
PartOf=@systemdgroupname@
-After=chronyd.service network.service
+After=chronyd.service ntpd.service network-online.target syslog.target
[Service]
Type=notify
diff --git a/wrappers/systemd.template.service.in b/wrappers/systemd.template.service.in
index 3eb0789..a045036 100644
--- a/wrappers/systemd.template.service.in
+++ b/wrappers/systemd.template.service.in
@@ -15,7 +15,7 @@
[Unit]
Description=@capbrand@ Directory Server %i.
PartOf=@systemdgroupname@
-After=chronyd.service network.service
+After=chronyd.service ntpd.service network-online.target syslog.target
[Service]
Type=notify
7 years, 4 months
Branch '389-ds-base-1.3.4' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/opshared.c | 8 ++++++--
ldap/servers/slapd/pagedresults.c | 4 ++++
ldap/servers/slapd/pblock.c | 13 +++++++++++++
ldap/servers/slapd/result.c | 11 +++++++----
ldap/servers/slapd/slap.h | 1 +
ldap/servers/slapd/slapi-plugin.h | 1 +
6 files changed, 32 insertions(+), 6 deletions(-)
New commits:
commit ca50d1ca577099e3f14778a20a2fc5ca27bc365d
Author: Thierry Bordaz <tbordaz(a)redhat.com>
Date: Fri May 27 17:25:53 2016 -0700
Ticket 48752: Page result search should return empty cookie if there is no returned entry
Bug Description:
When there is no more entry to return the cookie should be empty
(see https://www.ietf.org/rfc/rfc2696.txt).
This is done when current_search_count=-1 but in case current_search_count=0
the cookie is returned. This let the ldap client think it has to continue
to send PR searches
Fix Description:
This fix is an hardening of the case there is no more entry to return.
Plus for the troubleshooting, the cookie value is additionally logged in
the access log:
[..] conn=# op=# RESULT err=0 tag=101 nentries=5 etime=0 notes=P pr_idx=2 pr_cookie=2
https://fedorahosted.org/389/ticket/48752
Reviewed by: nhosoi(a)redhat.com
Platforms tested: F23
Flag Day: no
Doc impact: no
(cherry picked from commit f215fb63a4ba2b57c44b29d6a88d655fb98917d1)
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index e76ca0f..84e4c71 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/ldap/servers/slapd/opshared.c
@@ -476,10 +476,12 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
if ( slapi_control_present (ctrlp, LDAP_CONTROL_PAGEDRESULTS,
&ctl_value, &iscritical) )
{
+ int pr_cookie = -1;
/* be is set only when this request is new. otherwise, prev be is honored. */
rc = pagedresults_parse_control_value(pb, ctl_value, &pagesize, &pr_idx, be);
/* Let's set pr_idx even if it fails; in case, pr_idx == -1. */
slapi_pblock_set(pb, SLAPI_PAGED_RESULTS_INDEX, &pr_idx);
+ slapi_pblock_set(pb, SLAPI_PAGED_RESULTS_COOKIE, &pr_cookie);
if ((LDAP_SUCCESS == rc) || (LDAP_CANCELLED == rc) || (0 == pagesize)) {
unsigned int opnote = SLAPI_OP_NOTE_SIMPLEPAGED;
op_set_pagedresults(operation);
@@ -699,7 +701,7 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
}
pagedresults_unlock(pb->pb_conn, pr_idx);
- if (PAGEDRESULTS_SEARCH_END == pr_stat) {
+ if ((PAGEDRESULTS_SEARCH_END == pr_stat) || (0 == pnentries)) {
/* no more entries to send in the backend */
if (NULL == next_be) {
/* no more entries && no more backends */
@@ -708,6 +710,7 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
curr_search_count = pnentries;
}
estimate = 0;
+ pr_stat = PAGEDRESULTS_SEARCH_END; /* make sure stat is SEARCH_END */
} else {
curr_search_count = pnentries;
estimate -= estimate?curr_search_count:0;
@@ -869,13 +872,14 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
curr_search_count = pnentries;
slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_SET, &sr);
- if (PAGEDRESULTS_SEARCH_END == pr_stat) {
+ if ((PAGEDRESULTS_SEARCH_END == pr_stat) || (0 == pnentries)) {
/* no more entries, but at least another backend */
PR_EnterMonitor(pb->pb_conn->c_mutex);
pagedresults_set_search_result(pb->pb_conn, operation, NULL, 1, pr_idx);
be->be_search_results_release(&sr);
rc = pagedresults_set_current_be(pb->pb_conn, next_be, pr_idx, 1);
PR_ExitMonitor(pb->pb_conn->c_mutex);
+ pr_stat = PAGEDRESULTS_SEARCH_END; /* make sure stat is SEARCH_END */
if (NULL == next_be) {
/* no more entries && no more backends */
curr_search_count = -1;
diff --git a/ldap/servers/slapd/pagedresults.c b/ldap/servers/slapd/pagedresults.c
index 52d2158..07a7b69 100644
--- a/ldap/servers/slapd/pagedresults.c
+++ b/ldap/servers/slapd/pagedresults.c
@@ -235,6 +235,7 @@ pagedresults_set_response_control( Slapi_PBlock *pb, int iscritical,
char *cookie_str = NULL;
int found = 0;
int i;
+ int cookie = 0;
LDAPDebug1Arg(LDAP_DEBUG_TRACE,
"--> pagedresults_set_response_control: idx=%d\n", index);
@@ -246,10 +247,13 @@ pagedresults_set_response_control( Slapi_PBlock *pb, int iscritical,
/* begin sequence, payload, end sequence */
if (current_search_count < 0) {
+ cookie = 0;
cookie_str = slapi_ch_strdup("");
} else {
+ cookie = index;
cookie_str = slapi_ch_smprintf("%d", index);
}
+ slapi_pblock_set ( pb, SLAPI_PAGED_RESULTS_COOKIE, &cookie );
ber_printf ( ber, "{io}", estimate, cookie_str, strlen(cookie_str) );
if ( ber_flatten ( ber, &berval ) != LDAP_SUCCESS )
{
diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
index d373d99..f268f72 100644
--- a/ldap/servers/slapd/pblock.c
+++ b/ldap/servers/slapd/pblock.c
@@ -1936,6 +1936,15 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
}
break;
+ case SLAPI_PAGED_RESULTS_COOKIE:
+ if (op_is_pagedresults(pblock->pb_op)) {
+ /* search req is simple paged results */
+ (*(int *)value) = pblock->pb_paged_results_cookie;
+ } else {
+ (*(int *)value) = 0;
+ }
+ break;
+
/* ACI Target Check */
case SLAPI_ACI_TARGET_CHECK:
(*(int *)value) = pblock->pb_aci_target_check;
@@ -3520,6 +3529,10 @@ slapi_pblock_set( Slapi_PBlock *pblock, int arg, void *value )
pblock->pb_paged_results_index = *(int *)value;
break;
+ case SLAPI_PAGED_RESULTS_COOKIE:
+ pblock->pb_paged_results_cookie = *(int *)value;
+ break;
+
/* ACI Target Check */
case SLAPI_ACI_TARGET_CHECK:
pblock->pb_aci_target_check = *((int *) value);
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
index cd58f50..34c4d41 100644
--- a/ldap/servers/slapd/result.c
+++ b/ldap/servers/slapd/result.c
@@ -26,6 +26,7 @@
#include "pratom.h"
#include "fe.h"
#include "vattr_spi.h"
+#include "slapi-plugin.h"
#include <ssl.h>
@@ -1931,8 +1932,10 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag, int nentrie
char csn_str[CSN_STRSIZE + 5];
char etime[ETIME_BUFSIZ];
int pr_idx = -1;
+ int pr_cookie = -1;
slapi_pblock_get(pb, SLAPI_PAGED_RESULTS_INDEX, &pr_idx);
+ slapi_pblock_get(pb, SLAPI_PAGED_RESULTS_COOKIE, &pr_cookie);
internal_op = operation_is_flag_set( op, OP_FLAG_INTERNAL );
@@ -2033,24 +2036,24 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag, int nentrie
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d RESULT err=%d"
" tag=%" BERTAG_T " nentries=%d etime=%s%s%s"
- " pr_idx=%d\n",
+ " pr_idx=%d pr_cookie=%d\n",
op->o_connid,
op->o_opid,
err, tag, nentries,
etime,
- notes_str, csn_str, pr_idx );
+ notes_str, csn_str, pr_idx, pr_cookie );
}
else
{
slapi_log_access( LDAP_DEBUG_ARGS,
"conn=%s op=%d RESULT err=%d"
" tag=%" BERTAG_T " nentries=%d etime=%s%s%s"
- " pr_idx=%d\n",
+ " pr_idx=%d pr_cookie=%d \n",
LOG_INTERNAL_OP_CON_ID,
LOG_INTERNAL_OP_OP_ID,
err, tag, nentries,
etime,
- notes_str, csn_str, pr_idx );
+ notes_str, csn_str, pr_idx, pr_cookie );
}
}
else if ( !internal_op )
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index 657f16d..6615868 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -1724,6 +1724,7 @@ typedef struct slapi_pblock {
int pb_syntax_filter_normalized; /* the syntax filter types/values are already normalized */
void *pb_syntax_filter_data; /* extra data to pass to a syntax plugin function */
int pb_paged_results_index; /* stash SLAPI_PAGED_RESULTS_INDEX */
+ int pb_paged_results_cookie; /* stash SLAPI_PAGED_RESULTS_COOKIE */
passwdPolicy *pwdpolicy;
void *op_stack_elem;
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index 72f3920..a193aad 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -7287,6 +7287,7 @@ typedef struct slapi_plugindesc {
/* Simple paged results index */
#define SLAPI_PAGED_RESULTS_INDEX 1945
+#define SLAPI_PAGED_RESULTS_COOKIE 1949
/* ACI Target Check */
#define SLAPI_ACI_TARGET_CHECK 1946
7 years, 4 months
ldap/servers
by Noriko Hosoi
ldap/servers/slapd/opshared.c | 8 ++++++--
ldap/servers/slapd/pagedresults.c | 4 ++++
ldap/servers/slapd/pblock.c | 13 +++++++++++++
ldap/servers/slapd/result.c | 11 +++++++----
ldap/servers/slapd/slap.h | 1 +
ldap/servers/slapd/slapi-plugin.h | 1 +
6 files changed, 32 insertions(+), 6 deletions(-)
New commits:
commit f215fb63a4ba2b57c44b29d6a88d655fb98917d1
Author: Thierry Bordaz <tbordaz(a)redhat.com>
Date: Fri May 27 17:25:53 2016 -0700
Ticket 48752: Page result search should return empty cookie if there is no returned entry
Bug Description:
When there is no more entry to return the cookie should be empty
(see https://www.ietf.org/rfc/rfc2696.txt).
This is done when current_search_count=-1 but in case current_search_count=0
the cookie is returned. This let the ldap client think it has to continue
to send PR searches
Fix Description:
This fix is an hardening of the case there is no more entry to return.
Plus for the troubleshooting, the cookie value is additionally logged in
the access log:
[..] conn=# op=# RESULT err=0 tag=101 nentries=5 etime=0 notes=P pr_idx=2 pr_cookie=2
https://fedorahosted.org/389/ticket/48752
Reviewed by: nhosoi(a)redhat.com
Platforms tested: F23
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
index 29a1d84..7eaa19a 100644
--- a/ldap/servers/slapd/opshared.c
+++ b/ldap/servers/slapd/opshared.c
@@ -477,10 +477,12 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
if ( slapi_control_present (ctrlp, LDAP_CONTROL_PAGEDRESULTS,
&ctl_value, &iscritical) )
{
+ int pr_cookie = -1;
/* be is set only when this request is new. otherwise, prev be is honored. */
rc = pagedresults_parse_control_value(pb, ctl_value, &pagesize, &pr_idx, be);
/* Let's set pr_idx even if it fails; in case, pr_idx == -1. */
slapi_pblock_set(pb, SLAPI_PAGED_RESULTS_INDEX, &pr_idx);
+ slapi_pblock_set(pb, SLAPI_PAGED_RESULTS_COOKIE, &pr_cookie);
if ((LDAP_SUCCESS == rc) || (LDAP_CANCELLED == rc) || (0 == pagesize)) {
unsigned int opnote = SLAPI_OP_NOTE_SIMPLEPAGED;
op_set_pagedresults(operation);
@@ -700,7 +702,7 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
}
pagedresults_unlock(pb->pb_conn, pr_idx);
- if (PAGEDRESULTS_SEARCH_END == pr_stat) {
+ if ((PAGEDRESULTS_SEARCH_END == pr_stat) || (0 == pnentries)) {
/* no more entries to send in the backend */
if (NULL == next_be) {
/* no more entries && no more backends */
@@ -709,6 +711,7 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
curr_search_count = pnentries;
}
estimate = 0;
+ pr_stat = PAGEDRESULTS_SEARCH_END; /* make sure stat is SEARCH_END */
} else {
curr_search_count = pnentries;
estimate -= estimate?curr_search_count:0;
@@ -870,13 +873,14 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
curr_search_count = pnentries;
slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_SET, &sr);
- if (PAGEDRESULTS_SEARCH_END == pr_stat) {
+ if ((PAGEDRESULTS_SEARCH_END == pr_stat) || (0 == pnentries)) {
/* no more entries, but at least another backend */
PR_EnterMonitor(pb->pb_conn->c_mutex);
pagedresults_set_search_result(pb->pb_conn, operation, NULL, 1, pr_idx);
be->be_search_results_release(&sr);
rc = pagedresults_set_current_be(pb->pb_conn, next_be, pr_idx, 1);
PR_ExitMonitor(pb->pb_conn->c_mutex);
+ pr_stat = PAGEDRESULTS_SEARCH_END; /* make sure stat is SEARCH_END */
if (NULL == next_be) {
/* no more entries && no more backends */
curr_search_count = -1;
diff --git a/ldap/servers/slapd/pagedresults.c b/ldap/servers/slapd/pagedresults.c
index 52d2158..07a7b69 100644
--- a/ldap/servers/slapd/pagedresults.c
+++ b/ldap/servers/slapd/pagedresults.c
@@ -235,6 +235,7 @@ pagedresults_set_response_control( Slapi_PBlock *pb, int iscritical,
char *cookie_str = NULL;
int found = 0;
int i;
+ int cookie = 0;
LDAPDebug1Arg(LDAP_DEBUG_TRACE,
"--> pagedresults_set_response_control: idx=%d\n", index);
@@ -246,10 +247,13 @@ pagedresults_set_response_control( Slapi_PBlock *pb, int iscritical,
/* begin sequence, payload, end sequence */
if (current_search_count < 0) {
+ cookie = 0;
cookie_str = slapi_ch_strdup("");
} else {
+ cookie = index;
cookie_str = slapi_ch_smprintf("%d", index);
}
+ slapi_pblock_set ( pb, SLAPI_PAGED_RESULTS_COOKIE, &cookie );
ber_printf ( ber, "{io}", estimate, cookie_str, strlen(cookie_str) );
if ( ber_flatten ( ber, &berval ) != LDAP_SUCCESS )
{
diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
index d48c2d0..f6d3af0 100644
--- a/ldap/servers/slapd/pblock.c
+++ b/ldap/servers/slapd/pblock.c
@@ -1946,6 +1946,15 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
}
break;
+ case SLAPI_PAGED_RESULTS_COOKIE:
+ if (op_is_pagedresults(pblock->pb_op)) {
+ /* search req is simple paged results */
+ (*(int *)value) = pblock->pb_paged_results_cookie;
+ } else {
+ (*(int *)value) = 0;
+ }
+ break;
+
/* ACI Target Check */
case SLAPI_ACI_TARGET_CHECK:
(*(int *)value) = pblock->pb_aci_target_check;
@@ -3540,6 +3549,10 @@ slapi_pblock_set( Slapi_PBlock *pblock, int arg, void *value )
pblock->pb_paged_results_index = *(int *)value;
break;
+ case SLAPI_PAGED_RESULTS_COOKIE:
+ pblock->pb_paged_results_cookie = *(int *)value;
+ break;
+
/* ACI Target Check */
case SLAPI_ACI_TARGET_CHECK:
pblock->pb_aci_target_check = *((int *) value);
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
index b5681ec..cb465bf 100644
--- a/ldap/servers/slapd/result.c
+++ b/ldap/servers/slapd/result.c
@@ -26,6 +26,7 @@
#include "pratom.h"
#include "fe.h"
#include "vattr_spi.h"
+#include "slapi-plugin.h"
#include <ssl.h>
@@ -1938,8 +1939,10 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag, int nentrie
char csn_str[CSN_STRSIZE + 5];
char etime[ETIME_BUFSIZ];
int pr_idx = -1;
+ int pr_cookie = -1;
slapi_pblock_get(pb, SLAPI_PAGED_RESULTS_INDEX, &pr_idx);
+ slapi_pblock_get(pb, SLAPI_PAGED_RESULTS_COOKIE, &pr_cookie);
internal_op = operation_is_flag_set( op, OP_FLAG_INTERNAL );
@@ -2040,24 +2043,24 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag, int nentrie
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d RESULT err=%d"
" tag=%" BERTAG_T " nentries=%d etime=%s%s%s"
- " pr_idx=%d\n",
+ " pr_idx=%d pr_cookie=%d\n",
op->o_connid,
op->o_opid,
err, tag, nentries,
etime,
- notes_str, csn_str, pr_idx );
+ notes_str, csn_str, pr_idx, pr_cookie );
}
else
{
slapi_log_access( LDAP_DEBUG_ARGS,
"conn=%s op=%d RESULT err=%d"
" tag=%" BERTAG_T " nentries=%d etime=%s%s%s"
- " pr_idx=%d\n",
+ " pr_idx=%d pr_cookie=%d \n",
LOG_INTERNAL_OP_CON_ID,
LOG_INTERNAL_OP_OP_ID,
err, tag, nentries,
etime,
- notes_str, csn_str, pr_idx );
+ notes_str, csn_str, pr_idx, pr_cookie );
}
}
else if ( !internal_op )
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index 20a2a3a..a594a29 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -1735,6 +1735,7 @@ typedef struct slapi_pblock {
int pb_syntax_filter_normalized; /* the syntax filter types/values are already normalized */
void *pb_syntax_filter_data; /* extra data to pass to a syntax plugin function */
int pb_paged_results_index; /* stash SLAPI_PAGED_RESULTS_INDEX */
+ int pb_paged_results_cookie; /* stash SLAPI_PAGED_RESULTS_COOKIE */
passwdPolicy *pwdpolicy;
void *op_stack_elem;
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index d13aae9..294f2c3 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -7314,6 +7314,7 @@ typedef struct slapi_plugindesc {
/* Simple paged results index */
#define SLAPI_PAGED_RESULTS_INDEX 1945
+#define SLAPI_PAGED_RESULTS_COOKIE 1949
/* ACI Target Check */
#define SLAPI_ACI_TARGET_CHECK 1946
7 years, 4 months
Branch '389-ds-base-1.2.11' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/back-ldbm/import-threads.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
New commits:
commit d45d040db7284d404fd5d594b83468e036fb003e
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu May 26 17:58:51 2016 -0700
Ticket #48854 - Running db2index with no options breaks replication
Bug Description: It was a bug in import_foreman which was not adjusted
when the backend RUV entry was redesigned. The backend RUV entry has
no parent entry by nature. But import-forman mistakenly skipped to
handle the entry. If the 'db2index' command line is executed on a
consumer, this error message is logged.
error log on a consumer:
reindex userRoot: WARNING: Skipping entry "nsuniqueid=ffffffff-ffffffff-
ffffffff-ffffffff" which has no parent, ending at line 18 of file "id2entry.db"
reindex userRoot: WARNING: bad entry: ID 18
Due to this skip, the RUV entry is not found at the following start up
and a new RUV is generated by the MMR plugin. And the supplier finds the
generation ID mismatch.
error log on a supplier:
NSMMReplicationPlugin - agmt="cn=0_1" (HOST:PORT): The remote replica
has a different database generation ID than the local database. You
may have to reinitialize the remote replica, or the local replica.
Fix Description: Even if there is no parent entry, do not skip the RUV
entry as done for the suffix entry.
https://fedorahosted.org/389/ticket/48854
Reviewed by wibrown(a)redhat.com (Thank you, William!)
(cherry picked from commit ba3b8442abd4bd558d5467b07880d1c89613df9a)
(cherry picked from commit 14bc6ce2ba0e0613949dd45696b933e5a332a51c)
diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c
index 44fd35e..954abf2 100644
--- a/ldap/servers/slapd/back-ldbm/import-threads.c
+++ b/ldap/servers/slapd/back-ldbm/import-threads.c
@@ -2201,7 +2201,9 @@ import_foreman(void *param)
* we reject the entry but carry on since we've not stored
* anything related to this entry.
*/
- if (! slapi_be_issuffix(inst->inst_be, backentry_get_sdn(fi->entry))) {
+#define RUVRDN SLAPI_ATTR_UNIQUEID "=" RUV_STORAGE_ENTRY_UNIQUEID
+ if (!slapi_be_issuffix(inst->inst_be, backentry_get_sdn(fi->entry)) &&
+ strcasecmp(backentry_get_ndn(fi->entry), RUVRDN) /* NOT nsuniqueid=ffffffff-... */) {
import_log_notice(job, "WARNING: Skipping entry \"%s\" "
"which has no parent, ending at line %d "
"of file \"%s\"",
@@ -2227,8 +2229,7 @@ import_foreman(void *param)
goto cont; /* skip entry */
}
}
- if ((job->flags & FLAG_UPGRADEDNFORMAT) &&
- (LDBM_ERROR_FOUND_DUPDN == ret)) {
+ if ((job->flags & FLAG_UPGRADEDNFORMAT) && (LDBM_ERROR_FOUND_DUPDN == ret)) {
/*
* Duplicated DN is detected.
*
7 years, 4 months
Branch '389-ds-base-1.3.4' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/back-ldbm/import-threads.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
New commits:
commit 14bc6ce2ba0e0613949dd45696b933e5a332a51c
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu May 26 17:58:51 2016 -0700
Ticket #48854 - Running db2index with no options breaks replication
Bug Description: It was a bug in import_foreman which was not adjusted
when the backend RUV entry was redesigned. The backend RUV entry has
no parent entry by nature. But import-forman mistakenly skipped to
handle the entry. If the 'db2index' command line is executed on a
consumer, this error message is logged.
error log on a consumer:
reindex userRoot: WARNING: Skipping entry "nsuniqueid=ffffffff-ffffffff-
ffffffff-ffffffff" which has no parent, ending at line 18 of file "id2entry.db"
reindex userRoot: WARNING: bad entry: ID 18
Due to this skip, the RUV entry is not found at the following start up
and a new RUV is generated by the MMR plugin. And the supplier finds the
generation ID mismatch.
error log on a supplier:
NSMMReplicationPlugin - agmt="cn=0_1" (HOST:PORT): The remote replica
has a different database generation ID than the local database. You
may have to reinitialize the remote replica, or the local replica.
Fix Description: Even if there is no parent entry, do not skip the RUV
entry as done for the suffix entry.
https://fedorahosted.org/389/ticket/48854
Reviewed by wibrown(a)redhat.com (Thank you, William!)
(cherry picked from commit ba3b8442abd4bd558d5467b07880d1c89613df9a)
diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c
index e57267e..bae76c9 100644
--- a/ldap/servers/slapd/back-ldbm/import-threads.c
+++ b/ldap/servers/slapd/back-ldbm/import-threads.c
@@ -2540,7 +2540,9 @@ import_foreman(void *param)
* we reject the entry but carry on since we've not stored
* anything related to this entry.
*/
- if (! slapi_be_issuffix(inst->inst_be, backentry_get_sdn(fi->entry))) {
+#define RUVRDN SLAPI_ATTR_UNIQUEID "=" RUV_STORAGE_ENTRY_UNIQUEID
+ if (!slapi_be_issuffix(inst->inst_be, backentry_get_sdn(fi->entry)) &&
+ strcasecmp(backentry_get_ndn(fi->entry), RUVRDN) /* NOT nsuniqueid=ffffffff-... */) {
import_log_notice(job, "WARNING: Skipping entry \"%s\" "
"which has no parent, ending at line %d "
"of file \"%s\"",
@@ -2566,8 +2568,7 @@ import_foreman(void *param)
goto cont; /* skip entry */
}
}
- if ((job->flags & FLAG_UPGRADEDNFORMAT) &&
- (LDBM_ERROR_FOUND_DUPDN == ret)) {
+ if ((job->flags & FLAG_UPGRADEDNFORMAT) && (LDBM_ERROR_FOUND_DUPDN == ret)) {
/*
* Duplicated DN is detected.
*
7 years, 4 months
ldap/servers
by Noriko Hosoi
ldap/servers/slapd/back-ldbm/import-threads.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
New commits:
commit ba3b8442abd4bd558d5467b07880d1c89613df9a
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu May 26 17:58:51 2016 -0700
Ticket #48854 - Running db2index with no options breaks replication
Bug Description: It was a bug in import_foreman which was not adjusted
when the backend RUV entry was redesigned. The backend RUV entry has
no parent entry by nature. But import-forman mistakenly skipped to
handle the entry. If the 'db2index' command line is executed on a
consumer, this error message is logged.
error log on a consumer:
reindex userRoot: WARNING: Skipping entry "nsuniqueid=ffffffff-ffffffff-
ffffffff-ffffffff" which has no parent, ending at line 18 of file "id2entry.db"
reindex userRoot: WARNING: bad entry: ID 18
Due to this skip, the RUV entry is not found at the following start up
and a new RUV is generated by the MMR plugin. And the supplier finds the
generation ID mismatch.
error log on a supplier:
NSMMReplicationPlugin - agmt="cn=0_1" (HOST:PORT): The remote replica
has a different database generation ID than the local database. You
may have to reinitialize the remote replica, or the local replica.
Fix Description: Even if there is no parent entry, do not skip the RUV
entry as done for the suffix entry.
https://fedorahosted.org/389/ticket/48854
Reviewed by wibrown(a)redhat.com (Thank you, William!)
diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c
index d279056..1759478 100644
--- a/ldap/servers/slapd/back-ldbm/import-threads.c
+++ b/ldap/servers/slapd/back-ldbm/import-threads.c
@@ -2542,7 +2542,9 @@ import_foreman(void *param)
* we reject the entry but carry on since we've not stored
* anything related to this entry.
*/
- if (! slapi_be_issuffix(inst->inst_be, backentry_get_sdn(fi->entry))) {
+#define RUVRDN SLAPI_ATTR_UNIQUEID "=" RUV_STORAGE_ENTRY_UNIQUEID
+ if (!slapi_be_issuffix(inst->inst_be, backentry_get_sdn(fi->entry)) &&
+ strcasecmp(backentry_get_ndn(fi->entry), RUVRDN) /* NOT nsuniqueid=ffffffff-... */) {
import_log_notice(job, "WARNING: Skipping entry \"%s\" "
"which has no parent, ending at line %d "
"of file \"%s\"",
@@ -2568,8 +2570,7 @@ import_foreman(void *param)
goto cont; /* skip entry */
}
}
- if ((job->flags & FLAG_UPGRADEDNFORMAT) &&
- (LDBM_ERROR_FOUND_DUPDN == ret)) {
+ if ((job->flags & FLAG_UPGRADEDNFORMAT) && (LDBM_ERROR_FOUND_DUPDN == ret)) {
/*
* Duplicated DN is detected.
*
7 years, 4 months
ldap/servers
by William Brown
ldap/servers/slapd/plugin.c | 10 +++-
ldap/servers/slapd/slap.h | 1
ldap/servers/slapd/tools/pwenc.c | 81 +++++++++++++++++++++------------------
3 files changed, 54 insertions(+), 38 deletions(-)
New commits:
commit 2e5f0ffef4108cf4aca0adfb554e207c3132101c
Author: William Brown <firstyear(a)redhat.com>
Date: Mon May 23 13:11:11 2016 +1000
Ticket 48850 - Correct memory leaks in pwdhash-bin and ns-slapd
Bug Description: pwdhash-bin had two memory leaks in the handling of strings
and password types. We also leaked plugin component id's and the name of
password plugin types.
Fix Description: Free the data correctly.
https://fedorahosted.org/389/ticket/48850
Author: wibrown
Review by: nhosoi (Thanks!)
diff --git a/ldap/servers/slapd/plugin.c b/ldap/servers/slapd/plugin.c
index 5d63baa..39bfcef 100644
--- a/ldap/servers/slapd/plugin.c
+++ b/ldap/servers/slapd/plugin.c
@@ -52,6 +52,7 @@ static PRBool plugin_matches_operation (Slapi_DN *target_spec, PluginTargetData
static void plugin_config_init (struct pluginconfig *config);
static void plugin_config_cleanup (struct pluginconfig *config);
+static void plugin_free(struct slapdplugin *plugin);
static int plugin_config_set_action (int *action, char *value);
static struct pluginconfig* plugin_get_config (struct slapdplugin *plugin);
static void default_plugin_init();
@@ -1951,6 +1952,7 @@ plugin_closeall(int close_backends, int close_globals)
while (iterp) {
nextp = iterp->next;
slapi_entry_free(iterp->e);
+ plugin_free(iterp->plugin);
slapi_ch_free((void **)&iterp);
iterp = nextp;
}
@@ -2709,6 +2711,8 @@ plugin_free(struct slapdplugin *plugin)
slapi_ch_free_string(&plugin->plg_initfunc);
slapi_ch_free_string(&plugin->plg_name);
slapi_ch_free_string(&plugin->plg_dn);
+ slapi_ch_free_string(&plugin->plg_pwdstorageschemename);
+ release_componentid(plugin->plg_identity);
slapi_counter_destroy(&plugin->plg_op_counter);
if (!plugin->plg_group)
plugin_config_cleanup(&plugin->plg_conf);
@@ -3005,8 +3009,10 @@ plugin_setup(Slapi_Entry *plugin_entry, struct slapi_componentid *group,
slapi_pblock_set(&pb, SLAPI_PLUGIN, plugin);
slapi_pblock_set(&pb, SLAPI_PLUGIN_VERSION, (void *)SLAPI_PLUGIN_CURRENT_VERSION);
- cid = generate_componentid (plugin,NULL);
- slapi_pblock_set(&pb, SLAPI_PLUGIN_IDENTITY, (void*)cid);
+ cid = generate_componentid (plugin,NULL);
+ /* We take a copy of the pointer to this so we can free it correctly. */
+ plugin->plg_identity = cid;
+ slapi_pblock_set(&pb, SLAPI_PLUGIN_IDENTITY, (void*)cid);
configdir = config_get_configdir();
slapi_pblock_set(&pb, SLAPI_CONFIG_DIRECTORY, configdir);
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index c6763e4..20a2a3a 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -792,6 +792,7 @@ struct slapdplugin {
int plg_type; /* discriminates union */
char *plg_dn; /* config dn for this plugin */
char *plg_id; /* plugin id, used when adding/removing plugins */
+ struct slapi_componentid *plg_identity; /* Slapi component id */
int plg_precedence; /* for plugin execution ordering */
struct slapdplugin *plg_group; /* pointer to the group to which this plugin belongs */
struct pluginconfig plg_conf; /* plugin configuration parameters */
diff --git a/ldap/servers/slapd/tools/pwenc.c b/ldap/servers/slapd/tools/pwenc.c
index c5ed37c..525cd15 100644
--- a/ldap/servers/slapd/tools/pwenc.c
+++ b/ldap/servers/slapd/tools/pwenc.c
@@ -129,6 +129,7 @@ main( argc, argv )
{
int i, rc;
char *enc, *cmp, *name;
+ char *decoded = NULL;
struct pw_scheme *pwsp, *cmppwsp;
extern int optind;
char *cpwd = NULL; /* candidate password for comparison */
@@ -206,51 +207,63 @@ main( argc, argv )
}
}
- if ( cpwd != NULL ) {
- cmppwsp = pw_val2scheme( decode( cpwd ), &cmp, 1 );
- }
-
- if ( cmppwsp != NULL && pwsp != NULL ) {
- fprintf( stderr, "%s: do not use -s with -c\n", name );
- usage( name );
- }
+ if ( cpwd != NULL ) {
+ decoded = decode( cpwd );
+ cmppwsp = pw_val2scheme(decoded, &cmp, 1 );
+ }
+
+ if ( cmppwsp != NULL && pwsp != NULL ) {
+ fprintf( stderr, "%s: do not use -s with -c\n", name );
+ usage( name );
+ }
- if ( cmppwsp == NULL && pwsp == NULL ) {
- pwsp = pw_name2scheme( SALTED_SHA1_SCHEME_NAME );
- }
+ if ( cmppwsp == NULL && pwsp == NULL ) {
+ pwsp = pw_name2scheme( SALTED_SHA1_SCHEME_NAME );
+ }
- if ( argc <= optind ) {
- usage( name );
- }
+ if ( argc <= optind ) {
+ usage( name );
+ }
- if ( cmppwsp == NULL && pwsp->pws_enc == NULL ) {
+ if ( cmppwsp == NULL && pwsp->pws_enc == NULL ) {
fprintf( stderr,
"The scheme \"%s\" does not support password encoding.\n",
pwsp->pws_name );
- return( 1 );
- }
+ rc = 1;
+ goto out;
+ }
- srand((int)time(NULL)); /* schemes such as crypt use random salt */
+ srand((int)time(NULL)); /* schemes such as crypt use random salt */
- for ( rc = 0; optind < argc && rc == 0; ++optind ) {
+ for ( rc = 0; optind < argc && rc == 0; ++optind ) {
if ( cmppwsp == NULL ) { /* encode passwords */
- if (( enc = (*pwsp->pws_enc)( decode( argv[ optind ] ))) == NULL ) {
- perror( name );
- return( 1 );
+ decoded = decode( argv[ optind ] );
+ if (( enc = (*pwsp->pws_enc)( decoded )) == NULL ) {
+ perror( name );
+ rc = 1;
+ goto out;
}
puts( enc );
slapi_ch_free_string( &enc );
- } else { /* compare passwords */
- if (( rc = (*(cmppwsp->pws_cmp))( decode( argv[ optind ]), cmp )) == 0 ) {
- printf( "%s: password ok.\n", name );
+ } else { /* compare passwords */
+ decoded = decode( argv[ optind ] );
+ if (( rc = (*(cmppwsp->pws_cmp))( decoded, cmp )) == 0 ) {
+ printf( "%s: password ok.\n", name );
} else {
- printf( "%s: password does not match.\n", name );
+ printf( "%s: password does not match.\n", name );
}
}
- }
+ }
+
+out:
- return( rc == 0 ? 0 : 1 );
+ free_pw_scheme(pwsp);
+ slapi_ch_free_string(&decoded);
+
+ plugin_closeall( 1 /* Close Backends */, 1 /* Close Globals */);
+
+ return( rc == 0 ? 0 : 1 );
}
/* -------------------------------------------------------------- */
@@ -322,7 +335,7 @@ slapd_config(const char *configdir, const char *givenconfigfile)
* and schema subsystems be initialized... and they
* are not yet.
*/
- Slapi_Entry *e = slapi_str2entry(entrystr,
+ Slapi_Entry *e = slapi_str2entry(entrystr, // this one
SLAPI_STR2ENTRY_NOT_WELL_FORMED_LDIF);
if (e == NULL)
{
@@ -339,22 +352,18 @@ slapd_config(const char *configdir, const char *givenconfigfile)
if ( entry_has_attr_and_value(e, ATTR_PLUGIN_TYPE, "pwdstoragescheme"))
{
/* add the syntax/matching/pwd storage scheme rule plugin */
- if (plugin_setup(e, 0, 0, 1, returntext))
+ /* Because add_entry is 1, plugin_entry is duplicated */
+ if (plugin_setup(e, 0, 0, 1, returntext)) // This one
{
fprintf(stderr,
"The plugin entry [%s] in the configfile %s was invalid. %s\n",
slapi_entry_get_dn(e), configfile, returntext);
exit(1); /* yes this sucks, but who knows what else would go on if I did the right thing */
}
- else
- {
- e = 0; /* successful plugin_setup consumes entry */
- }
}
}
- if (e)
- slapi_entry_free(e);
+ slapi_entry_free(e);
}
/* kexcoff: initialize rootpwstoragescheme and pw_storagescheme
7 years, 4 months
m4/systemd.m4
by William Brown
m4/systemd.m4 | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
New commits:
commit b36a31526355be64943f468cc52ca90bccdf42f1
Author: William Brown <firstyear(a)redhat.com>
Date: Mon May 23 11:12:17 2016 +1000
Ticket 48849 - Systemd introduced incompatible changes that breaks ds build
Bug Description: In rawhide systemd removed a number of libraries in favour
of a monolithic version. This breaks our build that expected systemd modules.
Fix Description: Change our systemd.m4 to use the monolithic library
https://fedorahosted.org/389/ticket/48849
Author: wibrown
Review by: nhosoi (Thanks!{
diff --git a/m4/systemd.m4 b/m4/systemd.m4
index a6dd302..629f5ee 100644
--- a/m4/systemd.m4
+++ b/m4/systemd.m4
@@ -39,24 +39,18 @@ if test "$with_systemd" = yes; then
AC_PATH_PROG(PKG_CONFIG, pkg-config)
AC_MSG_CHECKING(for Systemd with pkg-config)
- if test "$with_journald" = yes; then
- if test -n "$PKG_CONFIG" && $PKG_CONFIG --exists systemd libsystemd-journal libsystemd-daemon ; then
- systemd_inc=`$PKG_CONFIG --cflags-only-I systemd libsystemd-journal libsystemd-daemon`
- systemd_lib=`$PKG_CONFIG --libs-only-l systemd libsystemd-journal libsystemd-daemon`
- systemd_defs="-DWITH_SYSTEMD -DHAVE_JOURNALD"
- else
- AC_MSG_ERROR([no Systemd / Journald pkg-config files])
- fi
+ if test -n "$PKG_CONFIG" && $PKG_CONFIG --exists libsystemd ; then
+ systemd_inc=`$PKG_CONFIG --cflags-only-I libsystemd`
+ systemd_lib=`$PKG_CONFIG --libs-only-l libsystemd`
else
+ AC_MSG_ERROR([no Systemd pkg-config files])
+ fi
- if test -n "$PKG_CONFIG" && $PKG_CONFIG --exists systemd libsystemd-daemon ; then
- systemd_inc=`$PKG_CONFIG --cflags-only-I systemd libsystemd-daemon`
- systemd_lib=`$PKG_CONFIG --libs-only-l systemd libsystemd-daemon`
- systemd_defs="-DWITH_SYSTEMD"
- else
- AC_MSG_ERROR([no Systemd pkg-config files])
- fi
+ if test "$with_journald" = yes; then
+ systemd_defs="-DWITH_SYSTEMD -DHAVE_JOURNALD"
+ else
+ systemd_defs="-DWITH_SYSTEMD"
fi
# Check for the pkg config provided unit paths
7 years, 4 months
3 commits - ldap/servers ldap/systools
by William Brown
ldap/servers/slapd/util.c | 41 +++++++++++++++++++++++++++++++----------
ldap/systools/idsktune.c | 25 ++++++++++++++++++++++---
2 files changed, 53 insertions(+), 13 deletions(-)
New commits:
commit 636c89b575d290dd3d3d7ee9df20d2da204b2784
Author: William Brown <firstyear(a)redhat.com>
Date: Sun May 22 14:19:03 2016 +1000
Ticket 48846 - 32 bit systems set low vmsize
Bug Description: 32 bit systems set vmsize low, and it grows. We should use
*not* use this for page available checks as it causes some errors.
Fix Description: Only uses pages from meminfo on a 32bit platform rather than
vmsize.
https://fedorahosted.org/389/ticket/48846
Author: wibrown
Review by: nhosoi (Thanks!)
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
index 070a7db..89c7579 100644
--- a/ldap/servers/slapd/util.c
+++ b/ldap/servers/slapd/util.c
@@ -1650,12 +1650,20 @@ int util_info_sys_pages(size_t *pagesize, size_t *pages, size_t *procpages, size
*/
LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages pages=%lu, vmsize=%lu, \n",
(unsigned long) *pages, (unsigned long) vmsize,0);
+#if __GNUC__
+#if __x86_64__ || __ppc64__
+ /* On 64bit platforms, vmsize is set high (VmSize), and doesn't change. IE 17tb */
if (vmsize < *pages) {
LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages using vmsize for pages \n",0,0,0);
*pages = vmsize;
} else {
LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages using pages for pages \n",0,0,0);
}
+#else
+ /* On 32bit platforms, vmsize is set low (VmSize) and grows. */
+ LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages using pages for pages \n",0,0,0);
+#endif
+#endif
/* Availpages is how much we *could* alloc. We should take the smallest:
* - pages
commit b08fa7e6d4b2eae22eef4931af86353274ef3945
Author: William Brown <firstyear(a)redhat.com>
Date: Fri May 20 22:34:57 2016 +1000
Ticket 48846 - Older kernels do not expose memavailable
Bug Description: Old kernels do not expose MemAvailable. As a result this would
be 0, and would be the lowest value in the check.
Fix Description: Check that our values for util_sys_pages is > 0
https://fedorahosted.org/389/ticket/48846
Author: wibrown
Review by: nhosoi (Thanks!)
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
index e7b02fa..070a7db 100644
--- a/ldap/servers/slapd/util.c
+++ b/ldap/servers/slapd/util.c
@@ -1670,15 +1670,15 @@ int util_info_sys_pages(size_t *pagesize, size_t *pages, size_t *procpages, size
(unsigned long)*pages, (unsigned long)*availpages, (unsigned long)freesize);
}
- if (rlimsize != RLIM_INFINITY && rlimsize < freesize && rlimsize < *pages) {
+ if (rlimsize != RLIM_INFINITY && rlimsize < freesize && rlimsize < *pages && rlimsize > 0) {
LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages using getrlim for availpages \n",0,0,0);
*availpages = rlimsize;
- } else if (*pages < freesize) {
- LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages using pages for availpages \n",0,0,0);
- *availpages = *pages;
- } else {
+ } else if (freesize < *pages && freesize > 0) {
LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages using freesize for availpages \n",0,0,0);
*availpages = freesize;
+ } else {
+ LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages using pages for availpages \n",0,0,0);
+ *availpages = *pages;
}
}
commit 17a56dbb676bbf4a4fd4f752eaa5bda616c4696c
Author: William Brown <firstyear(a)redhat.com>
Date: Fri May 20 10:20:16 2016 +1000
Ticket 48846 - Rlimit checks should detect RLIM_INFINITY
Bug Description: On certain platforms (32 bit) it was possible for dsktune and
other checks to fail as rlim.cur and rlim.max was -1. This would result in a
pattern of rlim.cur < some base limit, failing, even though rlimit implied
infinite. This did not affect 64bit platforms as rlim_infinity for them is
uint64 max.
Fix Description: Fix our various checks to look for and detect RLIM_INFINITY
when set correctly.
https://fedorahosted.org/389/ticket/48846
Author: wibrown
Review by: nhosoi (Thanks!)
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
index b0fd73b..e7b02fa 100644
--- a/ldap/servers/slapd/util.c
+++ b/ldap/servers/slapd/util.c
@@ -1571,6 +1571,7 @@ int util_info_sys_pages(size_t *pagesize, size_t *pages, size_t *procpages, size
size_t vmsize = 0;
size_t freesize = 0;
+ size_t rlimsize = 0;
*pagesize = getpagesize();
@@ -1632,8 +1633,14 @@ int util_info_sys_pages(size_t *pagesize, size_t *pages, size_t *procpages, size
freesize /= (*pagesize / 1024);
/* procpages is now in kb not pages... */
*procpages /= (*pagesize / 1024);
- /* This is in bytes, make it pages */
- *availpages = util_getvirtualmemsize() / *pagesize;
+
+ rlimsize = util_getvirtualmemsize();
+ /* On a 64 bit system, this is uint64 max, but on 32 it's -1 */
+ /* Either way, we should be ignoring it at this point if it's infinite */
+ if (rlimsize != RLIM_INFINITY) {
+ /* This is in bytes, make it pages */
+ rlimsize = rlimsize / *pagesize;
+ }
/* Now we have vmsize, the availpages from getrlimit, our freesize */
vmsize /= (*pagesize / 1024);
@@ -1655,19 +1662,25 @@ int util_info_sys_pages(size_t *pagesize, size_t *pages, size_t *procpages, size
* - getrlimit (availpages)
* - freesize
*/
- LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages pages=%lu, getrlim=%lu, freesize=%lu\n",
- (unsigned long)*pages, (unsigned long)*availpages, (unsigned long)freesize);
- if (*pages < *availpages && *pages < freesize) {
+ if (rlimsize == RLIM_INFINITY) {
+ LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages pages=%lu, getrlim=RLIM_INFINITY, freesize=%lu\n",
+ (unsigned long)*pages, (unsigned long)freesize, 0);
+ } else {
+ LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages pages=%lu, getrlim=%lu, freesize=%lu\n",
+ (unsigned long)*pages, (unsigned long)*availpages, (unsigned long)freesize);
+ }
+
+ if (rlimsize != RLIM_INFINITY && rlimsize < freesize && rlimsize < *pages) {
+ LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages using getrlim for availpages \n",0,0,0);
+ *availpages = rlimsize;
+ } else if (*pages < freesize) {
LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages using pages for availpages \n",0,0,0);
*availpages = *pages;
- } else if ( freesize < *pages && freesize < *availpages ) {
+ } else {
LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages using freesize for availpages \n",0,0,0);
*availpages = freesize;
- } else {
- LDAPDebug(LDAP_DEBUG_TRACE,"util_info_sys_pages using getrlim for availpages \n",0,0,0);
}
-
}
#endif /* linux */
diff --git a/ldap/systools/idsktune.c b/ldap/systools/idsktune.c
index 6a24b0e..c7e76e7 100644
--- a/ldap/systools/idsktune.c
+++ b/ldap/systools/idsktune.c
@@ -2380,7 +2380,12 @@ static void disk_tests(void)
if (flag_debug) {
printf("DEBUG : RLIMIT_CORE is %ld, %ld\n", r.rlim_cur, r.rlim_max);
}
- if (r.rlim_cur == (unsigned long)-1 || r.rlim_cur >= 2147483647) {
+
+#if defined(RLIM_INFINITY)
+ if (r.rlim_cur == RLIM_INFINITY || r.rlim_cur >= 2147483647) {
+#else
+ if (r.rlim_cur >= 2147483647) {
+#endif
if (swap_mb <2048) {
max_core = swap_mb;
} else {
@@ -2482,7 +2487,7 @@ static void check_mem_size(int ro,char *rn)
rprev = r.rlim_cur;
r.rlim_cur = r.rlim_max;
setrlimit(ro,&r);
- getrlimit(ro,&r);
+ getrlimit(ro,&r);
if (flag_debug) printf("DEBUG : %s (%d) max %d prev %d.\n", rn, ro, (int)r.rlim_cur, rprev);
@@ -2490,11 +2495,17 @@ static void check_mem_size(int ro,char *rn)
if (r.rlim_cur <= 0L) {
return;
}
-#endif
+#endif
if (r.rlim_cur <= 0) {
return;
}
+#if defined(RLIM_INFINITY)
+ if (r.rlim_cur == RLIM_INFINITY) {
+ return;
+ }
+#endif
+
m_mb = r.rlim_cur / 1048576;
if (m_mb < mem_min) { /* 64 MB */
@@ -2522,7 +2533,11 @@ static void limits_tests(void)
#if defined(RLIMIT_NOFILE)
getrlimit(RLIMIT_NOFILE,&r);
+#if defined(RLIM_INFINITY)
+ if (r.rlim_max <= 1024 && r.rlim_max != RLIM_INFINITY) {
+#else
if (r.rlim_max <= 1024) {
+#endif
if (flag_html) printf("<P>\n");
if (flag_carrier) {
@@ -2568,7 +2583,11 @@ static void limits_tests(void)
}
}
+#if defined(RLIM_INFINITY)
+ if (r.rlim_cur <= 1024 && r.rlim_max != RLIM_INFINITY) {
+#else
if (r.rlim_cur <= 1024) {
+#endif
if (flag_html) {
printf("<P>\n");
}
7 years, 4 months
ldap/servers
by William Brown
ldap/servers/slapd/back-ldbm/start.c | 45 ++++++++++++++++++++++-------------
1 file changed, 29 insertions(+), 16 deletions(-)
New commits:
commit d4eb7d04cf82c3be4d38f8c9e419a0fc26802206
Author: William Brown <firstyear(a)redhat.com>
Date: Thu May 19 11:41:05 2016 +1000
Ticket 48617 - Coverity fixes
Bug Description: During the addition of the combined cachesize checks, an
number of coverity issues were found.
Fix Description: Fix the defects that coverity discovered.
https://fedorahosted.org/389/ticket/48617
Author: wibrown
Review by: nhosoi (Thanks!)
diff --git a/ldap/servers/slapd/back-ldbm/start.c b/ldap/servers/slapd/back-ldbm/start.c
index 17d9228..acac2aa 100644
--- a/ldap/servers/slapd/back-ldbm/start.c
+++ b/ldap/servers/slapd/back-ldbm/start.c
@@ -37,8 +37,29 @@ ldbm_back_start( Slapi_PBlock *pb )
int retval;
int issane = 0;
PRUint64 total_cache_size = 0;
- size_t pagesize, pages, procpages, availpages;
- char *msg; /* This will be set by one of the two cache sizing paths below. */
+ size_t pagesize = 0;
+ size_t pages = 0;
+ size_t procpages = 0;
+ size_t availpages = 0;
+ char *msg = ""; /* This will be set by one of the two cache sizing paths below. */
+
+ char s[32]; /* big enough to hold %ld */
+ unsigned long cache_size_to_configure = 0;
+ int zone_pages;
+ int db_pages;
+ int entry_pages;
+ int import_pages;
+ size_t zone_size;
+ size_t import_size;
+ size_t total_size;
+ Object *inst_obj;
+ ldbm_instance *inst;
+ PRUint64 cache_size;
+ PRUint64 dncache_size;
+ PRUint64 db_size;
+#ifndef LINUX
+ PRUint64 memsize = pages * pagesize;
+#endif
LDAPDebug( LDAP_DEBUG_TRACE, "ldbm backend starting\n", 0, 0, 0 );
@@ -126,17 +147,6 @@ ldbm_back_start( Slapi_PBlock *pb )
return SLAPI_FAIL_GENERAL;
}
if (pagesize) {
- char s[32]; /* big enough to hold %ld */
- unsigned long cache_size_to_configure = 0;
- int zone_pages, db_pages, entry_pages, import_pages;
- Object *inst_obj;
- ldbm_instance *inst;
- PRUint64 cache_size;
- PRUint64 dncache_size;
- PRUint64 db_size;
-#ifndef LINUX
- PRUint64 memsize = pages * pagesize;
-#endif
if (li->li_cache_autosize == 0) {
/* First, set our message. */
msg = "This can be corrected by altering the values of nsslapd-dbcachesize, nsslapd-cachememsize and nsslapd-dncachememsize\n";
@@ -180,7 +190,7 @@ ldbm_back_start( Slapi_PBlock *pb )
} else if (li->li_cache_autosize > 0) {
msg = "This can be corrected by altering the values of nsslapd-cache-autosize, nsslapd-cache-autosize-split and nsslapd-dncachememsize\n";
zone_pages = (li->li_cache_autosize * pages) / 100;
- size_t zone_size = zone_pages * pagesize;
+ zone_size = zone_pages * pagesize;
/* This is how much we "might" use, lets check it's sane. */
/* In the case it is not, this will *reduce* the allocation */
issane = util_is_cachesize_sane(&zone_size);
@@ -234,8 +244,11 @@ ldbm_back_start( Slapi_PBlock *pb )
li->li_import_cache_autosize = 50;
}
import_pages = (li->li_import_cache_autosize * pages) / 100;
- size_t import_size = import_pages * pagesize;
+ import_size = import_pages * pagesize;
issane = util_is_cachesize_sane(&import_size);
+ if (!issane) {
+ LDAPDebug(LDAP_DEBUG_ANY, "Your autosized import cache values have been reduced. Likely your nsslapd-import-cache-autosize percentage is too high.\n", 0,0,0);
+ }
/* We just accept the reduced allocation here. */
import_pages = import_size / pagesize;
LDAPDebug(LDAP_DEBUG_ANY, "cache autosizing: import cache: %dk \n",
@@ -249,7 +262,7 @@ ldbm_back_start( Slapi_PBlock *pb )
/* Finally, lets check that the total result is sane. */
- size_t total_size = total_cache_size + (PRUint64)li->li_dbcachesize;
+ total_size = total_cache_size + (PRUint64)li->li_dbcachesize;
issane = util_is_cachesize_sane(&total_size);
if (!issane) {
/* Right, it's time to panic */
7 years, 4 months