Commit 4a8ab5db authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

Mostly based on patches provided by Hallvard B. Furuseth

ITS#1677 - cast away const warnings
ITS#1678 - unsigned char args to ctype funcs
ITS#1682 - don't redefine ldap_debug
ITS#1683 - uninitialized vars
ITS#1703 - ldo_debug initialization
ITS#1705 - unsigned testing
ITS#1706 - socklen_t args
ITS#1719 - back-tcl update (other cleanups/fixes/improvements; yet untested)
ITS#1724 - integerNormalize/integerFilter/integerIndexer bugs
ITS#1725 - libdes not required

Implement back-null (/dev/null style backend)
Cleanup some misc warnings ("%lu" format, unused/uninitialized vars,
        ambiguous operator precedence)

Kurt, please regenerate configure
parent 6b8e16ef
......@@ -93,7 +93,6 @@ main( int argc, char *argv[] )
int use_tls = 0;
int referrals = 0;
LDAP *ld = NULL;
struct berval *bv = NULL;
int id, code = LDAP_OTHER;
LDAPMessage *res;
......
......@@ -199,6 +199,9 @@ OL_ARG_WITH(meta_module,[ --with-meta-module module type], static,
OL_ARG_ENABLE(monitor,[ --enable-monitor enable monitor backend], no)dnl
OL_ARG_WITH(monitor_module,[ --with-monitor-module module type], static,
[static dynamic])
OL_ARG_ENABLE(null,[ --enable-null enable null backend], no)dnl
OL_ARG_WITH(null_module,[ --with-null-module module type], static,
[static dynamic])
OL_ARG_ENABLE(passwd,[ --enable-passwd enable passwd backend], no)dnl
OL_ARG_WITH(passwd_module,[ --with-passwd-module module type], static,
[static dynamic])
......@@ -252,6 +255,9 @@ if test $ol_enable_slapd = no ; then
if test $ol_enable_monitor = yes ; then
AC_MSG_WARN([slapd disabled, ignoring --enable-monitor argument])
fi
if test $ol_enable_null = yes ; then
AC_MSG_WARN([slapd disabled, ignoring --enable-null argument])
fi
if test $ol_enable_passwd = yes ; then
AC_MSG_WARN([slapd disabled, ignoring --enable-passwd argument])
fi
......@@ -309,6 +315,9 @@ dnl fi
if test $ol_with_monitor_module != static ; then
AC_MSG_WARN([slapd disabled, ignoring --with-monitor-module argument])
fi
if test $ol_with_null_module != static ; then
AC_MSG_WARN([slapd disabled, ignoring --with-null-module argument])
fi
if test $ol_with_passwd_module != static ; then
AC_MSG_WARN([slapd disabled, ignoring --with-passwd-module argument])
fi
......@@ -338,6 +347,7 @@ dnl fi
ol_enable_ldbm=no
ol_enable_meta=no
ol_enable_monitor=no
ol_enable_null=no
ol_enable_passwd=no
ol_enable_perl=no
ol_enable_shell=no
......@@ -361,6 +371,7 @@ dnl ol_enable_multimaster=no
ol_with_ldbm_module=static
ol_with_meta_module=static
ol_with_monitor_module=static
ol_with_null_module=static
ol_with_passwd_module=static
ol_with_perl_module=static
ol_with_shell_module=static
......@@ -392,6 +403,7 @@ elif test $ol_enable_ldbm = no ; then
$ol_enable_ldap = no -a \
$ol_enable_meta = no -a \
$ol_enable_monitor = no -a \
$ol_enable_null = no -a \
$ol_enable_passwd = no -a \
$ol_enable_perl = no -a \
$ol_enable_shell = no -a \
......@@ -506,6 +518,7 @@ BUILD_LDAP=no
BUILD_LDBM=no
BUILD_META=no
BUILD_MONITOR=no
BUILD_NULL=no
BUILD_PASSWD=no
BUILD_PERL=no
BUILD_SHELL=no
......@@ -518,6 +531,7 @@ BUILD_LDAP_DYNAMIC=static
BUILD_LDBM_DYNAMIC=static
BUILD_META_DYNAMIC=static
BUILD_MONITOR_DYNAMIC=static
BUILD_NULL_DYNAMIC=static
BUILD_PASSWD_DYNAMIC=static
BUILD_PERL_DYNAMIC=static
BUILD_SHELL_DYNAMIC=static
......@@ -734,6 +748,7 @@ else
ol_with_ldbm_module=static
ol_with_meta_module=static
ol_with_monitor_module=static
ol_with_null_module=static
ol_with_passwd_module=static
ol_with_perl_module=static
ol_with_shell_module=static
......@@ -1048,11 +1063,15 @@ if test $ol_with_kerberos = yes -o $ol_with_kerberos = auto \
[-l$krb5crypto -lcom_err])
elif test $krb5_impl = heimdal; then
AC_CHECK_LIB(des, main,
[krb5crypto=des],
[krb5crypto=crypto])
AC_CHECK_LIB(krb5, main,
[have_krb5=yes
KRB5_LIBS="-lkrb5 -ldes -lasn1 -lroken -lcom_err"],
KRB5_LIBS="-lkrb5 -l$krb5crypto -lasn1 -lroken -lcom_err"],
[have_krb5=no],
[-ldes -lasn1 -lroken -lcom_err])
[-l$krb5crypto -lasn1 -lroken -lcom_err])
AC_DEFINE(HAVE_HEIMDAL_KERBEROS, 1,
[define if you have HEIMDAL Kerberos])
......@@ -1097,7 +1116,7 @@ if test $ol_link_krb5 = yes -a \( $ol_with_kerberos = yes -o \
elif test $krb5_impl = heimdal; then
AC_CHECK_LIB(krb4, main, [have_k425=yes
KRB4_LIBS="-lkrb4"], [have_k425=no],
[-lkrb5 -ldes -lasn1 -lroken -lcom_err])
[-lkrb5 -l$krb5crypto -lasn1 -lroken -lcom_err])
else
have_425=no
......@@ -2599,6 +2618,22 @@ if test "$ol_enable_monitor" != no ; then
fi
fi
if test "$ol_enable_null" != no ; then
AC_DEFINE(SLAPD_NULL,1,[define to support NULL backend])
BUILD_SLAPD=yes
BUILD_NULL=yes
if test "$ol_with_null_module" != static ; then
AC_DEFINE(SLAPD_NULL_DYNAMIC,1,
[define to support dynamic NULL backend])
BUILD_NULL=mod
BUILD_NULL_DYNAMIC=shared
SLAPD_MODULES_LIST="$SLAPD_MODULES_LIST -dlopen \$(SLAP_DIR)back-null/back_null.la"
SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-null"
else
SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-null"
fi
fi
if test "$ol_enable_passwd" != no ; then
AC_DEFINE(SLAPD_PASSWD,1,[define to support PASSWD backend])
BUILD_SLAPD=yes
......@@ -2715,6 +2750,7 @@ AC_SUBST(BUILD_SLAPD)
AC_SUBST(BUILD_LDBM)
AC_SUBST(BUILD_META)
AC_SUBST(BUILD_MONITOR)
AC_SUBST(BUILD_NULL)
AC_SUBST(BUILD_PASSWD)
AC_SUBST(BUILD_PERL)
AC_SUBST(BUILD_SHELL)
......@@ -2726,6 +2762,7 @@ AC_SUBST(BUILD_SLAPD)
AC_SUBST(BUILD_LDBM_DYNAMIC)
AC_SUBST(BUILD_META_DYNAMIC)
AC_SUBST(BUILD_MONITOR_DYNAMIC)
AC_SUBST(BUILD_NULL_DYNAMIC)
AC_SUBST(BUILD_PASSWD_DYNAMIC)
AC_SUBST(BUILD_PERL_DYNAMIC)
AC_SUBST(BUILD_SHELL_DYNAMIC)
......@@ -2813,6 +2850,7 @@ servers/slapd/back-ldap/Makefile:build/top.mk:servers/slapd/back-ldap/Makefile.i
servers/slapd/back-ldbm/Makefile:build/top.mk:servers/slapd/back-ldbm/Makefile.in:build/mod.mk \
servers/slapd/back-meta/Makefile:build/top.mk:servers/slapd/back-meta/Makefile.in:build/mod.mk \
servers/slapd/back-monitor/Makefile:build/top.mk:servers/slapd/back-monitor/Makefile.in:build/mod.mk \
servers/slapd/back-null/Makefile:build/top.mk:servers/slapd/back-null/Makefile.in:build/mod.mk \
servers/slapd/back-passwd/Makefile:build/top.mk:servers/slapd/back-passwd/Makefile.in:build/mod.mk \
servers/slapd/back-perl/Makefile:build/top.mk:servers/slapd/back-perl/Makefile.in:build/mod.mk \
servers/slapd/back-shell/Makefile:build/top.mk:servers/slapd/back-shell/Makefile.in:build/mod.mk \
......
......@@ -139,13 +139,13 @@ It can have the forms
users
self
dn[.<dnstyle>]=<pattern>
dn[.<dnstyle>[,<modifier>]]=<pattern>
dnattr=<attrname>
group[/<objectclass>[/<attrname>]]
[.<style>]=<pattern>
peername[.<style>]=<pattern>
sockname[.<style>]=<pattern>
domain[.<style>]=<pattern>
domain[.<domainstyle>[,<modifier>]]=<pattern>
sockurl[.<style>]=<pattern>
set[.<style>]=<pattern>
......@@ -254,7 +254,18 @@ The same
.B style
rules for pattern match described for the
.B group
case apply.
case apply.
The
.BR domain
clause also allows the
.B subtree
style, which succeeds when a fully qualified name exactly matches the
.BR domain
pattern, or its trailing part, after a
.BR dot ,
exactly matches the
.BR domain
pattern.
.LP
The statement
.B set=<pattern>
......
......@@ -277,7 +277,6 @@ and
.BR timelimit ;
no limit is set on
.BR unchecked .
This feature is currently exploited by the ldbm backend only.
.RE
.TP
.B loglevel <integer>
......@@ -418,6 +417,11 @@ conditions are currently same.
may be used to require no conditions (useful for clearly globally
set conditions within a particular database).
.TP
.B reverse-lookup on | off
Enable/disable client name reverse lookup (default is
.BR on
if compiled with --enable-rlookups).
.TP
.B rootDSE <file>
Specify the name of an LDIF(5) file containing user defined attributes
for the root DSE. These attributes are returned in addition to the
......@@ -682,10 +686,19 @@ type of backend.
.B backend <databasetype>
Mark the beginning of a backend definition. <databasetype>
should be one of
.B bdb,
.B dnssrv,
.B ldap,
.B ldbm,
.B meta,
.B monitor,
.B null,
.B passwd,
.B perl,
.B shell,
.B sql,
or
.B passwd
.B tcl,
depending on which backend will serve the database.
.SH GENERAL DATABASE OPTIONS
......@@ -697,10 +710,18 @@ type of backend.
Mark the beginning of a new database instance definition. <databasetype>
should be one of
.B bdb,
.B dnssrv,
.B ldap,
.B ldbm,
.B meta,
.B monitor,
.B null,
.B passwd,
.B perl,
.B shell,
.B sql,
or
.B passwd
.B tcl,
depending on which backend will serve the database.
.TP
.B lastmod on | off
......@@ -806,7 +827,7 @@ required for each database definition.
.B subordinate
Specify that the current backend database is a subordinate of another
backend database. A subordinate database may have only one suffix. This
option may bse used to glue multiple databases into a single namingContext.
option may be used to glue multiple databases into a single namingContext.
If the suffix of the current database is within the namingContext of a
superior database, searches against the superior database will be
propagated to the subordinate as well. All of the databases
......@@ -969,6 +990,10 @@ file.
.B file <filename>
Specifies an alternate passwd file to use. The default is
.B /etc/passwd.
.SH OTHER DATABASE-SPECIFIC OPTIONS
Other databases may allow specific configuration options; they will be
documented separately since most of these databases are very specific
or experimental.
.SH EXAMPLE
"OpenLDAP Administrator's Guide" contains an annotated
example of a configuration file.
......
......@@ -124,7 +124,7 @@ Specifies a chroot "jail" directory. slapd will
.BR chdir (2)
then
.BR chroot (2)
to this directory after opening listeners but before any reading
to this directory after opening listeners but before reading
any configuration file or initializing any backend.
.TP
.BI \-u " user"
......
......@@ -84,16 +84,16 @@ LDAP_F (char*) ldap_utf8_strtok( char* sp, const char* sep, char **last);
LDAP_V (const char) ldap_utf8_lentab[128];
LDAP_V (const char) ldap_utf8_mintab[32];
#define LDAP_UTF8_ISASCII(p) ( !(*(unsigned char *)(p) & 0x80 ) )
#define LDAP_UTF8_ISASCII(p) ( !(*(const unsigned char *)(p) & 0x80 ) )
#define LDAP_UTF8_CHARLEN(p) ( LDAP_UTF8_ISASCII(p) \
? 1 : ldap_utf8_lentab[*(unsigned char *)(p) ^ 0x80] )
? 1 : ldap_utf8_lentab[*(const unsigned char *)(p) ^ 0x80] )
/* This is like CHARLEN but additionally validates to make sure
* the char used the shortest possible encoding.
* 'l' is used to temporarily hold the result of CHARLEN.
*/
#define LDAP_UTF8_CHARLEN2(p, l) ( ( ( l = LDAP_UTF8_CHARLEN( p )) < 3 || \
( ldap_utf8_mintab[*(unsigned char *)(p) & 0x1f] & (p)[1] ) ) ? \
( ldap_utf8_mintab[*(const unsigned char *)(p) & 0x1f] & (p)[1] ) ) ? \
l : 0 )
#define LDAP_UTF8_OFFSET(p) ( LDAP_UTF8_ISASCII(p) \
......
......@@ -947,6 +947,12 @@
/* define to support dynamic cn=Monitor backend */
#undef SLAPD_MONITOR_DYNAMIC
/* define to support NULL backend */
#undef SLAPD_NULL
/* define to support dynamic NULL backend */
#undef SLAPD_NULL_DYNAMIC
/* define to support PASSWD backend */
#undef SLAPD_PASSWD
......
......@@ -960,6 +960,12 @@
/* define to support dynamic cn=Monitor backend */
/* #undef SLAPD_MONITOR_DYNAMIC */
/* define to support NULL backend */
/* #undef SLAPD_NULL */
/* define to support dynamic NULL backend */
/* #undef SLAPD_NULL_DYNAMIC */
/* define to support PASSWD backend */
/* #undef SLAPD_PASSWD */
......
......@@ -210,7 +210,7 @@ ber_bprint(
off = BP_GRAPH + n + ((n >= 8)?1:0);
if ( isprint( data[i] )) {
if ( isprint( (unsigned char) data[i] )) {
line[ BP_GRAPH + n ] = data[i];
} else {
line[ BP_GRAPH + n ] = '.';
......
......@@ -72,8 +72,8 @@ main( int argc, char *argv[] )
size_t len;
fgets( buf, sizeof( buf ), stdin );
len = strlen( buf ) - 1;
if ( len >= 0 && buf[ len ] == '\n' ) {
len = strlen( buf );
if ( len > 0 && buf[ --len ] == '\n' ) {
buf[ len ] = '\0';
}
strin = buf;
......
......@@ -38,7 +38,6 @@ main( int argc, char *argv[] )
{
int c;
int debug=0;
char *filter=NULL;
while( (c = getopt( argc, argv, "d:" )) != EOF ) {
switch ( c ) {
......
......@@ -1753,7 +1753,7 @@ quotedIA52strval( const char *str, struct berval *val, const char **next, unsign
}
len = endPos - startPos - escapes;
assert( len >= 0 );
assert( endPos >= startPos + escapes );
val->bv_len = len;
if ( escapes == 0 ) {
val->bv_val = LDAP_STRNDUP( startPos, len );
......
......@@ -128,6 +128,7 @@ struct ldapoptions {
#define LDAP_UNINITIALIZED 0x0
#define LDAP_INITIALIZED 0x1
#define LDAP_VALID_SESSION 0x2
int ldo_debug;
#ifdef LDAP_CONNECTIONLESS
#define LDAP_IS_UDP(ld) ((ld)->ld_options.ldo_is_udp)
void* ldo_peer; /* struct sockaddr* */
......@@ -135,7 +136,6 @@ struct ldapoptions {
int ldo_is_udp;
#endif
int ldo_debug;
/* per API call timeout */
struct timeval *ldo_tm_api;
struct timeval *ldo_tm_net;
......
......@@ -152,7 +152,7 @@ ldap_pvt_is_socket_ready(LDAP *ld, int s)
#if defined( notyet ) /* && defined( SO_ERROR ) */
{
int so_errno;
int dummy = sizeof(so_errno);
socklen_t dummy = sizeof(so_errno);
if ( getsockopt( s, SOL_SOCKET, SO_ERROR, &so_errno, &dummy )
== AC_SOCKET_ERROR )
{
......@@ -170,7 +170,7 @@ ldap_pvt_is_socket_ready(LDAP *ld, int s)
/* error slippery */
struct sockaddr_in sin;
char ch;
int dummy = sizeof(sin);
socklen_t dummy = sizeof(sin);
if ( getpeername( s, (struct sockaddr *) &sin, &dummy )
== AC_SOCKET_ERROR )
{
......@@ -344,7 +344,7 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb,
hints.ai_socktype = socktype;
snprintf(serv, sizeof serv, "%d", port );
if ( err = getaddrinfo(host, serv, &hints, &res) ) {
if ( ( err = getaddrinfo(host, serv, &hints, &res) ) ) {
osip_debug(ld, "ldap_connect_to_host: getaddrinfo failed: %s\n",
AC_GAI_STRERROR(err), 0, 0);
return -1;
......
......@@ -97,7 +97,7 @@ ldap_pvt_is_socket_ready(LDAP *ld, int s)
#if defined( notyet ) /* && defined( SO_ERROR ) */
{
int so_errno;
int dummy = sizeof(so_errno);
socklen_t dummy = sizeof(so_errno);
if ( getsockopt( s, SOL_SOCKET, SO_ERROR, &so_errno, &dummy )
== AC_SOCKET_ERROR )
{
......@@ -115,7 +115,7 @@ ldap_pvt_is_socket_ready(LDAP *ld, int s)
/* error slippery */
struct sockaddr_un sa;
char ch;
int dummy = sizeof(sa);
socklen_t dummy = sizeof(sa);
if ( getpeername( s, (struct sockaddr *) &sa, &dummy )
== AC_SOCKET_ERROR )
{
......
......@@ -906,7 +906,7 @@ ldap_pvt_tls_check_hostname( void *s, const char *name_in )
alt = X509V3_EXT_d2i(ex);
if (alt)
{
int n, len1, len2;
int n, len1, len2 = 0;
char *domain;
GENERAL_NAME *gn;
X509V3_EXT_METHOD *method;
......
......@@ -891,7 +891,7 @@ ldap_url_parselist (LDAPURLDesc **ludlist, const char *url )
if (url == NULL)
return LDAP_PARAM_ERROR;
urls = ldap_str2charray((char *)url, ", ");
urls = ldap_str2charray(url, ", ");
if (urls == NULL)
return LDAP_NO_MEMORY;
......@@ -928,7 +928,7 @@ ldap_url_parsehosts(
if (hosts == NULL)
return LDAP_PARAM_ERROR;
specs = ldap_str2charray((char *)hosts, ", ");
specs = ldap_str2charray(hosts, ", ");
if (specs == NULL)
return LDAP_NO_MEMORY;
......
......@@ -86,7 +86,7 @@ int ldap_utf8_charlen( const char * p )
if (!(*p & 0x80))
return 1;
return ldap_utf8_lentab[*(unsigned char *)p ^ 0x80];
return ldap_utf8_lentab[*(const unsigned char *)p ^ 0x80];
}
/*
......
......@@ -411,8 +411,8 @@ ldif_sput(
stop = (const unsigned char *) (val + vlen);
if ( type == LDIF_PUT_VALUE
&& isgraph( val[0] ) && val[0] != ':' && val[0] != '<'
&& isgraph( val[vlen-1] )
&& isgraph( (unsigned char) val[0] ) && val[0] != ':' && val[0] != '<'
&& isgraph( (unsigned char) val[vlen-1] )
#ifndef LDAP_BINARY_DEBUG
&& strstr( name, ";binary" ) == NULL
#endif
......@@ -542,8 +542,8 @@ int ldif_is_not_printable(
return -1;
}
if( isgraph( val[0] ) && val[0] != ':' && val[0] != '<' &&
isgraph( val[vlen-1] ) )
if( isgraph( (unsigned char) val[0] ) && val[0] != ':' && val[0] != '<' &&
isgraph( (unsigned char) val[vlen-1] ) )
{
ber_len_t i;
......
......@@ -48,7 +48,7 @@ int lutil_entropy( unsigned char *buf, ber_len_t nbytes )
close(fd);
/* should return nbytes */
if( rc < nbytes ) return -1;
if( rc != nbytes ) return -1;
return 0;
}
......
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