ldap/servers
by Noriko Hosoi
ldap/servers/plugins/chainingdb/cb_bind.c | 12 ++++++------
ldap/servers/plugins/pam_passthru/pam_ptpreop.c | 6 +++---
ldap/servers/plugins/replication/repl_bind.c | 2 +-
ldap/servers/slapd/back-ldbm/ldbm_bind.c | 2 +-
ldap/servers/slapd/back-ldif/bind.c | 4 ++--
ldap/servers/slapd/bind.c | 8 ++++----
ldap/servers/slapd/defbackend.c | 3 ++-
ldap/servers/slapd/dse.c | 2 +-
ldap/servers/slapd/pblock.c | 4 ++--
ldap/servers/slapd/plugin.c | 6 +++---
ldap/servers/slapd/result.c | 4 ++--
ldap/servers/slapd/slapi-private.h | 2 +-
12 files changed, 28 insertions(+), 27 deletions(-)
New commits:
commit e0219e8fede80d1ab63a7c706d756abd4e53e3a4
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 10 16:37:36 2015 -0800
Ticket #47742 - 64bit problem on big endian: auth method not supported
Description: Cast from ber_tag_t to int on a big endian machine causes
the "auth method not supported" error. Instead of handling the method
as "int", use ber_tag_t through out the server code.
https://fedorahosted.org/389/ticket/47742
Reviewed by mreynolds(a)redhat.com (Thank you, Mark!!)
diff --git a/ldap/servers/plugins/chainingdb/cb_bind.c b/ldap/servers/plugins/chainingdb/cb_bind.c
index 827916e..4c6a12b 100644
--- a/ldap/servers/plugins/chainingdb/cb_bind.c
+++ b/ldap/servers/plugins/chainingdb/cb_bind.c
@@ -47,7 +47,7 @@ cb_free_bervals( struct berval **bvs );
static int
-cb_sasl_bind_once_s( cb_conn_pool *pool, const char *dn, int method,
+cb_sasl_bind_once_s( cb_conn_pool *pool, const char *dn, ber_tag_t method,
char * mechanism, struct berval *creds,
LDAPControl **reqctrls, char **matcheddnp,
char **errmsgp, struct berval ***refurlsp,
@@ -68,7 +68,7 @@ cb_sasl_bind_once_s( cb_conn_pool *pool, const char *dn, int method,
static int
cb_sasl_bind_s(Slapi_PBlock * pb, cb_conn_pool *pool, int tries,
- const char *dn, int method,char * mechanism,
+ const char *dn, ber_tag_t method, char * mechanism,
struct berval *creds, LDAPControl **reqctrls,
char **matcheddnp, char **errmsgp, struct berval ***refurlsp,
LDAPControl ***resctrlsp ,int *status)
@@ -84,7 +84,7 @@ cb_sasl_bind_s(Slapi_PBlock * pb, cb_conn_pool *pool, int tries,
if ( slapi_op_abandoned( pb )) {
rc = LDAP_USER_CANCELLED;
} else {
- rc = cb_sasl_bind_once_s( pool, dn, method,mechanism, creds, reqctrls,
+ rc = cb_sasl_bind_once_s( pool, dn, method, mechanism, creds, reqctrls,
matcheddnp, errmsgp, refurlsp, resctrlsp ,status);
}
} while ( CB_LDAP_CONN_ERROR( rc ) && --tries > 0 );
@@ -93,7 +93,7 @@ cb_sasl_bind_s(Slapi_PBlock * pb, cb_conn_pool *pool, int tries,
}
static int
-cb_sasl_bind_once_s( cb_conn_pool *pool, const char *dn, int method,
+cb_sasl_bind_once_s( cb_conn_pool *pool, const char *dn, ber_tag_t method,
char * mechanism, struct berval *creds,
LDAPControl **reqctrls, char **matcheddnp,
char **errmsgp, struct berval ***refurlsp,
@@ -244,7 +244,7 @@ chainingdb_bind( Slapi_PBlock *pb )
int rc = LDAP_SUCCESS;
int freectrls = 1;
int bind_retry;
- int method;
+ ber_tag_t method;
if ( LDAP_SUCCESS != (rc = cb_forward_operation(pb) )) {
cb_send_ldap_result( pb, rc, NULL, "Chaining forbidden", 0, NULL );
@@ -276,7 +276,7 @@ chainingdb_bind( Slapi_PBlock *pb )
dn = slapi_sdn_get_ndn(sdn);
/* always allow noauth simple binds */
- if (( method == LDAP_AUTH_SIMPLE) && creds->bv_len == 0 ) {
+ if ((method == LDAP_AUTH_SIMPLE) && (creds->bv_len == 0)) {
slapi_sdn_free(&mysdn);
return( SLAPI_BIND_ANONYMOUS );
}
diff --git a/ldap/servers/plugins/pam_passthru/pam_ptpreop.c b/ldap/servers/plugins/pam_passthru/pam_ptpreop.c
index 476d834..e550bcf 100644
--- a/ldap/servers/plugins/pam_passthru/pam_ptpreop.c
+++ b/ldap/servers/plugins/pam_passthru/pam_ptpreop.c
@@ -431,7 +431,7 @@ static int
pam_passthru_bindpreop( Slapi_PBlock *pb )
{
int rc = LDAP_SUCCESS;
- int method;
+ ber_tag_t method;
const char *normbinddn;
char *errmsg = NULL;
Slapi_DN *bindsdn = NULL;
@@ -460,8 +460,8 @@ pam_passthru_bindpreop( Slapi_PBlock *pb )
* We only handle simple bind requests that include non-NULL binddn and
* credentials. Let the Directory Server itself handle everything else.
*/
- if ( method != LDAP_AUTH_SIMPLE || *normbinddn == '\0' ||
- creds->bv_len == 0 ) {
+ if ((method != LDAP_AUTH_SIMPLE) || (*normbinddn == '\0') ||
+ (creds->bv_len == 0)) {
slapi_log_error( SLAPI_LOG_PLUGIN, PAM_PASSTHRU_PLUGIN_SUBSYSTEM,
"<= not handled (not simple bind or NULL dn/credentials)\n" );
return retcode;
diff --git a/ldap/servers/plugins/replication/repl_bind.c b/ldap/servers/plugins/replication/repl_bind.c
index c9b9229..4518e56 100644
--- a/ldap/servers/plugins/replication/repl_bind.c
+++ b/ldap/servers/plugins/replication/repl_bind.c
@@ -54,7 +54,7 @@ legacy_preop_bind( Slapi_PBlock *pb )
const char *dn = NULL;
Slapi_DN *sdn = NULL;
struct berval *cred = NULL;
- int method;
+ ber_tag_t method;
slapi_pblock_get(pb, SLAPI_BIND_METHOD, &method);
slapi_pblock_get(pb, SLAPI_BIND_TARGET_SDN, &sdn);
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_bind.c b/ldap/servers/slapd/back-ldbm/ldbm_bind.c
index f1dad38..aaa7b26 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_bind.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_bind.c
@@ -203,7 +203,7 @@ ldbm_back_bind( Slapi_PBlock *pb )
{
backend *be;
ldbm_instance *inst;
- int method;
+ ber_tag_t method;
struct berval *cred;
struct ldbminfo *li;
struct backentry *e;
diff --git a/ldap/servers/slapd/back-ldif/bind.c b/ldap/servers/slapd/back-ldif/bind.c
index f897230..06b3a76 100644
--- a/ldap/servers/slapd/back-ldif/bind.c
+++ b/ldap/servers/slapd/back-ldif/bind.c
@@ -62,7 +62,7 @@ int
ldif_back_bind( Slapi_PBlock *pb )
{
char *dn; /*Storage for the dn*/
- int method; /*Storage for the bind method*/
+ ber_tag_t method; /*Storage for the bind method*/
struct berval *cred; /*Storage for the bind credentials*/
struct berval **bvals;
LDIF *db; /*The database*/
@@ -91,7 +91,7 @@ ldif_back_bind( Slapi_PBlock *pb )
if ( (e = (ldif_Entry *)ldif_find_entry( pb, db, dn, &prev )) == NULL ) {
/* Allow noauth binds */
- if ( method == LDAP_AUTH_SIMPLE && cred->bv_len == 0 ) {
+ if ((method == LDAP_AUTH_SIMPLE) && (cred->bv_len == 0)) {
rc = SLAPI_BIND_ANONYMOUS;
} else {
slapi_send_ldap_result( pb, LDAP_NO_SUCH_OBJECT, NULL, NULL, 0, NULL );
diff --git a/ldap/servers/slapd/bind.c b/ldap/servers/slapd/bind.c
index bc4aa24..7acec84 100644
--- a/ldap/servers/slapd/bind.c
+++ b/ldap/servers/slapd/bind.c
@@ -76,7 +76,7 @@
static void log_bind_access(
Slapi_PBlock *pb,
const char* dn,
- int method,
+ ber_tag_t method,
int version,
const char *saslmech,
const char *msg
@@ -889,7 +889,7 @@ static void
log_bind_access (
Slapi_PBlock *pb,
const char* dn,
- int method,
+ ber_tag_t method,
int version,
const char *saslmech,
const char *msg
@@ -910,13 +910,13 @@ log_bind_access (
} else if (msg) {
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d BIND dn=\"%s\" "
- "method=%d version=%d, %s\n",
+ "method=%ld version=%d, %s\n",
(long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid, dn,
method, version, msg );
} else {
slapi_log_access( LDAP_DEBUG_STATS,
"conn=%" NSPRIu64 " op=%d BIND dn=\"%s\" "
- "method=%d version=%d\n",
+ "method=%ld version=%d\n",
(long long unsigned int)pb->pb_conn->c_connid, pb->pb_op->o_opid, dn,
method, version );
}
diff --git a/ldap/servers/slapd/defbackend.c b/ldap/servers/slapd/defbackend.c
index dd948d0..0f566d0 100644
--- a/ldap/servers/slapd/defbackend.c
+++ b/ldap/servers/slapd/defbackend.c
@@ -203,7 +203,8 @@ defbackend_abandon( Slapi_PBlock *pb )
static int
defbackend_bind( Slapi_PBlock *pb )
{
- int rc, method;
+ int rc;
+ ber_tag_t method;
struct berval *cred;
LDAPDebug( LDAP_DEBUG_TRACE, "defbackend_bind\n", 0, 0, 0 );
diff --git a/ldap/servers/slapd/dse.c b/ldap/servers/slapd/dse.c
index 9bb5914..b9ffc5f 100644
--- a/ldap/servers/slapd/dse.c
+++ b/ldap/servers/slapd/dse.c
@@ -1499,7 +1499,7 @@ dse_delete_entry(struct dse* pdse, Slapi_PBlock *pb, const Slapi_Entry *e)
int
dse_bind( Slapi_PBlock *pb ) /* JCM There should only be one exit point from this function! */
{
- int method; /* The bind method */
+ ber_tag_t method; /* The bind method */
struct berval *cred; /* The bind credentials */
Slapi_Value **bvals;
struct dse* pdse;
diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
index b35fce7..fd9ccb7 100644
--- a/ldap/servers/slapd/pblock.c
+++ b/ldap/servers/slapd/pblock.c
@@ -1301,7 +1301,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
case SLAPI_BIND_METHOD:
if(pblock->pb_op!=NULL)
{
- (*(int *)value) = pblock->pb_op->o_params.p.p_bind.bind_method;
+ (*(ber_tag_t *)value) = pblock->pb_op->o_params.p.p_bind.bind_method;
}
break;
case SLAPI_BIND_CREDENTIALS:
@@ -2936,7 +2936,7 @@ slapi_pblock_set( Slapi_PBlock *pblock, int arg, void *value )
case SLAPI_BIND_METHOD:
if(pblock->pb_op!=NULL)
{
- pblock->pb_op->o_params.p.p_bind.bind_method = *((int *) value);
+ pblock->pb_op->o_params.p.p_bind.bind_method = *((ber_tag_t *) value);
}
break;
case SLAPI_BIND_CREDENTIALS:
diff --git a/ldap/servers/slapd/plugin.c b/ldap/servers/slapd/plugin.c
index 94aba7f..4df2eb5 100644
--- a/ldap/servers/slapd/plugin.c
+++ b/ldap/servers/slapd/plugin.c
@@ -77,7 +77,7 @@ static int plugin_call_func (struct slapdplugin *list, int operation, Slapi_PBlo
static PRBool plugin_invoke_plugin_pb (struct slapdplugin *plugin, int operation, Slapi_PBlock *pb);
static PRBool plugin_matches_operation (Slapi_DN *target_spec, PluginTargetData *ptd,
- PRBool bindop, PRBool isroot, PRBool islocal, int method);
+ PRBool bindop, PRBool isroot, PRBool islocal, ber_tag_t method);
static void plugin_config_init (struct pluginconfig *config);
static void plugin_config_cleanup (struct pluginconfig *config);
@@ -3593,7 +3593,7 @@ plugin_invoke_plugin_sdn (struct slapdplugin *plugin, int operation, Slapi_PBloc
PRBool islocal;
PRBool bindop;
unsigned long op;
- int method = -1;
+ ber_tag_t method = LBER_ERROR;
PR_ASSERT (plugin);
if (!pb) {
@@ -3762,7 +3762,7 @@ PRBool plugin_allow_internal_op (Slapi_DN *target_spec, struct slapdplugin *plug
}
static PRBool plugin_matches_operation (Slapi_DN *target_spec, PluginTargetData *ptd,
- PRBool bindop, PRBool isroot, PRBool islocal, int method)
+ PRBool bindop, PRBool isroot, PRBool islocal, ber_tag_t method)
{
int cookie;
Slapi_DN *subtree;
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
index 544a9c7..45a5b4c 100644
--- a/ldap/servers/slapd/result.c
+++ b/ldap/servers/slapd/result.c
@@ -371,7 +371,7 @@ send_ldap_result_ext(
const char *dn = NULL;
ber_tag_t tag;
int flush_ber_element = 1;
- int bind_method = 0;
+ ber_tag_t bind_method = 0;
int internal_op;
int i, rc, logit = 0;
@@ -453,7 +453,7 @@ send_ldap_result_ext(
/* invalid password. Update the password retry here */
/* put this here for now. It could be a send_result pre-op plugin. */
- if (err == LDAP_INVALID_CREDENTIALS && bind_method != LDAP_AUTH_SASL ) {
+ if ((err == LDAP_INVALID_CREDENTIALS) && (bind_method != LDAP_AUTH_SASL)) {
slapi_pblock_get( pb, SLAPI_TARGET_SDN, &sdn );
dn = slapi_sdn_get_dn(sdn);
pwpolicy = new_passwdPolicy(pb, dn);
diff --git a/ldap/servers/slapd/slapi-private.h b/ldap/servers/slapd/slapi-private.h
index 921c397..43ba82c 100644
--- a/ldap/servers/slapd/slapi-private.h
+++ b/ldap/servers/slapd/slapi-private.h
@@ -573,7 +573,7 @@ typedef struct slapi_operation_parameters
struct bind_parameters
{
- int bind_method;
+ ber_tag_t bind_method;
struct berval *bind_creds;
char *bind_saslmechanism; /* v3 sasl mechanism name */
struct berval *bind_ret_saslcreds; /* v3 serverSaslCreds */
9 years, 1 month
Branch '389-ds-base-1.3.3' - ldap/servers
by Noriko Hosoi
ldap/servers/plugins/replication/repl5_agmt.c | 61 ++++++++------------------
1 file changed, 21 insertions(+), 40 deletions(-)
New commits:
commit 07cd61f6265067546758a4ee355b0a2c77279432
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 10 17:38:51 2015 -0800
Ticket #47836 - Do not return '0' as empty fallback value of nsds5replicalastupdatestart and nsds5replicalastupdatestart
Bug Description: In a replica agreement entry, if any of the
nsds5replicaLastUpdateStart, nsds5replicaLastUpdateEnd,
nsds5replicaLastInitStart or nsds5replicaLastInitEnd are not set,
it's initialized as "0" which is invalid. It should be in the
LDAP Generalized time format.
Fix Description: When these attributes are not set, instead of "0"
they are initialized with the epoch time 0 == 19700101000000Z.
https://fedorahosted.org/389/ticket/47836
Reviewed by mreynolds(a)redhat.com (Thank you, Mark!!)
(cherry picked from commit ed0a504a876fcfcd229ceca8470763355d54f9c6)
diff --git a/ldap/servers/plugins/replication/repl5_agmt.c b/ldap/servers/plugins/replication/repl5_agmt.c
index 91be757..7e66a44 100644
--- a/ldap/servers/plugins/replication/repl5_agmt.c
+++ b/ldap/servers/plugins/replication/repl5_agmt.c
@@ -2614,26 +2614,16 @@ get_agmt_status(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter,
slapi_entry_attr_delete(e, "nsds5replicaLastInitEnd");
/* now, add the real values (singly) */
- if (ra->last_update_start_time == 0)
- {
- slapi_entry_add_string(e, "nsds5replicaLastUpdateStart", "0");
- }
- else
- {
- time_tmp = format_genTime(ra->last_update_start_time);
- slapi_entry_add_string(e, "nsds5replicaLastUpdateStart", time_tmp);
- slapi_ch_free((void **)&time_tmp);
- }
- if (ra->last_update_end_time == 0)
- {
- slapi_entry_add_string(e, "nsds5replicaLastUpdateEnd", "0");
- }
- else
- {
- time_tmp = format_genTime(ra->last_update_end_time);
- slapi_entry_add_string(e, "nsds5replicaLastUpdateEnd", time_tmp);
- slapi_ch_free((void **)&time_tmp);
- }
+ /* In case last_update_start_time is not set, 19700101000000Z is set. */
+ time_tmp = format_genTime(ra->last_update_start_time);
+ slapi_entry_add_string(e, "nsds5replicaLastUpdateStart", time_tmp);
+ slapi_ch_free((void **)&time_tmp);
+
+ /* In case last_update_end_time is not set, 19700101000000Z is set. */
+ time_tmp = format_genTime(ra->last_update_end_time);
+ slapi_entry_add_string(e, "nsds5replicaLastUpdateEnd", time_tmp);
+ slapi_ch_free((void **)&time_tmp);
+
agmt_get_changecount_string (ra, changecount_string, sizeof (changecount_string) );
slapi_entry_add_string(e, "nsds5replicaChangesSentSinceStartup", changecount_string);
if (ra->last_update_status[0] == '\0')
@@ -2645,26 +2635,17 @@ get_agmt_status(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter,
slapi_entry_add_string(e, "nsds5replicaLastUpdateStatus", ra->last_update_status);
}
slapi_entry_add_string(e, "nsds5replicaUpdateInProgress", ra->update_in_progress ? "TRUE" : "FALSE");
- if (ra->last_init_start_time == 0)
- {
- slapi_entry_add_string(e, "nsds5replicaLastInitStart", "0");
- }
- else
- {
- time_tmp = format_genTime(ra->last_init_start_time);
- slapi_entry_add_string(e, "nsds5replicaLastInitStart", time_tmp);
- slapi_ch_free((void **)&time_tmp);
- }
- if (ra->last_init_end_time == 0)
- {
- slapi_entry_add_string(e, "nsds5replicaLastInitEnd", "0");
- }
- else
- {
- time_tmp = format_genTime(ra->last_init_end_time);
- slapi_entry_add_string(e, "nsds5replicaLastInitEnd", time_tmp);
- slapi_ch_free((void **)&time_tmp);
- }
+
+ /* In case last_init_start_time is not set, 19700101000000Z is set. */
+ time_tmp = format_genTime(ra->last_init_start_time);
+ slapi_entry_add_string(e, "nsds5replicaLastInitStart", time_tmp);
+ slapi_ch_free((void **)&time_tmp);
+
+ /* In case last_init_end_time is not set, 19700101000000Z is set. */
+ time_tmp = format_genTime(ra->last_init_end_time);
+ slapi_entry_add_string(e, "nsds5replicaLastInitEnd", time_tmp);
+ slapi_ch_free((void **)&time_tmp);
+
if (ra->last_init_status[0] != '\0')
{
slapi_entry_add_string(e, "nsds5replicaLastInitStatus", ra->last_init_status);
9 years, 1 month
ldap/servers
by Noriko Hosoi
ldap/servers/plugins/replication/repl5_agmt.c | 61 ++++++++------------------
1 file changed, 21 insertions(+), 40 deletions(-)
New commits:
commit ed0a504a876fcfcd229ceca8470763355d54f9c6
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 10 17:38:51 2015 -0800
Ticket #47836 - Do not return '0' as empty fallback value of nsds5replicalastupdatestart and nsds5replicalastupdatestart
Bug Description: In a replica agreement entry, if any of the
nsds5replicaLastUpdateStart, nsds5replicaLastUpdateEnd,
nsds5replicaLastInitStart or nsds5replicaLastInitEnd are not set,
it's initialized as "0" which is invalid. It should be in the
LDAP Generalized time format.
Fix Description: When these attributes are not set, instead of "0"
they are initialized with the epoch time 0 == 19700101000000Z.
https://fedorahosted.org/389/ticket/47836
Reviewed by mreynolds(a)redhat.com (Thank you, Mark!!)
diff --git a/ldap/servers/plugins/replication/repl5_agmt.c b/ldap/servers/plugins/replication/repl5_agmt.c
index 83694b3..d27648e 100644
--- a/ldap/servers/plugins/replication/repl5_agmt.c
+++ b/ldap/servers/plugins/replication/repl5_agmt.c
@@ -2632,26 +2632,16 @@ get_agmt_status(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter,
slapi_entry_attr_delete(e, "nsds5replicaLastInitEnd");
/* now, add the real values (singly) */
- if (ra->last_update_start_time == 0)
- {
- slapi_entry_add_string(e, "nsds5replicaLastUpdateStart", "0");
- }
- else
- {
- time_tmp = format_genTime(ra->last_update_start_time);
- slapi_entry_add_string(e, "nsds5replicaLastUpdateStart", time_tmp);
- slapi_ch_free((void **)&time_tmp);
- }
- if (ra->last_update_end_time == 0)
- {
- slapi_entry_add_string(e, "nsds5replicaLastUpdateEnd", "0");
- }
- else
- {
- time_tmp = format_genTime(ra->last_update_end_time);
- slapi_entry_add_string(e, "nsds5replicaLastUpdateEnd", time_tmp);
- slapi_ch_free((void **)&time_tmp);
- }
+ /* In case last_update_start_time is not set, 19700101000000Z is set. */
+ time_tmp = format_genTime(ra->last_update_start_time);
+ slapi_entry_add_string(e, "nsds5replicaLastUpdateStart", time_tmp);
+ slapi_ch_free((void **)&time_tmp);
+
+ /* In case last_update_end_time is not set, 19700101000000Z is set. */
+ time_tmp = format_genTime(ra->last_update_end_time);
+ slapi_entry_add_string(e, "nsds5replicaLastUpdateEnd", time_tmp);
+ slapi_ch_free((void **)&time_tmp);
+
agmt_get_changecount_string (ra, changecount_string, sizeof (changecount_string) );
slapi_entry_add_string(e, "nsds5replicaChangesSentSinceStartup", changecount_string);
if (ra->last_update_status[0] == '\0')
@@ -2663,26 +2653,17 @@ get_agmt_status(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter,
slapi_entry_add_string(e, "nsds5replicaLastUpdateStatus", ra->last_update_status);
}
slapi_entry_add_string(e, "nsds5replicaUpdateInProgress", ra->update_in_progress ? "TRUE" : "FALSE");
- if (ra->last_init_start_time == 0)
- {
- slapi_entry_add_string(e, "nsds5replicaLastInitStart", "0");
- }
- else
- {
- time_tmp = format_genTime(ra->last_init_start_time);
- slapi_entry_add_string(e, "nsds5replicaLastInitStart", time_tmp);
- slapi_ch_free((void **)&time_tmp);
- }
- if (ra->last_init_end_time == 0)
- {
- slapi_entry_add_string(e, "nsds5replicaLastInitEnd", "0");
- }
- else
- {
- time_tmp = format_genTime(ra->last_init_end_time);
- slapi_entry_add_string(e, "nsds5replicaLastInitEnd", time_tmp);
- slapi_ch_free((void **)&time_tmp);
- }
+
+ /* In case last_init_start_time is not set, 19700101000000Z is set. */
+ time_tmp = format_genTime(ra->last_init_start_time);
+ slapi_entry_add_string(e, "nsds5replicaLastInitStart", time_tmp);
+ slapi_ch_free((void **)&time_tmp);
+
+ /* In case last_init_end_time is not set, 19700101000000Z is set. */
+ time_tmp = format_genTime(ra->last_init_end_time);
+ slapi_entry_add_string(e, "nsds5replicaLastInitEnd", time_tmp);
+ slapi_ch_free((void **)&time_tmp);
+
if (ra->last_init_status[0] != '\0')
{
slapi_entry_add_string(e, "nsds5replicaLastInitStatus", ra->last_init_status);
9 years, 1 month
Branch '389-ds-base-1.3.3' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/entry.c | 2 +-
ldap/servers/slapd/pw.c | 2 +-
ldap/servers/slapd/slapi-plugin.h | 8 +++++++-
ldap/servers/slapd/slapi2nspr.c | 14 ++++++++++++++
4 files changed, 23 insertions(+), 3 deletions(-)
New commits:
commit 3520ab8f469850354fbf7ab4f9834eb7092046b9
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 10 15:37:14 2015 -0800
Ticket #47728 - compilation failed with ' incomplete struct/union/enum' if not set USE_POSIX_RWLOCKS
Description:
1) Slapi_RWLock is typedef'ed as follows without defining "struct slapi_rwlock".
ifdef USE_POSIX_RWLOCKS
typedef pthread_rwlock_t Slapi_RWLock;
else
typedef struct slapi_rwlock Slapi_RWLock;
endif
According to the wrapper layer slapi2nspr.c, the "else" of USE_POSIX_RWLOCKS
is supposed to handle PRRWLock. This patch replaces "struct slapi_rwlock"
with PRRWLock*.
2) In slapi_entry_size and pw_get_ext_size, the size of Slapi_RWLock is
added to the each object size. Unfortunately, the size of PRRWLock is not
provided by NSPR. This patch adds an API slapi_rwlock_get_size, in which
if not USE_POSIX_RWLOCKS, a rough estimate of the PRRWLock size is calculated
and returned. Note: "if USE_POSIX_RWLOCKS" is the default case and in the
case, the size is accurate.
https://fedorahosted.org/389/ticket/47728
Reviewed by mreynolds(a)redhat.com (Thank you, Mark!!)
(cherry picked from commit dbb5ef5dae65aeab87c3287d6bac946d9e71f5aa)
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index 203c742..981a02d 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -2094,7 +2094,7 @@ slapi_entry_size(Slapi_Entry *e)
if (e->e_uniqueid) size += strlen(e->e_uniqueid) + 1;
if (e->e_dncsnset) size += csnset_size(e->e_dncsnset);
if (e->e_maxcsn) size += sizeof( CSN );
- if (e->e_virtual_lock) size += sizeof(Slapi_RWLock);
+ if (e->e_virtual_lock) size += slapi_rwlock_get_size();
/* Slapi_DN and RDN are included in Slapi_Entry */
size += (slapi_sdn_get_size(&e->e_sdn) - sizeof(Slapi_DN));
size += (slapi_rdn_get_size(&e->e_srdn) - sizeof(Slapi_RDN));
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
index 43a11c7..c781adc 100644
--- a/ldap/servers/slapd/pw.c
+++ b/ldap/servers/slapd/pw.c
@@ -2782,7 +2782,7 @@ pw_get_ext_size(Slapi_Entry *entry, size_t *size)
return LDAP_SUCCESS;
}
*size += sizeof(struct slapi_pw_entry_ext);
- *size += sizeof(Slapi_RWLock);
+ *size += slapi_rwlock_get_size();
if (LDAP_SUCCESS == slapi_pw_get_entry_ext(entry, &pw_entry_values)) {
Slapi_Value *cvalue;
int idx = valuearray_first_value(pw_entry_values, &cvalue);
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index 41dd2c8..1148b3e 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -6100,7 +6100,7 @@ typedef struct slapi_condvar Slapi_CondVar;
#ifdef USE_POSIX_RWLOCKS
typedef pthread_rwlock_t Slapi_RWLock;
#else
-typedef struct slapi_rwlock Slapi_RWLock;
+typedef PRRWLock Slapi_RWLock;
#endif
Slapi_Mutex *slapi_new_mutex( void );
void slapi_destroy_mutex( Slapi_Mutex *mutex );
@@ -6169,6 +6169,12 @@ int slapi_rwlock_wrlock( Slapi_RWLock *rwlock );
*/
int slapi_rwlock_unlock( Slapi_RWLock *rwlock );
+/**
+ * Get the size of Slapi_RWLock
+ *
+ * \return the size of Slapi_RWLock
+ */
+int slapi_rwlock_get_size();
/*
* thread-safe LDAP connections
diff --git a/ldap/servers/slapd/slapi2nspr.c b/ldap/servers/slapd/slapi2nspr.c
index c734989..44b6d8e 100644
--- a/ldap/servers/slapd/slapi2nspr.c
+++ b/ldap/servers/slapd/slapi2nspr.c
@@ -289,3 +289,17 @@ slapi_rwlock_unlock( Slapi_RWLock *rwlock )
return ret;
}
+int
+slapi_rwlock_get_size()
+{
+#ifdef USE_POSIX_RWLOCKS
+ return sizeof(pthread_rwlock_t);
+#else
+ /*
+ * NSPR does not provide the size of PRRWLock.
+ * This is a rough estimate to maintain the entry size sane.
+ */
+ return sizeof("slapi_rwlock") + sizeof(void *) * 6;
+#endif
+}
+
9 years, 1 month
ldap/servers
by Noriko Hosoi
ldap/servers/slapd/entry.c | 2 +-
ldap/servers/slapd/pw.c | 2 +-
ldap/servers/slapd/slapi-plugin.h | 8 +++++++-
ldap/servers/slapd/slapi2nspr.c | 14 ++++++++++++++
4 files changed, 23 insertions(+), 3 deletions(-)
New commits:
commit dbb5ef5dae65aeab87c3287d6bac946d9e71f5aa
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 10 15:37:14 2015 -0800
Ticket #47728 - compilation failed with ' incomplete struct/union/enum' if not set USE_POSIX_RWLOCKS
Description:
1) Slapi_RWLock is typedef'ed as follows without defining "struct slapi_rwlock".
ifdef USE_POSIX_RWLOCKS
typedef pthread_rwlock_t Slapi_RWLock;
else
typedef struct slapi_rwlock Slapi_RWLock;
endif
According to the wrapper layer slapi2nspr.c, the "else" of USE_POSIX_RWLOCKS
is supposed to handle PRRWLock. This patch replaces "struct slapi_rwlock"
with PRRWLock*.
2) In slapi_entry_size and pw_get_ext_size, the size of Slapi_RWLock is
added to the each object size. Unfortunately, the size of PRRWLock is not
provided by NSPR. This patch adds an API slapi_rwlock_get_size, in which
if not USE_POSIX_RWLOCKS, a rough estimate of the PRRWLock size is calculated
and returned. Note: "if USE_POSIX_RWLOCKS" is the default case and in the
case, the size is accurate.
https://fedorahosted.org/389/ticket/47728
Reviewed by mreynolds(a)redhat.com (Thank you, Mark!!)
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index 203c742..981a02d 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -2094,7 +2094,7 @@ slapi_entry_size(Slapi_Entry *e)
if (e->e_uniqueid) size += strlen(e->e_uniqueid) + 1;
if (e->e_dncsnset) size += csnset_size(e->e_dncsnset);
if (e->e_maxcsn) size += sizeof( CSN );
- if (e->e_virtual_lock) size += sizeof(Slapi_RWLock);
+ if (e->e_virtual_lock) size += slapi_rwlock_get_size();
/* Slapi_DN and RDN are included in Slapi_Entry */
size += (slapi_sdn_get_size(&e->e_sdn) - sizeof(Slapi_DN));
size += (slapi_rdn_get_size(&e->e_srdn) - sizeof(Slapi_RDN));
diff --git a/ldap/servers/slapd/pw.c b/ldap/servers/slapd/pw.c
index 43a11c7..c781adc 100644
--- a/ldap/servers/slapd/pw.c
+++ b/ldap/servers/slapd/pw.c
@@ -2782,7 +2782,7 @@ pw_get_ext_size(Slapi_Entry *entry, size_t *size)
return LDAP_SUCCESS;
}
*size += sizeof(struct slapi_pw_entry_ext);
- *size += sizeof(Slapi_RWLock);
+ *size += slapi_rwlock_get_size();
if (LDAP_SUCCESS == slapi_pw_get_entry_ext(entry, &pw_entry_values)) {
Slapi_Value *cvalue;
int idx = valuearray_first_value(pw_entry_values, &cvalue);
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
index 41dd2c8..1148b3e 100644
--- a/ldap/servers/slapd/slapi-plugin.h
+++ b/ldap/servers/slapd/slapi-plugin.h
@@ -6100,7 +6100,7 @@ typedef struct slapi_condvar Slapi_CondVar;
#ifdef USE_POSIX_RWLOCKS
typedef pthread_rwlock_t Slapi_RWLock;
#else
-typedef struct slapi_rwlock Slapi_RWLock;
+typedef PRRWLock Slapi_RWLock;
#endif
Slapi_Mutex *slapi_new_mutex( void );
void slapi_destroy_mutex( Slapi_Mutex *mutex );
@@ -6169,6 +6169,12 @@ int slapi_rwlock_wrlock( Slapi_RWLock *rwlock );
*/
int slapi_rwlock_unlock( Slapi_RWLock *rwlock );
+/**
+ * Get the size of Slapi_RWLock
+ *
+ * \return the size of Slapi_RWLock
+ */
+int slapi_rwlock_get_size();
/*
* thread-safe LDAP connections
diff --git a/ldap/servers/slapd/slapi2nspr.c b/ldap/servers/slapd/slapi2nspr.c
index c734989..44b6d8e 100644
--- a/ldap/servers/slapd/slapi2nspr.c
+++ b/ldap/servers/slapd/slapi2nspr.c
@@ -289,3 +289,17 @@ slapi_rwlock_unlock( Slapi_RWLock *rwlock )
return ret;
}
+int
+slapi_rwlock_get_size()
+{
+#ifdef USE_POSIX_RWLOCKS
+ return sizeof(pthread_rwlock_t);
+#else
+ /*
+ * NSPR does not provide the size of PRRWLock.
+ * This is a rough estimate to maintain the entry size sane.
+ */
+ return sizeof("slapi_rwlock") + sizeof(void *) * 6;
+#endif
+}
+
9 years, 1 month
Changes to 'refs/tags/389-admin-console-1.1.10'
by Noriko Hosoi
Changes since the dawn of time:
Endi S. Dewata (1):
Bug 368481 - Unable to change Admin Server log paths in Console
Ludwig (1):
Ticket 47477 - Cannot restart SSL-admin server from console
Nathan Kinder (10):
Resolves: 247525
Resolves: 250699
Resolves: 251427
Related: 251427
Added ldapjdk default path as well as settable path.
Use less restrictive version of Open Publication License for online help docs.
Resolves: 379211
Bug 668950 - Add posix group support to Console
Ticket 362 - Directory Console generates insufficient key strength
Ticket 47467 - Improve online help for Add CRL dialog
Noriko Hosoi (11):
[191832] Admin Server password always remembers initial password on (part 2)
Resolves: #379191
Resolves: #159011
Resolves: #416311
Resolves: #400341
Bug 151705 - Need to update Console Cipher Preferences with new ciphers
Bug 211296 - Clean up all HTML pages (Admin Express, Repl Monitor, etc)
Bug 476925 - Admin Server: Do not allow 8-bit passwords for
bump version to 1.1.9
Bug 1022104 - Remove versioned jarfiles from _javadir
bump version to 1.1.10
Rich Megginson (26):
Initial import of admin server console into its own module
use admserv instead of as for jar file names
remove improperly added binary files
correctly add binary files
bump version to 1.0.3
fix symlinks
Resolves: bug 400361
updated spec for Fedora DS 1.1 release
Resolves: bug 428364
Bug 428364
bump version to 1.1.2 - disable sslv2 in the ui
this is the 1.1.2 release
Resolves: bug 452596
Resolves: bug 429514
Resolves: bug 166230
change version to 1.1.3
for the 1.1.3 release
Rename to 389
these files should be mode 644
change version to 1.1.4 - add doc subpackage - relicense under plain gplv2
bump version to 1.1.5
bump version to 1.1.6
bump version to 1.1.7
admin-version is unused
Bug 723126 - Configure Admin Server -> Connection Restriction --> Add Screen is flicking consistently.
bump version to 1.1.8
9 years, 1 month
2 commits - build.properties build.xml
by Noriko Hosoi
build.properties | 2 +-
build.xml | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
New commits:
commit 4b005e979b2c6c8794356c952a875e9a66aa7d23
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 11 14:18:37 2015 -0800
bump version to 1.1.10
diff --git a/build.properties b/build.properties
index 645c7ea..eea269a 100644
--- a/build.properties
+++ b/build.properties
@@ -21,7 +21,7 @@
lang=en
admservconsole.root=..
-admservconsole.version=1.1.9
+admservconsole.version=1.1.10
admservconsole.gen.version=1.1
brand=389
admservconsole.name=${brand}-admin-${admservconsole.version}
commit 60ab24bea0872293e4bf8ff58c62fe25c677f4cd
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 11 13:44:10 2015 -0800
Bug 1022104 - Remove versioned jarfiles from _javadir
Due to this change made to idm-console-framework, include jar file
name in build.xml should be replaced as follows.
- <include name="**/idm-console-base-*.jar"/>
- <include name="**/idm-console-mcc-*.jar"/>
- <include name="**/idm-console-nmclf-*.jar"/>
+ <include name="**/idm-console-base.jar"/>
+ <include name="**/idm-console-mcc.jar"/>
+ <include name="**/idm-console-nmclf.jar"/>
diff --git a/build.xml b/build.xml
index caa83ea..540c75d 100644
--- a/build.xml
+++ b/build.xml
@@ -85,9 +85,9 @@ END COPYRIGHT BLOCK
<!-- Construct classpath -->
<path id="admservconsole.classpath">
<fileset dir="${console.location}">
- <include name="**/idm-console-base-*.jar"/>
- <include name="**/idm-console-mcc-*.jar"/>
- <include name="**/idm-console-nmclf-*.jar"/>
+ <include name="**/idm-console-base.jar"/>
+ <include name="**/idm-console-mcc.jar"/>
+ <include name="**/idm-console-nmclf.jar"/>
</fileset>
<fileset dir="${ldapjdk.location}">
<include name="**/ldapjdk.jar"/>
9 years, 1 month
Changes to 'refs/tags/389-ds-console-1.2.10'
by Noriko Hosoi
Changes since the dawn of time:
Endi S. Dewata (3):
Bug 496863 - 'Construct' button creates incorrect referral urls
Resolves: bug 574098
Bug 563513 - New replication -> No changelong configured-msg
Mark Reynolds (10):
Ticket 370 - Opening merge qualifier CoS entry using RHDS console changes the entry
Bumped version to 1.2.7
Ticket 96 - Window too large for Manage password policy
Ticket 47883 - DS Console - java exception when refreshing
Ticket 176 - DS Console should timeout when mismatched port
Ticket 47886 - DS Console - mouse wheel speed very slow
Ticket 47485 - DS instance cannot be restored from remote console
Ticket 47887 - DS Console does not correctly disable SSL
Ticket 135 - DS console - right clicking an object does not select that object
Ticket 47994 - DS Console always sets nsSSL3 to "on" when a securty setting is adjusted
Nathan Kinder (28):
171941 - Adjusted the version number and branding. I had to modify the checkVersion method to deal with running in Console 1.0. I also cleaned up references to consolesdk in the Ant build files. They should be console instead since we dropped the consolesdk naming. The external and internal imports files were adjusted to pick up the new 1.0 Console component.
171941 - checkVersion was comparing versions with greater than when it should have been using greater than or equal to
177696 - Changed usage of enum keyword as a variable name for Java 1.5 compatibility
Bug(s) fixed: 181570
Resolves: 246513
Summary: Initial fedora-ds-console specfile.
Resolves: ?
Resolves: 250137
Resolves: 250145
Resolves: 204510
Resolves: 250636
Resolves: 252036
Add default ldapjdk path as well as a settable parameter
Fixed typo from last checkin
Use less restrictive version of Open Publication License for online help docs.
Resolves: 308221
Resolves: 333171
Resolves: 178247
Resolves: 379191
Bug 599732 - Root node in directory browser shows DN syntax error
Bug 229693 - Update naming attribute when objectclass is removed
Bug 474113 - Allow access log level to be configured from Console
Bug 504803 - Allow nsslapd-*-logmaxdiskspace to be set to -1 in UI
Bug 158262 - Windows Sync UI is inconistent
Bug 533505 - Warn about CA cert trust when enabling SSL in Console
Bug 616707 - Add attribute matching rule UI to Console
Bug 705753 - Refresh problem in Console directory browser
Bug 700908 - Validate matching rules when creating a new attribute
Noriko Hosoi (25):
Changed the ldapconsole package name to <brand>-ds-<version>.jar
Modified ant move syntax to support ant 1.6.2
[186105] Admin Server Makefile updates for Internal build
Resolves: #247215
Resolves: #248073
Resolves: #379191
Resolves: #386041
Resolves: #379191
Resolves: #379191
Resolves: #379191
Resolves: #379191
Resolves: #379191
Resolves: 178947
Bug 553066 - Directory Console: do not display "subtree" index type
Bug 151705 - Need to update Console Cipher Preferences with new ciphers
Bug 661116 - 389-console Configuration tab admin permissions
Bug 387981 - plain files can be chosen on the Restore Directory dialog
Bug 450016 - RFE- Console display values in KB/MB/GB
Bug 211296 - Clean up all HTML pages (Admin Express, Repl Monitor, etc)
Bug 757773 - SSL Port issue in Console
Ticket #47380 - RFE: Winsync loses connection with AD objects when they move from the console.
Bumped version to 1.2.8
Bumped version to 1.2.9
Bug 1022104 - Remove versioned jarfiles from _javadir
Bumped version to 1.2.10
Rich Megginson (39):
Bug(s) fixed: 167761
allow the definition of the console location on the command line with different directory layouts than the default
Bug(s) fixed: 178478
The console now builds jar files in the format
bump version to 1.0.3
updated spec for Fedora DS 1.1 release
Resolves: bug 428357
Bump version to 1.1.2
this is for the 1.1.2 release
Resolves: bug 469261
Resolves: bug 469261
Resolves: bug 234948
Resolves: bug 452596
Resolves: bug 178947
Resolves: bug 177334
Resolves: bug 249120
Resolves: bug 238762
Resolves: bug 179193
Resolves: bug 179184
change version to 1.1.3
Resolves: bug 487831
Resolves: bug 481213
Resolves: bug 483660
Resolves: bug 483660
updated for 1.1.3
version must correspond to ds base version - 1.2.0
rename to 389
change mode of spec file to 644
added separate doc subpackage
update to version 1.2.1
Bug 586571 - DS Console shows escaped DNs
bump version to 1.2.2
Bug 586571 - DS Console shows escaped DNs
Bug 591989 - [console] mis-matched trademark and text
bump version to 1.2.4
bump version to 1.2.5
add skin support
move dsbanner.gif to the localized jar for l10n/skinning
dsbannerlite.gif is obsolete
foxworth (2):
Import initial source drop of Fedora DirectoryConsole
Import initial source drop of Fedora DirectoryConsole
9 years, 1 month
2 commits - build.properties build.xml
by Noriko Hosoi
build.properties | 2 +-
build.xml | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
New commits:
commit cfd472e9b34b73a23fbd77873c1eb830d3ab7605
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 11 13:35:17 2015 -0800
Bumped version to 1.2.10
diff --git a/build.properties b/build.properties
index 49b83dd..6486d1d 100755
--- a/build.properties
+++ b/build.properties
@@ -21,7 +21,7 @@
lang=en
ldapconsole.root=..
-ldapconsole.version=1.2.9
+ldapconsole.version=1.2.10
ldapconsole.gen.version=1.2
brand=389
ldapconsole.name=${brand}-ds-${ldapconsole.version}
commit c2e3c4905bae3f7ae584d9dce0688f3f5f28b27c
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 11 13:29:56 2015 -0800
Bug 1022104 - Remove versioned jarfiles from _javadir
Due to this change made to idm-console-framework, include jar file
name in build.xml should be replaced as follows.
- <include name="**/idm-console-base-*.jar"/>
- <include name="**/idm-console-mcc-*.jar"/>
- <include name="**/idm-console-nmclf-*.jar"/>
+ <include name="**/idm-console-base.jar"/>
+ <include name="**/idm-console-mcc.jar"/>
+ <include name="**/idm-console-nmclf.jar"/>
diff --git a/build.xml b/build.xml
index 518a6e3..6562460 100644
--- a/build.xml
+++ b/build.xml
@@ -85,9 +85,9 @@ END COPYRIGHT BLOCK
<!-- Construct classpath -->
<path id="ldapconsole.classpath">
<fileset dir="${console.location}">
- <include name="**/idm-console-base-*.jar"/>
- <include name="**/idm-console-mcc-*.jar"/>
- <include name="**/idm-console-nmclf-*.jar"/>
+ <include name="**/idm-console-base.jar"/>
+ <include name="**/idm-console-mcc.jar"/>
+ <include name="**/idm-console-nmclf.jar"/>
</fileset>
<fileset dir="${ldapjdk.location}">
<include name="**/ldapjdk.jar"/>
9 years, 1 month
Branch '389-ds-base-1.2.11' - ldap/servers
by Mark Reynolds
ldap/servers/plugins/rootdn_access/rootdn_access.c | 132 ++++++++++++---------
1 file changed, 78 insertions(+), 54 deletions(-)
New commits:
commit dd864ce3f01f9189362e4d786b1558ab641c658c
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Tue Feb 10 09:16:25 2015 -0500
Ticket 48027 - revise the rootdn plugin configuration validation
Bug Description: There are several issues with the config validation. The use of
strcspn() was not working as expected for all the config attributes.
Needed to use strspn instead(). Also, for many errors we simply
ignored the new value, and logged an error. There was also a
memory leak between plugin restarts
Fix Description: Created new function to check all the characters in a config value.
The plugin now returns an error when an invalid config setting is
encountered. Fixed the memory leak when restarting the plugin.
https://fedorahosted.org/389/ticket/48027
Valgrind: passed
Reviewed by: rmeggins(Thanks!)
(cherry picked from commit 53e34440a3c4cced2372e810c14e1743fa4c716c)
Conflicts:
ldap/servers/plugins/rootdn_access/rootdn_access.c
(cherry picked from commit 7944ed527093b125082c2707fc3bca4c652a87c9)
Conflicts:
ldap/servers/plugins/rootdn_access/rootdn_access.c
diff --git a/ldap/servers/plugins/rootdn_access/rootdn_access.c b/ldap/servers/plugins/rootdn_access/rootdn_access.c
index d620e68..eea591c 100644
--- a/ldap/servers/plugins/rootdn_access/rootdn_access.c
+++ b/ldap/servers/plugins/rootdn_access/rootdn_access.c
@@ -218,10 +218,16 @@ static int
rootdn_load_config(Slapi_PBlock *pb)
{
Slapi_Entry *e = NULL;
+ char *daysAllowed_tmp = NULL;
+ char **hosts_tmp = NULL;
+ char **hosts_to_deny_tmp = NULL;
+ char **ips_tmp = NULL;
+ char **ips_to_deny_tmp = NULL;
char *openTime = NULL;
char *closeTime = NULL;
char *token, *iter = NULL, *copy;
char hour[3], min[3];
+ size_t end;
int result = 0;
int time;
int i;
@@ -234,31 +240,32 @@ rootdn_load_config(Slapi_PBlock *pb)
*/
openTime = slapi_entry_attr_get_charptr(e, "rootdn-open-time");
closeTime = slapi_entry_attr_get_charptr(e, "rootdn-close-time");
- daysAllowed = slapi_entry_attr_get_charptr(e, "rootdn-days-allowed");
- hosts = slapi_entry_attr_get_charray(e, "rootdn-allow-host");
- hosts_to_deny = slapi_entry_attr_get_charray(e, "rootdn-deny-host");
- ips = slapi_entry_attr_get_charray(e, "rootdn-allow-ip");
- ips_to_deny = slapi_entry_attr_get_charray(e, "rootdn-deny-ip");
+ daysAllowed_tmp = slapi_entry_attr_get_charptr(e, "rootdn-days-allowed");
+ hosts_tmp = slapi_entry_attr_get_charray(e, "rootdn-allow-host");
+ hosts_to_deny_tmp = slapi_entry_attr_get_charray(e, "rootdn-deny-host");
+ ips_tmp = slapi_entry_attr_get_charray(e, "rootdn-allow-ip");
+ ips_to_deny_tmp = slapi_entry_attr_get_charray(e, "rootdn-deny-ip");
/*
* Validate out settings
*/
- if(daysAllowed){
- daysAllowed = strToLower(daysAllowed);
- if(strcspn(daysAllowed, "abcdefghijklmnopqrstuvwxyz ,")){
+ if(daysAllowed_tmp){
+ daysAllowed_tmp = strToLower(daysAllowed_tmp);
+ end = strspn(daysAllowed_tmp, "abcdefghijklmnopqrstuvwxyz ,");
+ if(!end || daysAllowed_tmp[end] != '\0'){
slapi_log_error(SLAPI_LOG_FATAL, ROOTDN_PLUGIN_SUBSYSTEM, "rootdn_load_config: "
- "invalid rootdn-days-allowed value (%s), must be all letters, and comma separators\n", daysAllowed);
- slapi_ch_free_string(&daysAllowed);
+ "invalid rootdn-days-allowed value (%s), must be all letters, and comma separators\n", daysAllowed_tmp);
+ slapi_ch_free_string(&daysAllowed_tmp);
result = -1;
goto free_and_return;
}
/* make sure the "days" are valid "days" */
- copy = slapi_ch_strdup(daysAllowed);
+ copy = slapi_ch_strdup(daysAllowed_tmp);
token = ldap_utf8strtok_r(copy, ", ", &iter);
while(token){
if(strstr("mon tue wed thu fri sat sun",token) == 0){
slapi_log_error(SLAPI_LOG_FATAL, ROOTDN_PLUGIN_SUBSYSTEM, "rootdn_load_config: "
"invalid rootdn-days-allowed day value(%s), must be \"Mon, Tue, Wed, Thu, Fri, Sat, or Sun\".\n", token);
- slapi_ch_free_string(&daysAllowed);
+ slapi_ch_free_string(&daysAllowed_tmp);
slapi_ch_free_string(©);
result = -1;
goto free_and_return;
@@ -268,7 +275,8 @@ rootdn_load_config(Slapi_PBlock *pb)
slapi_ch_free_string(©);
}
if(openTime){
- if (strcspn(openTime, "0123456789")){
+ end = strspn(openTime, "0123456789");
+ if (!end || openTime[end] != '\0'){
slapi_log_error(SLAPI_LOG_FATAL, ROOTDN_PLUGIN_SUBSYSTEM, "rootdn_load_config: "
"invalid rootdn-open-time value (%s), must be all digits\n", openTime);
result = -1;
@@ -295,7 +303,8 @@ rootdn_load_config(Slapi_PBlock *pb)
open_time = (atoi(hour) * 3600) + (atoi(min) * 60);
}
if(closeTime){
- if (strcspn(closeTime, "0123456789")){
+ end = strspn(closeTime, "0123456789");
+ if (!end || closeTime[end] != '\0'){
slapi_log_error(SLAPI_LOG_FATAL, ROOTDN_PLUGIN_SUBSYSTEM, "rootdn_load_config: "
"invalid rootdn-close-time value (%s), must be all digits, and should be HHMM\n",closeTime);
result = -1;
@@ -338,70 +347,76 @@ rootdn_load_config(Slapi_PBlock *pb)
result = -1;
goto free_and_return;
}
- if(hosts){
- for(i = 0; hosts[i] != NULL; i++){
- if(strcspn(hosts[i], "0123456789.*-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")){
+ if(hosts_tmp){
+ for(i = 0; hosts_tmp[i] != NULL; i++){
+ end = strspn(hosts_tmp[i], "0123456789.*-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
+ if(!end || hosts_tmp[i][end] != '\0'){
slapi_log_error(SLAPI_LOG_FATAL, ROOTDN_PLUGIN_SUBSYSTEM, "rootdn_load_config: "
- "hostname (%s) contians invalid characters, skipping\n",hosts[i]);
- slapi_ch_free_string(&hosts[i]);
- hosts[i] = slapi_ch_strdup("!invalid");
- continue;
+ "hostname (%s) contains invalid characters, skipping\n",hosts_tmp[i]);
+ slapi_ch_array_free(hosts_tmp);
+ result = -1;
+ goto free_and_return;
}
}
}
- if(hosts_to_deny){
- for(i = 0; hosts_to_deny[i] != NULL; i++){
- if(strcspn(hosts_to_deny[i], "0123456789.*-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")){
+ if(hosts_to_deny_tmp){
+ for(i = 0; hosts_to_deny_tmp[i] != NULL; i++){
+ end = strspn(hosts_to_deny_tmp[i], "0123456789.*-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
+ if(!end || hosts_to_deny_tmp[i][end] != '\0'){
slapi_log_error(SLAPI_LOG_FATAL, ROOTDN_PLUGIN_SUBSYSTEM, "rootdn_load_config: "
- "hostname (%s) contians invalid characters, skipping\n",hosts_to_deny[i]);
- slapi_ch_free_string(&hosts_to_deny[i]);
- hosts_to_deny[i] = slapi_ch_strdup("!invalid");
- continue;
+ "hostname (%s) contains invalid characters, skipping\n",hosts_to_deny_tmp[i]);
+ slapi_ch_array_free(hosts_to_deny_tmp);
+ result = -1;
+ goto free_and_return;
}
}
}
- if(ips){
- for(i = 0; ips[i] != NULL; i++){
- if(strcspn(ips[i], "0123456789:ABCDEFabcdef.*")){
+ if(ips_tmp){
+ for(i = 0; ips_tmp[i] != NULL; i++){
+ end = strspn(ips_tmp[i], "0123456789:ABCDEFabcdef.");
+ if(!end || ips_tmp[i][end] != '\0'){
slapi_log_error(SLAPI_LOG_FATAL, ROOTDN_PLUGIN_SUBSYSTEM, "rootdn_load_config: "
- "IP address contains invalid characters (%s), skipping\n", ips[i]);
- slapi_ch_free_string(&ips[i]);
- ips[i] = slapi_ch_strdup("!invalid");
- continue;
+ "IP address contains invalid characters (%s), skipping\n", ips_tmp[i]);
+ slapi_ch_array_free(ips_tmp);
+ result = -1;
+ goto free_and_return;
}
- if(strstr(ips[i],":") == 0){
+ if(strstr(ips_tmp[i],":") == 0){
/*
* IPv4 - make sure it's just numbers, dots, and wildcard
*/
- if(strcspn(ips[i], "0123456789.*")){
+ end = strspn(ips_tmp[i], "0123456789.*");
+ if(!end || ips_tmp[i][end] != '\0'){
slapi_log_error(SLAPI_LOG_FATAL, ROOTDN_PLUGIN_SUBSYSTEM, "rootdn_load_config: "
- "IPv4 address contains invalid characters (%s), skipping\n", ips[i]);
- slapi_ch_free_string(&ips[i]);
- ips[i] = slapi_ch_strdup("!invalid");
- continue;
+ "IPv4 address contains invalid characters (%s), skipping\n", ips_tmp[i]);
+ slapi_ch_array_free(ips_tmp);
+ result = -1;
+ goto free_and_return;
}
}
}
}
- if(ips_to_deny){
- for(i = 0; ips_to_deny[i] != NULL; i++){
- if(strcspn(ips_to_deny[i], "0123456789:ABCDEFabcdef.*")){
+ if(ips_to_deny_tmp){
+ for(i = 0; ips_to_deny_tmp[i] != NULL; i++){
+ end = strspn(ips_to_deny_tmp[i], "0123456789:ABCDEFabcdef.*");
+ if(!end || ips_to_deny_tmp[i][end] != '\0'){
slapi_log_error(SLAPI_LOG_FATAL, ROOTDN_PLUGIN_SUBSYSTEM, "rootdn_load_config: "
- "IP address contains invalid characters (%s), skipping\n", ips_to_deny[i]);
- slapi_ch_free_string(&ips_to_deny[i]);
- ips_to_deny[i] = slapi_ch_strdup("!invalid");
- continue;
+ "IP address contains invalid characters (%s), skipping\n", ips_to_deny_tmp[i]);
+ slapi_ch_array_free(ips_to_deny_tmp);
+ result = -1;
+ goto free_and_return;
}
- if(strstr(ips_to_deny[i],":") == 0){
+ if(strstr(ips_to_deny_tmp[i],":") == 0){
/*
* IPv4 - make sure it's just numbers, dots, and wildcard
*/
- if(strcspn(ips_to_deny[i], "0123456789.*")){
+ end = strspn(ips_to_deny_tmp[i], "0123456789.*");
+ if(!end || ips_to_deny_tmp[i][end] != '\0'){
slapi_log_error(SLAPI_LOG_FATAL, ROOTDN_PLUGIN_SUBSYSTEM, "rootdn_load_config: "
- "IPv4 address contains invalid characters (%s), skipping\n", ips_to_deny[i]);
- slapi_ch_free_string(&ips_to_deny[i]);
- ips_to_deny[i] = slapi_ch_strdup("!invalid");
- continue;
+ "IPv4 address contains invalid characters (%s), skipping\n", ips_to_deny_tmp[i]);
+ slapi_ch_array_free(ips_to_deny_tmp);
+ result = -1;
+ goto free_and_return;
}
}
}
@@ -412,6 +427,13 @@ rootdn_load_config(Slapi_PBlock *pb)
}
free_and_return:
+ if(result == 0){
+ daysAllowed = daysAllowed_tmp;
+ hosts = hosts_tmp;
+ hosts_to_deny = hosts_to_deny_tmp;
+ ips = ips_tmp;
+ ips_to_deny = ips_to_deny_tmp;
+ }
slapi_ch_free_string(&openTime);
slapi_ch_free_string(&closeTime);
@@ -469,8 +491,10 @@ rootdn_check_access(Slapi_PBlock *pb){
char *today = day;
timestr = asctime(timeinfo); // DDD MMM dd hh:mm:ss YYYY
+ memset(day, 0 ,sizeof(day));
memmove(day, timestr, 3); // we only want the day
today = strToLower(today);
+ daysAllowed = strToLower(daysAllowed);
if(!strstr(daysAllowed, today)){
slapi_log_error(SLAPI_LOG_PLUGIN, ROOTDN_PLUGIN_SUBSYSTEM, "rootdn_check_access: bind not allowed for today(%s), "
9 years, 1 month