ldap/servers
by thierry bordaz
ldap/servers/slapd/control.c | 32 +++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)
New commits:
commit 16c41ad2303ae30dc9fbb5457e1d6cee1f8da3d2
Author: Thierry bordaz (tbordaz) <tbordaz(a)redhat.com>
Date: Thu May 16 15:28:47 2013 +0200
Ticket 47361 - Empty control list causes LDAP protocol error is thrown
Bug Description:
If a request contains a list of controls containing zero control, it does
not conform RFC http://tools.ietf.org/html/rfc4511#section-4.1.11. Then the
server returns a Protocol Error.
This is too restrictive for some applications.
Note: such application needs to be linked with old version of mozldap or openldap
because recent version skip sending empty list of controls
Fix Description:
The fix is to ignore this error and let the operation complete
https://fedorahosted.org/389/ticket/47361
Reviewed by: Rich Megginson (thanks Rich !)
Platforms tested: F17 (unit + acceptance vlv/proxy/managed/psearch/tls/bindcontrol)
Flag Day: no
Doc impact: no
diff --git a/ldap/servers/slapd/control.c b/ldap/servers/slapd/control.c
index fc3ab9f..e614d50 100644
--- a/ldap/servers/slapd/control.c
+++ b/ldap/servers/slapd/control.c
@@ -354,17 +354,27 @@ get_ldapmessage_controls_ext(
len = -1; /* reset for next loop iter */
}
- if ( (tag != LBER_END_OF_SEQORSET) && (len != -1) ) {
- goto free_and_return;
- }
-
- slapi_pblock_set( pb, SLAPI_REQCONTROLS, ctrls );
- managedsait = slapi_control_present( ctrls,
- LDAP_CONTROL_MANAGEDSAIT, NULL, NULL );
- slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, &managedsait );
- pwpolicy_ctrl = slapi_control_present( ctrls,
- LDAP_X_CONTROL_PWPOLICY_REQUEST, NULL, NULL );
- slapi_pblock_set( pb, SLAPI_PWPOLICY, &pwpolicy_ctrl );
+ if (curcontrols == 0) {
+ int ctrl_not_found = 0; /* means that a given control is not present in the request */
+
+ slapi_pblock_set(pb, SLAPI_REQCONTROLS, NULL);
+ slapi_pblock_set(pb, SLAPI_MANAGEDSAIT, &ctrl_not_found);
+ slapi_pblock_set(pb, SLAPI_PWPOLICY, &ctrl_not_found);
+ slapi_log_error(SLAPI_LOG_CONNS, "connection", "Warning: conn=%d op=%d contains an empty list of controls\n",
+ pb->pb_conn->c_connid, pb->pb_op->o_opid);
+ } else {
+ if ((tag != LBER_END_OF_SEQORSET) && (len != -1)) {
+ goto free_and_return;
+ }
+
+ slapi_pblock_set(pb, SLAPI_REQCONTROLS, ctrls);
+ managedsait = slapi_control_present(ctrls,
+ LDAP_CONTROL_MANAGEDSAIT, NULL, NULL);
+ slapi_pblock_set(pb, SLAPI_MANAGEDSAIT, &managedsait);
+ pwpolicy_ctrl = slapi_control_present(ctrls,
+ LDAP_X_CONTROL_PWPOLICY_REQUEST, NULL, NULL);
+ slapi_pblock_set(pb, SLAPI_PWPOLICY, &pwpolicy_ctrl);
+ }
if ( controlsp != NULL ) {
*controlsp = ctrls;
10 years, 11 months
ldap/servers
by Ludwig Krispenz
ldap/servers/slapd/back-ldbm/dblayer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit e2a5faf792f179c7e035b23457360b2efbb30159
Author: Ludwig Krispenz <lkrispen(a)redhat.com>
Date: Thu May 16 09:16:24 2013 +0200
fix hang related to ticket 568
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
index 2d5f98f..99902d9 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -3744,7 +3744,7 @@ int dblayer_txn_abort_ext(struct ldbminfo *li, back_txn *txn, PRBool use_lock)
priv->dblayer_enable_transactions)
{
int txn_id = db_txn->id(db_txn);
- if (log_flush_thread) {
+ if ( use_lock && log_flush_thread) {
PR_Lock(sync_txn_log_flush);
txn_in_progress_count--;
PR_Unlock(sync_txn_log_flush);
@@ -4488,7 +4488,7 @@ static int log_flush_threadmain(void *param)
* - no more active transaction, no need to wait
* - do_flush indicate that the max waiting interval is exceeded
*/
- if(trans_batch_count >= trans_batch_limit || trans_batch_count == txn_in_progress_count || do_flush) {
+ if(trans_batch_count >= trans_batch_limit || trans_batch_count >= txn_in_progress_count || do_flush) {
LDAPDebug(LDAP_DEBUG_BACKLDBM, "log_flush_threadmain (working): batchcount: %d, txn_in_progress: %d\n", trans_batch_count, txn_in_progress_count, 0);
LOG_FLUSH(priv->dblayer_env->dblayer_DB_ENV,0);
for (i=0;i<trans_batch_count;i++)
10 years, 11 months
ldap/servers
by Ludwig Krispenz
ldap/servers/slapd/back-ldbm/dblayer.c | 190 +++++++++++++++++++++----
ldap/servers/slapd/back-ldbm/ldbm_config.c | 2
ldap/servers/slapd/back-ldbm/ldbm_config.h | 2
ldap/servers/slapd/back-ldbm/proto-back-ldbm.h | 4
4 files changed, 171 insertions(+), 27 deletions(-)
New commits:
commit 37c531d17ce6dfe1ffd7b42adafc03960def3a40
Author: Ludwig Krispenz <lkrispen(a)redhat.com>
Date: Tue May 14 11:47:12 2013 +0200
Ticket 568 - make usage of transaction batch flush durable
Bug Description: if a transaction batch value >1 is specified
in a txn commit the txn log is ionly flushed if the batch
limit is reached. This can increase performance, but since
the operation is acknowleded to the client, a crash before
flushing the log would violate the durability condition.
Fix Description: to allow txn log flushing in batches, if batch-limit > 0
the flushing is done in the logflush thread. In a txn commit
a worker thread adds its transaction to the list of txns to flush,
eventually notifies the logflush thread and waits until logflushthread
confirms that the txn was flushed. only then the worker thread
continues and acknowledges success to the client.
There needs to be care that the txn logs are flushed frequently by the
logflush thread, even if there are less than the batch limit of txns
are waiting to be flushed.
one condition is base on active txns vs waiting txns, if there are no more
outstanding txns do flush.
the other condition is tiome based on two configurable timers:
- the logflush thread sleeps on a condition variable until it gets notified
by a worker thread that the batch limit is exceeded or the interval has passed
- if it awakes it checks when the last flush was done and either if it is longer
than th esecond timeer or the batch limit is reached the txns are flushed
The fix provided here makes the use of batch vals safe, but to get a performance
benefit further changes are required. Right now the txn is started and committed
inside dblayer_lock|unlock_backend, so txns cannot accumulate to be flushed.
So the order of txn and backend locking needs to be reveresed, or eventually the
code in the worker thread handling the synchronization could be move close to
sending the result to the client. But this optimization question ahs been moved
to a seperate ticket: 47358
The fix includes a minor change for the trickle thread, it is only started if trickling
is required (trickle percentage > 0).
https://fedorahosted.org/389/ticket/568
Reviewed by: Noriko, Thanks
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
index e272cfa..2d5f98f 100644
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
@@ -219,9 +219,16 @@ static int dblayer_start_checkpoint_thread(struct ldbminfo *li);
static int dblayer_start_trickle_thread(struct ldbminfo *li);
static int dblayer_start_perf_thread(struct ldbminfo *li);
static int dblayer_start_txn_test_thread(struct ldbminfo *li);
-static int trans_batch_count=1;
+static int trans_batch_count=0;
static int trans_batch_limit=0;
+static int trans_batch_txn_min_sleep = 50; /* ms */
+static int trans_batch_txn_max_sleep = 50;
static PRBool log_flush_thread=PR_FALSE;
+static int txn_in_progress_count = 0;
+static int *txn_log_flush_pending = NULL;
+static PRLock *sync_txn_log_flush = NULL;
+static PRCondVar *sync_txn_log_flush_done = NULL;
+static PRCondVar *sync_txn_log_do_flush = NULL;
static int dblayer_db_remove_ex(dblayer_private_env *env, char const path[], char const dbName[], PRBool use_lock);
static void dblayer_init_pvt_txn();
static void dblayer_push_pvt_txn(back_txn *txn);
@@ -342,12 +349,59 @@ dblayer_set_batch_transactions(void *arg, void *value, char *errorbuf, int phase
}
return retval;
}
+int
+dblayer_set_batch_txn_min_sleep(void *arg, void *value, char *errorbuf, int phase, int apply) {
+ int val = (int)((uintptr_t)value);
+ int retval = LDAP_SUCCESS;
+
+ if (apply) {
+ if(phase == CONFIG_PHASE_STARTUP) {
+ trans_batch_txn_min_sleep=val;
+ } else if(trans_batch_txn_min_sleep != FLUSH_REMOTEOFF ) {
+ if((val == 0) && (log_flush_thread)) {
+ log_flush_thread=PR_FALSE;
+ trans_batch_txn_min_sleep = FLUSH_REMOTEOFF;
+ } else if(val > 0) {
+ trans_batch_txn_min_sleep=val;
+ }
+ }
+ }
+ return retval;
+}
+int
+dblayer_set_batch_txn_max_sleep(void *arg, void *value, char *errorbuf, int phase, int apply) {
+ int val = (int)((uintptr_t)value);
+ int retval = LDAP_SUCCESS;
+
+ if (apply) {
+ if(phase == CONFIG_PHASE_STARTUP) {
+ trans_batch_txn_max_sleep=val;
+ } else if(trans_batch_txn_max_sleep != FLUSH_REMOTEOFF ) {
+ if((val == 0) && (log_flush_thread)) {
+ log_flush_thread=PR_FALSE;
+ trans_batch_txn_max_sleep = FLUSH_REMOTEOFF;
+ } else if(val > 0) {
+ trans_batch_txn_max_sleep=val;
+ }
+ }
+ }
+ return retval;
+}
void *
dblayer_get_batch_transactions(void *arg) {
return (void *)((uintptr_t)trans_batch_limit);
}
+void *
+dblayer_get_batch_txn_min_sleep(void *arg) {
+ return (void *)((uintptr_t)trans_batch_txn_min_sleep);
+}
+
+void *
+dblayer_get_batch_txn_max_sleep(void *arg) {
+ return (void *)((uintptr_t)trans_batch_txn_max_sleep);
+}
/*
Threading: dblayer isolates upper layers from threading considerations
@@ -3507,10 +3561,17 @@ dblayer_txn_begin_ext(struct ldbminfo *li, back_txnid parent_txn, back_txn *txn,
{
/* this txn is now our current transaction for current operations
and new parent for any nested transactions created */
- dblayer_push_pvt_txn(&new_txn);
- if (txn) {
- txn->back_txn_txn = new_txn.back_txn_txn;
- }
+ if (use_lock && log_flush_thread) {
+ int txn_id = new_txn.back_txn_txn->id(new_txn.back_txn_txn);
+ PR_Lock(sync_txn_log_flush);
+ txn_in_progress_count++;
+ LDAPDebug(LDAP_DEBUG_BACKLDBM, "txn_begin: batchcount: %d, txn_in_progress: %d, curr_txn: %x\n", trans_batch_count, txn_in_progress_count, txn_id);
+ PR_Unlock(sync_txn_log_flush);
+ }
+ dblayer_push_pvt_txn(&new_txn);
+ if (txn) {
+ txn->back_txn_txn = new_txn.back_txn_txn;
+ }
}
} else
{
@@ -3554,6 +3615,8 @@ int dblayer_txn_commit_ext(struct ldbminfo *li, back_txn *txn, PRBool use_lock)
dblayer_private *priv = NULL;
DB_TXN *db_txn = NULL;
back_txn *cur_txn = NULL;
+ int txn_id = 0;
+ int txn_batch_slot = 0;
PR_ASSERT(NULL != li);
@@ -3576,6 +3639,7 @@ int dblayer_txn_commit_ext(struct ldbminfo *li, back_txn *txn, PRBool use_lock)
priv->dblayer_env &&
priv->dblayer_enable_transactions)
{
+ txn_id = db_txn->id(db_txn);
return_value = TXN_COMMIT(db_txn, 0);
/* if we were given a transaction, and it is the same as the
current transaction in progress, pop it off the stack
@@ -3590,17 +3654,33 @@ int dblayer_txn_commit_ext(struct ldbminfo *li, back_txn *txn, PRBool use_lock)
}
if ((priv->dblayer_durable_transactions) && use_lock ) {
if(trans_batch_limit > 0) {
- if(trans_batch_count % trans_batch_limit) {
- trans_batch_count++;
- } else {
- LOG_FLUSH(priv->dblayer_env->dblayer_DB_ENV,0);
- trans_batch_count=1;
- }
+ /* let log_flush thread do the flushing */
+ PR_Lock(sync_txn_log_flush);
+ txn_batch_slot = trans_batch_count++;
+ txn_log_flush_pending[txn_batch_slot] = txn_id;
+ LDAPDebug(LDAP_DEBUG_BACKLDBM, "txn_commit (befor notify): batchcount: %d, txn_in_progress: %d, curr_txn: %x\n", trans_batch_count, txn_in_progress_count, txn_id);
+ /* the log flush thread will periodically flush the txn log,
+ * but in two cases it should be notified to do it immediately:
+ * - the batch limit is passed
+ * - there is no other outstanding txn
+ */
+ if (trans_batch_count > trans_batch_limit ||
+ trans_batch_count == txn_in_progress_count)
+ PR_NotifyCondVar(sync_txn_log_do_flush);
+ /* we need to wait until the txn has been flushed before continuing
+ * and returning success to the client, nit to vialate durability
+ * PR_WaitCondvar releases and reaquires the lock
+ */
+ while (txn_log_flush_pending[txn_batch_slot] == txn_id)
+ PR_WaitCondVar(sync_txn_log_flush_done, PR_INTERVAL_NO_TIMEOUT);
+ txn_in_progress_count--;
+ LDAPDebug(LDAP_DEBUG_BACKLDBM, "txn_commit (before unlock): batchcount: %d, txn_in_progress: %d, curr_txn %x\n", trans_batch_count, txn_in_progress_count, txn_id);
+ PR_Unlock(sync_txn_log_flush);
} else if(trans_batch_limit == FLUSH_REMOTEOFF) { /* user remotely turned batching off */
LOG_FLUSH(priv->dblayer_env->dblayer_DB_ENV,0);
- }
- }
- if(use_lock) slapi_rwlock_unlock(priv->dblayer_env->dblayer_env_lock);
+ }
+ }
+ if(use_lock) slapi_rwlock_unlock(priv->dblayer_env->dblayer_env_lock);
} else
{
return_value = 0;
@@ -3663,6 +3743,13 @@ int dblayer_txn_abort_ext(struct ldbminfo *li, back_txn *txn, PRBool use_lock)
priv->dblayer_env &&
priv->dblayer_enable_transactions)
{
+ int txn_id = db_txn->id(db_txn);
+ if (log_flush_thread) {
+ PR_Lock(sync_txn_log_flush);
+ txn_in_progress_count--;
+ PR_Unlock(sync_txn_log_flush);
+ LDAPDebug(LDAP_DEBUG_BACKLDBM, "txn_abort : batchcount: %d, txn_in_progress: %d, curr_txn: %x\n", trans_batch_count, txn_in_progress_count, txn_id);
+ }
return_value = TXN_ABORT(db_txn);
/* if we were given a transaction, and it is the same as the
current transaction in progress, pop it off the stack
@@ -4336,10 +4423,17 @@ static int
dblayer_start_log_flush_thread(dblayer_private *priv)
{
int return_value = 0;
+ int max_threads = config_get_threadnumber();
if ((priv->dblayer_durable_transactions) &&
(priv->dblayer_enable_transactions) && (trans_batch_limit > 0)) {
log_flush_thread=PR_TRUE;
+ /* initialize the synchronization objects for the log_flush and worker threads */
+ sync_txn_log_flush = PR_NewLock();
+ sync_txn_log_flush_done = PR_NewCondVar (sync_txn_log_flush);
+ sync_txn_log_do_flush = PR_NewCondVar (sync_txn_log_flush);
+ txn_log_flush_pending = (int*)slapi_ch_malloc(max_threads*sizeof(int));
+
if (NULL == PR_CreateThread (PR_USER_THREAD,
(VFP) (void *) log_flush_threadmain, priv,
PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
@@ -4365,28 +4459,65 @@ dblayer_start_log_flush_thread(dblayer_private *priv)
static int log_flush_threadmain(void *param)
{
dblayer_private *priv = NULL;
- PRIntervalTime interval;
+ PRIntervalTime interval_wait, interval_flush, interval_def;
+ PRIntervalTime last_flush;
+ int i;
+ int do_flush = 0;
PR_ASSERT(NULL != param);
priv = (dblayer_private *) param;
INCR_THREAD_COUNT(priv);
- interval = PR_MillisecondsToInterval(300);
+ interval_flush = PR_MillisecondsToInterval(trans_batch_txn_min_sleep);
+ interval_wait = PR_MillisecondsToInterval(trans_batch_txn_max_sleep);
+ interval_def = PR_MillisecondsToInterval(300); /*used while no txn or txn batching */
+ /* LK this is only needed if online change of
+ * of txn config is supported ???
+ */
while ((!priv->dblayer_stop_threads) && (log_flush_thread))
{
if (priv->dblayer_enable_transactions)
- {
- DB_CHECKPOINT_LOCK(1, priv->dblayer_env->dblayer_env_lock);
- if(trans_batch_limit > 0) {
- if(trans_batch_count > 1) {
- LOG_FLUSH(priv->dblayer_env->dblayer_DB_ENV,0);
- trans_batch_count=1;
- }
- }
- DB_CHECKPOINT_UNLOCK(1, priv->dblayer_env->dblayer_env_lock);
- }
- DS_Sleep(interval);
+ {
+ if (trans_batch_limit > 0) {
+ /* synchronize flushing thread with workers */
+ PR_Lock(sync_txn_log_flush);
+ LDAPDebug(LDAP_DEBUG_BACKLDBM, "log_flush_threadmain (in loop): batchcount: %d, txn_in_progress: %d\n", trans_batch_count, txn_in_progress_count, 0);
+ /* if here, do flush the txn logs if any of the following conditions are met
+ * - batch limit exceeded
+ * - no more active transaction, no need to wait
+ * - do_flush indicate that the max waiting interval is exceeded
+ */
+ if(trans_batch_count >= trans_batch_limit || trans_batch_count == txn_in_progress_count || do_flush) {
+ LDAPDebug(LDAP_DEBUG_BACKLDBM, "log_flush_threadmain (working): batchcount: %d, txn_in_progress: %d\n", trans_batch_count, txn_in_progress_count, 0);
+ LOG_FLUSH(priv->dblayer_env->dblayer_DB_ENV,0);
+ for (i=0;i<trans_batch_count;i++)
+ txn_log_flush_pending[i] = 0;
+ trans_batch_count = 0;
+ last_flush = PR_IntervalNow();
+ do_flush = 0;
+ LDAPDebug(LDAP_DEBUG_BACKLDBM, "log_flush_threadmain (before notify): batchcount: %d, txn_in_progress: %d\n", trans_batch_count, txn_in_progress_count, 0);
+ PR_NotifyAllCondVar(sync_txn_log_flush_done);
+ }
+ /* wait until flushing conditions are met */
+ while ( trans_batch_count == 0 ||
+ ( trans_batch_count < trans_batch_limit &&
+ trans_batch_count < txn_in_progress_count)) {
+ if (priv->dblayer_stop_threads) break;
+ if (PR_IntervalNow() - last_flush > interval_flush) {
+ do_flush = 1;
+ break;
+ }
+ PR_WaitCondVar(sync_txn_log_do_flush, interval_wait);
+ }
+ PR_Unlock(sync_txn_log_flush);
+ LDAPDebug(LDAP_DEBUG_BACKLDBM, "log_flush_threadmain (wakeup): batchcount: %d, txn_in_progress: %d\n", trans_batch_count, txn_in_progress_count, 0);
+ } else {
+ DS_Sleep(interval_def);
+ }
+ } else {
+ DS_Sleep(interval_def);
+ }
}
DECR_THREAD_COUNT(priv);
@@ -4580,6 +4711,11 @@ static int
dblayer_start_trickle_thread(struct ldbminfo *li)
{
int return_value = 0;
+ dblayer_private *priv = (dblayer_private*)li->li_dblayer_private;
+
+ if (priv->dblayer_trickle_percentage == 0)
+ return return_value;
+
if (NULL == PR_CreateThread (PR_USER_THREAD,
(VFP) (void *) trickle_threadmain, li,
PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c b/ldap/servers/slapd/back-ldbm/ldbm_config.c
index 232af54..b72984b 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c
@@ -1326,6 +1326,8 @@ static config_info ldbm_config[] = {
{CONFIG_DB_TRANSACTION_LOGGING, CONFIG_TYPE_ONOFF, "on", &ldbm_config_db_transaction_logging_get, &ldbm_config_db_transaction_logging_set, 0},
{CONFIG_DB_CHECKPOINT_INTERVAL, CONFIG_TYPE_INT, "60", &ldbm_config_db_checkpoint_interval_get, &ldbm_config_db_checkpoint_interval_set, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_DB_TRANSACTION_BATCH, CONFIG_TYPE_INT, "0", &dblayer_get_batch_transactions, &dblayer_set_batch_transactions, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
+ {CONFIG_DB_TRANSACTION_BATCH_MIN_SLEEP, CONFIG_TYPE_INT, "50", &dblayer_get_batch_txn_min_sleep, &dblayer_set_batch_txn_min_sleep, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
+ {CONFIG_DB_TRANSACTION_BATCH_MAX_SLEEP, CONFIG_TYPE_INT, "50", &dblayer_get_batch_txn_max_sleep, &dblayer_set_batch_txn_max_sleep, CONFIG_FLAG_ALWAYS_SHOW|CONFIG_FLAG_ALLOW_RUNNING_CHANGE},
{CONFIG_DB_LOGBUF_SIZE, CONFIG_TYPE_SIZE_T, "0", &ldbm_config_db_logbuf_size_get, &ldbm_config_db_logbuf_size_set, CONFIG_FLAG_ALWAYS_SHOW},
{CONFIG_DB_PAGE_SIZE, CONFIG_TYPE_SIZE_T, "0", &ldbm_config_db_page_size_get, &ldbm_config_db_page_size_set, 0},
{CONFIG_DB_INDEX_PAGE_SIZE, CONFIG_TYPE_SIZE_T, "0", &ldbm_config_db_index_page_size_get, &ldbm_config_db_index_page_size_set, 0},
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.h b/ldap/servers/slapd/back-ldbm/ldbm_config.h
index a5830e3..204f64d 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.h
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.h
@@ -111,6 +111,8 @@ struct config_info {
#define CONFIG_DB_TRANSACTION_LOGGING "nsslapd-db-transaction-logging"
#define CONFIG_DB_CHECKPOINT_INTERVAL "nsslapd-db-checkpoint-interval"
#define CONFIG_DB_TRANSACTION_BATCH "nsslapd-db-transaction-batch-val"
+#define CONFIG_DB_TRANSACTION_BATCH_MIN_SLEEP "nsslapd-db-transaction-batch-min-wait"
+#define CONFIG_DB_TRANSACTION_BATCH_MAX_SLEEP "nsslapd-db-transaction-batch-max-wait"
#define CONFIG_DB_LOGBUF_SIZE "nsslapd-db-logbuf-size"
#define CONFIG_DB_PAGE_SIZE "nsslapd-db-page-size"
#define CONFIG_DB_INDEX_PAGE_SIZE "nsslapd-db-index-page-size" /* With the new
diff --git a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
index e87c900..a326185 100644
--- a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
@@ -163,7 +163,11 @@ PRInt64 db_atol(char *str, int *err);
PRInt64 db_atoi(char *str, int *err);
unsigned long db_strtoul(const char *str, int *err);
int dblayer_set_batch_transactions(void *arg, void *value, char *errorbuf, int phase, int apply);
+int dblayer_set_batch_txn_min_sleep(void *arg, void *value, char *errorbuf, int phase, int apply);
+int dblayer_set_batch_txn_max_sleep(void *arg, void *value, char *errorbuf, int phase, int apply);
void *dblayer_get_batch_transactions(void *arg);
+void *dblayer_get_batch_txn_min_sleep(void *arg);
+void *dblayer_get_batch_txn_max_sleep(void *arg);
int dblayer_in_import(ldbm_instance *inst);
int dblayer_update_db_ext(ldbm_instance *inst, char *oldext, char *newext);
10 years, 11 months
ldap/servers
by Mark Reynolds
ldap/servers/plugins/mep/mep.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
New commits:
commit b4a4ef568491432a2d3f7287c82612c2d0a75ea6
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Wed May 15 15:01:09 2013 -0400
Ticket 47337 - mep_pre_op: Unable to fetch origin entry
Bug Description: After installing IPA, and adding a hostgroup, an error will be written
to the error log if you delete this host group(Unable to fetch origin entry).
This is caused by the referential integrity plugin trying to cleanup
the deleted entry's membership. This causes the mep plugin to process the
delete operation, but it can not find the origin entry(because it is deleted).
Fix Description: If the operation is internal(from a server plugin) do not write the error
to the standard log level.
https://fedorahosted.org/389/ticket/47337
Reviewed by: richm(Thanks!)
diff --git a/ldap/servers/plugins/mep/mep.c b/ldap/servers/plugins/mep/mep.c
index f8e3c2b..d4835ce 100644
--- a/ldap/servers/plugins/mep/mep.c
+++ b/ldap/servers/plugins/mep/mep.c
@@ -2227,9 +2227,18 @@ mep_pre_op(Slapi_PBlock * pb, int modop)
slapi_entry_free(origin_e);
mep_config_unlock();
} else {
- slapi_log_error(SLAPI_LOG_FATAL, MEP_PLUGIN_SUBSYSTEM,
+ Slapi_Operation *op;
+
+ slapi_pblock_get(pb, SLAPI_OPERATION, &op);
+ if(operation_is_flag_set(op, OP_FLAG_INTERNAL)){
+ slapi_log_error(SLAPI_LOG_PLUGIN, MEP_PLUGIN_SUBSYSTEM,
+ "mep_pre_op: (internal operation) Unable to fetch "
+ "origin entry \"%s\".\n", origin_dn);
+ } else {
+ slapi_log_error(SLAPI_LOG_FATAL, MEP_PLUGIN_SUBSYSTEM,
"mep_pre_op: Unable to fetch origin entry "
"\"%s\".\n", origin_dn);
+ }
}
slapi_ch_free_string(&origin_dn);
10 years, 11 months
passwordsync/passsync
by Noriko Hosoi
passwordsync/passsync/syncserv.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
New commits:
commit cd1ba8f53ae28c2a1795ef2dd775e5b95d649ccb
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Fri Apr 26 09:55:16 2013 -0700
ticket 47352 - Abandon old password changes prior to syncing
We currently go through abandoning old password changes in the
PassSync service right after we process sending changes to DS. In
some cases, this can cause us to send old password changes to DS
that have already passed the "Time To Live" setting.
This patch moved the abandoning of old password to happen right
before we send password to DS. This will ensure that we don't
send old password changes that may be queued up.
https://fedorahosted.org/389/ticket/47352
Reviewed by Noriko.
diff --git a/passwordsync/passsync/syncserv.cpp b/passwordsync/passsync/syncserv.cpp
index 17a47a2..bf3fde5 100644
--- a/passwordsync/passsync/syncserv.cpp
+++ b/passwordsync/passsync/syncserv.cpp
@@ -284,7 +284,6 @@ void PassSyncService::Run()
}
SyncPasswords();
- UpdateBackoff();
ResetEvent(passhookEventHandle);
}
@@ -390,6 +389,9 @@ int PassSyncService::SyncPasswords()
timeStamp(&outLog);
outLog << "Password list has " << passInfoList.size() << " entries" << endl;
}
+
+ // Update backoff here so we abondon any old passwords before sending them.
+ UpdateBackoff();
}
if(Connect(&mainLdapConnection, ldapAuthUsername, ldapAuthPassword) < 0)
10 years, 11 months
passwordsync/passhook passwordsync/passsync
by Noriko Hosoi
passwordsync/passhook/passhook.cpp | 143 ++++++++++++++++---------------------
passwordsync/passsync/syncserv.cpp | 50 +++++++++---
passwordsync/passsync/syncserv.h | 2
3 files changed, 100 insertions(+), 95 deletions(-)
New commits:
commit fb017b47317eb759da2625b3c2c798554b7de8ba
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Mon May 13 13:31:11 2013 -0700
Ticket #47351 - Passsync loops when updating password of locked user
Bug description: If a password of a user is updated/reset, whose
account is disabled/inactivated on both AD and DS, the password
update is endlessly repeated on AD and DS.
Fix description: A method CanBind in syncserv is used to determine
modify password is needed in the first round as well as to check
the modification was successful in the second round. The following
modification in SyncPassword invokes the server side's WinSync
plugin to send the modify back, and SyncPassword is invoked as the
second round. If the return code from CanBind is not LDAP_INVALID_
CREDENTIALS (e.g., LDAP_UNWILLING_TO_PERFORM for the inactivated
account), the second round CanBind wound not return LDAP_SUCCESS
even if the password is correctly updated. That's said, if Can-
Bind returns any error other than LDAP_INVALID_CREDENTIALS, we
should defer the password update.
Note: Changes in passhook.cpp are all indentation fix.
https://fedorahosted.org/389/ticket/47351
Reviewed by Rich (Thank you!!)
diff --git a/passwordsync/passhook/passhook.cpp b/passwordsync/passhook/passhook.cpp
index 49a0a9f..3218881 100644
--- a/passwordsync/passhook/passhook.cpp
+++ b/passwordsync/passhook/passhook.cpp
@@ -79,20 +79,20 @@ NTSTATUS NTAPI PasswordChangeNotify(PUNICODE_STRING UserName, ULONG RelativeId,
// Fill in the password change struct
if (newPassInfo->username && newPassInfo->password) {
- _snprintf(newPassInfo->username, (UserName->Length / 2), "%S", UserName->Buffer);
+ _snprintf(newPassInfo->username, (UserName->Length / 2), "%S", UserName->Buffer);
newPassInfo->username[UserName->Length / 2] = '\0';
if (Password != NULL) {
- _snprintf(newPassInfo->password, (Password->Length / 2), "%S", Password->Buffer);
+ _snprintf(newPassInfo->password, (Password->Length / 2), "%S", Password->Buffer);
newPassInfo->password[Password->Length / 2] = '\0';
} else {
newPassInfo->password[0] = '\0';
}
// Backoff
- newPassInfo->backoffCount = 0;
+ newPassInfo->backoffCount = 0;
- // Load time
- time(&(newPassInfo->atTime));
+ // Load time
+ time(&(newPassInfo->atTime));
} else {
// Memory error. Free everything we allocated.
free(newPassInfo->username);
@@ -114,12 +114,12 @@ NTSTATUS NTAPI PasswordChangeNotify(PUNICODE_STRING UserName, ULONG RelativeId,
// If we got the mutex, log the error, otherwise it's not safe to log
if (waitRes == WAIT_OBJECT_0) {
- outLog.open("passhook.log", ios::out | ios::app);
+ outLog.open("passhook.log", ios::out | ios::app);
- if(outLog.is_open()) {
- timeStamp(&outLog);
- outLog << "Failed to start thread. Aborting change for " << newPassInfo->username << endl;
- }
+ if(outLog.is_open()) {
+ timeStamp(&outLog);
+ outLog << "Failed to start thread. Aborting change for " << newPassInfo->username << endl;
+ }
outLog.close();
@@ -147,16 +147,13 @@ BOOL NTAPI InitializeChangeNotify()
// check if logging is enabled
RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\PasswordSync", ®Key);
- buffSize = PASSHAND_BUF_SIZE;
- if(RegQueryValueEx(regKey, "Log Level", NULL, &type, (unsigned char*)regBuff, &buffSize) == ERROR_SUCCESS)
- {
- logLevel = (unsigned long)atoi(regBuff);
- }
- else
- {
- logLevel = 0;
- }
- RegCloseKey(regKey);
+ buffSize = PASSHAND_BUF_SIZE;
+ if(RegQueryValueEx(regKey, "Log Level", NULL, &type, (unsigned char*)regBuff, &buffSize) == ERROR_SUCCESS) {
+ logLevel = (unsigned long)atoi(regBuff);
+ } else {
+ logLevel = 0;
+ }
+ RegCloseKey(regKey);
// Create mutex for passhook data file and log file access
passhookMutexHandle = CreateMutex(NULL, FALSE, PASSHOOK_MUTEX_NAME);
@@ -179,92 +176,80 @@ BOOL NTAPI InitializeChangeNotify()
DWORD WINAPI SavePasshookChange( LPVOID passinfo )
{
PASS_INFO *newPassInfo = NULL;
- PASS_INFO_LIST passInfoList;
- HANDLE passhookEventHandle = OpenEvent(EVENT_MODIFY_STATE, FALSE, PASSHAND_EVENT_NAME);
+ PASS_INFO_LIST passInfoList;
+ HANDLE passhookEventHandle = OpenEvent(EVENT_MODIFY_STATE, FALSE, PASSHAND_EVENT_NAME);
fstream outLog;
if ((newPassInfo = (PASS_INFO *)passinfo) == NULL) {
goto exit;
}
- // Acquire the mutex for passhook.dat. This mutex also guarantees
+ // Acquire the mutex for passhook.dat. This mutex also guarantees
// that we can write to outLog safely.
- WaitForSingleObject(passhookMutexHandle, INFINITE);
+ WaitForSingleObject(passhookMutexHandle, INFINITE);
// Open the log file if logging is enabled
- if(logLevel > 0)
- {
- outLog.open("passhook.log", ios::out | ios::app);
- }
-
- if(outLog.is_open())
- {
- timeStamp(&outLog);
- outLog << "user " << newPassInfo->username << " password changed" << endl;
- //outLog << "user " << newPassInfo->username << " password changed to " << newPassInfo->passname << endl;
- }
-
- // loadSet allocates memory for the usernames and password. We need to be
- // sure to free it by calling clearSet.
- if(loadSet(&passInfoList, "passhook.dat") == 0)
- {
- if(outLog.is_open())
- {
- timeStamp(&outLog);
- outLog << passInfoList.size() << " entries loaded from file" << endl;
- }
- }
- else
- {
- if(outLog.is_open())
- {
- timeStamp(&outLog);
- outLog << "failed to load entries from file" << endl;
- }
- }
+ if(logLevel > 0) {
+ outLog.open("passhook.log", ios::out | ios::app);
+ }
+
+ if(outLog.is_open()) {
+ timeStamp(&outLog);
+ outLog << "user " << newPassInfo->username << " password changed" << endl;
+ //outLog << "user " << newPassInfo->username << " password changed to " << newPassInfo->passname << endl;
+ }
+
+ // loadSet allocates memory for the usernames and password. We need to be
+ // sure to free it by calling clearSet.
+ if(loadSet(&passInfoList, "passhook.dat") == 0) {
+ if(outLog.is_open()) {
+ timeStamp(&outLog);
+ outLog << passInfoList.size() << " entries loaded from file" << endl;
+ }
+ } else {
+ if(outLog.is_open()) {
+ timeStamp(&outLog);
+ outLog << "failed to load entries from file" << endl;
+ }
+ }
// Add the new change to the list
- passInfoList.push_back(*newPassInfo);
-
- // Save the list to disk
- if(saveSet(&passInfoList, "passhook.dat") == 0)
- {
- if(outLog.is_open())
- {
- timeStamp(&outLog);
- outLog << passInfoList.size() << " entries saved to file" << endl;
- }
- }
- else
- {
+ passInfoList.push_back(*newPassInfo);
+
+ // Save the list to disk
+ if(saveSet(&passInfoList, "passhook.dat") == 0) {
+ if(outLog.is_open()) {
+ timeStamp(&outLog);
+ outLog << passInfoList.size() << " entries saved to file" << endl;
+ }
+ } else {
// We always want to log this error condition
- if(!outLog.is_open())
- {
+ if(!outLog.is_open()) {
// We need to open the log since debug logging is turned off
outLog.open("passhook.log", ios::out | ios::app);
}
- timeStamp(&outLog);
- outLog << "failed to save entries to file" << endl;
- }
+ timeStamp(&outLog);
+ outLog << "failed to save entries to file" << endl;
+ }
// Close the log file before we release the mutex.
outLog.close();
- // Release the mutex for passhook.dat
- ReleaseMutex(passhookMutexHandle);
+ // Release the mutex for passhook.dat
+ ReleaseMutex(passhookMutexHandle);
- // We need to call clearSet so memory gets free'd
- clearSet(&passInfoList);
+ // We need to call clearSet so memory gets free'd
+ clearSet(&passInfoList);
exit:
// Free the passed in struct from the heap
free(newPassInfo);
- if (passhookEventHandle != NULL) {
- SetEvent(passhookEventHandle);
+ if (passhookEventHandle != NULL) {
+ SetEvent(passhookEventHandle);
CloseHandle(passhookEventHandle);
- }
+ }
return 0;
}
diff --git a/passwordsync/passsync/syncserv.cpp b/passwordsync/passsync/syncserv.cpp
index 86081ba..17a47a2 100644
--- a/passwordsync/passsync/syncserv.cpp
+++ b/passwordsync/passsync/syncserv.cpp
@@ -414,6 +414,7 @@ int PassSyncService::SyncPasswords()
{
while((dn = GetDN()) != NULL)
{
+ int bindRC = LDAP_SUCCESS;
if(FutureOccurrence(currentPassInfo))
{
if(logLevel > 0)
@@ -427,14 +428,40 @@ int PassSyncService::SyncPasswords()
timeStamp(&outLog);
outLog << "Multiple results not allowed: " << currentPassInfo->username << endl;
}
- else if(CanBind(dn, currentPassInfo->password))
+ else if(LDAP_SUCCESS == (bindRC = CanBind(dn, currentPassInfo->password)))
{
- if(logLevel > 0)
- {
+ if(logLevel > 0) {
timeStamp(&outLog);
outLog << "Password match, no modify performed: " << currentPassInfo->username << endl;
}
}
+ else if(LDAP_INVALID_CREDENTIALS != bindRC)
+ {
+ // password check failure.
+ /*
+ * CanBind is used to determine modify password is needed in the
+ * first round as well as to check the modification was successful
+ * in the second round. The following modification invokes the
+ * server side's WinSync plugin to send the modify back, and this
+ * code is invoked as the second round. If the return code from
+ * CanBind is not LDAP_INVALID_CREDENTIALS (e.g., LDAP_UNWILLING_
+ * TO_PERFORM for the inactivated account), the second round Can-
+ * Bind wound not return LDAP_SUCCESS even if the password is
+ * correctly updated. That's said, if CanBind returns any error
+ * other than LDAP_INVALID_CREDENTIALS, we should defer the pass-
+ * word update.
+ */
+ timeStamp(&outLog);
+ outLog << "Checking password failed for remote entry: " << dn << endl;
+ // defer this change for later
+ timeStamp(&outLog);
+ outLog << "Deferring password change for " << currentPassInfo->username << endl;
+ currentPassInfo++;
+ // free dn
+ ldap_memfree(dn);
+ dn = NULL;
+ continue;
+ }
else if(ModifyPassword(dn, currentPassInfo->password) != 0)
{
// log modify failure.
@@ -505,7 +532,7 @@ exit:
// ****************************************************************
int PassSyncService::Connect(LDAP** connection, char* dn, char* auth)
{
- int result = 0;
+ int result = LDAP_SUCCESS;
*connection = ldapssl_init(ldapHostName, atoi(ldapHostPort), 1);
@@ -530,7 +557,7 @@ int PassSyncService::Connect(LDAP** connection, char* dn, char* auth)
outLog << "\t" << lastLdapError << ": " << ldap_err2string(lastLdapError) << endl;
}
- result = -1;
+ result = lastLdapError;
goto exit;
}
@@ -696,19 +723,12 @@ bool PassSyncService::MultipleResults()
// ****************************************************************
// PassSyncService::CanBind
// ****************************************************************
-bool PassSyncService::CanBind(char* dn, char* password)
+int PassSyncService::CanBind(char* dn, char* password)
{
- bool result;
+ int result = LDAP_SUCCESS;
LDAP* tempConnection = NULL;
- if(Connect(&tempConnection, dn, password) == 0)
- {
- result = true;
- }
- else
- {
- result = false;
- }
+ result = Connect(&tempConnection, dn, password);
if(tempConnection != NULL)
{
diff --git a/passwordsync/passsync/syncserv.h b/passwordsync/passsync/syncserv.h
index 60b1bcf..1dcbb53 100644
--- a/passwordsync/passsync/syncserv.h
+++ b/passwordsync/passsync/syncserv.h
@@ -73,7 +73,7 @@ private:
bool FutureOccurrence(PASS_INFO_LIST_ITERATOR &startingPassInfo);
bool MultipleResults();
- bool CanBind(char* dn, char* password);
+ int CanBind(char* dn, char* password);
unsigned long BackoffTime(int backoff);
void UpdateBackoff();
10 years, 11 months
passwordsync/wix
by Noriko Hosoi
passwordsync/wix/PassSync.wxs | 1 -
1 file changed, 1 deletion(-)
New commits:
commit db16c081b3c194a0d49ef0ce6fc36899661f66f4
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Mon May 13 11:06:06 2013 -0700
Ticket #47357 - Update the PassSync build environment
Description: commit dee187ccfdcd92c9261a2cd34b47703bb1d69835
mistakenly added an extra line to PassSync.wxs. Removing it.
diff --git a/passwordsync/wix/PassSync.wxs b/passwordsync/wix/PassSync.wxs
index c4f2c6d..1836c9d 100644
--- a/passwordsync/wix/PassSync.wxs
+++ b/passwordsync/wix/PassSync.wxs
@@ -270,7 +270,6 @@
<RegistryValue Name='User Name Field' Type='string' Value='ntuserdomainid' />
<RegistryValue Name='Password Field' Type='string' Value='userpassword' />
<RegistryValue Name='Log Level' Type='string' Value='0' />
- <RegistryValue Name='Notification Packages' Type='multiString' Value='passhook'/>
</RegistryKey>
<RegistryKey Id='NotPkgs' Root='HKLM' Key='SYSTEM\ControlSet001\Control\Lsa' ForceCreateOnInstall='yes' >
<RegistryValue Name='Notification Packages' Type='multiString' Value='passhook'/>
10 years, 11 months
passwordsync/build.bat passwordsync/passsync passwordsync/wix
by Noriko Hosoi
passwordsync/build.bat | 26 +++++--
passwordsync/passsync/subuniutil.cpp | 6 -
passwordsync/passsync/syncserv.cpp | 9 ++
passwordsync/wix/PassSync.wxs | 124 ++++++++++++++++++-----------------
4 files changed, 95 insertions(+), 70 deletions(-)
New commits:
commit dee187ccfdcd92c9261a2cd34b47703bb1d69835
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Fri May 10 10:38:58 2013 -0700
Ticket #47357 - Update the PassSync build environment
Description: Upgrade to use the newer build tools and SDKs.
. Microsoft Visual Studio 2012 Express
. Microsoft Windows SDK v6.1
. Wix Toolset v3.7
https://fedorahosted.org/389/ticket/47357
Reviewed by Rich (Thank you!!)
diff --git a/passwordsync/build.bat b/passwordsync/build.bat
index fbc5119..5b676dc 100644
--- a/passwordsync/build.bat
+++ b/passwordsync/build.bat
@@ -61,14 +61,14 @@ rem the command shell to set up the MS VC/SDK build environment
rem use goto to support if/elseif/elseif/else style statements
if [%APPVER%] == [6.0] goto WINVER60
rem else
-goto WINVER52
+goto WINVER61
:WINVER60
set WINVER=6.0
goto SETPLATFORM
-:WINVER52
-set WINVER=5.2
+:WINVER61
+set WINVER=6.1
goto SETPLATFORM
:SETPLATFORM
@@ -138,6 +138,12 @@ if not defined CRTMSM (
)
)
+if not defined POLICYCRTMSM (
+ if not ["%MSSDK%"] == [] (
+ set POLICYCRTMSM="%MSSDK%"\Redist\VC\policy.x.xx.microsoft.vcxx.crt.%MSMPLAT%_msm.msm
+ )
+)
+
if not defined CRTMSM (
echo ERROR: could not find the merge modules for the Visual C++
echo runtime side by side assemblies - they should be provided
@@ -146,6 +152,14 @@ if not defined CRTMSM (
exit 1
)
+if not defined POLICYCRTMSM (
+ echo ERROR 2: could not find the merge modules for the Visual C++
+ echo runtime side by side assemblies - they should be provided
+ echo with the Visual Studio C++ and/or the Windows SDK
+ echo cannot continue
+ exit 1
+)
+
if ["%BRAND%"] == [""] (
set BRAND=389
)
@@ -177,10 +191,8 @@ rem ------ Convert DISTDIR to absolute ------
call :relative %DISTDIR% DISTDIR
mkdir "%DISTDIR%"
-set WIXVER=2.0.5805.0
-set WIXDIR=..\wix
-rem ------ Convert WIXDIR to absolute ------
-call :relative %WIXDIR% WIXDIR
+set WIXVER=3.7
+set WIXDIR=C:\Program Files (x86)\WiX Toolset v%WIXVER%\bin
set WXSDIR=%CD%\wix
diff --git a/passwordsync/passsync/subuniutil.cpp b/passwordsync/passsync/subuniutil.cpp
index 850d6f8..2b0cf4d 100644
--- a/passwordsync/passsync/subuniutil.cpp
+++ b/passwordsync/passsync/subuniutil.cpp
@@ -72,8 +72,8 @@ ASCIIToUnicode( const char *buf, wchar_t *uni, int inUnilen )
/* XXX This function should be named UTF8ToUnicode */
/* XXX unilen should be size_t, not int */
{
- auto size_t unilen = (size_t)inUnilen; /* to get rid of warnings for now */
- auto size_t i;
+ size_t unilen = (size_t)inUnilen; /* to get rid of warnings for now */
+ size_t i;
if (unilen > 0 && buf && uni) {
for (i = 0; i < unilen; ++i) {
register unsigned long c = utf8getcc( &buf );
@@ -94,4 +94,4 @@ StrToUnicode( const char *buf )
ASCIIToUnicode( buf, unibuf, sizeof(unibuf) );
return _wcsdup( unibuf );
}
-// End Copy
\ No newline at end of file
+// End Copy
diff --git a/passwordsync/passsync/syncserv.cpp b/passwordsync/passsync/syncserv.cpp
index 3390821..86081ba 100644
--- a/passwordsync/passsync/syncserv.cpp
+++ b/passwordsync/passsync/syncserv.cpp
@@ -44,9 +44,12 @@
/*----------------------------------------------------------------------------*/
+/*
+ As of Visual Studio 2010, crtassem.h no longer exists.
#ifndef _CRT_ASSEMBLY_VERSION
#include <crtassem.h>
#endif
+ */
/*----------------------------------------------------------------------------*/
@@ -173,7 +176,7 @@ PassSyncService::PassSyncService(const TCHAR *serviceName) : CNTService(serviceN
ExpandEnvironmentStrings("%SystemRoot%", sysPath, SYNCSERV_BUF_SIZE);
_snprintf(certPath, SYNCSERV_BUF_SIZE, "%s", installPath);
_snprintf(logPath, SYNCSERV_BUF_SIZE, "%spasssync.log", installPath);
- _snprintf(dataFilename, SYNCSERV_BUF_SIZE, "%s\\system32\\passhook.dat", sysPath);
+ _snprintf(dataFilename, SYNCSERV_BUF_SIZE, "%s\\System32\\passhook.dat", sysPath);
outLog.open(logPath, ios::out | ios::app);
@@ -228,6 +231,10 @@ void PassSyncService::Run()
{
timeStamp(&outLog);
outLog << "PassSync service running" << endl;
+ if(logLevel > 0) {
+ timeStamp(&outLog);
+ outLog << "dataFilename is " << dataFilename << endl;
+ }
}
isRunning = true;
diff --git a/passwordsync/wix/PassSync.wxs b/passwordsync/wix/PassSync.wxs
index 060b6f7..c4f2c6d 100644
--- a/passwordsync/wix/PassSync.wxs
+++ b/passwordsync/wix/PassSync.wxs
@@ -46,19 +46,19 @@
<?define Property_SysFolder = "SystemFolder" ?>
<?define Property_PFilesFolder = "ProgramFilesFolder" ?>
<?define Property_Win64 = "no" ?>
- <?define Property_Platform = "Intel" ?>
+ <?define Property_Platform = "x86" ?>
<?endif ?>
-<Wix xmlns='http://schemas.microsoft.com/wix/2003/01/wi'>
+<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product Name='$(var.BRAND) Directory Password Sync'
Id='$(var.Property_ProductCode)'
Language='1033' Codepage='1252' UpgradeCode='698B3A4E-17D4-449f-9ACB-DE8BF43394C1'
Version='$(var.VERSION)' Manufacturer='$(var.VENDOR)'>
- <Package Id='????????-????-????-????-????????????' Keywords='Installer'
+ <Package Id='*' Keywords='Installer'
Description="$(var.BRAND) Directory Password Synchronization Installer"
- Manufacturer='$(var.VENDOR)' Platforms='$(var.Property_Platform)'
- InstallerVersion='200' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
+ Manufacturer='$(var.VENDOR)' Platform='$(var.Property_Platform)'
+ InstallerVersion='405' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
<!-- this upgrade element is for 1.1.0 and later
if we are upgrading the same version that is already installed,
@@ -192,114 +192,120 @@
<Directory Id='TARGETDIR' Name='SourceDir'>
<!-- the VC runtime redist package -->
- <Merge Id='CRT' Language='0' src='$(var.CRTMSM)' DiskId='1'/>
- <Merge Id='PolicyCRT' Language='0' src='$(var.POLICYCRTMSM)' DiskId='1'/>
+ <Merge Id='CRT' Language='0' SourceFile='$(var.CRTMSM)' DiskId='1'/>
+ <Merge Id='PolicyCRT' Language='0' SourceFile='$(var.POLICYCRTMSM)' DiskId='1'/>
<Directory Id='$(var.Property_SysFolder)' Name='SysDir'>
<Component Id='HookLibrary' Guid='93790ACE-F522-413C-AEE3-DF05D99BAA6D' Win64='$(var.Property_Win64)'>
- <File Id='PasshookDLL' Name='passhook.dll' DiskId='1' src='passhook.dll' Vital='yes' />
+ <File Id='PasshookDLL' Name='passhook.dll' DiskId='1' Source='passhook.dll' Vital='yes' />
<RemoveFile Id='PasshookDat' On='uninstall' Name='passhook.dat'/>
<RemoveFile Id='PasshookLog' On='uninstall' Name='passhook.log'/>
</Component>
<Component Id='NSPRLibrary' Guid='7DFF5449-F38C-4C3B-9876-E32A123F1EA5' Win64='$(var.Property_Win64)'>
- <File Id='NSPR' LongName='libnspr4.dll' Name='libnspr4.dll' DiskId='1' src='libnspr4.dll' Vital='yes' />
+ <File Id='NSPR' Name='libnspr4.dll' DiskId='1' Source='libnspr4.dll' Vital='yes' />
</Component>
<Component Id='NSPRpldsLibrary' Guid='50C89341-754F-4092-8307-129DB119B42E' Win64='$(var.Property_Win64)'>
- <File Id='NSPRPLDS' LongName='libplds4.dll' Name='libplds4.dll' DiskId='1' src='libplds4.dll' Vital='yes' />
+ <File Id='NSPRPLDS' Name='libplds4.dll' DiskId='1' Source='libplds4.dll' Vital='yes' />
</Component>
<Component Id='NSPRplcLibrary' Guid='1B8B1D78-E2C1-4F3A-A841-C79FFE26E6E0' Win64='$(var.Property_Win64)'>
- <File Id='NSPRPLC' LongName='libplc4.dll' Name='libplc4.dll' DiskId='1' src='libplc4.dll' Vital='yes' />
+ <File Id='NSPRPLC' Name='libplc4.dll' DiskId='1' Source='libplc4.dll' Vital='yes' />
</Component>
<Component Id='NSSLibrary' Guid='5E122346-6B77-456D-BCC5-76D7FA8AF258' Win64='$(var.Property_Win64)'>
- <File Id='NSS' LongName='nss3.dll' Name='nss3.dll' DiskId='1' src='nss3.dll' Vital='yes' />
+ <File Id='NSS' Name='nss3.dll' DiskId='1' Source='nss3.dll' Vital='yes' />
</Component>
<Component Id='NSSsslLibrary' Guid='A39CC896-F455-4701-9BF0-D1E31C116DE2' Win64='$(var.Property_Win64)'>
- <File Id='NSSSSL' LongName='ssl3.dll' Name='ssl3.dll' DiskId='1' src='ssl3.dll' Vital='yes' />
+ <File Id='NSSSSL' Name='ssl3.dll' DiskId='1' Source='ssl3.dll' Vital='yes' />
</Component>
<Component Id='NSSsoftoknLibrary' Guid='9C57A076-D52A-4E74-A46A-DDF916A7D8BD' Win64='$(var.Property_Win64)'>
- <File Id='NSSSOFTTOKN' LongName='softokn3.dll' Name='softokn3.dll' DiskId='1' src='softokn3.dll' Vital='yes' />
+ <File Id='NSSSOFTTOKN' Name='softokn3.dll' DiskId='1' Source='softokn3.dll' Vital='yes' />
</Component>
<Component Id='NSSsmimeLibrary' Guid='E1030203-0A43-4767-BF5F-C7A51C687040' Win64='$(var.Property_Win64)'>
- <File Id='NSSSMIME' LongName='smime3.dll' Name='smime3.dll' DiskId='1' src='smime3.dll' Vital='yes' />
+ <File Id='NSSSMIME' Name='smime3.dll' DiskId='1' Source='smime3.dll' Vital='yes' />
</Component>
<Component Id='NSSfreeblLibrary' Guid='405D9E74-1B7C-41e2-A9CC-DC8F0CEA1565' Win64='$(var.Property_Win64)'>
- <File Id='NSSFREEBL' LongName='freebl3.dll' Name='freebl3.dll' DiskId='1' src='freebl3.dll' Vital='yes' />
+ <File Id='NSSFREEBL' Name='freebl3.dll' DiskId='1' Source='freebl3.dll' Vital='yes' />
</Component>
<Component Id='NSSutilLibrary' Guid='2740AA9B-888A-4967-80A5-9CA222582816' Win64='$(var.Property_Win64)'>
- <File Id='NSSUTIL' LongName='nssutil3.dll' Name='nssutil3.dll' DiskId='1' src='nssutil3.dll' Vital='yes' />
+ <File Id='NSSUTIL' Name='nssutil3.dll' DiskId='1' Source='nssutil3.dll' Vital='yes' />
</Component>
<Component Id='NSSsqliteLibrary' Guid='C2EE5C29-0588-4ec8-B1AB-324FF878DB7D' Win64='$(var.Property_Win64)'>
- <File Id='NSSSQLITE' LongName='sqlite3.dll' Name='sqlite3.dll' DiskId='1' src='sqlite3.dll' Vital='yes' />
+ <File Id='NSSSQLITE' Name='sqlite3.dll' DiskId='1' Source='sqlite3.dll' Vital='yes' />
</Component>
<Component Id='NSSdbmLibrary' Guid='F4B8B7FA-11A5-43af-B471-0C71AFC2CAB9' Win64='$(var.Property_Win64)'>
- <File Id='NSSDBM' LongName='nssdbm3.dll' Name='nssdbm3.dll' DiskId='1' src='nssdbm3.dll' Vital='yes' />
+ <File Id='NSSDBM' Name='nssdbm3.dll' DiskId='1' Source='nssdbm3.dll' Vital='yes' />
</Component>
</Directory>
<Directory Id='$(var.Property_PFilesFolder)' Name='PFiles'>
- <Directory Id='INSTALLDIR' Name='PassSync' LongName='$(var.BRAND) Directory Password Synchronization'>
+ <Directory Id='INSTALLDIR' ShortName='PassSync' Name='$(var.BRAND) Directory Password Synchronization'>
<Component Id='MainExecutable' Guid='DCEECAA4-83F1-4F22-985B-FDB3C8ABD471' Win64='$(var.Property_Win64)'>
- <File Id='PassSyncEXE' Name='PassSync.exe' LongName='passsync.exe' DiskId='1'
- src='passsync.exe' Vital='yes' />
- <ServiceInstall Id='PassSyncEXE' Name='PassSync' DisplayName='Password Synchronization' Type='ownProcess'
- Interactive='no' Start='auto' Vital='yes' ErrorControl='ignore'/>
- <ServiceControl Id='PassSyncEXE' Name='PassSync' Start='install' Stop='both' Remove='uninstall' Wait='no'/>
-
- <Registry Id='InstPath' Root='HKLM' Key='Software\PasswordSync' Name='Install Path' Action='write' Type='string' Value='[INSTALLDIR]' />
- <Registry Id='HostName' Root='HKLM' Key='Software\PasswordSync' Name='Host Name' Action='write' Type='string' Value='[HOSTNAME]' />
- <Registry Id='PortNum' Root='HKLM' Key='Software\PasswordSync' Name='Port Number' Action='write' Type='string' Value='[PORTNUM]' />
- <Registry Id='UserName' Root='HKLM' Key='Software\PasswordSync' Name='User Name' Action='write' Type='string' Value='[USER]' />
- <Registry Id='Password' Root='HKLM' Key='Software\PasswordSync' Name='Password' Action='write' Type='string' Value='[PASSWORD]' />
- <Registry Id='Certtkn' Root='HKLM' Key='Software\PasswordSync' Name='Cert Token' Action='write' Type='string' Value='[CERTTOKEN]' />
- <Registry Id='SrchBase' Root='HKLM' Key='Software\PasswordSync' Name='Search Base' Action='write' Type='string' Value='[SRCHBASE]' />
- <Registry Id='UserFld' Root='HKLM' Key='Software\PasswordSync' Name='User Name Field' Action='write' Type='string' Value='ntuserdomainid' />
- <Registry Id='PassFld' Root='HKLM' Key='Software\PasswordSync' Name='Password Field' Action='write' Type='string' Value='userpassword' />
- <Registry Id='LogLevel' Root='HKLM' Key='Software\PasswordSync' Name='Log Level' Action='write' Type='string' Value='0' />
- <Registry Id='NotPkgs' Root='HKLM' Key='SYSTEM\ControlSet001\Control\Lsa' Name='Notification Packages' Action='append' Type='multiString' Value='passhook'/>
- <RemoveFile Id='NSSDBFiles' On='uninstall' Name='*.db'/>
- <RemoveFile Id='PassSyncLog' On='uninstall' Name='*.log'/>
+ <File Id='PassSyncEXE' Name='PassSync.exe' DiskId='1' Source='passsync.exe' Vital='yes'
+ ReadOnly="no" Compressed="yes" KeyPath="yes" Hidden="no" Checksum="no" />
+ <ServiceInstall Id='PassSyncInstall' Name='PassSync' DisplayName='Password Synchronization' Type='ownProcess'
+ Interactive='no' Start='auto' Vital='yes' ErrorControl='ignore' />
+ <ServiceControl Id='PassSyncControl' Name='PassSync' Start='install' Stop='uninstall' Remove='uninstall' Wait='no'/>
+
+ <RegistryKey Id='PassSyncKey' Root='HKLM' Key='Software\PasswordSync' ForceCreateOnInstall='yes' >
+ <RegistryValue Name='Install Path' Type='string' Value='[INSTALLDIR]' />
+ <RegistryValue Name='Host Name' Type='string' Value='[HOSTNAME]' />
+ <RegistryValue Name='Port Number' Type='string' Value='[PORTNUM]' />
+ <RegistryValue Name='User Name' Type='string' Value='[USER]' />
+ <RegistryValue Name='Password' Type='string' Value='[PASSWORD]' />
+ <RegistryValue Name='Cert Token' Type='string' Value='[CERTTOKEN]' />
+ <RegistryValue Name='Search Base' Type='string' Value='[SRCHBASE]' />
+ <RegistryValue Name='User Name Field' Type='string' Value='ntuserdomainid' />
+ <RegistryValue Name='Password Field' Type='string' Value='userpassword' />
+ <RegistryValue Name='Log Level' Type='string' Value='0' />
+ <RegistryValue Name='Notification Packages' Type='multiString' Value='passhook'/>
+ </RegistryKey>
+ <RegistryKey Id='NotPkgs' Root='HKLM' Key='SYSTEM\ControlSet001\Control\Lsa' ForceCreateOnInstall='yes' >
+ <RegistryValue Name='Notification Packages' Type='multiString' Value='passhook'/>
+ </RegistryKey>
+
+ <RemoveFile Id='NSSDBFiles' On='uninstall' Name='*.db'/>
+ <RemoveFile Id='PassSyncLog' On='uninstall' Name='*.log'/>
</Component>
<Component Id='NSScertutil' Guid='EE2FB62B-E104-4049-8A6D-B96D4524FC29' Win64='$(var.Property_Win64)'>
- <File Id='NSSCERTUTIL' LongName='certutil.exe' Name='certutil.exe' DiskId='1' src='certutil.exe' Vital='yes' />
+ <File Id='NSSCERTUTIL' Name='certutil.exe' DiskId='1' Source='certutil.exe' Vital='yes' />
</Component>
<Component Id='NSSpk12util' Guid='13393BA9-550A-4330-85B9-76F14225A6D7' Win64='$(var.Property_Win64)'>
- <File Id='NSSPK12UTIL' LongName='pk12util.exe' Name='pk12util.exe' DiskId='1' src='pk12util.exe' Vital='yes' />
+ <File Id='NSSPK12UTIL' Name='pk12util.exe' DiskId='1' Source='pk12util.exe' Vital='yes' />
</Component>
<Component Id='NSSrootcertsLibrary' Guid='783828BA-5B72-4320-92CA-127C42E2179E' Win64='$(var.Property_Win64)'>
- <File Id='NSSROOTCERTS' LongName='nssckbi.dll' Name='nssckbi.dll' DiskId='1' src='nssckbi.dll' Vital='yes' />
+ <File Id='NSSROOTCERTS' Name='nssckbi.dll' DiskId='1' Source='nssckbi.dll' Vital='yes' />
</Component>
<Component Id='NSLDAPLibrary' Guid='205B568A-F46D-4e80-AF5D-F5EDFC478046' Win64='$(var.Property_Win64)'>
- <File Id='NSLDAP' LongName='nsldap32v60.dll' Name='nsldap.dll' DiskId='1' src='nsldap32v60.dll' Vital='yes' />
+ <File Id='NSLDAP' Name='nsldap32v60.dll' DiskId='1' Source='nsldap32v60.dll' Vital='yes' />
</Component>
<Component Id='NSLDAPSSLLibrary' Guid='EFB4852A-7135-468b-A454-E61864BF2ECA' Win64='$(var.Property_Win64)'>
- <File Id='NSLDAPSSL' LongName='nsldapssl32v60.dll' Name='nsldapss.dll' DiskId='1' src='nsldapssl32v60.dll' Vital='yes' />
+ <File Id='NSLDAPSSL' Name='nsldapssl32v60.dll' DiskId='1' Source='nsldapssl32v60.dll' Vital='yes' />
</Component>
<Component Id='NSLDAPPRLibrary' Guid='66390300-D732-4983-B933-A3709F99F6AB' Win64='$(var.Property_Win64)'>
- <File Id='NSLDAPRP' LongName='nsldappr32v60.dll' Name='nsldappr.dll' DiskId='1' src='nsldappr32v60.dll' Vital='yes' />
+ <File Id='NSLDAPRP' Name='nsldappr32v60.dll' DiskId='1' Source='nsldappr32v60.dll' Vital='yes' />
</Component>
<Component Id='NSLDIFLibrary' Guid='38004143-EB9B-4dec-851A-2E34E8B3249E' Win64='$(var.Property_Win64)'>
- <File Id='NSLDIF' LongName='nsldif32v60.dll' Name='nsldif.dll' DiskId='1' src='nsldif32v60.dll' Vital='yes' />
+ <File Id='NSLDIF' Name='nsldif32v60.dll' DiskId='1' Source='nsldif32v60.dll' Vital='yes' />
</Component>
</Directory>
@@ -748,7 +754,7 @@
</Control>
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="[BannerBitmap]" />
<Control Id="AgreementText" Type="ScrollableText" X="20" Y="60" Width="330" Height="120" Sunken="yes" TabSkip="no">
- <Text src="Binary/License.rtf" />
+ <Text SourceFile="Binary/License.rtf" />
</Control>
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
<Text>Please read the following license agreement carefully</Text>
@@ -1467,17 +1473,17 @@
<RemoveExistingProducts After='InstallFinalize' />
</InstallExecuteSequence>
- <Binary Id="Up" src="Binary\Up.ico" />
- <Binary Id="New" src="Binary\New.ico" />
- <Binary Id="custicon" src="Binary\Custom.ico" />
- <Binary Id="repairic" src="Binary\Repair.ico" />
- <Binary Id="exclamic" src="Binary\Exclam.ico" />
- <Binary Id="removico" src="Binary\Remove.ico" />
- <Binary Id="completi" src="Binary\Complete.ico" />
- <Binary Id="insticon" src="Binary\Typical.ico" />
- <Binary Id="info" src="Binary\Info.ico" />
- <Binary Id="bannrbmp" src="Binary\Banner.bmp" />
- <Binary Id="dlgbmp" src="Binary\Dialog.bmp" />
- <Icon Id="PassSync.exe" src="passsync.exe" />
+ <Binary Id="Up" SourceFile="Binary\Up.ico" />
+ <Binary Id="New" SourceFile="Binary\New.ico" />
+ <Binary Id="custicon" SourceFile="Binary\Custom.ico" />
+ <Binary Id="repairic" SourceFile="Binary\Repair.ico" />
+ <Binary Id="exclamic" SourceFile="Binary\Exclam.ico" />
+ <Binary Id="removico" SourceFile="Binary\Remove.ico" />
+ <Binary Id="completi" SourceFile="Binary\Complete.ico" />
+ <Binary Id="insticon" SourceFile="Binary\Typical.ico" />
+ <Binary Id="info" SourceFile="Binary\Info.ico" />
+ <Binary Id="bannrbmp" SourceFile="Binary\Banner.bmp" />
+ <Binary Id="dlgbmp" SourceFile="Binary\Dialog.bmp" />
+ <Icon Id="PassSync.exe" SourceFile="passsync.exe" />
</Product>
</Wix>
10 years, 11 months
passwordsync/passhand.cpp passwordsync/passsync
by Noriko Hosoi
passwordsync/passhand.cpp | 53 +++++++++++++++++++++++++++++--
passwordsync/passsync/ntservice.cpp | 6 +--
passwordsync/passsync/service.cpp | 61 ++++++++++++++++++++++++++++++++++--
3 files changed, 111 insertions(+), 9 deletions(-)
New commits:
commit b4c18b3e17685ec1d092b5069253f73001555583
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Thu May 9 17:46:59 2013 -0700
Ticket #47353 - PassSync fails to open changelog
Bug description: The result of opening the changelog file
"passhook.dat" was checked by errno (_get_errno(&errno)),
which was not updated once an error (ENOENT) was set
although the other error returned from GetLastError.
Fix description: This patch replaces _get_errno with
GetLastError to get the correct error.
In addition, debug logging code is added.
https://fedorahosted.org/389/ticket/47353
Reviewed by Rich (Thank you!!)
diff --git a/passwordsync/passhand.cpp b/passwordsync/passhand.cpp
index cfab159..f9b39bd 100644
--- a/passwordsync/passhand.cpp
+++ b/passwordsync/passhand.cpp
@@ -69,6 +69,12 @@ int saveSet(PASS_INFO_LIST* passInfoList, char* filename)
int cipherTextLen;
int resultTextLen = 0;
int pairCount = passInfoList->size();
+ fstream outLog;
+
+#if 0
+ // Debug log
+ outLog.open("passhand.log", ios::out | ios::app);
+#endif
// Write usernames and passwords to a strstream
plainTextStream.write((char*)&pairCount, sizeof(pairCount));
@@ -101,6 +107,11 @@ int saveSet(PASS_INFO_LIST* passInfoList, char* filename)
goto exit;
}
+ if(outLog.is_open()) {
+ timeStamp(&outLog);
+ outLog << "==> saveSet(" << filename << ")" << endl;
+ }
+
// Write cipher text to file
outFile.open(filename, ios::out | ios::binary);
if(!outFile.is_open())
@@ -110,11 +121,18 @@ int saveSet(PASS_INFO_LIST* passInfoList, char* filename)
}
outFile.write(cipherTextBuf, resultTextLen);
outFile.close();
+ if(outLog.is_open()) {
+ timeStamp(&outLog);
+ outLog << "<== saveSet(" << filename << ")" << endl;
+ }
exit:
// We need to unfreeze plainTextStream so memory gets freed by the destructor
plainTextStream.rdbuf()->freeze(false);
free(cipherTextBuf);
+ if(outLog.is_open()) {
+ outLog.close();
+ }
return result;
}
@@ -133,12 +151,26 @@ int loadSet(PASS_INFO_LIST* passInfoList, char* filename)
int cipherTextLen = 0;
int resultTextLen = 0;
int pairCount = 0;
- errno_t err = 0;
+ DWORD err = 0;
+ fstream outLog;
+
+#if 0
+ // Debug log
+ outLog.open("passhand.log", ios::out | ios::app);
+#endif
+ if(outLog.is_open()) {
+ timeStamp(&outLog);
+ outLog << "==> loadSet(" << filename << ")" << endl;
+ }
// Read in cipher text from file
inFile.open(filename, ios::in | ios::binary);
- _get_errno(&err);
- if (err == ENOENT) { // file does not exist - ok
+ err = GetLastError();
+ if (err == ERROR_FILE_NOT_FOUND) { // file does not exist - ok
+ if(outLog.is_open()) {
+ timeStamp(&outLog);
+ outLog << "loadSet: Failed to open " << filename << ", Error: " << err << endl;
+ }
result = 1;
goto exit;
}
@@ -146,6 +178,10 @@ int loadSet(PASS_INFO_LIST* passInfoList, char* filename)
if(!inFile.is_open())
{
result = -1;
+ if(outLog.is_open()) {
+ timeStamp(&outLog);
+ outLog << "loadSet: File is not opened " << filename << endl;
+ }
goto exit;
}
// Determine file size
@@ -161,11 +197,19 @@ int loadSet(PASS_INFO_LIST* passInfoList, char* filename)
if ((cipherTextBuf == NULL) || (plainTextBuf == NULL)) {
result = -1;
inFile.close();
+ if(outLog.is_open()) {
+ timeStamp(&outLog);
+ outLog << "<== loadSet(" << filename << ")" << endl;
+ }
goto exit;
}
inFile.read(cipherTextBuf, cipherTextLen);
inFile.close();
+ if(outLog.is_open()) {
+ timeStamp(&outLog);
+ outLog << "<== loadSet(" << filename << ")" << endl;
+ }
if(decrypt(cipherTextBuf, cipherTextLen, plainTextBuf, plainTextLen, &resultTextLen) != 0)
{
@@ -208,6 +252,9 @@ int loadSet(PASS_INFO_LIST* passInfoList, char* filename)
delete plainTextStream;
exit:
+ if(outLog.is_open()) {
+ outLog.close();
+ }
free(cipherTextBuf);
free(plainTextBuf);
return result;
diff --git a/passwordsync/passsync/ntservice.cpp b/passwordsync/passsync/ntservice.cpp
index 05b5acb..bdacfb6 100644
--- a/passwordsync/passsync/ntservice.cpp
+++ b/passwordsync/passsync/ntservice.cpp
@@ -345,10 +345,10 @@ BOOL CNTService::StartService()
};
DebugMsg(_T("Calling StartServiceCtrlDispatcher()"));
- // Fails if started from command line, but StartService
- // works any way
+ // Fails if started from command line, but StartService
+ // works any way
BOOL b = ::StartServiceCtrlDispatcher(st);
- DWORD err = GetLastError();
+ DWORD err = GetLastError();
DebugMsg(_T("Returned from StartServiceCtrlDispatcher()"));
return b;
}
diff --git a/passwordsync/passsync/service.cpp b/passwordsync/passsync/service.cpp
index 26fbcee..e5cedbc 100644
--- a/passwordsync/passsync/service.cpp
+++ b/passwordsync/passsync/service.cpp
@@ -40,6 +40,7 @@
#include <windows.h>
#include <iostream>
+#include <fstream>
#include "syncserv.h"
#include "dssynchmsg.h"
// syncserv.h
@@ -113,10 +114,15 @@ static void usage()
#define OPT_START_DIRECT 4
/////////////////////////////////////////////////////////////////
-static int checkOptions( PassSyncService *pSynch, int& argc, char *argv[] )
+static int checkOptions( PassSyncService *pSynch, int& argc, char *argv[], fstream *outLog)
{
int result = OPT_START; // Default is to start the service
+ if(outLog->is_open()) {
+ timeStamp(outLog);
+ *outLog << "==> checkOptions(" << pSynch->m_szServiceName << ")" << endl;
+ }
+
// Check first for uninstall, since we shouldn't do anything else if set
int i;
for( i = 1; i < argc; i++ )
@@ -139,6 +145,10 @@ static int checkOptions( PassSyncService *pSynch, int& argc, char *argv[] )
// Terminate after completion
result = OPT_TERMINATE;
argc = 1;
+ if(outLog->is_open()) {
+ timeStamp(outLog);
+ *outLog << "<== checkOption uninstall" << endl;
+ }
return result;
}
}
@@ -166,12 +176,20 @@ static int checkOptions( PassSyncService *pSynch, int& argc, char *argv[] )
{
result = OPT_APP;
bLocal = TRUE;
+ if(outLog->is_open()) {
+ timeStamp(outLog);
+ *outLog << "checkOptions: start as app (-a)" << endl;
+ }
}
// Start service
else if ( 'x' == opt )
{
result = OPT_START_DIRECT;
bLocal = TRUE;
+ if(outLog->is_open()) {
+ timeStamp(outLog);
+ *outLog << "checkOptions: start service (-x)" << endl;
+ }
}
/*
// Command port
@@ -194,13 +212,25 @@ static int checkOptions( PassSyncService *pSynch, int& argc, char *argv[] )
printf( "%S is already installed\n", pSynch->m_szServiceName );
else
{
+ if(outLog->is_open()) {
+ timeStamp(outLog);
+ *outLog << "checkOptions: Installing: " << pSynch->m_szServiceName << endl;
+ }
// Try and install the copy that's running
if ( pSynch->Install() )
{
+ if(outLog->is_open()) {
+ timeStamp(outLog);
+ *outLog << "checkOptions: Installed. " << endl;
+ }
printf( "%S installed\n", pSynch->m_szServiceName );
}
else
{
+ if(outLog->is_open()) {
+ timeStamp(outLog);
+ *outLog << "checkOptions: Failed to install. Error %d" << GetLastError() << endl;
+ }
printf( "%S failed to install. Error %d\n",
pSynch->m_szServiceName, GetLastError() );
}
@@ -211,18 +241,30 @@ static int checkOptions( PassSyncService *pSynch, int& argc, char *argv[] )
// Terminate after completion
else if ( 'n' == opt )
{
+ if(outLog->is_open()) {
+ timeStamp(outLog);
+ *outLog << "checkOptions: Synchronize from NT to DS (-n): " << pSynch->m_szServiceName << endl;
+ }
result = OPT_NONE;
}
// Synchronize from DS to NT
// Terminate after completion
else if ( 's' == opt )
{
+ if(outLog->is_open()) {
+ timeStamp(outLog);
+ *outLog << "checkOptions: Synchronize from DS to NT (-s): " << pSynch->m_szServiceName << endl;
+ }
result = OPT_NONE;
}
// Synchronize both ways
// Terminate after completion
else if ( 'r' == opt )
{
+ if(outLog->is_open()) {
+ timeStamp(outLog);
+ *outLog << "checkOptions: Synchronize both ways (-s): " << pSynch->m_szServiceName << endl;
+ }
result = OPT_NONE;
}
if ( bLocal )
@@ -277,13 +319,24 @@ static int initialize( PassSyncService *pSynch, int argc, char *argv[] )
int
main( int argc, char *argv[] )
{
+ fstream outLog;
+
+#if 0
+ // Debug log
+ outLog.open("PassSyncService.log", ios::out | ios::app);
+#endif
+
// Global single instance
PassSyncService theSynch("Password Synchronization Service");
// Process special install/uninstall switches; this does install/uninstall
// It returns non-zero to actually start the service
- int nStart = checkOptions( &theSynch, argc, argv );
+ int nStart = checkOptions( &theSynch, argc, argv, &outLog );
+ if(outLog.is_open()) {
+ timeStamp(&outLog);
+ outLog << "checkOptions returned: " << nStart << endl;
+ }
// Set up configuration
if ( OPT_TERMINATE != nStart )
initialize( &theSynch, argc, argv );
@@ -323,7 +376,9 @@ main( int argc, char *argv[] )
}
exit(theSynch.m_Status.dwWin32ExitCode);
-
+ if(outLog.is_open()) {
+ outLog.close();
+ }
////////// That's it //////
return 0;
10 years, 11 months
ldap/servers
by Ludwig Krispenz
ldap/servers/slapd/entrywsi.c | 1 +
1 file changed, 1 insertion(+)
New commits:
commit 630c89267c35b3d34ca186f7791e971479f81fb3
Author: Ludwig Krispenz <lkrispen(a)redhat.com>
Date: Fri May 10 16:14:49 2013 +0200
removing an unused variable, did also remove an assigment
diff --git a/ldap/servers/slapd/entrywsi.c b/ldap/servers/slapd/entrywsi.c
index af96039..411fb6f 100644
--- a/ldap/servers/slapd/entrywsi.c
+++ b/ldap/servers/slapd/entrywsi.c
@@ -774,6 +774,7 @@ entry_delete_present_values_wsi_multi_valued(Slapi_Entry *e, const char *type, s
{
int retVal= LDAP_SUCCESS;
Slapi_Attr *a= NULL;
+ entry_attr_find_wsi(e, type, &a);
/* The attribute is on the present list, or the deleted list and we're doing URP */
if ( vals == NULL || vals[0] == NULL )
{
10 years, 11 months