misc cleanup

This commit is contained in:
Kurt Zeilenga 2002-07-23 18:35:12 +00:00
parent f5e209138b
commit 8a3d02bf6b
7 changed files with 46 additions and 38 deletions

View File

@ -1906,7 +1906,7 @@ regex_matches(
)
{
regex_t re;
char newbuf[512];
char newbuf[ACL_BUF_SIZE];
struct berval bv;
int rc;
@ -1917,7 +1917,7 @@ regex_matches(
string_expand(&bv, pat, buf, matches);
if (( rc = regcomp(&re, newbuf, REG_EXTENDED|REG_ICASE))) {
char error[512];
char error[ACL_BUF_SIZE];
regerror(rc, &re, error, sizeof(error));
#ifdef NEW_LOGGING

View File

@ -201,8 +201,7 @@ parse_acl(
}
if ( strcasecmp( left, "filter" ) == 0 ) {
if ( (a->acl_filter = str2filter(
right )) == NULL ) {
if ( (a->acl_filter = str2filter( right )) == NULL ) {
fprintf( stderr,
"%s: line %d: bad filter \"%s\" in to clause\n",
fname, lineno, right );
@ -227,7 +226,7 @@ parse_acl(
}
if ( a->acl_dn_pat.bv_len != 0 &&
strcmp(a->acl_dn_pat.bv_val, "*") == 0)
strcmp(a->acl_dn_pat.bv_val, "*") == 0 )
{
free( a->acl_dn_pat.bv_val );
a->acl_dn_pat.bv_val = NULL;

View File

@ -1026,6 +1026,7 @@ backend_group(
}
ldap_pvt_thread_mutex_lock( &conn->c_mutex );
for (g = conn->c_groups; g; g=g->ga_next) {
if (g->ga_be != be || g->ga_oc != group_oc ||
g->ga_at != group_at || g->ga_len != gr_ndn->bv_len)
@ -1033,7 +1034,9 @@ backend_group(
if (strcmp( g->ga_ndn, gr_ndn->bv_val ) == 0)
break;
}
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
if (g) {
return g->ga_res;
}

View File

@ -2275,22 +2275,29 @@ fp_parse_line(
token = strtok_quote( line, " \t" );
logline = line;
if ( token &&
(strcasecmp( token, "rootpw" ) == 0 ||
strcasecmp( token, "replica" ) == 0 || /* contains "credentials" */
strcasecmp( token, "bindpw" ) == 0 || /* used in back-ldap */
strcasecmp( token, "pseudorootpw" ) == 0 || /* used in back-meta */
strcasecmp( token, "dbpasswd" ) == 0 ) ) /* used in back-sql */
sprintf( logline = logbuf, "%s ***", token );
if ( strtok_quote_ptr )
if ( token && ( strcasecmp( token, "rootpw" ) == 0 ||
strcasecmp( token, "replica" ) == 0 || /* contains "credentials" */
strcasecmp( token, "bindpw" ) == 0 || /* used in back-ldap */
strcasecmp( token, "pseudorootpw" ) == 0 || /* used in back-meta */
strcasecmp( token, "dbpasswd" ) == 0 ) ) /* used in back-sql */
{
snprintf( logline = logbuf, sizeof logbuf, "%s ***", token );
}
if ( strtok_quote_ptr ) {
*strtok_quote_ptr = ' ';
}
#ifdef NEW_LOGGING
LDAP_LOG( CONFIG, DETAIL1, "line %d (%s)\n", lineno, logline , 0 );
#else
Debug( LDAP_DEBUG_CONFIG, "line %d (%s)\n", lineno, logline, 0 );
#endif
if ( strtok_quote_ptr )
if ( strtok_quote_ptr ) {
*strtok_quote_ptr = '\0';
}
for ( ; token != NULL; token = strtok_quote( NULL, " \t" ) ) {
if ( cargc == cargv_size - 1 ) {
@ -2373,18 +2380,18 @@ strtok_quote( char *line, char *sep )
static char buf[BUFSIZ];
static char *line;
static int lmax, lcur;
static size_t lmax, lcur;
#define CATLINE( buf ) { \
int len; \
len = strlen( buf ); \
while ( lcur + len + 1 > lmax ) { \
lmax += BUFSIZ; \
line = (char *) ch_realloc( line, lmax ); \
} \
strcpy( line + lcur, buf ); \
lcur += len; \
}
#define CATLINE( buf ) \
do { \
size_t len = strlen( buf ); \
while ( lcur + len + 1 > lmax ) { \
lmax += BUFSIZ; \
line = (char *) ch_realloc( line, lmax ); \
} \
strcpy( line + lcur, buf ); \
lcur += len; \
} while( 0 )
static char *
fp_getline( FILE *fp, int *lineno )

View File

@ -593,7 +593,7 @@ send_search_result(
{
char nbuf[64];
sprintf( nbuf, "%d nentries=%d", err, nentries );
snprintf( nbuf, sizeof nbuf, "%d nentries=%d", err, nentries );
Statslog( LDAP_DEBUG_STATS,
"conn=%lu op=%lu SEARCH RESULT tag=%lu err=%s text=%s\n",

View File

@ -20,11 +20,11 @@
#include "lber_pvt.h"
static struct berval supportedFeatures[] = {
BER_BVC("1.3.6.1.4.1.4203.1.5.1"), /* all Operational Attributes ("+") */
BER_BVC("1.3.6.1.4.1.4203.1.5.2"), /* OCs in Attributes List */
BER_BVC("1.3.6.1.4.1.4203.1.5.3"), /* (&) and (|) search filters */
BER_BVC("1.3.6.1.4.1.4203.1.5.4"), /* Language Tag Options */
BER_BVC("1.3.6.1.4.1.4203.1.5.5"), /* Language Range Options */
BER_BVC(LDAP_FEATURE_ALL_OPERATIONAL_ATTRS), /* all Operational Attributes ("+") */
BER_BVC(LDAP_FEATURE_OBJECTCLASS_ATTRS), /* OCs in Attributes List */
BER_BVC(LDAP_FEATURE_ABSOLUTE_FILTERS), /* (&) and (|) search filters */
BER_BVC(LDAP_FEATURE_LANGUAGE_TAG_OPTIONS), /* Language Tag Options */
BER_BVC(LDAP_FEATURE_LANGUAGE_RANGE_OPTIONS), /* Language Range Options */
{0,NULL}
};
@ -36,7 +36,6 @@ root_dse_info(
Entry **entry,
const char **text )
{
char buf[BUFSIZ];
Entry *e;
struct berval vals[2], *bv;
int i, j;
@ -122,13 +121,14 @@ root_dse_info(
/* supportedLDAPVersion */
for ( i=LDAP_VERSION_MIN; i<=LDAP_VERSION_MAX; i++ ) {
char buf[BUFSIZ];
if (!( global_allows & SLAP_ALLOW_BIND_V2 ) &&
( i < LDAP_VERSION3 ) )
{
/* version 2 and lower are disallowed */
continue;
}
sprintf(buf,"%d",i);
snprintf(buf, sizeof buf, "%d", i);
vals[0].bv_val = buf;
vals[0].bv_len = strlen( vals[0].bv_val );
attr_merge( e, ad_supportedLDAPVersion, vals );

View File

@ -1,3 +1,7 @@
/*
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
/*
* Copyright (c) 2000, Mark Adamson, Carnegie Mellon. All rights reserved.
* This software is not subject to any license of Carnegie Mellon University.
@ -193,11 +197,9 @@ static int slap_sasl_rx_off(char *rep, int *off)
off[n] = -1;
return( LDAP_SUCCESS );
}
#endif /* HAVE_CYRUS_SASL */
int slap_sasl_regexp_config( const char *match, const char *replace )
{
#ifdef HAVE_CYRUS_SASL
const char *c;
int rc, n;
SaslRegexp_t *reg;
@ -265,13 +267,10 @@ int slap_sasl_regexp_config( const char *match, const char *replace )
}
nSaslRegexp++;
#endif
return( LDAP_SUCCESS );
}
#ifdef HAVE_CYRUS_SASL
/* Perform replacement on regexp matches */
static void slap_sasl_rx_exp( char *rep, int *off, regmatch_t *str,
char *saslname, struct berval *out )