ldap/admin
by Richard Allen Megginson
ldap/admin/src/scripts/ds-logpipe.py | 35 ++++++++++++++++++++++++++++-------
1 file changed, 28 insertions(+), 7 deletions(-)
New commits:
commit bb02e98ee264fe37f4ab6495872a470170277b12
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Tue Mar 29 14:09:02 2011 -0600
Bug 668385 - DS pipe log script is executed as many times as the dirsrv service is restarted
https://bugzilla.redhat.com/show_bug.cgi?id=668385
Resolves: bug 668385
Bug Description: DS pipe log script is executed as many times as the dirsrv service is restarted
Reviewed by: nkinder (Thanks!)
Branch: master
Fix Description: When running the ds-logpipe "standalone", when not tracking a server
pid, the ds-logpipe script should run forever until explicitly killed.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/admin/src/scripts/ds-logpipe.py b/ldap/admin/src/scripts/ds-logpipe.py
index 11546d3..04cef6a 100644
--- a/ldap/admin/src/scripts/ds-logpipe.py
+++ b/ldap/admin/src/scripts/ds-logpipe.py
@@ -311,9 +311,19 @@ signal.signal(signal.SIGINT, sighandler)
signal.signal(signal.SIGTERM, sighandler)
signal.signal(signal.SIGALRM, sighandler)
+timerisset = False
+neverdone = False
if options.serverpidfile:
# start the timer to wait for the pid file to be available
signal.setitimer(signal.ITIMER_REAL, options.servertimeout)
+ timerisset = True
+
+# if we are tracking a server, we will be done
+# when the server exits
+# if not tracking a server, we will only be done
+# when we are killed
+if not serverpid and not options.serverpidfile:
+ neverdone = True
done = False
while not done:
@@ -325,9 +335,12 @@ while not done:
if debug:
print "opened pipe", logf
- if options.serverpidfile:
+ if timerisset:
# cancel the timer - the open succeeded
+ timerisset = False
signal.setitimer(signal.ITIMER_REAL, 0)
+ if debug:
+ print "cancelled startup timer"
lines = 0
# read and process the next line in the pipe
@@ -338,13 +351,14 @@ while not done:
lines += 1
# the other end of the pipe closed - we close our end too
+ if debug:
+ print "read", lines, "lines"
logf.close()
logf = None
+ if debug:
+ print "closed log pipe", logfname
- if not serverpid and not options.serverpidfile:
- # no server to deal with - we're done
- done = True;
- elif not serverpid and options.serverpidfile:
+ if not serverpid and options.serverpidfile:
# see if the server has written its server pid file yet
# it may take a "long time" for the server to actually
# write its pid file
@@ -353,8 +367,12 @@ while not done:
# if the server is no longer running, just finish
if serverpid and not is_proc_alive(serverpid):
done = True
-
- if not done:
+ if debug:
+ print "server pid", serverpid, "exited - script exiting"
+
+ if neverdone:
+ done = False
+ elif not done:
if not lines:
# at startup the server will close the log and reopen it
# when it does this lines will be 0 - this means we need
@@ -367,6 +385,9 @@ while not done:
# timeout so we don't wait a long time if the server
# really is exiting
signal.setitimer(signal.ITIMER_REAL, 0.25)
+ timerisset = True
+ if debug:
+ print "set startup timer - see if server is really shut down"
else: # we read something
# pipe closed - usually when server shuts down
done = True
13 years
ldap/servers
by Nathan Kinder
ldap/servers/plugins/acl/acleffectiverights.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 0699244c9185649b8710053a39bee3ebe7ff1d43
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Tue Mar 29 08:41:25 2011 -0700
Bug 691574 - (cov#10573) Fix syntax error
The previous patch for cov#10573 added an extra paren. This removes
it.
diff --git a/ldap/servers/plugins/acl/acleffectiverights.c b/ldap/servers/plugins/acl/acleffectiverights.c
index e30370d..b596c8f 100644
--- a/ldap/servers/plugins/acl/acleffectiverights.c
+++ b/ldap/servers/plugins/acl/acleffectiverights.c
@@ -124,7 +124,7 @@ _ger_g_permission_granted (
/*
* The requestor may be either the bind dn or a proxy dn
*/
- if ((proxyauth_get_dn( pb, &proxydn, &errtext ) == LDAP_SUCCESS) && ( proxydn != NULL )) {
+ if ((proxyauth_get_dn( pb, &proxydn, &errtext ) == LDAP_SUCCESS) && ( proxydn != NULL ))
{
requestor_sdn = slapi_sdn_new_dn_passin ( proxydn );
}
13 years
4 commits - ldap/servers
by Nathan Kinder
ldap/servers/plugins/acl/acleffectiverights.c | 3 +--
ldap/servers/plugins/replication/repl5_connection.c | 3 +--
ldap/servers/slapd/back-ldbm/sort.c | 19 ++++++++++++++-----
ldap/servers/slapd/entrywsi.c | 9 +++++----
4 files changed, 21 insertions(+), 13 deletions(-)
New commits:
commit 03a6bb77b0c1ff86ea67a79f7d0d3d232dff03ce
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Mon Mar 28 14:43:33 2011 -0700
Bug 691574 - (cov#10575) Check return value of ldap_get_option
We should check the return value of ldap_get_option() in the
replication code when we check if we are ready to write data.
diff --git a/ldap/servers/plugins/replication/repl5_connection.c b/ldap/servers/plugins/replication/repl5_connection.c
index 068f1f4..ebde0b6 100644
--- a/ldap/servers/plugins/replication/repl5_connection.c
+++ b/ldap/servers/plugins/replication/repl5_connection.c
@@ -509,8 +509,7 @@ see_if_write_available(Repl_Connection *conn, PRIntervalTime timeout)
int rc;
/* get the sockbuf */
- ldap_get_option(conn->ld, LDAP_OPT_DESC, &fd);
- if (fd <= 0) {
+ if ((ldap_get_option(conn->ld, LDAP_OPT_DESC, &fd) != LDAP_OPT_SUCCESS) || (fd <= 0)) {
slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
"%s: invalid connection insee_if_write_available \n",
agmt_get_long_name(conn->agmt));
commit 53da4c81903a44d75e8b111ea652f8d97baa623b
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Mon Mar 28 14:27:48 2011 -0700
Bug 691574 - (cov#10573) check return value in GER code
We should check the return value of proxyauth_get_dn() in the
get effective rights code.
diff --git a/ldap/servers/plugins/acl/acleffectiverights.c b/ldap/servers/plugins/acl/acleffectiverights.c
index a866664..e30370d 100644
--- a/ldap/servers/plugins/acl/acleffectiverights.c
+++ b/ldap/servers/plugins/acl/acleffectiverights.c
@@ -124,8 +124,7 @@ _ger_g_permission_granted (
/*
* The requestor may be either the bind dn or a proxy dn
*/
- proxyauth_get_dn ( pb, &proxydn, &errtext );
- if ( proxydn != NULL )
+ if ((proxyauth_get_dn( pb, &proxydn, &errtext ) == LDAP_SUCCESS) && ( proxydn != NULL )) {
{
requestor_sdn = slapi_sdn_new_dn_passin ( proxydn );
}
commit d55024da1176fe98f9fdf7486474cbb042fd94ba
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Mon Mar 28 14:08:16 2011 -0700
Bug 691574 - (cov#10577) Check return types when adding RDN CSNs
We are not checking the return types when searching for RDN attrs
and values to create the RDN CSNs. This could result in us using
a deleted attribute or value when we should only be looking at
present attributes and values. Checking the return type allows
us to verify that we found a present attribute or value.
diff --git a/ldap/servers/slapd/entrywsi.c b/ldap/servers/slapd/entrywsi.c
index 499b2b7..9087651 100644
--- a/ldap/servers/slapd/entrywsi.c
+++ b/ldap/servers/slapd/entrywsi.c
@@ -262,17 +262,18 @@ entry_add_rdn_csn(Slapi_Entry *e, const CSN *csn)
{
Slapi_Attr *a= NULL;
Slapi_Value *v= NULL;
- entry_attr_find_wsi(e, type, &a);
- if(a!=NULL)
+ if ((entry_attr_find_wsi(e, type, &a) == ATTRIBUTE_PRESENT) && (a!=NULL))
{
struct berval bv;
bv.bv_len= strlen(value);
bv.bv_val= (void*)value;
- attr_value_find_wsi(a, &bv, &v);
+ if (attr_value_find_wsi(a, &bv, &v) == VALUE_DELETED) {
+ v = NULL;
+ }
}
if(v!=NULL)
{
- value_update_csn(v,CSN_TYPE_VALUE_DISTINGUISHED,csn);
+ value_update_csn(v,CSN_TYPE_VALUE_DISTINGUISHED,csn);
}
else
{
commit af1a33b7b13eca3f19e76ad922e360d6735faea5
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Mon Mar 28 13:53:19 2011 -0700
Bug 691574 - (cov#10579) Check return value of ber_scanf() in sort code
We should check if there was an error returned from ber_scanf()
when processing the sort control.
diff --git a/ldap/servers/slapd/back-ldbm/sort.c b/ldap/servers/slapd/back-ldbm/sort.c
index 2c9595d..ae3f3d6 100644
--- a/ldap/servers/slapd/back-ldbm/sort.c
+++ b/ldap/servers/slapd/back-ldbm/sort.c
@@ -345,18 +345,23 @@ int parse_sort_spec(struct berval *sort_spec_ber, sort_spec **ps)
/* Is it the matching rule ? */
if (LDAP_TAG_SK_MATCHRULE == next_tag) {
/* If so, get it */
- ber_scanf(ber,"a",&matchrule);
+ return_value = ber_scanf(ber,"a",&matchrule);
+ if (LBER_ERROR == return_value) {
+ rc = LDAP_PROTOCOL_ERROR;
+ goto err;
+ }
+
/* That can be followed by a reverse indicator */
len = -1; /* reset - not used here */
next_tag = ber_next_element(ber,&len, inner_last);
if (LDAP_TAG_SK_REVERSE == next_tag) {
/* Get the reverse sort indicator here */
- ber_scanf(ber,"b",&reverse);
+ return_value = ber_scanf(ber,"b",&reverse);
/* The protocol police say--"You must have other than your default value" */
- if (0 == reverse) {
+ if ((LBER_ERROR == return_value) || (0 == reverse)) {
/* Protocol error */
rc = LDAP_PROTOCOL_ERROR;
- goto err;
+ goto err;
}
} else {
/* Perhaps we're done now ? */
@@ -372,7 +377,11 @@ int parse_sort_spec(struct berval *sort_spec_ber, sort_spec **ps)
/* Is it the reverse indicator ? */
if (LDAP_TAG_SK_REVERSE == next_tag) {
/* If so, get it */
- ber_scanf(ber,"b",&reverse);
+ return_value = ber_scanf(ber,"b",&reverse);
+ if (LBER_ERROR == return_value) {
+ rc = LDAP_PROTOCOL_ERROR;
+ goto err;
+ }
} else {
/* Protocol error---tag which isn't either of the legal ones came first */
rc = LDAP_PROTOCOL_ERROR;
13 years
2 commits - ldap/servers
by Richard Allen Megginson
ldap/servers/slapd/back-ldbm/init.c | 2 ++
ldap/servers/slapd/result.c | 10 ++++++++++
2 files changed, 12 insertions(+)
New commits:
commit d91cd6344ca40f92c19856159add2a08d4f78993
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Mon Mar 28 15:09:35 2011 -0600
Bug 690584 - #10652 #10651 #10650 #10649 #10648 #10647 send_specific_attrs send_all_attrs - fix coverity resource leak issues
https://bugzilla.redhat.com/show_bug.cgi?id=690584
Resolves: bug 690584
Bug Description: #10652 #10651 #10650 #10649 #10648 #10647 send_specific_attrs send_all_attrs - fix coverity resource leak issues
Reviewed by: nkinder (Thanks!)
Branch: master
Fix Description: if it is possible for slapi_vattr_namespace_values_get_sp with rc != 0 or
item_count == 0, make sure to free the values allocated
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
index d269477..800fb39 100644
--- a/ldap/servers/slapd/result.c
+++ b/ldap/servers/slapd/result.c
@@ -1045,6 +1045,11 @@ static int send_all_attrs(Slapi_Entry *e,char **attrs,Slapi_Operation *op,Slapi_
}
} else {
+ /* if we got here, then either values is NULL or values contains no elements
+ either way we can free it */
+ slapi_ch_free((void**)&values);
+ slapi_ch_free((void**)&actual_type_name);
+ slapi_ch_free((void**)&type_name_disposition);
rc = 0;
}
}
@@ -1177,6 +1182,11 @@ int send_specific_attrs(Slapi_Entry *e,char **attrs,Slapi_Operation *op,Slapi_PB
}
} else {
+ /* if we got here, then either values is NULL or values contains no elements
+ either way we can free it */
+ slapi_ch_free((void**)&values);
+ slapi_ch_free((void**)&actual_type_name);
+ slapi_ch_free((void**)&type_name_disposition);
rc = 0;
}
}
commit 9ea3531355c40b9e9742ca11254e090394db56dd
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Mon Mar 28 15:01:14 2011 -0600
Bug 690584 - #10691 ldbm_back_init() - fix coverity resource leak issues
https://bugzilla.redhat.com/show_bug.cgi?id=690584
Resolves: bug 690584
Bug Description: #10691 ldbm_back_init() - fix coverity resource leak issues
Reviewed by: nkinder (Thanks!)
Branch: master
Fix Description: also have to free li and set the pblock pointer to NULL
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/back-ldbm/init.c b/ldap/servers/slapd/back-ldbm/init.c
index 19e6ab6..a904b9c 100644
--- a/ldap/servers/slapd/back-ldbm/init.c
+++ b/ldap/servers/slapd/back-ldbm/init.c
@@ -280,6 +280,8 @@ ldbm_back_init( Slapi_PBlock *pb )
fail:
dblayer_terminate( li );
+ slapi_ch_free((void **)&li);
+ slapi_pblock_set( pb, SLAPI_PLUGIN_PRIVATE, NULL );
return( -1 );
}
13 years
9 commits - ldap/servers
by Richard Allen Megginson
ldap/servers/plugins/acl/acl.c | 10 ++++++++++
ldap/servers/plugins/collation/collate.c | 2 +-
ldap/servers/plugins/replication/cl5_api.c | 5 +----
ldap/servers/plugins/replication/csnpl.c | 2 +-
ldap/servers/plugins/replication/windows_protocol_util.c | 2 +-
ldap/servers/slapd/back-ldbm/ldif2ldbm.c | 2 +-
ldap/servers/slapd/plugin_internal_op.c | 2 +-
ldap/servers/slapd/tools/rsearch/sdattable.c | 4 ++--
8 files changed, 18 insertions(+), 11 deletions(-)
New commits:
commit 67e2651847a7a1afbd307462106a23804ed99f62
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Mon Mar 28 14:19:24 2011 -0600
Bug 691422 - windows_replay_update - fix coverity control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=691422
Resolves: bug 691422
Bug Description: windows_replay_update - fix coverity control flow issues
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: is_ours will always be true here - so just remove the ?: statement and hard code "ours"
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/plugins/replication/windows_protocol_util.c b/ldap/servers/plugins/replication/windows_protocol_util.c
index dc3754b..3290e8d 100644
--- a/ldap/servers/plugins/replication/windows_protocol_util.c
+++ b/ldap/servers/plugins/replication/windows_protocol_util.c
@@ -1423,7 +1423,7 @@ windows_replay_update(Private_Repl_Protocol *prp, slapi_operation_parameters *op
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name,
"%s: windows_replay_update: Looking at %s operation local dn=\"%s\" (%s)\n",
agmt_get_long_name(prp->agmt),
- op2string(op->operation_type), op->target_address.dn, is_ours ? "ours" : "not ours");
+ op2string(op->operation_type), op->target_address.dn, "ours");
}
/* Just bail on this change. We don't want to do any
* further checks since we don't have a local entry. */
commit 09f09816352f18e799abe5e25916f6c375b64bbf
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Mon Mar 28 14:16:32 2011 -0600
Bug 691422 - cl5WriteRUV - fix coverity control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=691422
Resolves: bug 691422
Bug Description: cl5WriteRUV - fix coverity control flow issues
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: file_obj will always be NULL here, so just remove the code
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c
index 6f75d7f..b7e56fa 100644
--- a/ldap/servers/plugins/replication/cl5_api.c
+++ b/ldap/servers/plugins/replication/cl5_api.c
@@ -6302,9 +6302,6 @@ cl5WriteRUV()
}
file_obj = objset_next_obj(s_cl5Desc.dbFiles, file_obj);
}
- if (file_obj) {
- object_release (file_obj);
- }
bail:
if (closeit && (CL5_STATE_OPEN == s_cl5Desc.dbState)) {
_cl5Close ();
commit 3cb50e12fec36e32c738f08b4d9f0baef341f916
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Mon Mar 28 14:14:50 2011 -0600
Bug 691422 - search_internal_callback_pb - fix coverity control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=691422
Resolves: bug 691422
Bug Description: search_internal_callback_pb - fix coverity control flow issues
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: just get rid of the ifstr ?: - it is ok to pass a NULL to slapi_ch_strdup anyway.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/plugin_internal_op.c b/ldap/servers/slapd/plugin_internal_op.c
index 031fbcc..76f70e8 100644
--- a/ldap/servers/slapd/plugin_internal_op.c
+++ b/ldap/servers/slapd/plugin_internal_op.c
@@ -719,7 +719,7 @@ static int search_internal_callback_pb (Slapi_PBlock *pb, void *callback_data,
op->o_search_entry_handler = internal_srch_entry_callback;
op->o_search_referral_handler = internal_ref_entry_callback;
- filter = slapi_str2filter(ifstr ? (fstr = slapi_ch_strdup(ifstr)) : NULL);
+ filter = slapi_str2filter((fstr = slapi_ch_strdup(ifstr)));
if(scope == LDAP_SCOPE_BASE) {
filter->f_flags |= (SLAPI_FILTER_LDAPSUBENTRY |
SLAPI_FILTER_TOMBSTONE | SLAPI_FILTER_RUV);
commit 90919bb41f89cfc376d170c4b0b6c790b7ba96d3
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Mon Mar 28 14:12:13 2011 -0600
Bug 691422 - acl_read_access_allowed_on_entry - fix coverity control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=691422
Resolves: bug 691422
Bug Description: acl_read_access_allowed_on_entry - fix coverity control flow issues
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: ifdef out all code related to DETERMINE_ACCESS_BASED_ON_REQUESTED_ATTRIBUTES
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c
index e42a83a..2794694 100644
--- a/ldap/servers/plugins/acl/acl.c
+++ b/ldap/servers/plugins/acl/acl.c
@@ -846,7 +846,9 @@ acl_read_access_allowed_on_entry (
Slapi_Attr *currAttr;
Slapi_Attr *nextAttr;
int len;
+#ifdef DETERMINE_ACCESS_BASED_ON_REQUESTED_ATTRIBUTES
int attr_index = -1;
+#endif
char *attr_type = NULL;
int rv, isRoot;
char *clientDn;
@@ -1055,6 +1057,7 @@ acl_read_access_allowed_on_entry (
aclpb->aclpb_Evalattr = slapi_ch_malloc(len+1);
}
PL_strncpyz (aclpb->aclpb_Evalattr, attr_type, len);
+#ifdef DETERMINE_ACCESS_BASED_ON_REQUESTED_ATTRIBUTES
if ( attr_index >= 0 ) {
/*
* access was granted to one of the user specified attributes
@@ -1064,13 +1067,16 @@ acl_read_access_allowed_on_entry (
aclpb->aclpb_state |=
ACLPB_ACCESS_ALLOWED_USERATTR;
} else {
+#endif /* DETERMINE_ACCESS_BASED_ON_REQUESTED_ATTRIBUTES */
/*
* Access was granted to _an_ attribute in the entry and that
* attribute is now in aclpb_Evalattr
*/
aclpb->aclpb_state |=
ACLPB_ACCESS_ALLOWED_ON_A_ATTR;
+#ifdef DETERMINE_ACCESS_BASED_ON_REQUESTED_ATTRIBUTES
}
+#endif /* DETERMINE_ACCESS_BASED_ON_REQUESTED_ATTRIBUTES */
TNF_PROBE_1_DEBUG(acl_read_access_allowed_on_entry_end , "ACL","",
tnf_string,called_access_allowed,"");
@@ -1078,9 +1084,11 @@ acl_read_access_allowed_on_entry (
} else {
/* try the next one */
attr_type = NULL;
+#ifdef DETERMINE_ACCESS_BASED_ON_REQUESTED_ATTRIBUTES
if (attr_index >= 0) {
attr_type = attrs[attr_index++];
} else {
+#endif /* DETERMINE_ACCESS_BASED_ON_REQUESTED_ATTRIBUTES */
rv = slapi_entry_next_attr ( e, currAttr, &nextAttr );
if ( rv != 0 ) break;
currAttr = nextAttr;
@@ -1093,7 +1101,9 @@ acl_read_access_allowed_on_entry (
}
/* Get the attr type */
if ( currAttr ) slapi_attr_get_type ( currAttr , &attr_type );
+#ifdef DETERMINE_ACCESS_BASED_ON_REQUESTED_ATTRIBUTES
}
+#endif /* DETERMINE_ACCESS_BASED_ON_REQUESTED_ATTRIBUTES */
}
}
commit e936bd91f910825918b6b2951add7bc37c1a814b
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Mon Mar 28 14:08:26 2011 -0600
Bug 691422 - cl5DeleteRUV - fix coverity control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=691422
Resolves: bug 691422
Bug Description: cl5DeleteRUV - fix coverity control flow issues
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: move the if (file_obj) clause after the bail: label - I think this
was the intention of the code - if the while loop was bailed, file_obj may be
acquired, so it would have to be released
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c
index 88085e1..6f75d7f 100644
--- a/ldap/servers/plugins/replication/cl5_api.c
+++ b/ldap/servers/plugins/replication/cl5_api.c
@@ -6401,10 +6401,10 @@ cl5DeleteRUV()
}
file_obj = objset_next_obj(s_cl5Desc.dbFiles, file_obj);
}
+bail:
if (file_obj) {
object_release (file_obj);
}
-bail:
if (closeit && (CL5_STATE_OPEN == s_cl5Desc.dbState)) {
_cl5Close ();
s_cl5Desc.dbState = CL5_STATE_CLOSED; /* force to change the state */
commit be6ee97e7ee238fc03aea74ab3e5e37537fc6e13
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Mon Mar 28 13:57:53 2011 -0600
Bug 691422 - SetUnicodeStringFromUTF_8 - fix coverity control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=691422
Resolves: bug 691422
Bug Description: SetUnicodeStringFromUTF_8 - fix coverity control flow issues
Reviewed by: nkinder (Thanks!)
Branch: master
Fix Description: n is size_t, which is unsigned. In this case, n cannot be less
than zero anyway, so comparison with 0 will suffice.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/plugins/collation/collate.c b/ldap/servers/plugins/collation/collate.c
index be2e372..240da70 100644
--- a/ldap/servers/plugins/collation/collate.c
+++ b/ldap/servers/plugins/collation/collate.c
@@ -278,7 +278,7 @@ SetUnicodeStringFromUTF_8 (UChar** U, int32_t* Ulen, int *isAlloced, const struc
}
/* end now points at last non-null/non-space of val */
- if (n < 0) { /* bogus */
+ if (n == 0) { /* bogus */
return U_INVALID_FORMAT_ERROR; /* don't know what else to use here */
}
commit 1f23a16771a75b958850220c166af373e32457d8
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Mon Mar 28 12:39:05 2011 -0600
Bug 691422 - csnplFree - fix coverity control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=691422
Resolves: bug 691422
Bug Description: csnplFree - fix coverity control flow issues
Reviewed by: nkinder (Thanks!)
Branch: master
Fix Description: remove spurious semicolon
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/plugins/replication/csnpl.c b/ldap/servers/plugins/replication/csnpl.c
index 0f0d24b..048c6a3 100644
--- a/ldap/servers/plugins/replication/csnpl.c
+++ b/ldap/servers/plugins/replication/csnpl.c
@@ -122,7 +122,7 @@ void csnplFree (CSNPL **csnpl)
/* free all remaining nodes */
llistDestroy (&((*csnpl)->csnList), (FNFree)csnpldata_free);
- if ((*csnpl)->csnLock);
+ if ((*csnpl)->csnLock)
PR_DestroyRWLock ((*csnpl)->csnLock);
slapi_ch_free ((void**)csnpl);
commit 5ab6c376a9339aef68c492f8bcf657b28a662a22
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Mon Mar 28 12:33:58 2011 -0600
Bug 691422 - ldbm_back_upgradedb - fix coverity control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=691422
Resolves: bug 691422
Bug Description: ldbm_back_upgradedb - fix coverity control flow issues
Reviewed by: nkinder (Thanks!)
Branch: master
Fix Description: remove spurious semicolon
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
index cf0f539..87048c9 100644
--- a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
+++ b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
@@ -2760,7 +2760,7 @@ int ldbm_back_upgradedb(Slapi_PBlock *pb)
else
{
rval = dblayer_delete_indices(inst);
- if (rval);
+ if (rval)
{
upgrade_rval += rval;
slapi_log_error(SLAPI_LOG_FATAL, "upgrade DB",
commit 45189c533b46292bcea0adcfba457d292ef23a3d
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Mon Mar 28 12:32:28 2011 -0600
Bug 691422 - sdt_destroy - fix coverity control flow issues
https://bugzilla.redhat.com/show_bug.cgi?id=691422
Resolves: bug 691422
Bug Description: sdt_destroy - fix coverity control flow issues
Reviewed by: nkinder (Thanks!)
Branch: master
Fix Description: remove spurious semicolons
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/tools/rsearch/sdattable.c b/ldap/servers/slapd/tools/rsearch/sdattable.c
index 126ddc3..df1c152 100644
--- a/ldap/servers/slapd/tools/rsearch/sdattable.c
+++ b/ldap/servers/slapd/tools/rsearch/sdattable.c
@@ -96,9 +96,9 @@ void sdt_destroy(SDatTable *sdt)
free(sdt->uids[i]);
}
}
- if (sdt->dns);
+ if (sdt->dns)
free(sdt->dns);
- if (sdt->uids);
+ if (sdt->uids)
free(sdt->uids);
free(sdt);
}
13 years
Branch '389-ds-base-1.2.8' - ldap/servers
by Noriko Hosoi
ldap/servers/plugins/replication/repl5_replica.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
New commits:
commit 429574fbc36b08f0073a79907f5d1fc6bd5b516b
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Mar 25 16:18:34 2011 -0700
Bug 690955 - Mrclone fails due to the replica generation id mismatch
https://bugzilla.redhat.com/show_bug.cgi?id=690955
Description: To fix Bug 624442 - MMR: duplicate replica ID,
_replica_configure_ruv (repl5_replica.c) checks the replica IDs
from changelog, backend, and configuration. If the id from
config is different, recreate RUV.
For the mrclone (restore per backend instance) case, replica ID
from the backend is the other master's one. The value should
not be used to check if the RUV is recreated or not. Instead,
it does between the nsds5replicaID from config and the one
from the changelog.
diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c
index 71923d7..b2ebf93 100644
--- a/ldap/servers/plugins/replication/repl5_replica.c
+++ b/ldap/servers/plugins/replication/repl5_replica.c
@@ -1988,13 +1988,15 @@ _replica_configure_ruv (Replica *r, PRBool isLocked)
char *first_purl = NULL;
ruv_get_first_id_and_purl(ruv, &first_rid, &first_purl);
/* if the local supplier is not first in the list . . . */
+ /* rid is from changelog; first_rid is from backend */
if (rid != first_rid)
{
/* . . . move the local supplier to the beginning of the list */
ruv_move_local_supplier_to_first(ruv, rid);
need_update = RUV_UPDATE_PARTIAL; /* must update tombstone also */
}
- if (r->repl_rid != first_rid)
+ /* r->repl_rid is from config; rid is from changelog */
+ if (r->repl_rid != rid)
{
/* Most likely, the replica was once deleted
* and recreated with a different rid from the
13 years
ldap/servers
by Noriko Hosoi
ldap/servers/plugins/replication/repl5_replica.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
New commits:
commit c21b037b4dab44ba9c48330ce8b3e38c3dfbb656
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Mar 25 16:18:34 2011 -0700
Bug 690955 - Mrclone fails due to the replica generation id mismatch
https://bugzilla.redhat.com/show_bug.cgi?id=690955
Description: To fix Bug 624442 - MMR: duplicate replica ID,
_replica_configure_ruv (repl5_replica.c) checks the replica IDs
from changelog, backend, and configuration. If the id from
config is different, recreate RUV.
For the mrclone (restore per backend instance) case, replica ID
from the backend is the other master's one. The value should
not be used to check if the RUV is recreated or not. Instead,
it does between the nsds5replicaID from config and the one
from the changelog.
diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c
index 71923d7..b2ebf93 100644
--- a/ldap/servers/plugins/replication/repl5_replica.c
+++ b/ldap/servers/plugins/replication/repl5_replica.c
@@ -1988,13 +1988,15 @@ _replica_configure_ruv (Replica *r, PRBool isLocked)
char *first_purl = NULL;
ruv_get_first_id_and_purl(ruv, &first_rid, &first_purl);
/* if the local supplier is not first in the list . . . */
+ /* rid is from changelog; first_rid is from backend */
if (rid != first_rid)
{
/* . . . move the local supplier to the beginning of the list */
ruv_move_local_supplier_to_first(ruv, rid);
need_update = RUV_UPDATE_PARTIAL; /* must update tombstone also */
}
- if (r->repl_rid != first_rid)
+ /* r->repl_rid is from config; rid is from changelog */
+ if (r->repl_rid != rid)
{
/* Most likely, the replica was once deleted
* and recreated with a different rid from the
13 years
10 commits - ldap/servers
by Richard Allen Megginson
ldap/servers/plugins/acl/acllas.c | 4 +-
ldap/servers/plugins/linkedattrs/linked_attrs.c | 16 +-------
ldap/servers/plugins/replication/cl5_api.c | 46 +++++++++++++-----------
ldap/servers/slapd/back-ldbm/dblayer.c | 43 ++++++++++++++--------
ldap/servers/slapd/back-ldbm/init.c | 20 ++++++----
ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c | 5 +-
ldap/servers/slapd/entry.c | 4 ++
ldap/servers/slapd/modify.c | 4 +-
ldap/servers/slapd/resourcelimit.c | 40 +-------------------
ldap/servers/slapd/result.c | 25 +++++++++----
10 files changed, 101 insertions(+), 106 deletions(-)
New commits:
commit 6c9822577b32af674dae2f884030bf2fd8a51bc2
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Fri Mar 25 10:48:27 2011 -0600
Bug 690584 - #10641 reslimit_bv2int - fix coverity resource leak issues
https://bugzilla.redhat.com/show_bug.cgi?id=690584
Resolves: bug 690584
Bug Description: #10641 reslimit_bv2int - fix coverity resource leak issues
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: The comment was incorrect - slapi_value_get_int does handle
signed values correctly - it uses the same function atoi - the fix is to
get rid of reslimit_bv2int
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/resourcelimit.c b/ldap/servers/slapd/resourcelimit.c
index dc22a0a..563381f 100644
--- a/ldap/servers/slapd/resourcelimit.c
+++ b/ldap/servers/slapd/resourcelimit.c
@@ -181,7 +181,6 @@ static void reslimit_connext_destructor( void *extension, void *object,
void *parent );
static int reslimit_get_ext( Slapi_Connection *conn, const char *logname,
SLAPIResLimitConnData **rlcdpp );
-static int reslimit_bv2int( const struct berval *bvp );
static char ** reslimit_get_registered_attributes();
@@ -327,38 +326,6 @@ reslimit_get_ext( Slapi_Connection *conn, const char *logname,
}
-/*
- * utility function to convert a string-represented integer to an int.
- *
- * XXXmcs: wouldn't need this if slapi_value_get_int() returned a signed int!
- */
-static int
-reslimit_bv2int( const struct berval *bvp )
-{
- int rc = 0;
- char smallbuf[ 25 ], *buf;
-
- if ( bvp != NULL ) {
- /* make a copy to ensure it is zero-terminated */
- if ( bvp->bv_len < sizeof( smallbuf )) {
- buf = smallbuf;
- } else {
- buf = slapi_ch_malloc( bvp->bv_len + 1 );
- }
- memcpy( buf, bvp->bv_val, bvp->bv_len);
- buf[ bvp->bv_len ] = '\0';
-
- rc = atoi( buf );
-
- if ( buf != smallbuf ) {
- slapi_ch_free( (void **)&smallbuf );
- }
- }
-
- return( rc );
-}
-
-
/**** Semi-public functions start here ***********************************/
/*
* These functions are exposed to other parts of the server only, i.e.,
@@ -464,11 +431,10 @@ reslimit_update_from_entry( Slapi_Connection *conn, Slapi_Entry *e )
&actual_type_name, 0, &free_flags )) {
Slapi_Value *v;
int index;
- const struct berval *bvp;
- if (( index = slapi_valueset_first_value( vs, &v )) != -1 &&
- ( bvp = slapi_value_get_berval( v )) != NULL ) {
- rlcdp->rlcd_integer_value[ i ] = reslimit_bv2int( bvp );
+ if ((( index = slapi_valueset_first_value( vs, &v )) != -1) &&
+ ( v != NULL )) {
+ rlcdp->rlcd_integer_value[ i ] = slapi_value_get_int( v );
rlcdp->rlcd_integer_available[ i ] = PR_TRUE;
LDAPDebug( SLAPI_RESLIMIT_TRACELEVEL,
commit 8a88106ba1d49818ab36548303d16a156e921afd
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Fri Mar 25 10:40:30 2011 -0600
Bug 690584 - #10643 hash_rootpw - fix coverity resource leak issues
https://bugzilla.redhat.com/show_bug.cgi?id=690584
Resolves: bug 690584
Bug Description: #10643 hash_rootpw - fix coverity resource leak issues
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: store the pointer returned by pw_val2scheme and free it
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c
index ca580fb..2eafcf6 100644
--- a/ldap/servers/slapd/modify.c
+++ b/ldap/servers/slapd/modify.c
@@ -1241,7 +1241,9 @@ hash_rootpw (LDAPMod **mods)
for (j = 0; mod->mod_bvalues[j] != NULL; j++) {
char *val = mod->mod_bvalues[j]->bv_val;
char *hashedval = NULL;
- if (pw_val2scheme (val, NULL, 0)) {
+ struct pw_scheme *pws = pw_val2scheme (val, NULL, 0);
+ if (pws) {
+ free_pw_scheme(pws);
/* Value is pre-hashed, no work to do for this value */
continue;
} else if (! slapd_nss_is_initialized() ) {
commit 3e97d377e0899793fe156d09178a999952c792bf
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Fri Mar 25 10:36:09 2011 -0600
Bug 690584 - #10652 #10651 #10650 #10649 #10648 #10647 send_specific_attrs send_all_attrs - fix coverity resource leak issues
https://bugzilla.redhat.com/show_bug.cgi?id=690584
Resolves: bug 690584
Bug Description: #10652 #10651 #10650 #10649 #10648 #10647 send_specific_attrs send_all_attrs - fix coverity resource leak issues
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: if there is an error, we still have to free the values allocated
by slapi_vattr_namespace_values_get_sp() - so just continue the for loop, but if
rc != 0 just free the remaining values and continue
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
index fe150e7..d269477 100644
--- a/ldap/servers/slapd/result.c
+++ b/ldap/servers/slapd/result.c
@@ -995,6 +995,13 @@ static int send_all_attrs(Slapi_Entry *e,char **attrs,Slapi_Operation *op,Slapi_
for(iter=0; iter<item_count; iter++)
{
+ if ( rc != 0 ) {
+ /* we hit an error - we need to free all of the stuff allocated by
+ slapi_vattr_namespace_values_get_sp */
+ slapi_vattr_values_free(&(values[iter]), &(actual_type_name[iter]), attr_free_flags);
+ continue;
+ }
+
if (SLAPI_VIRTUALATTRS_TYPE_NAME_MATCHED_SUBTYPE == type_name_disposition[iter]) {
name_to_return = actual_type_name[iter];
}
@@ -1028,14 +1035,14 @@ static int send_all_attrs(Slapi_Entry *e,char **attrs,Slapi_Operation *op,Slapi_
}
slapi_vattr_values_free(&(values[iter]), &(actual_type_name[iter]), attr_free_flags);
- if ( rc != 0 ) {
- goto exit;
- }
}
slapi_ch_free((void**)&actual_type_name);
slapi_ch_free((void**)&type_name_disposition);
slapi_ch_free((void**)&values);
+ if ( rc != 0 ) {
+ goto exit;
+ }
} else {
rc = 0;
@@ -1121,6 +1128,12 @@ int send_specific_attrs(Slapi_Entry *e,char **attrs,Slapi_Operation *op,Slapi_PB
for(iter=0; iter<item_count; iter++)
{
+ if ( rc != 0 ) {
+ /* we hit an error - we need to free all of the stuff allocated by
+ slapi_vattr_namespace_values_get_sp */
+ slapi_vattr_values_free(&(values[iter]), &(actual_type_name[iter]), attr_free_flags);
+ continue;
+ }
if (SLAPI_VIRTUALATTRS_TYPE_NAME_MATCHED_SUBTYPE == type_name_disposition[iter]) {
name_to_return = actual_type_name[iter];
} else {
@@ -1154,14 +1167,14 @@ int send_specific_attrs(Slapi_Entry *e,char **attrs,Slapi_Operation *op,Slapi_PB
rc = encode_attr_2( pb, ber, e, values[iter], attrsonly, current_type_name, name_to_return );
slapi_vattr_values_free(&(values[iter]), &(actual_type_name[iter]), attr_free_flags);
- if ( rc != 0 ) {
- goto exit;
- }
}
slapi_ch_free((void**)&actual_type_name);
slapi_ch_free((void**)&type_name_disposition);
slapi_ch_free((void**)&values);
+ if ( rc != 0 ) {
+ goto exit;
+ }
} else {
rc = 0;
commit 51bf2d258d097264d1d8c0d344ee40cbca09cc9d
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Fri Mar 25 09:58:33 2011 -0600
Bug 690584 - #10654 #10653 str2entry_dupcheck - fix coverity resource leak issues
https://bugzilla.redhat.com/show_bug.cgi?id=690584
Resolves: bug 690584
Bug Description: #10654 #10653 str2entry_dupcheck - fix coverity resource leak issues
Reviewed by: nkinder (Thanks!)
Branch: master
Fix Description: make sure to free maxcsn and attributedeletioncsn before they go
out of scope
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index a30bab1..a4a67a6 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -809,6 +809,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
slapi_entry_free( e );
if (freeval) slapi_ch_free_string(&bvvalue.bv_val);
csn_free(&attributedeletioncsn);
+ csn_free(&maxcsn);
return NULL;
}
/* normdn is consumed in e */
@@ -826,6 +827,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
slapi_entry_free( e );
if (freeval) slapi_ch_free_string(&bvvalue.bv_val);
csn_free(&attributedeletioncsn);
+ csn_free(&maxcsn);
return NULL;
}
/* normdn is just referred in slapi_entry_set_rdn. */
@@ -879,6 +881,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
if ( (flags & SLAPI_STR2ENTRY_NO_ENTRYDN) &&
strcasecmp( type, "entrydn" ) == 0 ) {
if (freeval) slapi_ch_free_string(&bvvalue.bv_val);
+ csn_free(&attributedeletioncsn);
continue;
}
@@ -939,6 +942,7 @@ str2entry_dupcheck( const char *rawdn, char *s, int flags, int read_stateinfo )
/* Something very bad happened */
if (freeval) slapi_ch_free_string(&bvvalue.bv_val);
csn_free(&attributedeletioncsn);
+ csn_free(&maxcsn);
return NULL;
}
for ( i = 0; i < nattrs; i++ )
commit f25fef365df535c154a3cbffbda7317c5766fb38
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Fri Mar 25 09:41:30 2011 -0600
Bug 690584 - #10655 acllas__handle_group_entry - fix coverity resource leak issues
https://bugzilla.redhat.com/show_bug.cgi?id=690584
Resolves: bug 690584
Bug Description: #10655 acllas__handle_group_entry - fix coverity resource leak issue
Reviewed by: nkinder (Thanks!)
Branch: master
Fix Description: Make sure n_dn is freed before returning.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/plugins/acl/acllas.c b/ldap/servers/plugins/acl/acllas.c
index 99b0281..e08c70c 100644
--- a/ldap/servers/plugins/acl/acllas.c
+++ b/ldap/servers/plugins/acl/acllas.c
@@ -2376,7 +2376,7 @@ acllas__handle_group_entry (Slapi_Entry* e, void *callback_data)
{
struct eval_info *info;
Slapi_Attr *currAttr, *nextAttr;
- char *n_dn, *attrType;
+ char *n_dn = NULL, *attrType;
int n;
int i;
@@ -2415,6 +2415,7 @@ acllas__handle_group_entry (Slapi_Entry* e, void *callback_data)
if (n < 0) {
slapi_log_error( SLAPI_LOG_FATAL, plugin_name,
"acllas__handle_group_entry: last member index lu_idx is overflown:%d: Too many group ACL members\n", n);
+ slapi_ch_free_string(&n_dn);
return 0;
}
if (!(n % ACLLAS_MAX_GRP_MEMBER)) {
@@ -2428,6 +2429,7 @@ acllas__handle_group_entry (Slapi_Entry* e, void *callback_data)
"acllas__handle_group_entry: out of memory - could not allocate space for %d group members\n",
n + ACLLAS_MAX_GRP_MEMBER );
info->memberInfo = orig_memberInfo;
+ slapi_ch_free_string(&n_dn);
return 0;
}
}
commit 5bbe379e3753b397a13fb0f3a418c90a717a1d7a
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Fri Mar 25 09:36:47 2011 -0600
Bug 690584 - #10658 linked_attrs_pre_op - fix coverity resource leak issues
https://bugzilla.redhat.com/show_bug.cgi?id=690584
Resolves: bug 690584
Bug Description: #10658 linked_attrs_pre_op - fix coverity resource leak issues
Reviewed by: nkinder (Thanks!)
Branch: master
Fix Description: just get rid of smods - not used here
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/plugins/linkedattrs/linked_attrs.c b/ldap/servers/plugins/linkedattrs/linked_attrs.c
index 5cfef5d..b69b2cd 100644
--- a/ldap/servers/plugins/linkedattrs/linked_attrs.c
+++ b/ldap/servers/plugins/linkedattrs/linked_attrs.c
@@ -1446,8 +1446,7 @@ linked_attrs_pre_op(Slapi_PBlock * pb, int modop)
{
char *dn = 0;
Slapi_Entry *e = 0;
- Slapi_Mods *smods = 0;
- LDAPMod **mods;
+ LDAPMod **mods = NULL;
int free_entry = 0;
char *errstr = NULL;
int ret = 0;
@@ -1488,14 +1487,11 @@ linked_attrs_pre_op(Slapi_PBlock * pb, int modop)
/* Grab the mods. */
slapi_pblock_get(pb, SLAPI_MODIFY_MODS, &mods);
- smods = slapi_mods_new();
- slapi_mods_init_passin(smods, mods);
-
/* Apply the mods to create the resulting entry. */
if (mods && (slapi_entry_apply_mods(e, mods) != LDAP_SUCCESS)) {
/* The mods don't apply cleanly, so we just let this op go
* to let the main server handle it. */
- goto bailmod;
+ goto bail;
}
}
@@ -1509,14 +1505,6 @@ linked_attrs_pre_op(Slapi_PBlock * pb, int modop)
"linked attribute configuration.");
}
}
-
- bailmod:
- /* Clean up smods. */
- if (LDAP_CHANGETYPE_MODIFY == modop) {
- mods = slapi_mods_get_ldapmods_passout(smods);
- slapi_pblock_set(pb, SLAPI_MODIFY_MODS, mods);
- slapi_mods_free(&smods);
- }
}
bail:
commit b1cebedd1b2de30f7dd2885d57eaec19d445044a
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Fri Mar 25 09:29:23 2011 -0600
Bug 690584 - #10669 #10668 cl5ImportLDIF - fix coverity resource leak issues
https://bugzilla.redhat.com/show_bug.cgi?id=690584
Resolves: bug 690584
Bug Description: #10669 #10668 cl5ImportLDIF - fix coverity resource leak issues
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: I didn't quite follow the logic, but it looked as though
maxvals and purgevals could have been re-malloced if the code allocated
them and went through the loop more than once. So I changed the code to
just realloc as needed (realloc NULL is the same as malloc). When building
maxvals and purgevals, always NULL terminate the list so we don't have to
do that later. Finally, I moved the code that cleaned up maxvals and
purgevals to the end of the function so that they will always be called.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c
index ea47d77..88085e1 100644
--- a/ldap/servers/plugins/replication/cl5_api.c
+++ b/ldap/servers/plugins/replication/cl5_api.c
@@ -883,8 +883,8 @@ cl5ImportLDIF (const char *clDir, const char *ldifFile, Object **replicas)
struct berval **maxvals = NULL;
int purgeidx = 0;
int maxidx = 0;
- int maxpurgesz = 8;
- int maxmaxsz = 8;
+ int maxpurgesz = 0;
+ int maxmaxsz = 0;
int entryCount = 0;
/* validate params */
@@ -989,26 +989,31 @@ cl5ImportLDIF (const char *clDir, const char *ldifFile, Object **replicas)
struct berval type, value;
int freeval = 0;
- purgevals = (struct berval **)slapi_ch_malloc(
- sizeof(struct berval *) * maxpurgesz);
- maxvals = (struct berval **)slapi_ch_malloc(
- sizeof(struct berval *) * maxmaxsz);
while ((line = ldif_getline(&next)) != NULL) {
rc = slapi_ldif_parse_line(line, &type, &value, &freeval);
/* ruv_dump (dbfile->purgeRUV, "clpurgeruv", prFile); */
if (0 == strcasecmp (type.bv_val, "clpurgeruv")) {
- if (maxpurgesz == purgeidx + 2) {
- maxpurgesz *= 2;
+ if (maxpurgesz < purgeidx + 2) {
+ if (!maxpurgesz) {
+ maxpurgesz = 4 * (purgeidx + 2);
+ } else {
+ maxpurgesz *= 2;
+ }
purgevals = (struct berval **)slapi_ch_realloc(
(char *)purgevals,
sizeof(struct berval *) * maxpurgesz);
}
purgevals[purgeidx++] = slapi_ch_bvdup(&value);
+ purgevals[purgeidx] = NULL; /* make sure NULL terminated */
}
/* ruv_dump (dbfile->maxRUV, "clmaxruv", prFile); */
else if (0 == strcasecmp (type.bv_val, "clmaxruv")) {
- if (maxmaxsz == maxidx + 2) {
- maxmaxsz *= 2;
+ if (maxmaxsz < maxidx + 2) {
+ if (!maxmaxsz) {
+ maxmaxsz = 4 * (maxidx + 2);
+ } else {
+ maxmaxsz *= 2;
+ }
maxvals = (struct berval **)slapi_ch_realloc(
(char *)maxvals,
sizeof(struct berval *) * maxmaxsz);
@@ -1016,6 +1021,7 @@ cl5ImportLDIF (const char *clDir, const char *ldifFile, Object **replicas)
/* {replica #} min_csn csn [last_modified] */
/* get rid of last_modified, if any */
maxvals[maxidx++] = slapi_ch_bvdup(&value);
+ maxvals[maxidx] = NULL; /* make sure NULL terminated */
}
if (freeval) {
slapi_ch_free_string(&value.bv_val);
@@ -1096,24 +1102,13 @@ next:
if (dbfile) {
if (purgeidx > 0) {
ruv_destroy (&dbfile->purgeRUV);
- purgevals[purgeidx] = NULL;
rc = ruv_init_from_bervals(purgevals, &dbfile->purgeRUV);
}
if (maxidx > 0) {
ruv_destroy (&dbfile->maxRUV);
- maxvals[maxidx] = NULL;
rc = ruv_init_from_bervals(maxvals, &dbfile->maxRUV);
}
- for (purgeidx = 0; purgevals && purgevals[purgeidx]; purgeidx++) {
- slapi_ch_bvfree(&purgevals[purgeidx]);
- }
- slapi_ch_free((void **)&purgevals);
- for (maxidx = 0; maxvals && maxvals[maxidx]; maxidx++) {
- slapi_ch_bvfree(&maxvals[maxidx]);
- }
- slapi_ch_free((void **)&maxvals);
-
dbfile->entryCount = entryCount;
}
if (file_obj) {
@@ -1121,6 +1116,15 @@ next:
}
done:
+ for (purgeidx = 0; purgevals && purgevals[purgeidx]; purgeidx++) {
+ slapi_ch_bvfree(&purgevals[purgeidx]);
+ }
+ slapi_ch_free((void **)&purgevals);
+ for (maxidx = 0; maxvals && maxvals[maxidx]; maxidx++) {
+ slapi_ch_bvfree(&maxvals[maxidx]);
+ }
+ slapi_ch_free((void **)&maxvals);
+
if (file) {
#if defined(USE_OPENLDAP)
ldif_close(file);
commit 909150899c5262b64af5b5a4b6935a98f8593ece
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Fri Mar 25 08:52:32 2011 -0600
Bug 690584 - #10688 - dblayer_make_env - fix coverity resource leak issues
https://bugzilla.redhat.com/show_bug.cgi?id=690584
Resolves: bug 690584
Bug Description: #10688 - dblayer_make_env - fix coverity resource leak issues
Reviewed by: nkinder (Thanks!)
Branch: master
Fix Description: do not return upon failure, goto fail instead. The fail
condition will clean up any memory allocated in the function. I had to
move dblayer_free_env to before dblayer_make_env.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
index 534abfe..363c62d 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -1180,6 +1180,20 @@ dblayer_inst_exists(ldbm_instance *inst, char *dbname)
return 0;
}
+static void
+dblayer_free_env(struct dblayer_private_env **env)
+{
+ if (NULL == env || NULL == *env) {
+ return;
+ }
+ if ((*env)->dblayer_env_lock) {
+ PR_DestroyRWLock((*env)->dblayer_env_lock);
+ (*env)->dblayer_env_lock = NULL;
+ }
+ slapi_ch_free((void **)env);
+ return;
+}
+
/*
* create a new DB_ENV and fill it with the goodies from dblayer_private
*/
@@ -1206,8 +1220,9 @@ dblayer_make_env(struct dblayer_private_env **env, struct ldbminfo *li)
/* Here we overide various system functions called by libdb */
ret = dblayer_override_libdb_functions(pEnv->dblayer_DB_ENV, priv);
- if (ret != 0)
- return ret;
+ if (ret != 0) {
+ goto fail;
+ }
if (priv->dblayer_spin_count != 0) {
DB_ENV_SET_TAS_SPINS(pEnv->dblayer_DB_ENV, priv->dblayer_spin_count);
@@ -1252,27 +1267,23 @@ dblayer_make_env(struct dblayer_private_env **env, struct ldbminfo *li)
if (pEnv->dblayer_env_lock) {
*env = pEnv;
+ pEnv = NULL; /* do not free below */
} else {
LDAPDebug(LDAP_DEBUG_ANY,
"ERROR -- Failed to create RWLock (returned: %d).\n",
ret, 0, 0);
}
- return ret;
-}
-
-static void
-dblayer_free_env(struct dblayer_private_env **env)
-{
- if (NULL == env || NULL == *env) {
- return;
- }
- if ((*env)->dblayer_env_lock) {
- PR_DestroyRWLock((*env)->dblayer_env_lock);
- (*env)->dblayer_env_lock = NULL;
+fail:
+ if (pEnv) {
+ slapi_ch_array_free(priv->dblayer_data_directories);
+ priv->dblayer_data_directories = NULL;
+ if (pEnv->dblayer_DB_ENV) {
+ pEnv->dblayer_DB_ENV->close(pEnv->dblayer_DB_ENV, 0);
+ }
+ dblayer_free_env(&pEnv); /* pEnv is now garbage */
}
- slapi_ch_free((void **)env);
- return;
+ return ret;
}
/* generate an absolute path if the given instance dir is not. */
commit e99c735d37b2cec59d46bd270f661b13385cfcdd
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Fri Mar 25 08:27:52 2011 -0600
Bug 690584 - #10690 #10689 attrcrypt_get_ssl_cert_name() - fix coverity resource leak issues
https://bugzilla.redhat.com/show_bug.cgi?id=690584
Resolves: bug 690584
Bug Description: #10690 #10689 attrcrypt_get_ssl_cert_name() - fix coverity resource leak issues
Reviewed by: nkinder (Thanks!)
Branch: master
Fix Description: always free token and personality at the end of the function
- set personality to NULL if the memory was passed off to cert_name.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c b/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c
index f700434..f0ef692 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c
@@ -161,13 +161,14 @@ attrcrypt_get_ssl_cert_name(char **cert_name)
if(!strcasecmp(token, "internal") ||
!strcasecmp(token, "internal (software)")) {
*cert_name = personality;
+ personality = NULL; /* do not free below */
} else {
/* external PKCS #11 token - attach token name */
*cert_name = slapi_ch_smprintf("%s:%s", token, personality);
- slapi_ch_free_string(&personality);
}
- slapi_ch_free_string(&token);
}
+ slapi_ch_free_string(&personality);
+ slapi_ch_free_string(&token);
freeConfigEntry(&config_entry);
return 0;
}
commit 5b44581e0bee31cd455bbfe0f7cb109e7e7b25f8
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Fri Mar 25 08:17:38 2011 -0600
Bug 690584 - #10691 ldbm_back_init() - fix coverity resource leak issues
https://bugzilla.redhat.com/show_bug.cgi?id=690584
Resolves: bug 690584
Bug Description: #10691 ldbm_back_init() - fix coverity resource leak issues
Reviewed by: nkinder (Thanks!)
Branch: master
Fix Description: do not return (or exit!) from ldbm_back_init() - just goto
fail and clean up the ldbm_instance upon error.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/back-ldbm/init.c b/ldap/servers/slapd/back-ldbm/init.c
index c645444..19e6ab6 100644
--- a/ldap/servers/slapd/back-ldbm/init.c
+++ b/ldap/servers/slapd/back-ldbm/init.c
@@ -123,7 +123,7 @@ ldbm_back_init( Slapi_PBlock *pb )
/* initialize dblayer */
if (dblayer_init(li)) {
LDAPDebug( LDAP_DEBUG_ANY, "ldbm_back_init: dblayer_init failed\n",0, 0, 0 );
- return (-1);
+ goto fail;
}
/* Fill in the fields of the ldbminfo and the dblayer_private
@@ -138,7 +138,7 @@ ldbm_back_init( Slapi_PBlock *pb )
&li->li_bulk_import_object, &li->li_bulk_import_handle) != 0) {
LDAPDebug(LDAP_DEBUG_ANY, "ldbm_back_init: "
"slapi_register_object_extension failed.\n", 0, 0, 0);
- return (-1);
+ goto fail;
}
/* add some private attributes */
@@ -150,24 +150,24 @@ ldbm_back_init( Slapi_PBlock *pb )
if ((li->li_dbcache_mutex = PR_NewLock()) == NULL ) {
LDAPDebug( LDAP_DEBUG_ANY, "ldbm_back_init: PR_NewLock failed\n",
0, 0, 0 );
- return(-1);
+ goto fail;
}
if ((li->li_shutdown_mutex = PR_NewLock()) == NULL ) {
LDAPDebug( LDAP_DEBUG_ANY, "ldbm_back_init: PR_NewLock failed\n",
0, 0, 0 );
- return(-1);
+ goto fail;
}
if ((li->li_config_mutex = PR_NewLock()) == NULL ) {
LDAPDebug( LDAP_DEBUG_ANY, "ldbm_back_init: PR_NewLock failed\n",
0, 0, 0 );
- return(-1);
+ goto fail;
}
if ((li->li_dbcache_cv = PR_NewCondVar( li->li_dbcache_mutex )) == NULL ) {
LDAPDebug( LDAP_DEBUG_ANY, "ldbm_back_init: PR_NewCondVar failed\n", 0, 0, 0 );
- exit(-1);
+ goto fail;
}
/* set all of the necessary database plugin callback functions */
@@ -255,7 +255,7 @@ ldbm_back_init( Slapi_PBlock *pb )
if ( rc != 0 ) {
LDAPDebug( LDAP_DEBUG_ANY, "ldbm_back_init failed\n", 0, 0, 0 );
- return( -1 );
+ goto fail;
}
/* register the IDL interface with the API broker */
@@ -268,7 +268,7 @@ ldbm_back_init( Slapi_PBlock *pb )
if( slapi_apib_register(IDL_v1_0_GUID, IDL_api) )
{
LDAPDebug( LDAP_DEBUG_ANY, "ldbm_back_init: failed to publish IDL interface\n", 0, 0, 0);
- return( -1 );
+ goto fail;
}
interface_published = 1;
@@ -277,6 +277,10 @@ ldbm_back_init( Slapi_PBlock *pb )
LDAPDebug( LDAP_DEBUG_TRACE, "<= ldbm_back_init\n", 0, 0, 0 );
return( 0 );
+
+fail:
+ dblayer_terminate( li );
+ return( -1 );
}
13 years
4 commits - ldap/servers
by Nathan Kinder
ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c | 4 ++--
ldap/servers/slapd/uuid.c | 13 +++++++------
ldap/servers/slapd/vattr.c | 2 +-
3 files changed, 10 insertions(+), 9 deletions(-)
New commits:
commit 5b6d116d6a8ec7823f6f806277069e153b46e734
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Fri Mar 25 10:40:52 2011 -0700
Bug 690882 - (cov#10572,10710) Incorrect sizeof use in uuid code
When sizeof() is called at line 943, it is calculating the size of
a pointer, not the array. This happens since the array was passed
to get_random_info(), which considers it to just be a pointer. The
result is that we do not fill in the full array with random data.
We should pass the array length to this function instead of using
sizeof().
diff --git a/ldap/servers/slapd/uuid.c b/ldap/servers/slapd/uuid.c
index c19648f..4a3ec8e 100644
--- a/ldap/servers/slapd/uuid.c
+++ b/ldap/servers/slapd/uuid.c
@@ -89,6 +89,7 @@
#define MODULE "uuid" /* for logging */
#define UPDATE_INTERVAL 60000 /* 1 minute */
#define NEED_TIME_UPDATE -1
+#define SEED_LENGTH 16
/* generates uuid in singlethreaded environment */
static int uuid_create_st(guid_t *uuid);
@@ -127,7 +128,7 @@ static void get_system_time(uuid_time_t *uuid_time);
/* generates random value - used to set clock sequence */
static unsigned16 true_random(void);
/* generate random info buffer to generate nodeid */
-static void get_random_info(unsigned char seed[16]);
+static void get_random_info(unsigned char seed[], size_t arraylen);
/* UUID generator state stored persistently */
typedef struct
@@ -890,7 +891,7 @@ static void format_uuid_v3(guid_t * uuid, unsigned char hash[16])
*/
static int get_node_identifier (uuid_node_t *node)
{
- unsigned char seed[16]= {0};
+ unsigned char seed[SEED_LENGTH]= {0};
#ifdef USE_NIC
/* ONREPL - code to use NIC address would go here; Currently, we use
@@ -899,7 +900,7 @@ static int get_node_identifier (uuid_node_t *node)
docs for more info.
*/
#endif
- get_random_info(seed);
+ get_random_info(seed, SEED_LENGTH);
seed[0] |= 0x80;
memcpy (node, seed, sizeof (uuid_node_t));
@@ -938,7 +939,7 @@ static unsigned16 true_random(void)
return (slapi_rand_r(&uuid_seed));
}
-static void get_random_info(unsigned char seed[16])
+static void get_random_info(unsigned char seed[], size_t arraylen)
{
- slapi_rand_array(seed, sizeof(seed));
+ slapi_rand_array(seed, arraylen);
}
commit 3e9fa7ada315098b9e18b4ed30e777170314c2cb
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Fri Mar 25 10:11:17 2011 -0700
Bug 690882 - (cov#10703) Incorrect sizeof use in vattr code
We are using sizeof() incorrectly when allocating memory for an
array of integers. We are currently getting the sizeof a pointer
to an int instead of the size of an int itself.
diff --git a/ldap/servers/slapd/vattr.c b/ldap/servers/slapd/vattr.c
index e221096..2961ea4 100644
--- a/ldap/servers/slapd/vattr.c
+++ b/ldap/servers/slapd/vattr.c
@@ -1705,7 +1705,7 @@ int vattr_call_sp_get_batch_values(vattr_sp_handle *handle, vattr_context *c, Sl
{
/* make our args look like the simple non-batched case */
*results = (Slapi_ValueSet**)slapi_ch_calloc(2, sizeof(**results)); /* 2 for null terminated list */
- *type_name_disposition = (int *)slapi_ch_calloc(2, sizeof(*type_name_disposition));
+ *type_name_disposition = (int *)slapi_ch_calloc(2, sizeof(**type_name_disposition));
*actual_type_name = (char**)slapi_ch_calloc(2, sizeof(**actual_type_name));
ret =((handle->sp->sp_get_fn)(handle,c,e,*type,*results,*type_name_disposition,*actual_type_name,flags,buffer_flags, hint));
commit 0d327240c853bb2c06dc9fdec39e1e649a363c18
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Fri Mar 25 10:07:14 2011 -0700
Bug 690882 - (cov#10636,10637) Useless comparison in attrcrypt
The backend attribute encryption code makes a useless comparison
when doing error checking. We are comparing an array with NULL,
but an array will always be non-NULL, so we can just check if
state_priv is NULL.
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c b/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c
index 9f22a58..f700434 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_attrcrypt.c
@@ -1116,7 +1116,7 @@ back_crypt_encrypt_value(void *handle, struct berval *in, struct berval **out)
goto bail;
}
*out = NULL;
- if (!state_priv || !state_priv->acs_array) {
+ if (!state_priv) {
goto bail;
}
invalue = slapi_value_new_berval(in);
@@ -1147,7 +1147,7 @@ back_crypt_decrypt_value(void *handle, struct berval *in, struct berval **out)
goto bail;
}
*out = NULL;
- if (!state_priv || !state_priv->acs_array) {
+ if (!state_priv) {
goto bail;
}
invalue = slapi_value_new_berval(in);
commit 76561dba969d39ef6f792adb0338c9ccdfa7c04e
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Fri Mar 25 10:00:37 2011 -0700
Bug 690882 - (cov#10571) Incorrect sizeof use in uuid code
It looks like the caller wanted to clear out the uuid struct if
there was a problem creating the NSS context. The problem is that
the memset at line 341 is only clearing out the local pointer to
the struct. This local pointer is never seen by the caller and the
struct retains whetever it previously held in memory. We need to
clear out the contents of the struct itself instead of just
clearing the address held by the local pointer.
diff --git a/ldap/servers/slapd/uuid.c b/ldap/servers/slapd/uuid.c
index 5e26be2..c19648f 100644
--- a/ldap/servers/slapd/uuid.c
+++ b/ldap/servers/slapd/uuid.c
@@ -338,7 +338,7 @@ void uuid_create_from_name(guid_t * uuid, /* resulting UUID */
PK11_DestroyContext(c, PR_TRUE);
}
else { /* Probably desesperate but at least deterministic... */
- memset(&uuid, 0, sizeof(uuid));
+ memset(uuid, 0, sizeof(*uuid));
}
}
13 years
ldap/servers
by Nathan Kinder
ldap/servers/slapd/back-ldbm/index.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 13e53f4655f4812f7412d333bb285c9d390a4a0f
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Thu Mar 24 16:02:00 2011 -0700
Bug 690649 - (cov#10731) Use of free'd pointer in indexing code
There is a very unlikely chance that we can use a free'd pointer
in the indexing code when attribute encryption is used and there is
a problem encrypting the index key. The bug requires debug logging
to be enabled as well as an attribute name longer than 255 chars to
be used.
We have a 256 byte buffer that we attempt to use to store the
attribute name. The call to slapi_attr_basetype() will try to fill
this buffer in, but it will malloc space if the buffer is too small.
The pointer to this allocated memory is basetmp, which will be NULL
if we just used the buffer. In the event that we do allocate memory,
basetype will point to the allocated memory, otherwise it will point
to the buffer.
At line 912, we free basetmp if it was allocated, yet we use
basetype for debug logging at line 922 (which points to the same
memory if we indeed allocated memory). We should just free basetmp
at the end of the function instead of at line 912. This will allow
us to use basetype safely at line 922.
diff --git a/ldap/servers/slapd/back-ldbm/index.c b/ldap/servers/slapd/back-ldbm/index.c
index 03ea5e4..5d2b499 100644
--- a/ldap/servers/slapd/back-ldbm/index.c
+++ b/ldap/servers/slapd/back-ldbm/index.c
@@ -909,7 +909,6 @@ index_read_ext(
slapi_ch_free_string( &basetmp );
return( NULL );
}
- slapi_ch_free_string( &basetmp );
if ( val != NULL ) {
size_t plen, vlen;
@@ -959,6 +958,7 @@ index_read_ext(
} else if ( *err != 0 && *err != DB_NOTFOUND ) {
ldbm_nasty(errmsg, 1050, *err);
}
+ slapi_ch_free_string( &basetmp );
slapi_ch_free_string(&tmpbuf);
dblayer_release_index_file( be, ai, db );
13 years