本文整理汇总了C++中LDAPDebug函数的典型用法代码示例。如果您正苦于以下问题:C++ LDAPDebug函数的具体用法?C++ LDAPDebug怎么用?C++ LDAPDebug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LDAPDebug函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: snmp_collator_create_semaphore
/*
* snmp_collator_create_semaphore()
*
* Create a semaphore to synchronize access to the stats file with
* the SNMP sub-agent. NSPR doesn't support a trywait function
* for semaphores, so we just use POSIX semaphores directly.
*/
static void
snmp_collator_create_semaphore()
{
/* First just try to create the semaphore. This should usually just work. */
if ((stats_sem = sem_open(stats_sem_name, O_CREAT | O_EXCL, SLAPD_DEFAULT_FILE_MODE, 1)) == SEM_FAILED) {
if (errno == EEXIST) {
/* It appears that we didn't exit cleanly last time and left the semaphore
* around. Recreate it since we don't know what state it is in. */
if (sem_unlink(stats_sem_name) != 0) {
LDAPDebug( LDAP_DEBUG_ANY, "Failed to delete old semaphore for stats file (%s). "
"Error %d (%s).\n", szStatsFile, errno, slapd_system_strerror(errno) );
exit(1);
}
if ((stats_sem = sem_open(stats_sem_name, O_CREAT | O_EXCL, SLAPD_DEFAULT_FILE_MODE, 1)) == SEM_FAILED) {
/* No dice */
LDAPDebug( LDAP_DEBUG_ANY, "Failed to create semaphore for stats file (%s). Error %d (%s).\n",
szStatsFile, errno, slapd_system_strerror(errno) );
exit(1);
}
} else {
/* Some other problem occurred creating the semaphore. */
LDAPDebug( LDAP_DEBUG_ANY, "Failed to create semaphore for stats file (%s). Error %d.(%s)\n",
szStatsFile, errno, slapd_system_strerror(errno) );
exit(1);
}
}
/* If we've reached this point, everything should be good. */
return;
}
开发者ID:leto,项目名称:389-ds,代码行数:38,代码来源:snmp_collator.c
示例2: bitwise_filter_create
static int
bitwise_filter_create (Slapi_PBlock* pb)
{
auto int rc = LDAP_UNAVAILABLE_CRITICAL_EXTENSION; /* failed to initialize */
auto char* mrOID = NULL;
auto char* mrTYPE = NULL;
auto struct berval* mrVALUE = NULL;
if (!slapi_pblock_get (pb, SLAPI_PLUGIN_MR_OID, &mrOID) && mrOID != NULL &&
!slapi_pblock_get (pb, SLAPI_PLUGIN_MR_TYPE, &mrTYPE) && mrTYPE != NULL &&
!slapi_pblock_get (pb, SLAPI_PLUGIN_MR_VALUE, &mrVALUE) && mrVALUE != NULL) {
struct bitwise_match_cb *bmc = NULL;
if (strcmp(mrOID, "1.2.840.113556.1.4.803") == 0) {
slapi_pblock_set (pb, SLAPI_PLUGIN_MR_FILTER_MATCH_FN, (void*)bitwise_filter_match_and);
} else if (strcmp(mrOID, "1.2.840.113556.1.4.804") == 0) {
slapi_pblock_set (pb, SLAPI_PLUGIN_MR_FILTER_MATCH_FN, (void*)bitwise_filter_match_or);
} else { /* this oid not handled by this plugin */
LDAPDebug (LDAP_DEBUG_FILTER, "=> bitwise_filter_create OID (%s) not handled\n", mrOID, 0, 0);
return rc;
}
bmc = new_bitwise_match_cb(mrTYPE, mrVALUE);
slapi_pblock_set (pb, SLAPI_PLUGIN_OBJECT, bmc);
slapi_pblock_set (pb, SLAPI_PLUGIN_DESTROY_FN, (void*)bitwise_filter_destroy);
rc = LDAP_SUCCESS;
} else {
LDAPDebug (LDAP_DEBUG_FILTER, "=> bitwise_filter_create missing parameter(s)\n", 0, 0, 0);
}
LDAPDebug (LDAP_DEBUG_FILTER, "<= bitwise_filter_create %i\n", rc, 0, 0);
return LDAP_SUCCESS;
}
开发者ID:leto,项目名称:389-ds,代码行数:31,代码来源:bitwise.c
示例3: memory_record_dump
static int
memory_record_dump( caddr_t data, caddr_t arg )
{
int frame= 0;
char b1[MR_DUMP_AMOUNT*2+1];
char b2[MR_DUMP_AMOUNT+1];
char b3[128];
int size= 0;
struct memory_record *mr = (struct memory_record *)data;
if(!IsBadReadPtr(mr->p, MR_DUMP_AMOUNT))
{
size= MR_DUMP_AMOUNT;
}
mr_to_hex_dump(b1, mr->p, size, MR_DUMP_AMOUNT);
mr_to_char_dump(b2, mr->p, size, MR_DUMP_AMOUNT);
PR_snprintf(b3,sizeof(b3),"%p %ld %s %s",mr->p,mr->size,b1,b2);
LDAPDebug( LDAP_DEBUG_ANY, "%s\n",b3,0,0);
while(mr->ra[frame]!=0)
{
char fn[100];
AddressToName(mr->ra[frame], fn, 100);
LDAPDebug( LDAP_DEBUG_ANY, "%d %p %s\n",frame,mr->ra[frame],fn);
frame++;
}
return 0;
}
开发者ID:leto,项目名称:389-ds,代码行数:26,代码来源:ch_malloc.c
示例4: nsldapi_is_read_ready
int
nsldapi_is_read_ready( LDAP *ld, Sockbuf *sb )
{
struct selectinfo *sip;
short i;
if (( sip = (struct selectinfo *)ld->ld_selectinfo ) == NULL ) {
return( 0 ); /* punt */
}
if ( ld->ld_select_fn != NULL ) {
return( FD_ISSET( (int)sb->sb_sd, &sip->si_stdinfo.ssi_use_readfds ));
}
if ( sip->si_count > 0 && sip->si_streaminfo != NULL ) {
for ( i = 0; i < sip->si_count; ++i ) {
if ( sip->si_streaminfo[ i ].tcpsi_stream == (tcpstream *)sb->sb_sd ) {
#ifdef LDAP_DEBUG
if ( sip->si_streaminfo[ i ].tcpsi_is_read_ready ) {
LDAPDebug( LDAP_DEBUG_TRACE, "is_read_ready: stream %x READY\n",
(tcpstream *)sb->sb_sd, 0, 0 );
} else {
LDAPDebug( LDAP_DEBUG_TRACE, "is_read_ready: stream %x Not Ready\n",
(tcpstream *)sb->sb_sd, 0, 0 );
}
#endif /* LDAP_DEBUG */
return( sip->si_streaminfo[ i ].tcpsi_is_read_ready ? 1 : 0 );
}
}
}
LDAPDebug( LDAP_DEBUG_TRACE, "is_read_ready: stream %x: NOT FOUND\n", (tcpstream *)sb->sb_sd, 0, 0 );
return( 0 );
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:34,代码来源:macos-ip.c
示例5: dblayer_copy_file_resetlsns
int dblayer_copy_file_resetlsns(char *home_dir ,char *source_file_name, char *destination_file_name, int overwrite, dblayer_private *priv)
{
int retval = 0;
DB_ENV *env = NULL;
LDAPDebug( LDAP_DEBUG_TRACE, "=> dblayer_copy_file_resetlsns\n", 0, 0, 0 );
/* Make the environment */
retval = dblayer_make_private_simple_env(home_dir,&env);
if (retval || !env) {
LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_resetlsns: Call to dblayer_make_private_simple_env failed!\n"
"Unable to open an environment.", 0, 0, 0);
goto out;
}
/* Do the copy */
retval = dblayer_copy_file_keybykey(env, source_file_name, destination_file_name, overwrite, priv);
if (retval) {
LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_resetlsns: Copy not completed successfully.", 0, 0, 0);
}
out:
/* Close the environment */
if (env) {
int retval2 = 0;
retval2 = env->close(env,0);
if (retval2) {
if (0 == retval) {
retval = retval2;
LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_resetlsns, error %d: %s\n", retval, db_strerror(retval), 0);
}
}
}
LDAPDebug( LDAP_DEBUG_TRACE, "<= dblayer_copy_file_resetlsns\n", 0, 0, 0 );
return retval;
}
开发者ID:leto,项目名称:389-ds,代码行数:35,代码来源:dbhelp.c
示例6: dblayer_make_private_recovery_env
/* Make an environment to be used for isolated recovery (e.g. during a partial restore operation) */
int dblayer_make_private_recovery_env(char *db_home_dir, dblayer_private *priv, DB_ENV **env)
{
int retval = 0;
DB_ENV *ret_env = NULL;
LDAPDebug( LDAP_DEBUG_TRACE, "=> dblayer_make_private_recovery_env\n", 0, 0, 0 );
if (NULL == env) {
LDAPDebug(LDAP_DEBUG_ANY, "dblayer_make_private_recovery_env: Null environment. Cannot continue.", 0, 0, 0);
return -1;
}
*env = NULL;
retval = db_env_create(&ret_env,0);
if (retval) {
LDAPDebug(LDAP_DEBUG_ANY, "dblayer_make_private_recovery_env, Create error %d: %s\n", retval, db_strerror(retval), 0);
goto error;
}
dblayer_set_env_debugging(ret_env, priv);
retval = (ret_env->open)(ret_env,db_home_dir, DB_INIT_TXN | DB_RECOVER_FATAL | DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE,0);
if (0 == retval) {
*env = ret_env;
} else {
LDAPDebug(LDAP_DEBUG_ANY, "dblayer_make_private_recovery_env, Open error %d: %s\n", retval, db_strerror(retval), 0);
goto error;
}
error:
LDAPDebug( LDAP_DEBUG_TRACE, "<= dblayer_make_private_recovery_env\n", 0, 0, 0 );
return retval;
}
开发者ID:leto,项目名称:389-ds,代码行数:32,代码来源:dbhelp.c
示例7: dblayer_make_private_simple_env
/* Make an environment to be used for simple non-transacted database operations, e.g. fixup during upgrade */
int dblayer_make_private_simple_env(char *db_home_dir, DB_ENV **env)
{
int retval = 0;
DB_ENV *ret_env = NULL;
LDAPDebug( LDAP_DEBUG_TRACE, "=> dblayer_make_private_simple_env\n", 0, 0, 0 );
if (NULL == env) {
LDAPDebug(LDAP_DEBUG_ANY, "dblayer_make_private_simple_env: Null environment. Cannot continue.", 0, 0, 0);
return -1;
}
*env = NULL;
retval = db_env_create(&ret_env,0);
if (retval) {
LDAPDebug(LDAP_DEBUG_ANY, "dblayer_make_private_simple_env, error %d: %s\n", retval, db_strerror(retval), 0);
goto error;
}
retval = (ret_env->open)(ret_env,db_home_dir,DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE,0);
if (0 == retval) {
*env = ret_env;
} else {
LDAPDebug(LDAP_DEBUG_ANY, "dblayer_make_private_simple_env, error %d: %s\n", retval, db_strerror(retval), 0);
goto error;
}
error:
LDAPDebug( LDAP_DEBUG_TRACE, "<= dblayer_make_private_simple_env\n", 0, 0, 0 );
return retval;
}
开发者ID:leto,项目名称:389-ds,代码行数:31,代码来源:dbhelp.c
示例8: int_init
int
int_init( Slapi_PBlock *pb )
{
int rc, flags;
LDAPDebug( LDAP_DEBUG_PLUGIN, "=> int_init\n", 0, 0, 0 );
rc = slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
(void *) SLAPI_PLUGIN_VERSION_01 );
rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION,
(void *)&pdesc );
rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FILTER_AVA,
(void *) int_filter_ava );
rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_VALUES2KEYS,
(void *) int_values2keys );
rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_AVA,
(void *) int_assertion2keys );
flags = SLAPI_PLUGIN_SYNTAX_FLAG_ORDERING;
rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_FLAGS,
(void *) &flags );
rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_NAMES,
(void *) names );
rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_OID,
(void *) INTEGER_SYNTAX_OID );
rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_COMPARE,
(void *) int_compare );
rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_VALIDATE,
(void *) int_validate );
rc |= slapi_pblock_set( pb, SLAPI_PLUGIN_SYNTAX_NORMALIZE,
(void *) int_normalize );
rc |= register_matching_rule_plugins();
LDAPDebug( LDAP_DEBUG_PLUGIN, "<= int_init %d\n", rc, 0, 0 );
return( rc );
}
开发者ID:leto,项目名称:389-ds,代码行数:35,代码来源:int.c
示例9: check_rdn_for_created_attrs
/* Checks if created attributes are used in the RDN.
* Returns 1 if created attrs are in the RDN, and
* 0 if created attrs are not in the RDN. Returns
* -1 if an error occurs.
*/
static int check_rdn_for_created_attrs(const char *newrdn)
{
int i, rc = 0;
Slapi_RDN *rdn = NULL;
char *value = NULL;
char *type[] = {"modifytimestamp", "createtimestamp",
"creatorsname", "modifiersname", 0};
if (newrdn && *newrdn && (rdn = slapi_rdn_new())) {
slapi_rdn_init_dn(rdn, newrdn);
for (i = 0; type[i] != NULL; i++) {
if (slapi_rdn_contains_attr(rdn, type[i], &value)) {
LDAPDebug(LDAP_DEBUG_TRACE, "Invalid DN. RDN contains %s attribute\n", type[i], 0, 0);
rc = 1;
break;
}
}
slapi_rdn_free(&rdn);
} else {
LDAPDebug(LDAP_DEBUG_TRACE, "check_rdn_for_created_attrs: Error allocating RDN\n", 0, 0, 0);
rc = -1;
}
return rc;
}
开发者ID:ohamada,项目名称:389ds,代码行数:30,代码来源:modrdn.c
示例10: nsldapi_free_connection
void
nsldapi_free_connection( LDAP *ld, LDAPConn *lc, LDAPControl **serverctrls,
LDAPControl **clientctrls, int force, int unbind )
{
LDAPConn *tmplc, *prevlc;
LDAPDebug( LDAP_DEBUG_TRACE, "nsldapi_free_connection\n", 0, 0, 0 );
if ( force || --lc->lconn_refcnt <= 0 ) {
if ( lc->lconn_status == LDAP_CONNST_CONNECTED ) {
nsldapi_iostatus_interest_clear( ld, lc->lconn_sb );
if ( unbind ) {
nsldapi_send_unbind( ld, lc->lconn_sb,
serverctrls, clientctrls );
}
}
nsldapi_close_connection( ld, lc->lconn_sb );
prevlc = NULL;
for ( tmplc = ld->ld_conns; tmplc != NULL;
tmplc = tmplc->lconn_next ) {
if ( tmplc == lc ) {
if ( prevlc == NULL ) {
ld->ld_conns = tmplc->lconn_next;
} else {
prevlc->lconn_next = tmplc->lconn_next;
}
break;
}
prevlc = tmplc;
}
free_servers( lc->lconn_server );
if ( lc->lconn_krbinstance != NULL ) {
NSLDAPI_FREE( lc->lconn_krbinstance );
}
/*
* if this is the default connection (lc->lconn_sb==ld->ld_sbp)
* we do not free the Sockbuf here since it will be freed
* later inside ldap_unbind().
*/
if ( lc->lconn_sb != ld->ld_sbp ) {
ber_sockbuf_free( lc->lconn_sb );
lc->lconn_sb = NULL;
}
if ( lc->lconn_ber != NULLBER ) {
ber_free( lc->lconn_ber, 1 );
}
if ( lc->lconn_binddn != NULL ) {
NSLDAPI_FREE( lc->lconn_binddn );
}
NSLDAPI_FREE( lc );
LDAPDebug( LDAP_DEBUG_TRACE, "nsldapi_free_connection: actually freed\n",
0, 0, 0 );
} else {
lc->lconn_lastused = time( 0 );
LDAPDebug( LDAP_DEBUG_TRACE, "nsldapi_free_connection: refcnt %d\n",
lc->lconn_refcnt, 0, 0 );
}
}
开发者ID:andreiw,项目名称:polaris,代码行数:58,代码来源:request.c
示例11: mkdir_p
/* mkdir -p */
int
mkdir_p(char *dir, unsigned int mode)
{
PRFileInfo info;
int rval;
char sep = get_sep(dir);
rval = PR_GetFileInfo(dir, &info);
if (PR_SUCCESS == rval)
{
if (PR_FILE_DIRECTORY != info.type) /* not a directory */
{
PR_Delete(dir);
if (PR_SUCCESS != PR_MkDir(dir, mode))
{
LDAPDebug(LDAP_DEBUG_ANY, "mkdir_p %s: error %d (%s)\n",
dir, PR_GetError(),slapd_pr_strerror(PR_GetError()));
return -1;
}
}
return 0;
}
else
{
/* does not exist */
char *p, *e;
char c[2] = {0, 0};
int len = strlen(dir);
rval = 0;
e = dir + len - 1;
if (*e == sep)
{
c[1] = *e;
*e = '\0';
}
c[0] = '/';
p = strrchr(dir, sep);
if (NULL != p)
{
*p = '\0';
rval = mkdir_p(dir, mode);
*p = c[0];
}
if (c[1])
*e = c[1];
if (0 != rval)
return rval;
if (PR_SUCCESS != PR_MkDir(dir, mode))
{
LDAPDebug(LDAP_DEBUG_ANY, "mkdir_p %s: error %d (%s)\n",
dir, PR_GetError(),slapd_pr_strerror(PR_GetError()));
return -1;
}
return 0;
}
}
开发者ID:leto,项目名称:389-ds,代码行数:59,代码来源:misc.c
示例12: ldif_back_compare
/*
* Function: ldif_back_compare
*
* Returns: -1, 0 or 1
*
* Description: compares entries in the ldif backend
*/
int
ldif_back_compare( Slapi_PBlock *pb )
{
LDIF *db; /*The Database*/
ldif_Entry *e, *prev; /*Used for searching the database*/
char *dn, *type; /*The dn and the type*/
struct berval *bval;
Slapi_Attr *attr;
int rc;
LDAPDebug( LDAP_DEBUG_TRACE, "=> ldif_back_compare\n", 0, 0, 0 );
prev = NULL;
if (slapi_pblock_get( pb, SLAPI_PLUGIN_PRIVATE, &db ) < 0 ||
slapi_pblock_get( pb, SLAPI_COMPARE_TARGET, &dn ) < 0 ||
slapi_pblock_get( pb, SLAPI_COMPARE_TYPE, &type ) < 0 ||
slapi_pblock_get( pb, SLAPI_COMPARE_VALUE, &bval ) < 0){
slapi_send_ldap_result( pb, LDAP_OPERATIONS_ERROR, NULL, NULL, 0, NULL );
return(-1);
}
/*Lock the database*/
PR_Lock( db->ldif_lock );
/*Find the entry for comparison*/
if ( (e = (ldif_Entry*) ldif_find_entry( pb, db, dn, &prev )) == NULL ) {
slapi_send_ldap_result( pb, LDAP_NO_SUCH_OBJECT, NULL, NULL, 0, NULL );
PR_Unlock( db->ldif_lock );
return( 1 );
}
/*Check the access*/
rc= slapi_access_allowed( pb, e->lde_e, type, bval, SLAPI_ACL_COMPARE );
if ( rc!=LDAP_SUCCESS ) {
slapi_send_ldap_result( pb, rc, NULL, NULL, 0, NULL );
PR_Unlock( db->ldif_lock );
return( 1 );
}
/*find the attribute*/
if ( slapi_entry_attr_find( e->lde_e, type, &attr ) != 0 ) {
slapi_send_ldap_result( pb, LDAP_NO_SUCH_ATTRIBUTE, NULL, NULL, 0, NULL );
PR_Unlock( db->ldif_lock );
return( 1 );
}
if ( slapi_attr_value_find( attr, bval ) == 0 ) {
slapi_send_ldap_result( pb, LDAP_COMPARE_TRUE, NULL, NULL, 0, NULL );
PR_Unlock( db->ldif_lock );
return( 0 );
}
slapi_send_ldap_result( pb, LDAP_COMPARE_FALSE, NULL, NULL, 0, NULL );
PR_Unlock( db->ldif_lock );
LDAPDebug( LDAP_DEBUG_TRACE, "<= ldif_back_compare\n", 0, 0, 0 );
return( 0 );
}
开发者ID:leto,项目名称:389-ds,代码行数:65,代码来源:compare.c
示例13: ldap_x_sasl_digest_md5_bind_s
int ldap_x_sasl_digest_md5_bind_s(
LDAP *ld,
char *user_name,
struct berval *cred,
LDAPControl **serverctrls,
LDAPControl **clientctrls)
{
struct berval *challenge = NULL;
int errnum;
char *digest = NULL;
struct berval resp;
LDAPDebug(LDAP_DEBUG_TRACE, "ldap_x_sasl_digest_md5_bind_s\n", 0, 0, 0);
/* Add debug */
if (ld == NULL || user_name == NULL || cred == NULL ||
cred->bv_val == NULL)
return (LDAP_PARAM_ERROR);
if (ld->ld_version < LDAP_VERSION3)
return (LDAP_PARAM_ERROR);
errnum = ldap_sasl_bind_s(ld, NULL, LDAP_SASL_DIGEST_MD5,
NULL, serverctrls, clientctrls, &challenge);
if (errnum == LDAP_SASL_BIND_IN_PROGRESS) {
if (challenge != NULL) {
LDAPDebug(LDAP_DEBUG_TRACE,
"SASL challenge: %s\n",
challenge->bv_val, 0, 0);
errnum = ldap_digest_md5_encode(challenge->bv_val,
user_name, cred->bv_val, &digest);
ber_bvfree(challenge);
challenge = NULL;
if (errnum == LDAP_SUCCESS) {
resp.bv_val = digest;
resp.bv_len = strlen(digest);
LDAPDebug(LDAP_DEBUG_TRACE,
"SASL reply: %s\n",
digest, 0, 0);
errnum = ldap_sasl_bind_s(ld, NULL,
LDAP_SASL_DIGEST_MD5, &resp,
serverctrls, clientctrls, &challenge);
free(digest);
}
if (challenge != NULL)
ber_bvfree(challenge);
} else {
errnum = LDAP_NO_MEMORY; /* TO DO: What val? */
}
}
LDAP_MUTEX_LOCK(ld, LDAP_ERR_LOCK);
ld->ld_errno = errnum;
LDAP_MUTEX_UNLOCK(ld, LDAP_ERR_LOCK);
return (errnum);
}
开发者ID:apprisi,项目名称:illumos-gate,代码行数:57,代码来源:digest_md5.c
示例14: ldbm_back_flush
int ldbm_back_flush( Slapi_PBlock *pb )
{
struct ldbminfo *li;
LDAPDebug( LDAP_DEBUG_TRACE, "ldbm backend flushing\n", 0, 0, 0 );
slapi_pblock_get( pb, SLAPI_PLUGIN_PRIVATE, &li );
dblayer_flush( li );
LDAPDebug( LDAP_DEBUG_TRACE, "ldbm backend done flushing\n", 0, 0, 0 );
return 0;
}
开发者ID:leto,项目名称:389-ds,代码行数:10,代码来源:close.c
示例15: upgrade_db_3x_40
static int upgrade_db_3x_40(backend *be)
{
struct ldbminfo *li = (struct ldbminfo *) be->be_database->plg_private;
int ret = 0;
back_txn txn;
static char* indexes_modified[] = {"parentid", "numsubordinates", NULL};
LDAPDebug( LDAP_DEBUG_ANY, "WARNING: Detected a database older than this server, upgrading data...\n",0,0,0);
dblayer_txn_init(li,&txn);
ret = dblayer_txn_begin(li,NULL,&txn);
if (0 != ret) {
ldbm_nasty(filename,69,ret);
goto error;
}
ret = indexfile_delete_all_keys(be,"parentid",&txn);
if (0 != ret) {
ldbm_nasty(filename,70,ret);
goto error;
}
{
Slapi_Mods smods;
slapi_mods_init(&smods,1);
/* Mods are to remove the hassubordinates attribute */
slapi_mods_add(&smods, LDAP_MOD_DELETE, "hassubordinates", 0, NULL);
/* This function takes care of generating the subordinatecount attribute and indexing it */
ret = indexfile_primary_modifyall(be,slapi_mods_get_ldapmods_byref(&smods),indexes_modified,&txn);
slapi_mods_done(&smods);
}
if (0 != ret) {
ldbm_nasty(filename,61,ret);
}
error:
if (0 != ret ) {
dblayer_txn_abort(li,&txn);
} else {
ret = dblayer_txn_commit(li,&txn);
if (0 != ret) {
ldbm_nasty(filename,60,ret);
} else {
/* Now update DBVERSION file */
}
}
if (0 == ret) {
LDAPDebug( LDAP_DEBUG_ANY, "...upgrade complete.\n",0,0,0);
} else {
LDAPDebug( LDAP_DEBUG_ANY, "ERROR: Attempt to upgrade the older database FAILED.\n",0,0,0);
}
return ret;
}
开发者ID:leto,项目名称:389-ds,代码行数:54,代码来源:upgrade.c
示例16: ldap_abandon
/*
* ldap_abandon - perform an ldap abandon operation. Parameters:
*
* ld LDAP descriptor
* msgid The message id of the operation to abandon
*
* ldap_abandon returns 0 if everything went ok, -1 otherwise.
*
* Example:
* ldap_abandon(ld, msgid);
*/
int LDAP_CALL ldap_abandon(LDAP *ld, int msgid) {
LDAPDebug(LDAP_DEBUG_TRACE, "ldap_abandon %d\n", msgid, 0, 0);
LDAPDebug(LDAP_DEBUG_TRACE, "4e65747363617065\n", msgid, 0, 0);
LDAPDebug(LDAP_DEBUG_TRACE, "466f726576657221\n", msgid, 0, 0);
if (ldap_abandon_ext(ld, msgid, NULL, NULL) == LDAP_SUCCESS) {
return (0);
}
return (-1);
}
开发者ID:mozilla,项目名称:releases-comm-central,代码行数:22,代码来源:abandon.c
示例17: ldbm_instance_delete_instance_entry_callback
int
ldbm_instance_delete_instance_entry_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* entryAfter, int *returncode, char *returntext, void *arg)
{
char *instance_name;
struct ldbminfo *li = (struct ldbminfo *)arg;
struct ldbm_instance *inst = NULL;
parse_ldbm_instance_entry(entryBefore, &instance_name);
inst = ldbm_instance_find_by_name(li, instance_name);
if (inst == NULL) {
LDAPDebug(LDAP_DEBUG_ANY, "ldbm: instance '%s' does not exist!\n",
instance_name, 0, 0);
if (returntext) {
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "No ldbm instance exists with the name '%s'\n",
instance_name);
}
if (returncode) {
*returncode = LDAP_UNWILLING_TO_PERFORM;
}
slapi_ch_free((void **)&instance_name);
return SLAPI_DSE_CALLBACK_ERROR;
}
/* check if some online task is happening */
if ((instance_set_busy(inst) != 0) ||
(slapi_counter_get_value(inst->inst_ref_count) > 0)) {
LDAPDebug(LDAP_DEBUG_ANY, "ldbm: '%s' is in the middle of a task. "
"Cancel the task or wait for it to finish, "
"then try again.\n", instance_name, 0, 0);
if (returntext) {
PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "ldbm instance '%s' is in the middle of a "
"task. Cancel the task or wait for it to finish, "
"then try again.\n", instance_name);
}
if (returncode) {
*returncode = LDAP_UNWILLING_TO_PERFORM;
}
slapi_ch_free((void **)&instance_name);
return SLAPI_DSE_CALLBACK_ERROR;
}
/* okay, we're gonna delete this database instance. take it offline. */
LDAPDebug(LDAP_DEBUG_ANY, "ldbm: Bringing %s offline...\n",
instance_name, 0, 0);
slapi_mtn_be_stopping(inst->inst_be);
dblayer_instance_close(inst->inst_be);
slapi_ch_free((void **)&instance_name);
return SLAPI_DSE_CALLBACK_OK;
}
开发者ID:ohamada,项目名称:389ds,代码行数:50,代码来源:ldbm_instance_config.c
示例18: ldbm_upgrade
/* When we're called, the database files have been opened, and any
recovery needed has been performed. */
int ldbm_upgrade(ldbm_instance *inst, int action)
{
int rval = 0;
if (0 == action)
{
return rval;
}
/* upgrade from db3 to db4 or db4 to db5 */
if (action & (DBVERSION_UPGRADE_3_4|DBVERSION_UPGRADE_4_5))
{
rval = dblayer_update_db_ext(inst, LDBM_SUFFIX_OLD, LDBM_SUFFIX);
if (0 == rval)
{
LDAPDebug(LDAP_DEBUG_ANY, "ldbm_upgrade: "
"Upgrading instance %s supporting bdb %d.%d "
"was successfully done.\n",
inst->inst_name, DB_VERSION_MAJOR, DB_VERSION_MINOR);
}
else
{
/* recovery effort ... */
dblayer_update_db_ext(inst, LDBM_SUFFIX, LDBM_SUFFIX_OLD);
}
}
return rval;
}
开发者ID:leto,项目名称:389-ds,代码行数:31,代码来源:upgrade.c
示例19: check_db_version
/*
* this function reads the db/DBVERSION file and check
* 1) if the db version is supported, and
* 2) if the db version requires some migration operation
*
* return: 0: supported
* DBVERSION_NOT_SUPPORTED: not supported
*
* action: 0: nothing is needed
* DBVERSION_UPGRADE_3_4: db3->db4 uprev is needed
* DBVERSION_UPGRADE_4_4: db4->db4 uprev is needed
* DBVERSION_UPGRADE_4_5: db4->db uprev is needed
*/
int
check_db_version( struct ldbminfo *li, int *action )
{
int value = 0;
char *ldbmversion = NULL;
char *dataversion = NULL;
*action = 0;
dbversion_read(li, li->li_directory, &ldbmversion, &dataversion);
if (NULL == ldbmversion || '\0' == *ldbmversion) {
slapi_ch_free_string(&dataversion);
return 0;
}
value = lookup_dbversion( ldbmversion, DBVERSION_TYPE | DBVERSION_ACTION );
if ( !value )
{
LDAPDebug( LDAP_DEBUG_ANY,
"ERROR: Database version mismatch (expecting "
"'%s' but found '%s' in directory %s)\n",
LDBM_VERSION, ldbmversion, li->li_directory );
/*
* A non-zero return here will cause slapd to exit during startup.
*/
slapi_ch_free_string(&ldbmversion);
slapi_ch_free_string(&dataversion);
return DBVERSION_NOT_SUPPORTED;
}
if ( value & DBVERSION_UPGRADE_3_4 )
{
dblayer_set_recovery_required(li);
*action = DBVERSION_UPGRADE_3_4;
}
else if ( value & DBVERSION_UPGRADE_4_4 )
{
dblayer_set_recovery_required(li);
*action = DBVERSION_UPGRADE_4_4;
}
else if ( value & DBVERSION_UPGRADE_4_5 )
{
dblayer_set_recovery_required(li);
*action = DBVERSION_UPGRADE_4_5;
}
if (value & DBVERSION_RDN_FORMAT) {
if (entryrdn_get_switch()) {
/* nothing to do */
} else {
*action |= DBVERSION_NEED_RDN2DN;
}
} else {
if (entryrdn_get_switch()) {
*action |= DBVERSION_NEED_DN2RDN;
} else {
/* nothing to do */
}
}
slapi_ch_free_string(&ldbmversion);
slapi_ch_free_string(&dataversion);
return 0;
}
开发者ID:leto,项目名称:389-ds,代码行数:73,代码来源:upgrade.c
示例20: ldap_entry2html
int
LDAP_CALL
ldap_entry2html(
LDAP *ld,
char *buf, /* NULL for "use internal" */
LDAPMessage *entry,
struct ldap_disptmpl *tmpl,
char **defattrs,
char ***defvals,
writeptype writeproc,
void *writeparm,
char *eol,
int rdncount,
unsigned long opts,
char *base,
char *urlprefix
)
{
LDAPDebug( LDAP_DEBUG_TRACE, "ldap_entry2html\n", 0, 0, 0 );
if ( urlprefix == NULL ) {
urlprefix = DEF_LDAP_URL_PREFIX;
}
return( do_entry2text( ld, buf, base, entry, tmpl, defattrs, defvals,
writeproc, writeparm, eol, rdncount, opts, urlprefix ));
}
开发者ID:andreiw,项目名称:polaris,代码行数:27,代码来源:tmplout.c
注:本文中的LDAPDebug函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论