mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-30 13:30:57 +08:00
minor cleanup
This commit is contained in:
parent
6df4889f43
commit
aee3600276
@ -23,7 +23,7 @@
|
||||
#include "slap.h"
|
||||
|
||||
#ifdef LDAP_DEBUG
|
||||
static void at_index_print( void );
|
||||
static void at_index_print( void ) {};
|
||||
#endif
|
||||
|
||||
void
|
||||
|
@ -48,7 +48,6 @@ monitor_subsys_conn_init(
|
||||
{
|
||||
struct monitorinfo *mi;
|
||||
|
||||
char buf[1024];
|
||||
Entry *e;
|
||||
struct berval *bv[2], val;
|
||||
|
||||
|
@ -310,7 +310,7 @@ monitor_back_db_init(
|
||||
"cn: Monitor\n"
|
||||
"description: %s",
|
||||
SLAPD_MONITOR_DN,
|
||||
(char *) Versionstr
|
||||
/* (char *) Versionstr */ "slapd 2.0"
|
||||
);
|
||||
e = str2entry( buf );
|
||||
if ( e == NULL) {
|
||||
|
@ -61,6 +61,7 @@ monitor_send_children(
|
||||
struct monitorinfo *mi = (struct monitorinfo *) be->be_private;
|
||||
Entry *e, *e_tmp;
|
||||
struct monitorentrypriv *mp;
|
||||
int nentries;
|
||||
int rc;
|
||||
|
||||
mp = ( struct monitorentrypriv * )e_parent->e_private;
|
||||
@ -74,7 +75,7 @@ monitor_send_children(
|
||||
}
|
||||
monitor_cache_release( mi, e_parent );
|
||||
|
||||
for ( ; e != NULL; ) {
|
||||
for ( nentries = *nentriesp; e != NULL; ) {
|
||||
mp = ( struct monitorentrypriv * )e->e_private;
|
||||
|
||||
monitor_entry_update( mi, e );
|
||||
@ -83,14 +84,14 @@ monitor_send_children(
|
||||
if ( rc == LDAP_COMPARE_TRUE ) {
|
||||
send_search_entry( be, conn, op, e,
|
||||
attrs, attrsonly, NULL );
|
||||
*nentriesp++;
|
||||
nentries++;
|
||||
}
|
||||
|
||||
if ( ( mp->mp_children || MONITOR_HAS_VOLATILE_CH( mp ) )
|
||||
&& sub ) {
|
||||
rc = monitor_send_children( be, conn, op, filter,
|
||||
attrs, attrsonly,
|
||||
e, sub, nentriesp );
|
||||
e, sub, &nentries );
|
||||
if ( rc ) {
|
||||
return( rc );
|
||||
}
|
||||
|
@ -412,11 +412,11 @@ do_bind(
|
||||
NULL, text, NULL, NULL );
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
|
||||
"do_bind: conn %d v%d unknown authentication method (%d)\n",
|
||||
"do_bind: conn %ld v%d unknown authentication method (%ld)\n",
|
||||
conn->c_connid, version, method ));
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"do_bind: v%d unknown authentication method (%d)\n",
|
||||
"do_bind: v%d unknown authentication method (%ld)\n",
|
||||
version, method, 0 );
|
||||
#endif
|
||||
goto cleanup;
|
||||
|
@ -36,7 +36,6 @@ do_compare(
|
||||
)
|
||||
{
|
||||
Entry *entry = NULL;
|
||||
Attribute *a = NULL;
|
||||
char *dn = NULL, *ndn=NULL;
|
||||
struct berval desc;
|
||||
struct berval value;
|
||||
|
@ -865,11 +865,11 @@ read_config( const char *fname )
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
|
||||
"%s: line %d: \"%s\" is reserved for monitoring slapd\n",
|
||||
SLAPD_MONITOR_DN, fname, lineno ));
|
||||
fname, lineno, SLAPD_MONITOR_DN ));
|
||||
#else
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"%s: line %d: \"%s\" is reserved for monitoring slapd\n",
|
||||
SLAPD_MONITOR_DN, fname, lineno );
|
||||
fname, lineno, SLAPD_MONITOR_DN );
|
||||
#endif
|
||||
return( 1 );
|
||||
#endif /* SLAPD_MONITOR_DN */
|
||||
|
@ -14,11 +14,15 @@
|
||||
#include <ac/signal.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/time.h>
|
||||
#include <ac/unistd.h>
|
||||
|
||||
#include "ldap_pvt.h"
|
||||
#include "lutil.h"
|
||||
#include "slap.h"
|
||||
|
||||
/* I guess this should be declared in ldap_pvt.h */
|
||||
extern void * ldap_pvt_tls_sb_ctx( Sockbuf *sb );
|
||||
|
||||
/* protected by connections_mutex */
|
||||
static ldap_pvt_thread_mutex_t connections_mutex;
|
||||
static Connection *connections = NULL;
|
||||
@ -1063,8 +1067,10 @@ int connection_read(ber_socket_t s)
|
||||
if ( c->c_is_tls && c->c_needs_tls_accept ) {
|
||||
rc = ldap_pvt_tls_accept( c->c_sb, NULL );
|
||||
if ( rc < 0 ) {
|
||||
#if 0 /* required by next #if 0 */
|
||||
struct timeval tv;
|
||||
fd_set rfd;
|
||||
#endif
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
|
||||
|
@ -374,7 +374,7 @@ static int slap_get_listener_addresses(
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
snprintf(serv, sizeof serv, "%d", port);
|
||||
|
||||
if (err = getaddrinfo(host, serv, &hints, &res)) {
|
||||
if ( (err = getaddrinfo(host, serv, &hints, &res)) ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
|
||||
"slap_get_listener_addresses: getaddrinfo failed: %s\n",
|
||||
@ -502,7 +502,7 @@ static Listener * slap_open_listener(
|
||||
Listener *li;
|
||||
LDAPURLDesc *lud;
|
||||
unsigned short port;
|
||||
int err, addrlen;
|
||||
int err, addrlen = 0;
|
||||
struct sockaddr **sal, **psal;
|
||||
int socktype = SOCK_STREAM; /* default to COTS */
|
||||
|
||||
@ -940,7 +940,7 @@ slapd_daemon_task(
|
||||
)
|
||||
{
|
||||
int l;
|
||||
time_t last_idle_check;
|
||||
time_t last_idle_check = 0;
|
||||
time( &starttime );
|
||||
|
||||
if ( global_idletimeout > 0 ) {
|
||||
@ -1162,7 +1162,7 @@ slapd_daemon_task(
|
||||
slap_ssf_t ssf = 0;
|
||||
char *authid = NULL;
|
||||
|
||||
char *dnsname;
|
||||
char *dnsname = NULL;
|
||||
char *peeraddr;
|
||||
#ifdef LDAP_PF_LOCAL
|
||||
char peername[MAXPATHLEN + sizeof("PATH=")];
|
||||
|
@ -28,6 +28,10 @@
|
||||
#define INQUOTEDVALUE 7
|
||||
#define B4SEPARATOR 8
|
||||
|
||||
/* schema_init.c */
|
||||
extern int
|
||||
dnNormalize( Syntax *syntax, struct berval *val, struct berval **normalized );
|
||||
|
||||
/*
|
||||
* dn_validate - validate and compress dn. the dn is
|
||||
* compressed in place are returned if valid.
|
||||
|
@ -41,7 +41,6 @@ str2entry( char *s )
|
||||
{
|
||||
int rc;
|
||||
Entry *e;
|
||||
Attribute **a = NULL;
|
||||
char *type;
|
||||
struct berval value;
|
||||
struct berval *vals[2];
|
||||
|
@ -15,10 +15,15 @@
|
||||
#include <ac/wait.h>
|
||||
#include <ac/errno.h>
|
||||
|
||||
#include "ldap_pvt.h"
|
||||
|
||||
#include "slap.h"
|
||||
#include "lutil.h"
|
||||
#include "ldif.h"
|
||||
|
||||
/* I guess this should be declared in ldap_pvt.h */
|
||||
extern int ldap_pvt_tls_init_def_ctx( void );
|
||||
|
||||
#ifdef LDAP_SIGCHLD
|
||||
static RETSIGTYPE wait4child( int sig );
|
||||
#endif
|
||||
@ -127,7 +132,7 @@ int main( int argc, char **argv )
|
||||
#endif
|
||||
{
|
||||
int i, no_detach = 0;
|
||||
int rc;
|
||||
int rc = 1;
|
||||
char *urls = NULL;
|
||||
#if defined(HAVE_SETUID) && defined(HAVE_SETGID)
|
||||
char *username = NULL;
|
||||
|
@ -842,8 +842,8 @@ LDAP_SLAPD_F (int) krbv4_ldap_auth();
|
||||
/*
|
||||
* Other...
|
||||
*/
|
||||
#define SLAP_SB_MAX_INCOMING_DEFAULT (1<<18 - 1)
|
||||
#define SLAP_SB_MAX_INCOMING_AUTH (1<<24 - 1)
|
||||
#define SLAP_SB_MAX_INCOMING_DEFAULT ((1<<18) - 1)
|
||||
#define SLAP_SB_MAX_INCOMING_AUTH ((1<<24) - 1)
|
||||
|
||||
LDAP_SLAPD_F (ber_len_t) sockbuf_max_incoming;
|
||||
LDAP_SLAPD_F (ber_len_t) sockbuf_max_incoming_auth;
|
||||
|
@ -17,6 +17,8 @@
|
||||
#include <ac/time.h>
|
||||
#include <ac/unistd.h>
|
||||
|
||||
#include <ldap_pvt.h>
|
||||
|
||||
#include "slap.h"
|
||||
|
||||
/*
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <ac/string.h>
|
||||
|
||||
#include "slap.h"
|
||||
#include <ldif.h>
|
||||
|
||||
static char *supportedFeatures[] = {
|
||||
"1.3.6.1.4.1.4203.1.5.1", /* All Operational Attributes ("+") */
|
||||
@ -146,7 +147,6 @@ root_dse_info(
|
||||
int read_root_dse_file( const char *fname )
|
||||
{
|
||||
FILE *fp;
|
||||
char *line, *savefname, *saveline;
|
||||
int rc = 0, lineno = 0, lmax = 0;
|
||||
char *buf = NULL;
|
||||
|
||||
@ -164,7 +164,6 @@ int read_root_dse_file( const char *fname )
|
||||
usr_attr->e_attrs = NULL;
|
||||
|
||||
while( ldif_read_record( fp, &lineno, &buf, &lmax ) ) {
|
||||
ID id;
|
||||
Entry *e = str2entry( buf );
|
||||
|
||||
if( e == NULL ) {
|
||||
|
@ -60,11 +60,11 @@ slap_sasl_log(
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
|
||||
"SASL [conn=%d] %s: %s\n",
|
||||
"SASL [conn=%ld] %s: %s\n",
|
||||
conn ? conn->c_connid : -1,
|
||||
label, message ));
|
||||
#else
|
||||
Debug( level, "SASL [conn=%d] %s: %s\n",
|
||||
Debug( level, "SASL [conn=%ld] %s: %s\n",
|
||||
conn ? conn->c_connid: -1,
|
||||
label, message );
|
||||
#endif
|
||||
@ -617,13 +617,13 @@ int slap_sasl_bind(
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
|
||||
"sasl_bind: conn %ld dn=\"%s\" mech=%s datalen=%d\n",
|
||||
"sasl_bind: conn %ld dn=\"%s\" mech=%s datalen=%ld\n",
|
||||
conn->c_connid, dn,
|
||||
conn->c_sasl_bind_in_progress ? "<continuing>" : conn->c_sasl_bind_mech,
|
||||
cred ? cred->bv_len : 0 ));
|
||||
#else
|
||||
Debug(LDAP_DEBUG_ARGS,
|
||||
"==> sasl_bind: dn=\"%s\" mech=%s datalen=%d\n", dn,
|
||||
"==> sasl_bind: dn=\"%s\" mech=%s datalen=%ld\n", dn,
|
||||
conn->c_sasl_bind_in_progress ? "<continuing>":conn->c_sasl_bind_mech,
|
||||
cred ? cred->bv_len : 0 );
|
||||
#endif
|
||||
|
@ -1104,7 +1104,7 @@ caseExactIgnoreSubstringsMatch(
|
||||
void *assertedValue )
|
||||
{
|
||||
int match = 0;
|
||||
SubstringsAssertion *sub;
|
||||
SubstringsAssertion *sub = NULL;
|
||||
struct berval left;
|
||||
int i;
|
||||
ber_len_t inlen=0;
|
||||
@ -3530,7 +3530,6 @@ asn1_integer2str(ASN1_INTEGER *a)
|
||||
*/
|
||||
while (base < n) {
|
||||
unsigned int carry;
|
||||
unsigned int temp;
|
||||
|
||||
carry = 0;
|
||||
for (i = base; i<n; i++ ) {
|
||||
@ -3602,7 +3601,6 @@ certificateExactConvert(
|
||||
struct berval *serial;
|
||||
struct berval *issuer_dn;
|
||||
struct berval *bv_tmp;
|
||||
int ret;
|
||||
|
||||
xcert = d2i_X509(NULL, &p, in->bv_len);
|
||||
if ( !xcert ) {
|
||||
@ -4090,7 +4088,7 @@ utcTimeNormalize(
|
||||
return LBER_ERROR_MEMORY;
|
||||
}
|
||||
|
||||
sprintf( out->bv_val, "%02ld%02ld%02ld%02ld%02ld%02ldZ",
|
||||
sprintf( out->bv_val, "%02d%02d%02d%02d%02d%02dZ",
|
||||
parts[1], parts[2] + 1, parts[3] + 1,
|
||||
parts[4], parts[5], parts[6] );
|
||||
out->bv_len = 13;
|
||||
@ -4145,7 +4143,7 @@ generalizedTimeNormalize(
|
||||
return LBER_ERROR_MEMORY;
|
||||
}
|
||||
|
||||
sprintf( out->bv_val, "%02ld%02ld%02ld%02ld%02ld%02ld%02ldZ",
|
||||
sprintf( out->bv_val, "%02d%02d%02d%02d%02d%02d%02dZ",
|
||||
parts[0], parts[1], parts[2] + 1, parts[3] + 1,
|
||||
parts[4], parts[5], parts[6] );
|
||||
out->bv_len = 15;
|
||||
|
@ -293,7 +293,6 @@ parse_at(
|
||||
int code;
|
||||
const char *err;
|
||||
char *oid = NULL;
|
||||
char *soid = NULL;
|
||||
|
||||
at = ldap_str2attributetype(line,&code,&err,LDAP_SCHEMA_ALLOW_ALL);
|
||||
if ( !at ) {
|
||||
|
@ -219,7 +219,7 @@ set_filter (SET_GATHER gatherer,
|
||||
*results = NULL;
|
||||
|
||||
stp = -1;
|
||||
while (c = *filter++) {
|
||||
while ((c = *filter++)) {
|
||||
set = NULL;
|
||||
switch (c) {
|
||||
case ' ':
|
||||
@ -390,7 +390,7 @@ set_filter (SET_GATHER gatherer,
|
||||
_error:
|
||||
if (IS_SET(set))
|
||||
set_dispose(set);
|
||||
while (set = SF_POP()) {
|
||||
while ((set = SF_POP())) {
|
||||
if (IS_SET(set))
|
||||
set_dispose(set);
|
||||
}
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include <stdio.h>
|
||||
#include <ac/socket.h>
|
||||
|
||||
#include <ldap_pvt.h>
|
||||
|
||||
#include "slap.h"
|
||||
|
||||
#ifdef HAVE_TLS
|
||||
|
@ -43,8 +43,8 @@
|
||||
void
|
||||
slap_init_user( char *user, char *group )
|
||||
{
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
uid_t uid = 0;
|
||||
gid_t gid = 0;
|
||||
int got_uid = 0, got_gid = 0;
|
||||
|
||||
if ( user ) {
|
||||
|
@ -134,7 +134,6 @@ value_match(
|
||||
int rc;
|
||||
struct berval *nv1 = NULL;
|
||||
struct berval *nv2 = NULL;
|
||||
Syntax *syntax;
|
||||
|
||||
if( !mr->smr_match ) {
|
||||
return LDAP_INAPPROPRIATE_MATCHING;
|
||||
|
Loading…
Reference in New Issue
Block a user