dirsrvtests/tests
by Simon Pichugin
dirsrvtests/tests/tickets/ticket49008_test.py | 110 ++++++++++++++++++++++++++
1 file changed, 110 insertions(+)
New commits:
commit 360d797597f19c1684e5031ed30aca596cbbf63f
Author: Simon Pichugin <spichugi(a)redhat.com>
Date: Tue Jan 17 15:32:38 2017 +0100
Ticket 49008 - Add CI test
Description: Check that RUV doesn't change the state after failing operation
(but is succeeding in plugin operation).
https://fedorahosted.org/389/ticket/49008
Author: lkrispen (Thanks!)
Reviewed by: spichugi
diff --git a/dirsrvtests/tests/tickets/ticket49008_test.py b/dirsrvtests/tests/tickets/ticket49008_test.py
new file mode 100644
index 0000000..67ee7c7
--- /dev/null
+++ b/dirsrvtests/tests/tickets/ticket49008_test.py
@@ -0,0 +1,110 @@
+import pytest
+from lib389.tasks import *
+from lib389.utils import *
+from lib389.topologies import topology_m3 as T
+
+DEBUGGING = os.getenv("DEBUGGING", default=False)
+if DEBUGGING:
+ logging.getLogger(__name__).setLevel(logging.DEBUG)
+else:
+ logging.getLogger(__name__).setLevel(logging.INFO)
+log = logging.getLogger(__name__)
+
+
+def test_ticket49008(T):
+ A = T.ms['master1']
+ B = T.ms['master2']
+ C = T.ms['master3']
+
+ A.enableReplLogging()
+ B.enableReplLogging()
+ C.enableReplLogging()
+
+ AtoB = A.agreement.list(suffix=DEFAULT_SUFFIX)[0].dn
+ AtoC = A.agreement.list(suffix=DEFAULT_SUFFIX)[1].dn
+ CtoA = C.agreement.list(suffix=DEFAULT_SUFFIX)[0].dn
+ CtoB = C.agreement.list(suffix=DEFAULT_SUFFIX)[1].dn
+
+ # we want replication in a line A <==> B <==> C
+ A.agreement.pause(AtoC)
+ C.agreement.pause(CtoA)
+
+ B.plugins.enable(name=PLUGIN_MEMBER_OF)
+ B.restart(timeout=10)
+
+ # add a few entries allowing memberof
+ for i in range(1, 6):
+ name = "userX{}".format(i)
+ dn = "cn={},{}".format(name, DEFAULT_SUFFIX)
+ A.add_s(Entry((dn, {'objectclass': "top person inetuser".split(),
+ 'sn': name, 'cn': name})))
+
+ # add a few entries not allowing memberof
+ for i in range(1, 6):
+ name = "userY{}".format(i)
+ dn = "cn={},{}".format(name, DEFAULT_SUFFIX)
+ A.add_s(Entry((dn, {'objectclass': "top person".split(),
+ 'sn': name, 'cn': name})))
+
+ time.sleep(10)
+
+ A_entries = A.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE,
+ '(objectClass=person)')
+ B_entries = B.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE,
+ '(objectClass=person)')
+ C_entries = C.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE,
+ '(objectClass=person)')
+
+ assert len(A_entries) == len(B_entries)
+ assert len(B_entries) == len(C_entries)
+
+ # add a group with members allowing memberof
+ dn = "cn=g1,{}".format(DEFAULT_SUFFIX)
+ A.add_s(Entry((dn, {'objectclass': "top groupOfNames".split(),
+ 'description': "Test Owned Group {}".format(name),
+ 'member': "cn=userX1,{}".format(DEFAULT_SUFFIX),
+ 'cn': "g1"})))
+
+ # check ruv on m2 before applying failing op
+ time.sleep(10)
+ B_RUV = B.search_s("cn=config", ldap.SCOPE_SUBTREE,
+ "(&(objectclass=nsds5replica)(nsDS5ReplicaRoot={}))".format(DEFAULT_SUFFIX),
+ ['nsds50ruv'])
+ elements = B_RUV[0].getValues('nsds50ruv')
+ ruv_before = 'ruv_before'
+ for ruv in elements:
+ if 'replica 2' in ruv:
+ ruv_before = ruv
+
+ # add a group with members allowing memberof and members which don't
+ # the op will fail on M2
+ dn = "cn=g2,{}".format(DEFAULT_SUFFIX)
+ A.add_s(Entry((dn, {'objectclass': "top groupOfNames".split(),
+ 'description': "Test Owned Group {}".format(name),
+ 'member': ["cn=userX1,{}".format(DEFAULT_SUFFIX),
+ "cn=userX2,{}".format(DEFAULT_SUFFIX),
+ "cn=userY1,{}".format(DEFAULT_SUFFIX)],
+ 'cn': "g2"})))
+
+ # check ruv on m2 after applying failing op
+ time.sleep(10)
+ B_RUV = B.search_s("cn=config", ldap.SCOPE_SUBTREE,
+ "(&(objectclass=nsds5replica)(nsDS5ReplicaRoot={}))".format(DEFAULT_SUFFIX),
+ ['nsds50ruv'])
+ elements = B_RUV[0].getValues('nsds50ruv')
+ ruv_after = 'ruv_after'
+ for ruv in elements:
+ if 'replica 2' in ruv:
+ ruv_after = ruv
+
+ log.info('ruv before fail: {}'.format(ruv_before))
+ log.info('ruv after fail: {}'.format(ruv_after))
+ # the ruv should not have changed
+ assert ruv_before == ruv_after
+
+
+if __name__ == '__main__':
+ # Run isolated
+ # -s for DEBUG mode
+ CURRENT_FILE = os.path.realpath(__file__)
+ pytest.main("-s {}".format(CURRENT_FILE))
7 years, 2 months
ldap/servers
by Ludwig Krispenz
ldap/servers/plugins/replication/csnpl.c | 75 ++++++++++++++++++++---
ldap/servers/plugins/replication/csnpl.h | 5 +
ldap/servers/plugins/replication/repl5.h | 2
ldap/servers/plugins/replication/repl5_init.c | 22 ++++++
ldap/servers/plugins/replication/repl5_plugins.c | 40 +++++++-----
ldap/servers/plugins/replication/repl5_replica.c | 6 -
ldap/servers/plugins/replication/repl5_ruv.c | 74 ++++++++++++++++------
ldap/servers/plugins/replication/repl5_ruv.h | 4 -
ldap/servers/slapd/csn.c | 15 ++++
ldap/servers/slapd/slapi-private.h | 2
10 files changed, 195 insertions(+), 50 deletions(-)
New commits:
commit 0c7ef560ae3f4641155a44509573b6f6dfff1caa
Author: Ludwig Krispenz <lkrispen(a)redhat.com>
Date: Tue Jan 24 14:05:16 2017 +0100
Ticket 49008 v2: aborted operation can leave RUV in incorrect state
Bug description:
If a plugin operation succeeded, but the operation itself fails and is aborted the RUV is in an incorrect state (rolled up to the succesful plugin op)
Fix Decription:
Introduce a "primary_csn", this is the csn of the main operation, either a client operation or a replicated operation.
csns generated by internal operations, eg by plugins are secondary csn.
Maintain the primary csn in thread local data, like it is used for the agreement name (or txn stack): prim_csn.
Extend the data structure of the pending list to keep prim_csn for each inserted csn
If a csn is created or received check prim_csn: if it exists use it, if it doesn't exist set it
when inserting a csn to the pending list pass the prim_csn
when cancelling a csn, if it is the prim_csn also cancell all secondary csns
when committing a csn,
if it is not the primary csn, do nothing
if it is the prim_csn trigger the pending list rollup, stop at the first not committed csn
if the RID of the prim_csn is not the local RID also rollup the pending list for the local RID.
Reviewed by: Thierry, Thanks
diff --git a/ldap/servers/plugins/replication/csnpl.c b/ldap/servers/plugins/replication/csnpl.c
index 7861b6d..4a0f5f5 100644
--- a/ldap/servers/plugins/replication/csnpl.c
+++ b/ldap/servers/plugins/replication/csnpl.c
@@ -24,8 +24,9 @@ struct csnpl
typedef struct _csnpldata
{
- PRBool committed; /* True if CSN committed */
- CSN *csn; /* The actual CSN */
+ PRBool committed; /* True if CSN committed */
+ CSN *csn; /* The actual CSN */
+ const CSN *prim_csn; /* The primary CSN of an operation consising of multiple sub ops*/
} csnpldata;
/* forward declarations */
@@ -103,7 +104,7 @@ void csnplFree (CSNPL **csnpl)
* 1 if the csn has already been seen
* -1 for any other kind of errors
*/
-int csnplInsert (CSNPL *csnpl, const CSN *csn)
+int csnplInsert (CSNPL *csnpl, const CSN *csn, const CSN *prim_csn)
{
int rc;
csnpldata *csnplnode;
@@ -131,6 +132,7 @@ int csnplInsert (CSNPL *csnpl, const CSN *csn)
csnplnode = (csnpldata *)slapi_ch_malloc(sizeof(csnpldata));
csnplnode->committed = PR_FALSE;
csnplnode->csn = csn_dup(csn);
+ csnplnode->prim_csn = prim_csn;
csn_as_string(csn, PR_FALSE, csn_str);
rc = llistInsertTail (csnpl->csnList, csn_str, csnplnode);
@@ -186,6 +188,57 @@ int csnplRemove (CSNPL *csnpl, const CSN *csn)
return 0;
}
+int csnplRemoveAll (CSNPL *csnpl, const CSN *csn)
+{
+ csnpldata *data;
+ void *iterator;
+
+ slapi_rwlock_wrlock (csnpl->csnLock);
+ data = (csnpldata *)llistGetFirst(csnpl->csnList, &iterator);
+ while (NULL != data)
+ {
+ if (csn_is_equal(data->csn, csn) ||
+ csn_is_equal(data->prim_csn, csn)) {
+ csnpldata_free(&data);
+ data = (csnpldata *)llistRemoveCurrentAndGetNext(csnpl->csnList, &iterator);
+ } else {
+ data = (csnpldata *)llistGetNext (csnpl->csnList, &iterator);
+ }
+ }
+#ifdef DEBUG
+ _csnplDumpContentNoLock(csnpl, "csnplRemoveAll");
+#endif
+ slapi_rwlock_unlock (csnpl->csnLock);
+ return 0;
+}
+
+
+int csnplCommitAll (CSNPL *csnpl, const CSN *csn)
+{
+ csnpldata *data;
+ void *iterator;
+ char csn_str[CSN_STRSIZE];
+
+ csn_as_string(csn, PR_FALSE, csn_str);
+ slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
+ "csnplCommitALL: committing all csns for csn %s\n", csn_str);
+ slapi_rwlock_wrlock (csnpl->csnLock);
+ data = (csnpldata *)llistGetFirst(csnpl->csnList, &iterator);
+ while (NULL != data)
+ {
+ csn_as_string(data->csn, PR_FALSE, csn_str);
+ slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
+ "csnplCommitALL: processing data csn %s\n", csn_str);
+ if (csn_is_equal(data->csn, csn) ||
+ csn_is_equal(data->prim_csn, csn)) {
+ data->committed = PR_TRUE;
+ }
+ data = (csnpldata *)llistGetNext (csnpl->csnList, &iterator);
+ }
+ slapi_rwlock_unlock (csnpl->csnLock);
+ return 0;
+}
+
int csnplCommit (CSNPL *csnpl, const CSN *csn)
{
csnpldata *data;
@@ -276,13 +329,12 @@ csnplRollUp(CSNPL *csnpl, CSN **first_commited)
*first_commited = NULL;
}
data = (csnpldata *)llistGetFirst(csnpl->csnList, &iterator);
- while (NULL != data)
+ while (NULL != data && data->committed)
{
if (NULL != largest_committed_csn && freeit)
{
csn_free(&largest_committed_csn);
}
- if (data->committed) {
freeit = PR_TRUE;
largest_committed_csn = data->csn; /* Save it */
if (first_commited && (*first_commited == NULL)) {
@@ -294,9 +346,6 @@ csnplRollUp(CSNPL *csnpl, CSN **first_commited)
data->csn = NULL;
csnpldata_free(&data);
data = (csnpldata *)llistRemoveCurrentAndGetNext(csnpl->csnList, &iterator);
- } else {
- data = (csnpldata *)llistGetNext (csnpl->csnList, &iterator);
- }
}
#ifdef DEBUG
@@ -326,6 +375,7 @@ static void _csnplDumpContentNoLock(CSNPL *csnpl, const char *caller)
csnpldata *data;
void *iterator;
char csn_str[CSN_STRSIZE];
+ char primcsn_str[CSN_STRSIZE];
data = (csnpldata *)llistGetFirst(csnpl->csnList, &iterator);
if (data) {
@@ -334,11 +384,18 @@ static void _csnplDumpContentNoLock(CSNPL *csnpl, const char *caller)
}
while (data)
{
- slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name, "%s, %s\n",
+ slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name, "%s,(prim %s), %s\n",
csn_as_string(data->csn, PR_FALSE, csn_str),
+ data->prim_csn ? csn_as_string(data->prim_csn, PR_FALSE, primcsn_str) : " ",
data->committed ? "committed" : "not committed");
data = (csnpldata *)llistGetNext (csnpl->csnList, &iterator);
}
}
#endif
+/* wrapper around csn_free, to satisfy NSPR thread context API */
+void
+csnplFreeCSN (void *arg)
+{
+ csn_free((CSN **)&arg);
+}
diff --git a/ldap/servers/plugins/replication/csnpl.h b/ldap/servers/plugins/replication/csnpl.h
index 3f6132d..594c8f2 100644
--- a/ldap/servers/plugins/replication/csnpl.h
+++ b/ldap/servers/plugins/replication/csnpl.h
@@ -22,10 +22,13 @@ typedef struct csnpl CSNPL;
CSNPL* csnplNew(void);
void csnplFree (CSNPL **csnpl);
-int csnplInsert (CSNPL *csnpl, const CSN *csn);
+int csnplInsert (CSNPL *csnpl, const CSN *csn, const CSN *prim_csn);
int csnplRemove (CSNPL *csnpl, const CSN *csn);
+int csnplRemoveAll (CSNPL *csnpl, const CSN *csn);
+int csnplCommitAll (CSNPL *csnpl, const CSN *csn);
CSN* csnplGetMinCSN (CSNPL *csnpl, PRBool *committed);
int csnplCommit (CSNPL *csnpl, const CSN *csn);
CSN *csnplRollUp(CSNPL *csnpl, CSN ** first);
void csnplDumpContent(CSNPL *csnpl, const char *caller);
+
#endif
diff --git a/ldap/servers/plugins/replication/repl5.h b/ldap/servers/plugins/replication/repl5.h
index 93342dd..c3bd10c 100644
--- a/ldap/servers/plugins/replication/repl5.h
+++ b/ldap/servers/plugins/replication/repl5.h
@@ -232,6 +232,8 @@ int multimaster_be_betxnpostop_modify (Slapi_PBlock *pb);
extern int repl5_is_betxn;
char* get_thread_private_agmtname(void);
void set_thread_private_agmtname (const char *agmtname);
+void set_thread_primary_csn (const CSN *prim_csn);
+CSN* get_thread_primary_csn(void);
void* get_thread_private_cache(void);
void set_thread_private_cache (void *buf);
char* get_repl_session_id (Slapi_PBlock *pb, char *id, CSN **opcsn);
diff --git a/ldap/servers/plugins/replication/repl5_init.c b/ldap/servers/plugins/replication/repl5_init.c
index a9aa519..0945f7b 100644
--- a/ldap/servers/plugins/replication/repl5_init.c
+++ b/ldap/servers/plugins/replication/repl5_init.c
@@ -136,6 +136,7 @@ static int multimaster_started_flag = 0;
/* Thread private data and interface */
static PRUintn thread_private_agmtname; /* thread private index for logging*/
static PRUintn thread_private_cache;
+static PRUintn thread_primary_csn;
char*
get_thread_private_agmtname()
@@ -153,6 +154,26 @@ set_thread_private_agmtname(const char *agmtname)
PR_SetThreadPrivate(thread_private_agmtname, (void *)agmtname);
}
+CSN*
+get_thread_primary_csn(void)
+{
+ CSN *prim_csn = NULL;
+ if (thread_primary_csn)
+ prim_csn = (CSN *)PR_GetThreadPrivate(thread_primary_csn);
+ return prim_csn;
+}
+void
+set_thread_primary_csn(const CSN *prim_csn)
+{
+ if (thread_primary_csn) {
+ if (prim_csn) {
+ PR_SetThreadPrivate(thread_primary_csn, (void *)csn_dup(prim_csn));
+ } else {
+ PR_SetThreadPrivate(thread_primary_csn, NULL);
+ }
+ }
+}
+
void*
get_thread_private_cache ()
{
@@ -719,6 +740,7 @@ multimaster_start( Slapi_PBlock *pb )
/* Initialize thread private data for logging. Ignore if fails */
PR_NewThreadPrivateIndex (&thread_private_agmtname, NULL);
PR_NewThreadPrivateIndex (&thread_private_cache, NULL);
+ PR_NewThreadPrivateIndex (&thread_primary_csn, csnplFreeCSN);
/* Decode the command line args to see if we're dumping to LDIF */
is_ldif_dump = check_for_ldif_dump(pb);
diff --git a/ldap/servers/plugins/replication/repl5_plugins.c b/ldap/servers/plugins/replication/repl5_plugins.c
index 70e003b..357c093 100644
--- a/ldap/servers/plugins/replication/repl5_plugins.c
+++ b/ldap/servers/plugins/replication/repl5_plugins.c
@@ -1033,9 +1033,11 @@ static int
write_changelog_and_ruv (Slapi_PBlock *pb)
{
Slapi_Operation *op = NULL;
+ CSN *opcsn;
+ CSN *prim_csn;
int rc;
slapi_operation_parameters *op_params = NULL;
- Object *repl_obj;
+ Object *repl_obj = NULL;
int return_value = SLAPI_PLUGIN_SUCCESS;
Replica *r;
Slapi_Backend *be;
@@ -1063,17 +1065,17 @@ write_changelog_and_ruv (Slapi_PBlock *pb)
{
return return_value;
}
+ /* we only log changes for operations applied to a replica */
+ repl_obj = replica_get_replica_for_op (pb);
+ if (repl_obj == NULL)
+ return return_value;
slapi_pblock_get(pb, SLAPI_RESULT_CODE, &rc);
if (rc) { /* op failed - just return */
- return return_value;
+ cancel_opcsn(pb);
+ goto common_return;
}
- /* we only log changes for operations applied to a replica */
- repl_obj = replica_get_replica_for_op (pb);
- if (repl_obj == NULL)
- return return_value;
-
r = (Replica*)object_get_data (repl_obj);
PR_ASSERT (r);
@@ -1108,7 +1110,7 @@ write_changelog_and_ruv (Slapi_PBlock *pb)
slapi_pblock_get (pb, SLAPI_OPERATION_PARAMETERS, &op_params);
if (NULL == op_params) {
- return return_value;
+ goto common_return;
}
/* need to set uniqueid operation parameter */
@@ -1127,19 +1129,18 @@ write_changelog_and_ruv (Slapi_PBlock *pb)
slapi_pblock_get (pb, SLAPI_ENTRY_PRE_OP, &e);
}
if (NULL == e) {
- return return_value;
+ goto common_return;
}
uniqueid = slapi_entry_get_uniqueid (e);
if (NULL == uniqueid) {
- return return_value;
+ goto common_return;
}
op_params->target_address.uniqueid = slapi_ch_strdup (uniqueid);
}
if( op_params->csn && is_cleaned_rid(csn_get_replicaid(op_params->csn))){
/* this RID has been cleaned */
- object_release (repl_obj);
- return return_value;
+ goto common_return;
}
/* we might have stripped all the mods - in that case we do not
@@ -1152,7 +1153,7 @@ write_changelog_and_ruv (Slapi_PBlock *pb)
{
slapi_log_err(SLAPI_LOG_CRIT, repl_plugin_name,
"write_changelog_and_ruv - Skipped due to DISKFULL\n");
- return return_value;
+ goto common_return;
}
slapi_pblock_get(pb, SLAPI_TXN, &txn);
rc = cl5WriteOperationTxn(repl_name, repl_gen, op_params,
@@ -1188,7 +1189,6 @@ write_changelog_and_ruv (Slapi_PBlock *pb)
*/
if (0 == return_value) {
char csn_str[CSN_STRSIZE] = {'\0'};
- CSN *opcsn;
int rc;
const char *dn = op_params ? REPL_GET_DN(&op_params->target_address) : "unknown";
Slapi_DN *sdn = op_params ? (&op_params->target_address)->sdn : NULL;
@@ -1220,7 +1220,15 @@ write_changelog_and_ruv (Slapi_PBlock *pb)
}
}
- object_release (repl_obj);
+common_return:
+ opcsn = operation_get_csn(op);
+ prim_csn = get_thread_primary_csn();
+ if (csn_is_equal(opcsn, prim_csn)) {
+ set_thread_primary_csn(NULL);
+ }
+ if (repl_obj) {
+ object_release (repl_obj);
+ }
return return_value;
}
@@ -1417,7 +1425,7 @@ cancel_opcsn (Slapi_PBlock *pb)
ruv_obj = replica_get_ruv (r);
PR_ASSERT (ruv_obj);
- ruv_cancel_csn_inprogress ((RUV*)object_get_data (ruv_obj), opcsn);
+ ruv_cancel_csn_inprogress ((RUV*)object_get_data (ruv_obj), opcsn, replica_get_rid(r));
object_release (ruv_obj);
}
diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c
index 04e7e8f..7beef50 100644
--- a/ldap/servers/plugins/replication/repl5_replica.c
+++ b/ldap/servers/plugins/replication/repl5_replica.c
@@ -895,7 +895,7 @@ replica_update_ruv(Replica *r, const CSN *updated_csn, const char *replica_purl)
}
}
/* Update max csn for local and remote replicas */
- rc = ruv_update_ruv (ruv, updated_csn, replica_purl, rid == r->repl_rid);
+ rc = ruv_update_ruv (ruv, updated_csn, replica_purl, r->repl_rid);
if (RUV_COVERS_CSN == rc)
{
slapi_log_err(SLAPI_LOG_REPL,
@@ -3618,7 +3618,7 @@ assign_csn_callback(const CSN *csn, void *data)
if (NULL != r->min_csn_pl)
{
- if (csnplInsert(r->min_csn_pl, csn) != 0)
+ if (csnplInsert(r->min_csn_pl, csn, NULL) != 0)
{
char csn_str[CSN_STRSIZE]; /* For logging only */
/* Ack, we can't keep track of min csn. Punt. */
@@ -3666,7 +3666,7 @@ abort_csn_callback(const CSN *csn, void *data)
}
}
- ruv_cancel_csn_inprogress (ruv, csn);
+ ruv_cancel_csn_inprogress (ruv, csn, replica_get_rid(r));
replica_unlock(r->repl_lock);
object_release (ruv_obj);
diff --git a/ldap/servers/plugins/replication/repl5_ruv.c b/ldap/servers/plugins/replication/repl5_ruv.c
index c2a9d19..111b88f 100644
--- a/ldap/servers/plugins/replication/repl5_ruv.c
+++ b/ldap/servers/plugins/replication/repl5_ruv.c
@@ -77,6 +77,7 @@ static char *get_replgen_from_berval(const struct berval *bval);
static const char * const prefix_replicageneration = "{replicageneration}";
static const char * const prefix_ruvcsn = "{replica "; /* intentionally missing '}' */
+static int ruv_update_ruv_element (RUV *ruv, RUVElement *replica, const CSN *csn, const char *replica_purl, PRBool isLocal);
/* API implementation */
@@ -1604,6 +1605,7 @@ int ruv_add_csn_inprogress (RUV *ruv, const CSN *csn)
char csn_str[CSN_STRSIZE];
int rc = RUV_SUCCESS;
int rid = csn_get_replicaid (csn);
+ CSN *prim_csn;
PR_ASSERT (ruv && csn);
@@ -1641,8 +1643,12 @@ int ruv_add_csn_inprogress (RUV *ruv, const CSN *csn)
rc = RUV_COVERS_CSN;
goto done;
}
-
- rc = csnplInsert (replica->csnpl, csn);
+ prim_csn = get_thread_primary_csn();
+ if (prim_csn == NULL) {
+ set_thread_primary_csn(csn);
+ prim_csn = get_thread_primary_csn();
+ }
+ rc = csnplInsert (replica->csnpl, csn, prim_csn);
if (rc == 1) /* we already seen this csn */
{
if (slapi_is_loglevel_set(SLAPI_LOG_REPL)) {
@@ -1650,6 +1656,7 @@ int ruv_add_csn_inprogress (RUV *ruv, const CSN *csn)
"The csn %s has already be seen - ignoring\n",
csn_as_string (csn, PR_FALSE, csn_str));
}
+ set_thread_primary_csn(NULL);
rc = RUV_COVERS_CSN;
}
else if(rc != 0)
@@ -1674,24 +1681,36 @@ done:
return rc;
}
-int ruv_cancel_csn_inprogress (RUV *ruv, const CSN *csn)
+int ruv_cancel_csn_inprogress (RUV *ruv, const CSN *csn, ReplicaId local_rid)
{
RUVElement* replica;
int rc = RUV_SUCCESS;
+ CSN *prim_csn = NULL;
+
PR_ASSERT (ruv && csn);
+ prim_csn = get_thread_primary_csn();
/* locate ruvElement */
slapi_rwlock_wrlock (ruv->lock);
replica = ruvGetReplica (ruv, csn_get_replicaid (csn));
- if (replica == NULL)
- {
+ if (replica == NULL) {
/* ONREPL - log error */
- rc = RUV_NOTFOUND;
- goto done;
- }
-
- rc = csnplRemove (replica->csnpl, csn);
+ rc = RUV_NOTFOUND;
+ goto done;
+ }
+ if (csn_is_equal(csn, prim_csn)) {
+ /* the prim csn is cancelled, lets remove all dependent csns */
+ ReplicaId prim_rid = csn_get_replicaid (csn);
+ replica = ruvGetReplica (ruv, prim_rid);
+ rc = csnplRemoveAll (replica->csnpl, prim_csn);
+ if (prim_rid != local_rid) {
+ replica = ruvGetReplica (ruv, local_rid);
+ rc = csnplRemoveAll (replica->csnpl, prim_csn);
+ }
+ } else {
+ rc = csnplRemove (replica->csnpl, csn);
+ }
if (rc != 0)
rc = RUV_NOTFOUND;
else
@@ -1702,19 +1721,37 @@ done:
return rc;
}
-int ruv_update_ruv (RUV *ruv, const CSN *csn, const char *replica_purl, PRBool isLocal)
+int ruv_update_ruv (RUV *ruv, const CSN *csn, const char *replica_purl, ReplicaId local_rid)
+{
+ int rc=RUV_SUCCESS;
+ RUVElement *replica;
+ ReplicaId prim_rid;
+
+ CSN *prim_csn = get_thread_primary_csn();
+
+ if (! csn_is_equal(csn, prim_csn)) {
+ /* not a primary csn, nothing to do */
+ return rc;
+ }
+ slapi_rwlock_wrlock (ruv->lock);
+ prim_rid = csn_get_replicaid (csn);
+ replica = ruvGetReplica (ruv, local_rid);
+ rc = ruv_update_ruv_element(ruv, replica, csn, replica_purl, PR_TRUE);
+ if ( rc || local_rid == prim_rid) goto done;
+ replica = ruvGetReplica (ruv, prim_rid);
+ rc = ruv_update_ruv_element(ruv, replica, csn, replica_purl, PR_FALSE);
+done:
+ slapi_rwlock_unlock (ruv->lock);
+ return rc;
+}
+static int
+ruv_update_ruv_element (RUV *ruv, RUVElement *replica, const CSN *csn, const char *replica_purl, PRBool isLocal)
{
int rc=RUV_SUCCESS;
char csn_str[CSN_STRSIZE];
CSN *max_csn;
CSN *first_csn = NULL;
- RUVElement *replica;
- PR_ASSERT (ruv && csn);
-
- slapi_rwlock_wrlock (ruv->lock);
-
- replica = ruvGetReplica (ruv, csn_get_replicaid (csn));
if (replica == NULL)
{
/* we should have a ruv element at this point because it would have
@@ -1724,7 +1761,7 @@ int ruv_update_ruv (RUV *ruv, const CSN *csn, const char *replica_purl, PRBool i
goto done;
}
- if (csnplCommit(replica->csnpl, csn) != 0)
+ if (csnplCommitAll(replica->csnpl, csn) != 0)
{
slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name, "ruv_update_ruv - Cannot commit csn %s\n",
csn_as_string(csn, PR_FALSE, csn_str));
@@ -1765,7 +1802,6 @@ int ruv_update_ruv (RUV *ruv, const CSN *csn, const char *replica_purl, PRBool i
}
done:
- slapi_rwlock_unlock (ruv->lock);
return rc;
}
diff --git a/ldap/servers/plugins/replication/repl5_ruv.h b/ldap/servers/plugins/replication/repl5_ruv.h
index e9eff5a..c8960fd 100644
--- a/ldap/servers/plugins/replication/repl5_ruv.h
+++ b/ldap/servers/plugins/replication/repl5_ruv.h
@@ -109,8 +109,8 @@ PRInt32 ruv_replica_count (const RUV *ruv);
char **ruv_get_referrals(const RUV *ruv);
void ruv_dump(const RUV *ruv, char *ruv_name, PRFileDesc *prFile);
int ruv_add_csn_inprogress (RUV *ruv, const CSN *csn);
-int ruv_cancel_csn_inprogress (RUV *ruv, const CSN *csn);
-int ruv_update_ruv (RUV *ruv, const CSN *csn, const char *replica_purl, PRBool isLocal);
+int ruv_cancel_csn_inprogress (RUV *ruv, const CSN *csn, ReplicaId rid);
+int ruv_update_ruv (RUV *ruv, const CSN *csn, const char *replica_purl, ReplicaId local_rid);
int ruv_move_local_supplier_to_first(RUV *ruv, ReplicaId rid);
int ruv_get_first_id_and_purl(RUV *ruv, ReplicaId *rid, char **replica_purl );
int ruv_local_contains_supplier(RUV *ruv, ReplicaId rid);
diff --git a/ldap/servers/slapd/csn.c b/ldap/servers/slapd/csn.c
index ce14816..5b420bf 100644
--- a/ldap/servers/slapd/csn.c
+++ b/ldap/servers/slapd/csn.c
@@ -268,6 +268,21 @@ csn_as_attr_option_string(CSNType t,const CSN *csn,char *ss)
return s;
}
+int
+csn_is_equal(const CSN *csn1, const CSN *csn2)
+{
+ int retval = 0;
+ if ((csn1 == NULL && csn2 == NULL) ||
+ (csn1 && csn2 &&
+ csn1->tstamp == csn2->tstamp &&
+ csn1->seqnum == csn2->seqnum &&
+ csn1->rid == csn2->rid &&
+ csn1->subseqnum == csn2->subseqnum)) {
+ retval = 1;
+ }
+ return retval;
+}
+
int
csn_compare_ext(const CSN *csn1, const CSN *csn2, unsigned int flags)
{
diff --git a/ldap/servers/slapd/slapi-private.h b/ldap/servers/slapd/slapi-private.h
index 406b014..dd180a7 100644
--- a/ldap/servers/slapd/slapi-private.h
+++ b/ldap/servers/slapd/slapi-private.h
@@ -174,6 +174,7 @@ time_t csn_get_time(const CSN *csn);
PRUint16 csn_get_seqnum(const CSN *csn);
PRUint16 csn_get_subseqnum(const CSN *csn);
char *csn_as_string(const CSN *csn, PRBool replicaIdOrder, char *ss); /* WARNING: ss must be CSN_STRSIZE bytes, or NULL. */
+int csn_is_equal(const CSN *csn1, const CSN *csn2);
int csn_compare(const CSN *csn1, const CSN *csn2);
int csn_compare_ext(const CSN *csn1, const CSN *csn2, unsigned int flags);
#define CSN_COMPARE_SKIP_SUBSEQ 0x1
@@ -189,6 +190,7 @@ const CSN *csn_max(const CSN *csn1,const CSN *csn2);
a csn from the set.*/
int csn_increment_subsequence (CSN *csn);
+void csnplFreeCSN (void *arg);
/*
* csnset.c
*/
7 years, 2 months
dirsrvtests/tests
by Noriko Hosoi
dirsrvtests/tests/tickets/ticket47973_test.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit a6e905efa2d00e151ba736aceb7855f196e4258b
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri Jan 20 16:13:07 2017 -0800
Ticket 47973 - CI Test case (test_ticket47973_case)
Description: custom schema is registered in small caps after schema reload
Revised the test cases to strict the case checking.
diff --git a/dirsrvtests/tests/tickets/ticket47973_test.py b/dirsrvtests/tests/tickets/ticket47973_test.py
index c7548a5..6c6e9eb 100644
--- a/dirsrvtests/tests/tickets/ticket47973_test.py
+++ b/dirsrvtests/tests/tickets/ticket47973_test.py
@@ -116,7 +116,7 @@ def test_ticket47973_case(topology_st):
tsfile = topology_st.standalone.schemadir + '/98test.ldif'
tsfd = open(tsfile, "w")
Mozattr0 = "MoZiLLaaTTRiBuTe"
- testschema = "dn: cn=schema\nattributetypes: ( 8.9.10.11.12.13.14 NAME 'MozillaAttribute' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Mozilla Dummy Schema' )\nobjectclasses: ( 1.2.3.4.5.6.7 NAME 'MozillaObject' SUP top MUST ( objectclass $ cn ) MAY ( " + Mozattr0 + " ) X-ORIGIN 'user defined' )"
+ testschema = "dn: cn=schema\nattributetypes: ( 8.9.10.11.12.13.14 NAME '" + Mozattr0 + "' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Mozilla Dummy Schema' )\nobjectclasses: ( 1.2.3.4.5.6.7 NAME 'MozillaObject' SUP top MUST ( objectclass $ cn ) MAY ( " + Mozattr0 + " ) X-ORIGIN 'user defined' )"
tsfd.write(testschema)
tsfd.close()
@@ -156,7 +156,7 @@ def test_ticket47973_case(topology_st):
tsfile = topology_st.standalone.schemadir + '/97test.ldif'
tsfd = open(tsfile, "w")
Mozattr1 = "MOZILLAATTRIBUTE"
- testschema = "dn: cn=schema\nattributetypes: ( 8.9.10.11.12.13.14 NAME 'MozillaAttribute' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Mozilla Dummy Schema' )\nobjectclasses: ( 1.2.3.4.5.6.7 NAME 'MozillaObject' SUP top MUST ( objectclass $ cn ) MAY ( " + Mozattr1 + " ) X-ORIGIN 'user defined' )"
+ testschema = "dn: cn=schema\nattributetypes: ( 8.9.10.11.12.13.14 NAME '" + Mozattr1 + "' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Mozilla Dummy Schema' )\nobjectclasses: ( 1.2.3.4.5.6.7 NAME 'MozillaObject' SUP top MUST ( objectclass $ cn ) MAY ( " + Mozattr1 + " ) X-ORIGIN 'user defined' )"
tsfd.write(testschema)
tsfd.close()
7 years, 2 months
Branch '389-ds-base-1.2.11' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/schema.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
New commits:
commit 90702d1d9955fccd341d40605ef87479986460c3
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Jan 19 11:36:38 2017 -0800
Ticket 47973 - custom schema is registered in small caps after schema reload
Description: The fix for ticket 47973 [1] brought an side effect which
lowers the case of the reloaded new schema. This patch fixes the issue
by eliminating normalize_oc_nolock().
Note that the normalization is not needed since all the checks are done
by strcasecmp. There is an exception. When trying to replace a schema
with the same one having the different cases, exact string compare is
called.
[1] commit e0c78e1c1db351ea5cf835cdb55437b1ea26a3a6
(cherry picked from commit bbd84b451fc015f28658ecbf8c186119cc2cea0d)
diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c
index 798d905..1daf216 100644
--- a/ldap/servers/slapd/schema.c
+++ b/ldap/servers/slapd/schema.c
@@ -4129,11 +4129,19 @@ init_schema_dse_ext(char *schemadir, Slapi_Backend *be,
if (rc && !(schema_flags & DSE_SCHEMA_NO_BACKEND))
{
- /* make sure the schema is normalized */
- if (schema_flags & DSE_SCHEMA_LOCKED)
- normalize_oc_nolock();
- else
+ if (schema_flags & DSE_SCHEMA_LOCKED) {
+ /*
+ * Code path for schema reload.
+ * To fix the side effect which lowers the case of the
+ * reloaded new schema, eliminating normalize_oc_nolock().
+ * Note that the normalization is not needed since all
+ * the checks are done by strcasecmp.
+ */
+ ;
+ } else {
+ /* make sure the schema is normalized */
normalize_oc();
+ }
/* register callbacks */
dse_register_callback(*local_pschemadse, SLAPI_OPERATION_SEARCH,
7 years, 2 months
Branch '389-ds-base-1.3.5' - ldap/servers
by Noriko Hosoi
ldap/servers/slapd/schema.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
New commits:
commit 28309c30fa5f0cbba7254bbb279278b18bc69b03
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Jan 19 17:34:50 2017 -0800
Ticket 47973 - custom schema is registered in small caps after schema reload
Description: The fix for ticket 47973 [1] brougt an side effect which
lowers the case of the reloaded new schema. This patch fixes the issue
by eliminating normalize_oc_nolock().
Note that the normalization is not needed since all the checks are done
by strcasecmp. There is an exception. When trying to replace a schema
with the same one having the different cases, exact string compare is
called.
[1] commit e0c78e1c1db351ea5cf835cdb55437b1ea26a3a6
diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c
index 4b8910d..df4a71d 100644
--- a/ldap/servers/slapd/schema.c
+++ b/ldap/servers/slapd/schema.c
@@ -5386,11 +5386,19 @@ init_schema_dse_ext(char *schemadir, Slapi_Backend *be,
if (rc && !(schema_flags & DSE_SCHEMA_NO_BACKEND))
{
- /* make sure the schema is normalized */
- if (schema_flags & DSE_SCHEMA_LOCKED)
- normalize_oc_nolock();
- else
+ if (schema_flags & DSE_SCHEMA_LOCKED) {
+ /*
+ * Code path for schema reload.
+ * To fix the side effect which lowers the case of the
+ * reloaded new schema, eliminating normalize_oc_nolock().
+ * Note that the normalization is not needed since all
+ * the checks are done by strcasecmp.
+ */
+ ;
+ } else {
+ /* make sure the schema is normalized */
normalize_oc();
+ }
/* register callbacks */
dse_register_callback(*local_pschemadse, SLAPI_OPERATION_SEARCH,
7 years, 2 months
2 commits - dirsrvtests/tests ldap/servers
by Noriko Hosoi
dirsrvtests/tests/tickets/ticket47973_test.py | 109 ++++++++++++++++++++++++++
ldap/servers/slapd/schema.c | 11 ++
2 files changed, 118 insertions(+), 2 deletions(-)
New commits:
commit 75a19585f47bdabdd2c3e0ac0c343fb4ffd42337
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu Jan 19 16:26:51 2017 -0800
Ticket 47973 - CI Test case (test_ticket47973_case)
Description: custom schema is registered in small caps after schema reload
diff --git a/dirsrvtests/tests/tickets/ticket47973_test.py b/dirsrvtests/tests/tickets/ticket47973_test.py
index c333ddb..c7548a5 100644
--- a/dirsrvtests/tests/tickets/ticket47973_test.py
+++ b/dirsrvtests/tests/tickets/ticket47973_test.py
@@ -7,6 +7,7 @@
# --- END COPYRIGHT BLOCK ---
#
import logging
+import re
import ldap.sasl
import pytest
@@ -107,6 +108,114 @@ def test_ticket47973(topology_st):
task_count += 1
+def test_ticket47973_case(topology_st):
+ log.info('Testing Ticket 47973 (case) - Test the cases in the original schema are preserved.')
+
+ log.info('case 1 - Test the cases in the original schema are preserved.')
+
+ tsfile = topology_st.standalone.schemadir + '/98test.ldif'
+ tsfd = open(tsfile, "w")
+ Mozattr0 = "MoZiLLaaTTRiBuTe"
+ testschema = "dn: cn=schema\nattributetypes: ( 8.9.10.11.12.13.14 NAME 'MozillaAttribute' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Mozilla Dummy Schema' )\nobjectclasses: ( 1.2.3.4.5.6.7 NAME 'MozillaObject' SUP top MUST ( objectclass $ cn ) MAY ( " + Mozattr0 + " ) X-ORIGIN 'user defined' )"
+ tsfd.write(testschema)
+ tsfd.close()
+
+ try:
+ # run the schema reload task with the default schemadir
+ topology_st.standalone.tasks.schemaReload(schemadir=topology_st.standalone.schemadir,
+ args={TASK_WAIT: False})
+ except ValueError:
+ log.error('Schema Reload task failed.')
+ assert False
+
+ time.sleep(5)
+
+ try:
+ schemaentry = topology_st.standalone.search_s("cn=schema", ldap.SCOPE_BASE,
+ 'objectclass=top',
+ ["objectclasses"])
+ oclist = schemaentry[0].data.get("objectclasses")
+ except ldap.LDAPError as e:
+ log.error('Failed to get schema entry: error (%s)' % e.message['desc'])
+ raise e
+
+ found = 0
+ for oc in oclist:
+ log.info('OC: %s' % oc)
+ moz = re.findall(Mozattr0, oc)
+ if moz:
+ found = 1
+ log.info('case 1: %s is in the objectclasses list -- PASS' % Mozattr0)
+
+ if found == 0:
+ log.error('case 1: %s is not in the objectclasses list -- FAILURE' % Mozattr0)
+ assert False
+
+ log.info('case 2 - Duplicated schema except cases are not loaded.')
+
+ tsfile = topology_st.standalone.schemadir + '/97test.ldif'
+ tsfd = open(tsfile, "w")
+ Mozattr1 = "MOZILLAATTRIBUTE"
+ testschema = "dn: cn=schema\nattributetypes: ( 8.9.10.11.12.13.14 NAME 'MozillaAttribute' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'Mozilla Dummy Schema' )\nobjectclasses: ( 1.2.3.4.5.6.7 NAME 'MozillaObject' SUP top MUST ( objectclass $ cn ) MAY ( " + Mozattr1 + " ) X-ORIGIN 'user defined' )"
+ tsfd.write(testschema)
+ tsfd.close()
+
+ try:
+ # run the schema reload task with the default schemadir
+ topology_st.standalone.tasks.schemaReload(schemadir=topology_st.standalone.schemadir,
+ args={TASK_WAIT: False})
+ except ValueError:
+ log.error('Schema Reload task failed.')
+ assert False
+
+ time.sleep(5)
+
+ try:
+ schemaentry = topology_st.standalone.search_s("cn=schema", ldap.SCOPE_BASE,
+ 'objectclass=top',
+ ["objectclasses"])
+ oclist = schemaentry[0].data.get("objectclasses")
+ except ldap.LDAPError as e:
+ log.error('Failed to get schema entry: error (%s)' % e.message['desc'])
+ raise e
+
+ for oc in oclist:
+ log.info('OC: %s' % oc)
+ moz = re.findall(Mozattr1, oc)
+ if moz:
+ log.error('case 2: %s is in the objectclasses list -- FAILURE' % Mozattr1)
+ assert False
+
+ log.info('case 2: %s is not in the objectclasses list -- PASS' % Mozattr1)
+
+ Mozattr2 = "mozillaattribute"
+ log.info('case 2-1: Use the custom schema with %s' % Mozattr2)
+ name = "test user"
+ try:
+ topology_st.standalone.add_s(Entry(("cn=%s,%s" % (name, SUFFIX), {
+ 'objectclass': "top person MozillaObject".split(),
+ 'sn': name,
+ 'cn': name,
+ Mozattr2: name})))
+ except ldap.LDAPError as e:
+ log.error('Failed to add a test entry: error (%s)' % e.message['desc'])
+ raise e
+
+ try:
+ testentry = topology_st.standalone.search_s(SUFFIX, ldap.SCOPE_SUBTREE,
+ 'objectclass=mozillaobject',
+ [Mozattr2])
+ except ldap.LDAPError as e:
+ log.error('Failed to get schema entry: error (%s)' % e.message['desc'])
+ raise e
+
+ mozattrval = testentry[0].data.get(Mozattr2)
+ if mozattrval[0] == name:
+ log.info('case 2-1: %s: %s found-- PASS' % (Mozattr2, name))
+ else:
+ log.info('case 2-1: %s: %s not found-- FAILURE' % (Mozattr2, mozattrval[0]))
+
+
if __name__ == '__main__':
# Run isolated
# -s for DEBUG mode
commit a0545ed39904f969e083c4b385664e3c4ebfab45
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Jan 18 14:42:49 2017 -0800
Ticket 47973 - custom schema is registered in small caps after schema reload
Description: The fix for ticket 47973 [1] brougt an side effect which
lowers the case of the reloaded new schema. This patch fixes the issue
by eliminating normalize_oc_nolock().
Note that the normalization is not needed since all the checks are done
by strcasecmp. There is an exception. When trying to replace a schema
with the same one having the different cases, exact string compare is
called.
[1] commit e0c78e1c1db351ea5cf835cdb55437b1ea26a3a6
https://fedorahosted.org/389/ticket/47973
Reviewed by bordaz(a)redhat.com (Thanks, Thierry!!)
diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c
index c65cdba..392c01f 100644
--- a/ldap/servers/slapd/schema.c
+++ b/ldap/servers/slapd/schema.c
@@ -5377,10 +5377,17 @@ init_schema_dse_ext(char *schemadir, Slapi_Backend *be,
if (rc && !(schema_flags & DSE_SCHEMA_NO_BACKEND))
{
- /* make sure the schema is normalized */
if (schema_flags & DSE_SCHEMA_LOCKED) {
- normalize_oc_nolock();
+ /*
+ * Code path for schema reload.
+ * To fix the side effect which lowers the case of the
+ * reloaded new schema, eliminating normalize_oc_nolock().
+ * Note that the normalization is not needed since all
+ * the checks are done by strcasecmp.
+ */
+ ;
} else {
+ /* make sure the schema is normalized */
normalize_oc();
}
7 years, 2 months
Makefile.am
by William Brown
Makefile.am | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
New commits:
commit 9b702edb573ae2381255258a2499e3a71c5c77e2
Author: William Brown <firstyear(a)redhat.com>
Date: Fri Jan 13 10:34:39 2017 +1000
Ticket 49089 - List library build deps
Bug Description: lslebodn notified us of:
https://bugzilla.redhat.com/show_bug.cgi?id=1260190
https://lists.gnu.org/archive/html/automake/2010-03/msg00039.html
This highlighted to me that we were not correctly tracking the dependencies
of our build, where libslapd.la was not a dependency of the make targets
for other plugins. It's better to be explicit!
Fix Description: Add explicit dependencies lines to our makefile: That way
there can be no mistakes during a compliation.
https://fedorahosted.org/389/ticket/49089
Author: wibrown
Review by: mreynolds (Thanks)
diff --git a/Makefile.am b/Makefile.am
index 5f27681..78248e5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1140,6 +1140,7 @@ libback_ldbm_la_SOURCES = ldap/servers/slapd/back-ldbm/ancestorid.c \
ldap/servers/slapd/back-ldbm/vlv_srch.c
libback_ldbm_la_CPPFLAGS = $(PLUGIN_CPPFLAGS) @db_inc@
+libback_ldbm_la_DEPENDENCIES = libslapd.la
libback_ldbm_la_LIBADD = libslapd.la $(DB_LINK) $(LDAPSDK_LINK) $(NSPR_LINK)
libback_ldbm_la_LDFLAGS = -avoid-version
@@ -1153,6 +1154,7 @@ libacctpolicy_plugin_la_SOURCES = ldap/servers/plugins/acctpolicy/acct_config.c
libacctpolicy_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libacctpolicy_plugin_la_LIBADD = libslapd.la $(NSPR_LINK)
+libacctpolicy_plugin_la_DEPENDENCIES = libslapd.la
libacctpolicy_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1162,6 +1164,7 @@ libacctusability_plugin_la_SOURCES = ldap/servers/plugins/acct_usability/acct_us
libacctusability_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libacctusability_plugin_la_LIBADD = libslapd.la $(NSPR_LINK)
+libacctusability_plugin_la_DEPENDENCIES = libslapd.la
libacctusability_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1180,6 +1183,7 @@ libacl_plugin_la_SOURCES = ldap/servers/plugins/acl/acl.c \
ldap/servers/plugins/acl/aclutil.c
libacl_plugin_la_CPPFLAGS = -I$(srcdir)/include/libaccess $(PLUGIN_CPPFLAGS)
+libacl_plugin_la_DEPENDENCIES = libslapd.la libns-dshttpd.la
libacl_plugin_la_LIBADD = libslapd.la libns-dshttpd.la $(LDAPSDK_LINK) $(NSPR_LINK) $(LIBCSTD) $(LIBCRUN)
libacl_plugin_la_LDFLAGS = -avoid-version
# libacl_plugin_la_LINK = $(CXXLINK) -avoid-version
@@ -1191,6 +1195,7 @@ libaddn_plugin_la_SOURCES = ldap/servers/plugins/addn/addn.c
libaddn_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libaddn_plugin_la_LIBADD = libslapd.la $(NSPR_LINK)
+libaddn_plugin_la_DEPENDENCIES = libslapd.la
libaddn_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1201,6 +1206,7 @@ librootdn_access_plugin_la_SOURCES = ldap/servers/plugins/rootdn_access/rootdn_a
librootdn_access_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
librootdn_access_plugin_la_LIBADD = libslapd.la $(NSPR_LINK)
+librootdn_access_plugin_la_DEPENDENCIES = libslapd.la
librootdn_access_plugin_la_LDFLAGS = -avoid-version
@@ -1211,6 +1217,7 @@ libautomember_plugin_la_SOURCES = ldap/servers/plugins/automember/automember.c
libautomember_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libautomember_plugin_la_LIBADD = libslapd.la $(NSPR_LINK)
+libautomember_plugin_la_DEPENDENCIES = libslapd.la
libautomember_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1222,6 +1229,7 @@ libattr_unique_plugin_la_SOURCES = ldap/servers/plugins/uiduniq/7bit.c \
libattr_unique_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libattr_unique_plugin_la_LIBADD = libslapd.la $(NSPR_LINK)
+libattr_unique_plugin_la_DEPENDENCIES = libslapd.la
libattr_unique_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1231,6 +1239,7 @@ libbitwise_plugin_la_SOURCES = ldap/servers/plugins/bitwise/bitwise.c
libbitwise_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libbitwise_plugin_la_LIBADD = libslapd.la
+libbitwise_plugin_la_DEPENDENCIES = libslapd.la
libbitwise_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1264,6 +1273,7 @@ libchainingdb_plugin_la_SOURCES = ldap/servers/plugins/chainingdb/cb_abandon.c \
libchainingdb_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libchainingdb_plugin_la_LIBADD = libslapd.la $(LDAPSDK_LINK) $(NSPR_LINK)
+libchainingdb_plugin_la_DEPENDENCIES = libslapd.la
libchainingdb_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1275,6 +1285,7 @@ libcollation_plugin_la_SOURCES = ldap/servers/plugins/collation/collate.c \
libcollation_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS) @icu_inc@
libcollation_plugin_la_LIBADD = libslapd.la $(LDAPSDK_LINK) $(NSPR_LINK) $(ICU_LINK) $(LIBCSTD) $(LIBCRUN)
+libcollation_plugin_la_DEPENDENCIES = libslapd.la
libcollation_plugin_la_LDFLAGS = -avoid-version
# libcollation_plugin_la_LINK = $(CXXLINK) -avoid-version
@@ -1286,6 +1297,7 @@ libcos_plugin_la_SOURCES = ldap/servers/plugins/cos/cos.c \
libcos_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libcos_plugin_la_LIBADD = libslapd.la $(LDAPSDK_LINK) $(NSPR_LINK)
+libcos_plugin_la_DEPENDENCIES = libslapd.la
libcos_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1295,6 +1307,7 @@ libderef_plugin_la_SOURCES = ldap/servers/plugins/deref/deref.c
libderef_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libderef_plugin_la_LIBADD = libslapd.la $(LDAPSDK_LINK) $(NSPR_LINK)
+libderef_plugin_la_DEPENDENCIES = libslapd.la
libderef_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1305,6 +1318,7 @@ libpbe_plugin_la_SOURCES = ldap/servers/plugins/rever/pbe.c \
libpbe_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS) @svrcore_inc@
libpbe_plugin_la_LIBADD = libslapd.la $(NSS_LINK)
+libpbe_plugin_la_DEPENDENCIES = libslapd.la
libpbe_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1314,6 +1328,7 @@ libdistrib_plugin_la_SOURCES = ldap/servers/plugins/distrib/distrib.c
libdistrib_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libdistrib_plugin_la_LIBADD = libslapd.la
+libdistrib_plugin_la_DEPENDENCIES = libslapd.la
libdistrib_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1323,6 +1338,7 @@ libdna_plugin_la_SOURCES = ldap/servers/plugins/dna/dna.c
libdna_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libdna_plugin_la_LIBADD = libslapd.la $(LDAPSDK_LINK) $(NSPR_LINK)
+libdna_plugin_la_DEPENDENCIES = libslapd.la
libdna_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1333,6 +1349,7 @@ libhttp_client_plugin_la_SOURCES = ldap/servers/plugins/http/http_client.c \
libhttp_client_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libhttp_client_plugin_la_LIBADD = libslapd.la $(NSS_LINK) $(NSPR_LINK)
+libhttp_client_plugin_la_DEPENDENCIES = libslapd.la
libhttp_client_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1343,6 +1360,7 @@ liblinkedattrs_plugin_la_SOURCES = ldap/servers/plugins/linkedattrs/fixup_task.c
liblinkedattrs_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
liblinkedattrs_plugin_la_LIBADD = libslapd.la $(NSPR_LINK)
+liblinkedattrs_plugin_la_DEPENDENCIES = libslapd.la
liblinkedattrs_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1352,6 +1370,7 @@ libmanagedentries_plugin_la_SOURCES = ldap/servers/plugins/mep/mep.c
libmanagedentries_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libmanagedentries_plugin_la_LIBADD = libslapd.la $(NSPR_LINK)
+libmanagedentries_plugin_la_DEPENDENCIES = libslapd.la
libmanagedentries_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1362,6 +1381,7 @@ libmemberof_plugin_la_SOURCES= ldap/servers/plugins/memberof/memberof.c \
libmemberof_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libmemberof_plugin_la_LIBADD = libslapd.la $(LDAPSDK_LINK) $(NSPR_LINK)
+libmemberof_plugin_la_DEPENDENCIES = libslapd.la
libmemberof_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1374,6 +1394,7 @@ libpam_passthru_plugin_la_SOURCES = ldap/servers/plugins/pam_passthru/pam_ptconf
libpam_passthru_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libpam_passthru_plugin_la_LIBADD = libslapd.la $(LDAPSDK_LINK) $(NSPR_LINK) $(PAM_LINK)
+libpam_passthru_plugin_la_DEPENDENCIES = libslapd.la
libpam_passthru_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1388,6 +1409,7 @@ libpassthru_plugin_la_SOURCES = ldap/servers/plugins/passthru/ptbind.c \
libpassthru_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libpassthru_plugin_la_LIBADD = libslapd.la $(LDAPSDK_LINK) $(NSPR_LINK)
+libpassthru_plugin_la_DEPENDENCIES = libslapd.la
libpassthru_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1401,6 +1423,7 @@ libposix_winsync_plugin_la_SOURCES = ldap/servers/plugins/posix-winsync/posix-wi
libposix_winsync_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS) -DWINSYNC_TEST_POSIX \
-I$(srcdir)/ldap/servers/plugins/replication
libposix_winsync_plugin_la_LIBADD = libslapd.la $(LDAPSDK_LINK) $(NSPR_LINK)
+libposix_winsync_plugin_la_DEPENDENCIES = libslapd.la
libposix_winsync_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1410,6 +1433,7 @@ libpresence_plugin_la_SOURCES = ldap/servers/plugins/presence/presence.c
libpresence_plugin_la_CPPFLAGS = -I$(srcdir)/ldap/servers/plugins/http $(PLUGIN_CPPFLAGS)
libpresence_plugin_la_LIBADD = libslapd.la
+libpresence_plugin_la_DEPENDENCIES = libslapd.la
libpresence_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1429,6 +1453,7 @@ libpwdstorage_plugin_la_SOURCES = ldap/servers/plugins/pwdstorage/clear_pwd.c \
libpwdstorage_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libpwdstorage_plugin_la_LIBADD = libslapd.la $(NSS_LINK) $(NSPR_LINK) $(LIBCRYPT)
+libpwdstorage_plugin_la_DEPENDENCIES = libslapd.la
libpwdstorage_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1441,6 +1466,7 @@ libcontentsync_plugin_la_SOURCES = ldap/servers/plugins/sync/sync_init.c \
libcontentsync_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libcontentsync_plugin_la_LIBADD = libslapd.la $(NSS_LINK) $(NSPR_LINK) $(LIBCRYPT)
+libcontentsync_plugin_la_DEPENDENCIES = libslapd.la
libcontentsync_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1450,6 +1476,7 @@ libreferint_plugin_la_SOURCES = ldap/servers/plugins/referint/referint.c
libreferint_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libreferint_plugin_la_LIBADD = libslapd.la $(LDAPSDK_LINK) $(NSPR_LINK)
+libreferint_plugin_la_DEPENDENCIES = libslapd.la
libreferint_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1514,6 +1541,7 @@ libreplication_plugin_la_SOURCES = ldap/servers/plugins/replication/cl5_api.c \
libreplication_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS) @icu_inc@ @db_inc@
libreplication_plugin_la_LIBADD = libslapd.la $(LDAPSDK_LINK) $(NSS_LINK) $(NSPR_LINK) $(ICU_LINK) $(DB_LINK)
+libreplication_plugin_la_DEPENDENCIES = libslapd.la
libreplication_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1528,6 +1556,7 @@ libretrocl_plugin_la_SOURCES = ldap/servers/plugins/retrocl/retrocl.c \
libretrocl_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libretrocl_plugin_la_LIBADD = libslapd.la $(LDAPSDK_LINK) $(NSPR_LINK)
+libretrocl_plugin_la_DEPENDENCIES = libslapd.la
libretrocl_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1538,6 +1567,7 @@ libroles_plugin_la_SOURCES = ldap/servers/plugins/roles/roles_cache.c \
libroles_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libroles_plugin_la_LIBADD = libslapd.la $(NSPR_LINK)
+libroles_plugin_la_DEPENDENCIES = libslapd.la
libroles_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1547,6 +1577,7 @@ libschemareload_plugin_la_SOURCES = ldap/servers/plugins/schema_reload/schema_re
libschemareload_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libschemareload_plugin_la_LIBADD = libslapd.la $(NSPR_LINK)
+libschemareload_plugin_la_DEPENDENCIES = libslapd.la
libschemareload_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1556,6 +1587,7 @@ libstatechange_plugin_la_SOURCES = ldap/servers/plugins/statechange/statechange.
libstatechange_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libstatechange_plugin_la_LIBADD = libslapd.la
+libstatechange_plugin_la_DEPENDENCIES = libslapd.la
libstatechange_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1586,6 +1618,7 @@ libsyntax_plugin_la_SOURCES = ldap/servers/plugins/syntaxes/bin.c \
libsyntax_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libsyntax_plugin_la_LIBADD = libslapd.la $(LDAPSDK_LINK) $(NSPR_LINK)
+libsyntax_plugin_la_DEPENDENCIES = libslapd.la
libsyntax_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1596,6 +1629,7 @@ libusn_plugin_la_SOURCES = ldap/servers/plugins/usn/usn.c \
libusn_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libusn_plugin_la_LIBADD = libslapd.la $(LDAPSDK_LINK) $(NSPR_LINK)
+libusn_plugin_la_DEPENDENCIES = libslapd.la
libusn_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1605,6 +1639,7 @@ libviews_plugin_la_SOURCES = ldap/servers/plugins/views/views.c
libviews_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libviews_plugin_la_LIBADD = libslapd.la $(LDAPSDK_LINK) $(NSPR_LINK)
+libviews_plugin_la_DEPENDENCIES = libslapd.la
libviews_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1614,6 +1649,7 @@ libwhoami_plugin_la_SOURCES = ldap/servers/plugins/whoami/whoami.c
libwhoami_plugin_la_CPPFLAGS = $(PLUGIN_CPPFLAGS)
libwhoami_plugin_la_LIBADD = libslapd.la $(LDAPSDK_LINK) $(NSPR_LINK)
+libwhoami_plugin_la_DEPENDENCIES = libslapd.la
libwhoami_plugin_la_LDFLAGS = -avoid-version
#------------------------
@@ -1698,6 +1734,7 @@ migratecred_bin_SOURCES = ldap/servers/slapd/tools/migratecred.c
migratecred_bin_CPPFLAGS = $(AM_CPPFLAGS) @openldap_inc@ @ldapsdk_inc@ @nss_inc@ @nspr_inc@
migratecred_bin_LDADD = libslapd.la $(NSPR_LINK) $(NSS_LINK) $(SVRCORE_LINK) $(LDAPSDK_LINK) $(SASL_LINK)
+migratecred_bin_DEPENDENCIES = libslapd.la
#------------------------
# mmldif
@@ -1706,6 +1743,7 @@ mmldif_bin_SOURCES = ldap/servers/slapd/tools/mmldif.c
mmldif_bin_CPPFLAGS = $(AM_CPPFLAGS) @openldap_inc@ @ldapsdk_inc@ @nss_inc@ @nspr_inc@
mmldif_bin_LDADD = libslapd.la $(NSPR_LINK) $(NSS_LINK) $(SVRCORE_LINK) $(LDAPSDK_LINK_NOTHR) $(SASL_LINK)
+mmldif_bin_DEPENDENCIES = libslapd.la
#------------------------
# ns-slapd
@@ -1759,6 +1797,7 @@ ns_slapd_CPPFLAGS = $(AM_CPPFLAGS) @sasl_inc@ @openldap_inc@ @ldapsdk_inc@ @nss_
@nspr_inc@ @svrcore_inc@ @systemd_inc@
ns_slapd_LDADD = libslapd.la libldaputil.a $(LDAPSDK_LINK) $(NSS_LINK) $(LIBADD_DL) \
$(NSPR_LINK) $(SASL_LINK) $(SVRCORE_LINK) $(LIBNSL) $(LIBSOCKET) $(THREADLIB) $(SYSTEMD_LINK)
+ns_slapd_DEPENDENCIES = libslapd.la
# We need to link ns-slapd with the C++ compiler on HP-UX since we load
# some C++ shared libraries (such as icu).
if HPUX
@@ -1774,6 +1813,7 @@ pwdhash_bin_SOURCES = ldap/servers/slapd/tools/pwenc.c
pwdhash_bin_CPPFLAGS = $(AM_CPPFLAGS) @openldap_inc@ @ldapsdk_inc@ @nss_inc@ @nspr_inc@
pwdhash_bin_LDADD = libslapd.la $(NSPR_LINK) $(NSS_LINK) $(SVRCORE_LINK) $(LDAPSDK_LINK) $(SASL_LINK)
+pwdhash_bin_DEPENDENCIES = libslapd.la
#------------------------
# rsearch
7 years, 2 months
dirsrvtests/create_test.py
by Simon Pichugin
dirsrvtests/create_test.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
New commits:
commit 9fcfb6c9d14f25d595f75025a45cb3db38a85965
Author: Simon Pichugin <spichugi(a)redhat.com>
Date: Mon Jan 16 13:47:41 2017 +0100
Ticket 49085 - Make a short topology fixture alias
Description: Modify create_test.py, so it will insert "topo" import alias
instead of long topology names like "topology_m1h1c1".
With it we have more readable code - 'topo.ms["master1"]'.
https://fedorahosted.org/389/ticket/49085
Reviewed by: mreynolds (Thanks!)
diff --git a/dirsrvtests/create_test.py b/dirsrvtests/create_test.py
index 4c2876e..d898397 100755
--- a/dirsrvtests/create_test.py
+++ b/dirsrvtests/create_test.py
@@ -212,7 +212,7 @@ if len(sys.argv) > 0:
# Write the imports
if my_topology[0]:
- topology_import = 'from lib389.topologies import {}\n'.format(my_topology[1])
+ topology_import = 'from lib389.topologies import {} as topo\n'.format(my_topology[1])
else:
topology_import = ''
@@ -287,7 +287,7 @@ if len(sys.argv) > 0:
# Write the 'topology function'
TEST.write('@pytest.fixture(scope="module")\n')
- TEST.write('def {}(request):\n'.format(my_topology[1]))
+ TEST.write('def topo(request):\n')
if repl_deployment:
TEST.write(' """Create Replication Deployment"""\n')
@@ -656,14 +656,14 @@ if len(sys.argv) > 0:
# Write the test function
if ticket:
- TEST.write('def test_ticket{}({}):\n'.format(ticket, my_topology[1]))
+ TEST.write('def test_ticket{}(topo):\n'.format(ticket))
TEST.write(' """Write your testcase here...\n\n')
TEST.write(' Also, if you need any testcase initialization,\n')
TEST.write(' please, write additional fixture for that' +
'(include finalizer).\n')
TEST.write(' """\n\n')
else:
- TEST.write('def test_something({}):\n'.format(my_topology[1]))
+ TEST.write('def test_something(topo):\n')
TEST.write(' """Write a single test here...\n\n')
TEST.write(' Also, if you need any test suite initialization,\n')
TEST.write(' please, write additional fixture for that (including finalizer).\n'
7 years, 2 months
Branch '389-ds-base-1.3.5' - rpm/389-ds-base.spec.in
by Noriko Hosoi
rpm/389-ds-base.spec.in | 33 +++++++++++++++------------------
1 file changed, 15 insertions(+), 18 deletions(-)
New commits:
commit 0cb9c6c55464f16c7daf59d224ba2fa249c6dfbb
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Sat Jan 14 16:15:46 2017 -0800
Ticket #49088 - 389-ds-base rpm postinstall script bugs
Description: The uid and gid of the user dirsrv - the owner of ns-slapd are
(389, 389) if the id is available. If not, the id was increased by one until
unused id was found. But there is no such requirement.
This patch follows the Fedora Project UID GID soft static allocation strategy.
https://fedoraproject.org/wiki/Packaging:UsersAndGroups#Soft_static_alloc...
Reviewed by William <wibrown(a)redhat.com> and Frank <fhirtz(a)redhat.com>. (Thanks!!)
(cherry picked from commit c969a8214d591500ba5ec36e54811293b7ebe7d9)
diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in
index 5f934bd..682a9f9 100644
--- a/rpm/389-ds-base.spec.in
+++ b/rpm/389-ds-base.spec.in
@@ -339,24 +339,21 @@ if [ -n "$DEBUGPOSTTRANS" ] ; then
output2=${DEBUGPOSTTRANS}.upgrade
fi
-has_dirsrv=`/usr/bin/egrep -i "^dirsrv\>" /etc/passwd` || :
-if [ "$has_dirsrv" = "" ]; then
- dirsrv_uid=389
- while [ "`getent passwd | awk -F: '{print $3}' | grep $dirsrv_uid`" != "" ]; do
- dirsrv_uid=`expr $dirsrv_uid + 1`
- done
- echo "User dirsrv does not exist, create it with uid %dirsrv_uid." >> $output 2>&1 || :
- /usr/sbin/useradd -c "389-ds-base" -u $dirsrv_uid \
- -s /sbin/nologin -r -d /usr/share/dirsrv dirsrv 2> /dev/null || :
- fi
- has_dirsrv=`/usr/bin/egrep -i "^dirsrv\>" /etc/group` || :
- if [ "$has_dirsrv" = "" ]; then
- dirsrv_gid=389
- while [ "`getent group | grep $dirsrv_gid`" != "" ]; do
- dirsrv_gid=`expr $dirsrv_gid + 1`
- done
- echo "Group dirsrv does not exist, create it with uid %dirsrv_gid." >> $output 2>&1 || :
- /usr/sbin/groupadd -g $dirsrv_gid -r dirsrv 2> /dev/null || :
+# https://fedoraproject.org/wiki/Packaging:UsersAndGroups#Soft_static_alloc...
+# Soft static allocation for UID and GID
+USERNAME="dirsrv"
+ALLOCATED_UID=389
+GROUPNAME="dirsrv"
+ALLOCATED_GID=389
+HOMEDIR="/usr/share/dirsrv"
+
+getent group $GROUPNAME >/dev/null || groupadd -f -g $ALLOCATED_GID -r $GROUPNAME
+if ! getent passwd $USERNAME >/dev/null ; then
+ if ! getent passwd $ALLOCATED_UID >/dev/null ; then
+ useradd -r -u $ALLOCATED_UID -g $GROUPNAME -d $HOMEDIR -s /sbin/nologin -c "user for 389-ds-base" $USERNAME
+ else
+ useradd -r -g $GROUPNAME -d $HOMEDIR -s /sbin/nologin -c "user for 389-ds-base" $USERNAME
+ fi
fi
echo looking for instances in %{_sysconfdir}/%{pkgname} > $output 2>&1 || :
7 years, 2 months
rpm/389-ds-base.spec.in
by Noriko Hosoi
rpm/389-ds-base.spec.in | 33 +++++++++++++++------------------
1 file changed, 15 insertions(+), 18 deletions(-)
New commits:
commit c969a8214d591500ba5ec36e54811293b7ebe7d9
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Sat Jan 14 16:15:46 2017 -0800
Ticket #49088 - 389-ds-base rpm postinstall script bugs
Description: The uid and gid of the user dirsrv - the owner of ns-slapd are
(389, 389) if the id is available. If not, the id was increased by one until
unused id was found. But there is no such requirement.
This patch follows the Fedora Project UID GID soft static allocation strategy.
https://fedoraproject.org/wiki/Packaging:UsersAndGroups#Soft_static_alloc...
Reviewed by William <wibrown(a)redhat.com> and Frank <fhirtz(a)redhat.com>. (Thanks!!)
diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in
index 77c77fb..4aad5b2 100644
--- a/rpm/389-ds-base.spec.in
+++ b/rpm/389-ds-base.spec.in
@@ -385,24 +385,21 @@ if [ -n "$DEBUGPOSTTRANS" ] ; then
output2=${DEBUGPOSTTRANS}.upgrade
fi
-has_dirsrv=`/usr/bin/egrep -i "^dirsrv\>" /etc/passwd` || :
-if [ "$has_dirsrv" = "" ]; then
- dirsrv_uid=389
- while [ "`getent passwd | awk -F: '{print $3}' | grep $dirsrv_uid`" != "" ]; do
- dirsrv_uid=`expr $dirsrv_uid + 1`
- done
- echo "User dirsrv does not exist, create it with uid %dirsrv_uid." >> $output 2>&1 || :
- /usr/sbin/useradd -c "389-ds-base" -u $dirsrv_uid \
- -s /sbin/nologin -r -d /usr/share/dirsrv dirsrv 2> /dev/null || :
- fi
- has_dirsrv=`/usr/bin/egrep -i "^dirsrv\>" /etc/group` || :
- if [ "$has_dirsrv" = "" ]; then
- dirsrv_gid=389
- while [ "`getent group | grep $dirsrv_gid`" != "" ]; do
- dirsrv_gid=`expr $dirsrv_gid + 1`
- done
- echo "Group dirsrv does not exist, create it with uid %dirsrv_gid." >> $output 2>&1 || :
- /usr/sbin/groupadd -g $dirsrv_gid -r dirsrv 2> /dev/null || :
+# https://fedoraproject.org/wiki/Packaging:UsersAndGroups#Soft_static_alloc...
+# Soft static allocation for UID and GID
+USERNAME="dirsrv"
+ALLOCATED_UID=389
+GROUPNAME="dirsrv"
+ALLOCATED_GID=389
+HOMEDIR="/usr/share/dirsrv"
+
+getent group $GROUPNAME >/dev/null || groupadd -f -g $ALLOCATED_GID -r $GROUPNAME
+if ! getent passwd $USERNAME >/dev/null ; then
+ if ! getent passwd $ALLOCATED_UID >/dev/null ; then
+ useradd -r -u $ALLOCATED_UID -g $GROUPNAME -d $HOMEDIR -s /sbin/nologin -c "user for 389-ds-base" $USERNAME
+ else
+ useradd -r -g $GROUPNAME -d $HOMEDIR -s /sbin/nologin -c "user for 389-ds-base" $USERNAME
+ fi
fi
echo looking for instances in %{_sysconfdir}/%{pkgname} > $output 2>&1 || :
7 years, 2 months