Commit 7169dc82 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Misc changes from HEAD

parent 67d86bac
This diff is collapsed.
......@@ -2077,6 +2077,10 @@ dnl ----------------------------------------------------------------
dnl SQL
ol_link_sql=no
if test $ol_enable_sql != no ; then
AC_CHECK_HEADERS(sql.h sqlext.h,[],[
AC_MSG_ERROR([could not locate SQL headers])
])
AC_CHECK_LIB(iodbc,SQLDriverConnect,[have_iodbc=yes],[have_iodbc=no])
if test $have_iodbc = yes ; then
ol_link_sql="-liodbc"
......
......@@ -482,6 +482,12 @@
/* Define if you have the <slp.h> header file. */
#undef HAVE_SLP_H
/* Define if you have the <sql.h> header file. */
#undef HAVE_SQL_H
/* Define if you have the <sqlext.h> header file. */
#undef HAVE_SQLEXT_H
/* Define if you have the <ssl.h> header file. */
#undef HAVE_SSL_H
......
......@@ -91,6 +91,12 @@ static ldap_pvt_thread_mutex_t ldbm_big_mutex;
DB_ENV *ldbm_Env = NULL; /* real or fake, depending on db and version */
#endif
/* Let's make the version comparisons a little easier... */
#undef DB_VERSION_X
#ifdef HAVE_BERKELEY_DB
#define DB_VERSION_X ((DB_VERSION_MAJOR<<16)|(DB_VERSION_MINOR<<8)|DB_VERSION_PATCH)
#endif
/*******************************************************************
* *
* Create some special functions to initialize Berkeley DB for *
......@@ -231,7 +237,7 @@ DB_ENV *ldbm_initialize_env(const char *home, int dbcachesize, int *envdirok)
return NULL;
}
#if DB_VERSION_MAJOR > 3 || DB_VERSION_MINOR >= 3
#if DB_VERSION_X >= 0x030300
/* This interface appeared in 3.3 */
env->set_alloc( env, ldbm_malloc, NULL, NULL );
#endif
......@@ -253,7 +259,7 @@ DB_ENV *ldbm_initialize_env(const char *home, int dbcachesize, int *envdirok)
envFlags |= DB_THREAD;
#endif
#if DB_VERSION_MAJOR > 3 || DB_VERSION_MINOR > 0
#if DB_VERSION_X >= 0x030100
err = env->open( env, home, envFlags, 0 );
#else
/* 3.0.x requires an extra argument */
......@@ -321,7 +327,7 @@ ldbm_open( DB_ENV *env, char *name, int rw, int mode, int dbcachesize )
return NULL;
}
#if DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR < 3
#if DB_VERSION_X < 0x030300
ret->set_malloc( ret, ldbm_malloc );
#endif
......@@ -335,7 +341,7 @@ ldbm_open( DB_ENV *env, char *name, int rw, int mode, int dbcachesize )
__atoe(n2);
name = n2;
#endif
#if DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR > 0 && DB_VERSION_PATCH >= 17
#if DB_VERSION_X >= 0x040111
err = ret->open( ret, NULL, name, NULL, DB_TYPE, rw, mode);
#else
err = ret->open( ret, name, NULL, DB_TYPE, rw, mode);
......@@ -514,7 +520,7 @@ ldbm_firstkey( LDBM ldbm, LDBMCursor **dbch )
LDBM_RLOCK;
/* acquire a cursor for the DB */
# if DB_VERSION_MAJOR >= 3 || (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR > 5)
# if DB_VERSION_X >= 0x020600
rc = ldbm->cursor( ldbm, NULL, &dbci, 0 );
# else
rc = ldbm->cursor( ldbm, NULL, &dbci );
......
......@@ -601,8 +601,16 @@ an_find(
return( 0 );
}
/* Convert a delimited string into a list of AttributeNames; Add on
* to an existing list if it was given.
/*
* Convert a delimited string into a list of AttributeNames;
* add on to an existing list if it was given. If the string
* is not a valid attribute name, if a '-' is prepended it is
* skipped and the remaining name is tried again; if a '+' is
* prepended, an objectclass name is searched instead.
*
* NOTE: currently, if a valid attribute name is not found,
* the same string is also checked as valid objectclass name;
* however, this behavior is deprecated.
*/
AttributeName *
str2anlist( AttributeName *an, char *in, const char *brkstr )
......@@ -647,11 +655,15 @@ str2anlist( AttributeName *an, char *in, const char *brkstr )
slap_bv2ad(&adname, &anew->an_desc, &text);
if ( !anew->an_desc ) {
free( an );
/* overwrites input string on error! */
/*
* overwrites input string
* on error!
*/
strcpy( in, s );
return NULL;
}
} break;
case '+': {
struct berval ocname;
ocname.bv_len = anew->an_name.bv_len - 1;
......@@ -659,11 +671,15 @@ str2anlist( AttributeName *an, char *in, const char *brkstr )
anew->an_oc = oc_bvfind( &ocname );
if ( !anew->an_oc ) {
free( an );
/* overwrites input string on error! */
/*
* overwrites input string
* on error!
*/
strcpy( in, s );
return NULL;
}
} break;
default:
/* old (deprecated) way */
anew->an_oc = oc_bvfind( &anew->an_name );
......
......@@ -605,7 +605,8 @@ at_schema_info( Entry *e )
return -1;
}
attr_merge( e, ad_attributeTypes, vals );
if( attr_merge( e, ad_attributeTypes, vals ) )
return -1;
ldap_memfree( vals[0].bv_val );
}
return 0;
......
......@@ -45,6 +45,7 @@ static int bdb_cache_delete_entry_internal(Cache *cache, Entry *e);
static void bdb_lru_print(Cache *cache);
#endif
#if 0 /* unused */
static int
bdb_cache_entry_rdwr_lock(Entry *e, int rw)
{
......@@ -98,6 +99,7 @@ bdb_cache_entry_rdwr_unlock(Entry *e, int rw)
else
return ldap_pvt_thread_rdwr_runlock(&BEI(e)->bei_rdwr);
}
#endif /* unused */
static int
bdb_cache_entry_rdwr_init(Entry *e)
......
......@@ -126,7 +126,7 @@ bdb_db_config(
if( rc != LDAP_SUCCESS ) return 1;
/* size of the cache in entries */
} else if ( strcasecmp( argv[0], "cachesize" ) == 0 ) {
} else if ( strcasecmp( argv[0], "cachesize" ) == 0 ) {
if ( argc < 2 ) {
fprintf( stderr,
"%s: line %d: missing size in \"cachesize <size>\" line\n",
......
......@@ -185,6 +185,7 @@ int bdb_idl_insert( ID *ids, ID id )
return 0;
}
#if 0 /* unused */
static int idl_delete( ID *ids, ID id )
{
unsigned x = bdb_idl_search( ids, id );
......@@ -228,6 +229,7 @@ static int idl_delete( ID *ids, ID id )
return 0;
}
#endif /* unused */
static char *
bdb_show_key(
......
......@@ -37,13 +37,13 @@ struct berval bdb_uuid = { 0, NULL };
typedef void * db_malloc(size_t);
typedef void * db_realloc(void *, size_t);
#if 0
static int
bdb_open( BackendInfo *bi )
{
return 0;
}
#if 0
static int
bdb_destroy( BackendInfo *bi )
{
......@@ -516,7 +516,7 @@ bdb_initialize(
#ifdef NEW_LOGGING
LDAP_LOG( BACK_BDB, ENTRY, "bdb_db_initialize\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "bdb_open: initialize BDB backend\n",
Debug( LDAP_DEBUG_TRACE, "bdb_initialize: initialize BDB backend\n",
0, 0, 0 );
#endif
......@@ -545,7 +545,7 @@ bdb_initialize(
"\texpected: %s \tgot: %s\n", DB_VERSION_STRING, version, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"bdb_open: version mismatch\n"
"bdb_initialize: version mismatch\n"
"\texpected: " DB_VERSION_STRING "\n"
"\tgot: %s \n", version, 0, 0 );
#endif
......@@ -553,9 +553,9 @@ bdb_initialize(
#ifdef NEW_LOGGING
LDAP_LOG( BACK_BDB, DETAIL1,
"bdb_db_initialize: bdb_open: %s\n", version, 0, 0 );
"bdb_db_initialize: %s\n", version, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "bdb_open: %s\n",
Debug( LDAP_DEBUG_ANY, "bdb_initialize: %s\n",
version, 0, 0 );
#endif
}
......
......@@ -95,12 +95,12 @@ ldap_back_add(
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform", NULL, NULL );
NULL, "Operation not allowed", NULL, NULL );
return( -1 );
case REWRITE_REGEXEC_ERR:
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "Operations error", NULL, NULL );
NULL, "Rewrite error", NULL, NULL );
return( -1 );
}
#else /* !ENABLE_REWRITE */
......@@ -154,12 +154,15 @@ ldap_back_add(
#ifdef ENABLE_REWRITE
/*
* FIXME: dn-valued attrs should be rewritten
* to allow their use in ACLs at the back-ldap
* level.
* to allow their use in ACLs at back-ldap level.
*/
if ( strcmp( a->a_desc->ad_type->sat_syntax->ssyn_oid,
SLAPD_DN_SYNTAX ) == 0 ) {
ldap_dnattr_rewrite( li->rwinfo, a->a_vals, conn );
/*
* FIXME: rewrite could fail; in this case
* the operation should give up, right?
*/
(void)ldap_dnattr_rewrite( li->rwinfo, a->a_vals, conn );
}
#endif /* ENABLE_REWRITE */
......
......@@ -102,12 +102,12 @@ ldap_back_bind(
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform", NULL, NULL );
NULL, "Operation not allowed", NULL, NULL );
return( -1 );
case REWRITE_REGEXEC_ERR:
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "Operations error", NULL, NULL );
NULL, "Rewrite error", NULL, NULL );
return( -1 );
}
#else /* !ENABLE_REWRITE */
......@@ -228,7 +228,7 @@ ldap_back_getconn(struct ldapinfo *li, Connection *conn, Operation *op)
if (err != LDAP_SUCCESS) {
err = ldap_back_map_result(err);
send_ldap_result( conn, op, err,
NULL, "ldap_init failed", NULL, NULL );
NULL, "ldap_initialize() failed", NULL, NULL );
return( NULL );
}
/* Set LDAP version. This will always succeed: If the client
......@@ -263,7 +263,8 @@ ldap_back_getconn(struct ldapinfo *li, Connection *conn, Operation *op)
&lc->bound_dn.bv_val ) ) {
case REWRITE_REGEXEC_OK:
if ( lc->bound_dn.bv_val == NULL ) {
ber_dupbv( &lc->bound_dn, &lc->conn->c_dn );
ber_dupbv( &lc->bound_dn,
&lc->conn->c_dn );
}
#ifdef NEW_LOGGING
LDAP_LOG( BACK_LDAP, DETAIL1,
......@@ -283,25 +284,28 @@ ldap_back_getconn(struct ldapinfo *li, Connection *conn, Operation *op)
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op,
LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform",
NULL, "Operation not allowed",
NULL, NULL );
return( NULL );
case REWRITE_REGEXEC_ERR:
send_ldap_result( conn, op,
LDAP_OTHER,
NULL, "Operations error",
NULL, "Rewrite error",
NULL, NULL );
return( NULL );
}
#else /* !ENABLE_REWRITE */
struct berval bv;
ldap_back_dn_massage( li, &lc->conn->c_dn, &bv, 0, 1 );
if ( bv.bv_val == lc->conn->c_dn.bv_val )
if ( bv.bv_val == lc->conn->c_dn.bv_val ) {
ber_dupbv( &lc->bound_dn, &bv );
else
} else {
lc->bound_dn = bv;
}
#endif /* !ENABLE_REWRITE */
} else {
lc->bound_dn.bv_val = NULL;
lc->bound_dn.bv_len = 0;
......
......@@ -85,12 +85,12 @@ ldap_back_compare(
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform", NULL, NULL );
NULL, "Operation not allowed", NULL, NULL );
return( -1 );
case REWRITE_REGEXEC_ERR:
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "Operations error", NULL, NULL );
NULL, "Rewrite error", NULL, NULL );
return( -1 );
}
#else /* !ENABLE_REWRITE */
......
......@@ -85,12 +85,12 @@ ldap_back_delete(
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform", NULL, NULL );
NULL, "Operation not allowed", NULL, NULL );
return( -1 );
case REWRITE_REGEXEC_ERR:
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "Operations error", NULL, NULL );
NULL, "Rewrite error", NULL, NULL );
return( -1 );
}
#else /* !ENABLE_REWRITE */
......
......@@ -89,12 +89,12 @@ ldap_back_modify(
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform", NULL, NULL );
NULL, "Operation not allowed", NULL, NULL );
return( -1 );
case REWRITE_REGEXEC_ERR:
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "Operations error", NULL, NULL );
NULL, "Rewrite error", NULL, NULL );
return( -1 );
}
#else /* !ENABLE_REWRITE */
......@@ -139,13 +139,18 @@ ldap_back_modify(
ml->sml_bvalues, conn );
}
#endif /* ENABLE_REWRITE */
for (j = 0; ml->sml_bvalues[j].bv_val; j++);
mods[i].mod_bvalues = (struct berval **)ch_malloc((j+1) *
sizeof(struct berval *));
for (j = 0; ml->sml_bvalues[j].bv_val; j++)
mods[i].mod_bvalues[j] = &ml->sml_bvalues[j];
mods[i].mod_bvalues[j] = NULL;
if ( ml->sml_bvalues != NULL ) {
for (j = 0; ml->sml_bvalues[j].bv_val; j++);
mods[i].mod_bvalues = (struct berval **)ch_malloc((j+1) *
sizeof(struct berval *));
for (j = 0; ml->sml_bvalues[j].bv_val; j++)
mods[i].mod_bvalues[j] = &ml->sml_bvalues[j];
mods[i].mod_bvalues[j] = NULL;
} else {
mods[i].mod_bvalues = NULL;
}
i++;
}
modv[i] = 0;
......
......@@ -96,13 +96,13 @@ ldap_back_modrdn(
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform",
NULL, "Operation not allowed",
NULL, NULL );
return( -1 );
case REWRITE_REGEXEC_ERR:
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "Operations error",
NULL, "Rewrite error",
NULL, NULL );
return( -1 );
}
......@@ -134,12 +134,12 @@ ldap_back_modrdn(
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform", NULL, NULL );
NULL, "Operation not allowed", NULL, NULL );
return( -1 );
case REWRITE_REGEXEC_ERR:
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "Operations error", NULL, NULL );
NULL, "Rewrite error", NULL, NULL );
return( -1 );
}
#else /* !ENABLE_REWRITE */
......
......@@ -172,13 +172,13 @@ ldap_back_search(
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform", NULL, NULL );
NULL, "Operation not allowed", NULL, NULL );
rc = -1;
goto finish;
case REWRITE_REGEXEC_ERR:
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "Operations error", NULL, NULL );
NULL, "Rewrite error", NULL, NULL );
rc = -1;
goto finish;
}
......@@ -211,8 +211,13 @@ ldap_back_search(
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform", NULL, NULL );
NULL, "Operation not allowed", NULL, NULL );
rc = -1;
goto finish;
case REWRITE_REGEXEC_ERR:
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "Rewrite error", NULL, NULL );
rc = -1;
goto finish;
}
......@@ -251,9 +256,9 @@ ldap_back_search(
mapped_attrs[count] = NULL;
}
if ((msgid = ldap_search(lc->ld, mbase.bv_val, scope, mapped_filter, mapped_attrs,
attrsonly)) == -1)
{
msgid = ldap_search(lc->ld, mbase.bv_val, scope, mapped_filter,
mapped_attrs, attrsonly);
if ( msgid == -1 ) {
fail:;
rc = ldap_back_op_result(lc, op);
goto finish;
......@@ -364,19 +369,18 @@ fail:;
break;
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform",
NULL, NULL );
case REWRITE_REGEXEC_ERR:
rc = -1;
goto finish;
/* FIXME: no error, but no matched ... */
mmatch = NULL;
break;
}
}
if ( v2refs ) {
sres = LDAP_REFERRAL;
}
send_search_result( conn, op, sres,
mmatch, err, v2refs, NULL, count );
......
......@@ -131,12 +131,12 @@ meta_back_add(
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
NULL, NULL, NULL, NULL );
NULL, "Operation not allowed", NULL, NULL );
return -1;
case REWRITE_REGEXEC_ERR:
send_ldap_result( conn, op, LDAP_OTHER,
NULL, NULL, NULL, NULL );
NULL, "Rewrite error", NULL, NULL );
return -1;
}
......
......@@ -138,7 +138,7 @@ meta_back_compare(
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform",
NULL, "Operation not allowed",
NULL, NULL );
return -1;
......@@ -324,7 +324,7 @@ finish:;
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform",
NULL, "Operation not allowed",
NULL, NULL );
rc = -1;
goto cleanup;
......
......@@ -286,7 +286,7 @@ init_one_conn(
case REWRITE_REGEXEC_UNWILLING:
send_ldap_result( conn, op,
LDAP_UNWILLING_TO_PERFORM,
NULL, "Unwilling to perform",
NULL, "Operation not allowed",
NULL, NULL );
return LDAP_UNWILLING_TO_PERFORM;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment