rc = ber_scanf( ber, "{oo}", &type, &value );
if( rc == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
+ "get_ava: ber_scanf failure\n" ));
+#else
Debug( LDAP_DEBUG_ANY, " get_ava ber_scanf\n", 0, 0, 0 );
+#endif
*text = "Error decoding attribute value assertion";
return SLAPD_DISCONNECT;
}
FD_SET( s, &slap_daemon.sd_actives );
FD_SET( s, &slap_daemon.sd_readers );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
+ "slapd_add: added %ld%s%s\n",
+ (long)s,
+ FD_ISSET(s, &slap_daemon.sd_readers) ? "r" : "",
+ FD_ISSET(s, &slap_daemon.sd_writers) ? "w" : "" ));
+#else
Debug( LDAP_DEBUG_CONNS, "daemon: added %ld%s%s\n",
(long) s,
FD_ISSET(s, &slap_daemon.sd_readers) ? "r" : "",
FD_ISSET(s, &slap_daemon.sd_writers) ? "w" : "" );
-
+#endif
ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
}
void slapd_remove(ber_socket_t s, int wake) {
ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
+ "slapd_remove: removing %ld%s%s\n",
+ (long) s,
+ FD_ISSET(s, &slap_daemon.sd_readers) ? "r" : "",
+ FD_ISSET(s, &slap_daemon.sd_writers) ? "w" : "" ));
+#else
Debug( LDAP_DEBUG_CONNS, "daemon: removing %ld%s%s\n",
(long) s,
FD_ISSET(s, &slap_daemon.sd_readers) ? "r" : "",
FD_ISSET(s, &slap_daemon.sd_writers) ? "w" : "" );
-
+#endif
FD_CLR( s, &slap_daemon.sd_actives );
FD_CLR( s, &slap_daemon.sd_readers );
FD_CLR( s, &slap_daemon.sd_writers );
}
static void slapd_close(ber_socket_t s) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
+ "slapd_close: closing %ld\n", (long)s ));
+#else
Debug( LDAP_DEBUG_CONNS, "daemon: closing %ld\n",
(long) s, 0, 0 );
+#endif
tcp_close(s);
}
hints.ai_family = AF_LOCAL;
/* host specifies a service in this case */
if (err = getaddrinfo(NULL, host, &hints, &res)) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "slap_get_listener_addresses: getaddrinfo failed: %s\n",
+ AC_GAI_STRERROR(err) ));
+#else
Debug( LDAP_DEBUG_ANY, "daemon: getaddrinfo failed: %s\n",
AC_GAI_STRERROR(err), 0, 0);
+#endif
return -1;
}
} else
snprintf(serv, sizeof serv, "%d", port);
hints.ai_family = AF_UNSPEC;
if (err = getaddrinfo(host, serv, &hints, &res)) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "slap_get_listener_addresses: getaddrinfo failed: %s\n",
+ AC_GAI_STRERROR(err) ));
+#else
Debug( LDAP_DEBUG_ANY, "daemon: getaddrinfo failed: %s\n",
AC_GAI_STRERROR(err), 0, 0);
+#endif
return -1;
}
}
(*sap)->sa_family = AF_LOCAL;
if ( strlen(host) >
(sizeof(((struct sockaddr_un *)*sal)->sun_path) - 1) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "slap_get_listener_addresses: domain socket path (%s) too long in URL\n",
+ host ));
+#else
Debug( LDAP_DEBUG_ANY,
"daemon: domain socket path (%s) too long in URL",
host, 0, 0);
+#endif
goto errexit;
}
strcpy( ((struct sockaddr_un *)*sap)->sun_path, host );
} else if ( !inet_aton( host, &in ) ) {
struct hostent *he = gethostbyname( host );
if( he == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "slap_get_listener_addresses: invalid host %s\n",
+ host ));
+#else
Debug( LDAP_DEBUG_ANY,
"daemon: invalid host %s", host, 0, 0);
+#endif
return -1;
}
AC_MEMCPY( &in, he->h_addr, sizeof( in ) );
rc = ldap_url_parse( url, &lud );
if( rc != LDAP_URL_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ "slap_open_listener: listen URL \"%s\" parse error %d\n",
+ url, rc ));
+#else
Debug( LDAP_DEBUG_ANY,
"daemon: listen URL \"%s\" parse error=%d\n",
url, rc, 0 );
+#endif
return NULL;
}
#ifndef HAVE_TLS
if( ldap_pvt_url_scheme2tls( lud->lud_scheme ) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "slap_open_listener: TLS is not supported (%s)\n",
+ url ));
+#else
Debug( LDAP_DEBUG_ANY,
"daemon: TLS not supported (%s)\n",
url, 0, 0 );
+#endif
ldap_free_urldesc( lud );
return NULL;
}
err = slap_get_listener_addresses(lud->lud_host, 0, &sal);
}
#else
+
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "slap_open_listener: URL scheme is not supported: %s\n",
+ url ));
+#else
Debug( LDAP_DEBUG_ANY, "daemon: URL scheme not supported: %s",
url, 0, 0);
+#endif
ldap_free_urldesc( lud );
return NULL;
#endif
l.sl_sd = socket( (*sal)->sa_family, SOCK_STREAM, 0);
if ( l.sl_sd == AC_SOCKET_INVALID ) {
int err = sock_errno();
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ "slap_open_listener: socket() failed errno=%d (%s)\n",
+ err, sock_errstr(err) ));
+#else
Debug( LDAP_DEBUG_ANY,
"daemon: socket() failed errno=%d (%s)\n", err,
sock_errstr(err), 0 );
+#endif
sal++;
continue;
}
#ifndef HAVE_WINSOCK
if ( l.sl_sd >= dtblsize ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ "slap_open_listener: listener descriptor %ld is too great %ld\n",
+ (long)l.sl_sd, (long)dtblsize ));
+#else
Debug( LDAP_DEBUG_ANY,
"daemon: listener descriptor %ld is too great %ld\n",
(long) l.sl_sd, (long) dtblsize, 0 );
+#endif
tcp_close( l.sl_sd );
sal++;
continue;
(char *) &tmp, sizeof(tmp) );
if ( rc == AC_SOCKET_ERROR ) {
int err = sock_errno();
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "slap_open_listener: setsockopt( %ld, SO_REUSEADDR ) failed errno %d (%s)\n",
+ (long)l.sl_sd, err, sock_errstr(err) ));
+#else
Debug( LDAP_DEBUG_ANY,
"slapd(%ld): setsockopt(SO_REUSEADDR) failed errno=%d (%s)\n",
(long) l.sl_sd, err, sock_errstr(err) );
+#endif
}
#endif
}
if (!bind(l.sl_sd, *sal, addrlen))
break;
err = sock_errno();
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "slap_open_listener: bind(%ld) failed errno=%d (%s)\n",
+ (long)l.sl_sd, err, sock_errstr(err) ));
+#else
Debug( LDAP_DEBUG_ANY, "daemon: bind(%ld) failed errno=%d (%s)\n",
(long) l.sl_sd, err, sock_errstr(err) );
+#endif
tcp_close( l.sl_sd );
sal++;
} /* while ( *sal != NULL ) */
if ( *sal == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "slap_open_listener: bind(%ld) failed.\n", (long)l.sl_sd ));
+#else
Debug( LDAP_DEBUG_ANY, "daemon: bind(%ld) failed\n",
(long) l.sl_sd, 0, 0 );
+#endif
slap_free_listener_addresses(psal);
return NULL;
}
char *addr = ((struct sockaddr_un *)*sal)->sun_path;
if ( chmod( addr, S_IRWXU ) < 0 ) {
int err = sock_errno();
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "slap_open_listener: fchmod(%ld) failed errno=%d (%s)\n",
+ (long)l.sl_sd, err, sock_errstr(err) ));
+#else
Debug( LDAP_DEBUG_ANY, "daemon: fchmod(%ld) failed errno=%d (%s)",
(long) l.sl_sd, err, sock_errstr(err) );
+#endif
tcp_close( l.sl_sd );
slap_free_listener_addresses(psal);
return NULL;
#endif /* LDAP_PF_INET6 */
default:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "slap_open_listener: unsupported address family (%d)\n",
+ (int)(*sal)->sa_family ));
+#else
Debug( LDAP_DEBUG_ANY, "daemon: unsupported address family (%d)\n",
(int) (*sal)->sa_family, 0, 0 );
+#endif
break;
}
li = ch_malloc( sizeof( Listener ) );
*li = l;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_RESULTS,
+ "slap_open_listener: daemon initialzed %s\n", l.sl_url ));
+#else
Debug( LDAP_DEBUG_TRACE, "daemon: initialized %s\n",
l.sl_url, 0, 0 );
-
+#endif
return li;
}
int i, rc;
char **u;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ARGS,
+ "slapd_daemon_init: %s\n",
+ urls ? urls : "<null>" ));
+#else
Debug( LDAP_DEBUG_ARGS, "daemon_init: %s\n",
urls ? urls : "<null>", 0, 0 );
-
+#endif
if( (rc = sockinit()) != 0 ) {
return rc;
}
* this byte arrives.
*/
if( (rc = lutil_pair( wake_sds )) < 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ "slap_daemon_init: lutil_pair() failed rc=%d\n", rc ));
+#else
Debug( LDAP_DEBUG_ANY,
"daemon: lutil_pair() failed rc=%d\n", rc, 0, 0 );
+#endif
return rc;
}
u = str2charray( urls, " " );
if( u == NULL || u[0] == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ "slap_daemon_init: no urls (%s) provided.\n", urls ));
+#else
Debug( LDAP_DEBUG_ANY, "daemon_init: no urls (%s) provided.\n",
urls, 0, 0 );
-
+#endif
return -1;
}
for( i=0; u[i] != NULL; i++ ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
+ "slap_daemon_init: listen on %s\n.", u[i] ));
+#else
Debug( LDAP_DEBUG_TRACE, "daemon_init: listen on %s\n",
u[i], 0, 0 );
+#endif
}
if( i == 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "slap_daemon_init: no listeners to open (%s)\n", urls ));
+#else
Debug( LDAP_DEBUG_ANY, "daemon_init: no listeners to open (%s)\n",
urls, 0, 0 );
+#endif
charray_free( u );
return -1;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "slap_daemon_init: %d listeners to open...\n", i ));
+#else
Debug( LDAP_DEBUG_TRACE, "daemon_init: %d listeners to open...\n",
i, 0, 0 );
-
+#endif
slap_listeners = ch_malloc( (i+1)*sizeof(Listener *) );
for(i = 0; u[i] != NULL; i++ ) {
}
slap_listeners[i] = NULL;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
+ "slap_daemon_init: %d listeners opened\n", i ));
+#else
Debug( LDAP_DEBUG_TRACE, "daemon_init: %d listeners opened\n",
i, 0, 0 );
-
+#endif
charray_free( u );
ldap_pvt_thread_mutex_init( &slap_daemon.sd_mutex );
return !i;
if ( listen( slap_listeners[l]->sl_sd, SLAPD_LISTEN ) == -1 ) {
int err = sock_errno();
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ "slapd_daemon_task: listen( %s, 5 ) failed errno=%d (%s)\n",
+ slap_listeners[l]->sl_url, err, sock_errstr(err) ));
+#else
Debug( LDAP_DEBUG_ANY,
"daemon: listen(%s, 5) failed errno=%d (%s)\n",
slap_listeners[l]->sl_url, err,
sock_errstr(err) );
+#endif
return( (void*)-1 );
}
if ( slap_listeners[l]->sl_sd == AC_SOCKET_INVALID )
continue;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
+ "slapd_daemon_task: select: listen=%d active_threads=%d tvp=%s\n",
+ slap_listeners[l]->sl_sd, at, tvp == NULL ? "NULL" : "zero" ));
+#else
Debug( LDAP_DEBUG_CONNS,
"daemon: select: listen=%d active_threads=%d tvp=%s\n",
slap_listeners[l]->sl_sd, at,
tvp == NULL ? "NULL" : "zero" );
+#endif
}
switch(ns = select( nfds, &readfds,
}
if( err != EINTR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "slapd_daemon_task: select failed (%d): %s\n",
+ err, sock_errstr(err) ));
+#else
Debug( LDAP_DEBUG_CONNS,
"daemon: select failed (%d): %s\n",
err, sock_errstr(err), 0 );
-
+#endif
slapd_shutdown = -1;
}
}
case 0: /* timeout - let threads run */
ebadf = 0;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL2,
+ "slapd_daemon_task: select timeout - yielding\n" ));
+#else
Debug( LDAP_DEBUG_CONNS, "daemon: select timeout - yielding\n",
0, 0, 0 );
+#endif
ldap_pvt_thread_yield();
continue;
if( slapd_shutdown ) continue;
ebadf = 0;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL2,
+ "slapd_daemon_task: activity on %d descriptors\n", ns ));
+#else
Debug( LDAP_DEBUG_CONNS, "daemon: activity on %d descriptors\n",
ns, 0, 0 );
+#endif
/* FALL THRU */
}
(struct sockaddr *) &from, &len );
if ( s == AC_SOCKET_INVALID ) {
int err = sock_errno();
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ "slapd_daemon_task: accept(%ld) failed errno=%d (%s)\n",
+ (long)slap_listeners[l]->sl_sd, err, sock_errstr(err) ));
+#else
Debug( LDAP_DEBUG_ANY,
"daemon: accept(%ld) failed errno=%d (%s)\n",
(long) slap_listeners[l]->sl_sd, err,
sock_errstr(err) );
+#endif
continue;
}
#ifndef HAVE_WINSOCK
/* make sure descriptor number isn't too great */
if ( s >= dtblsize ) {
+#ifdef NEW_LGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ "slapd_daemon_task: %ld beyond descriptor table size %ld\n",
+ (long)s, (long)dtblsize ));
+#else
Debug( LDAP_DEBUG_ANY,
"daemon: %ld beyond descriptor table size %ld\n",
(long) s, (long) dtblsize, 0 );
+#endif
slapd_close(s);
continue;
}
(char *) &tmp, sizeof(tmp) );
if ( rc == AC_SOCKET_ERROR ) {
int err = sock_errno();
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ "slapd_daemon_task: setsockopt( %ld, SO_KEEPALIVE) failed errno=%d (%s)\n",
+ (long)s, err, sock_errstr(err) ));
+#else
Debug( LDAP_DEBUG_ANY,
"slapd(%ld): setsockopt(SO_KEEPALIVE) failed "
"errno=%d (%s)\n", (long) s, err, sock_errstr(err) );
+#endif
}
#endif
#ifdef TCP_NODELAY
(char *)&tmp, sizeof(tmp) );
if ( rc == AC_SOCKET_ERROR ) {
int err = sock_errno();
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ "slapd_daemon_task: setsockopt( %ld, TCP_NODELAY) failed errno=%d (%s)\n",
+ (long)s, err, sock_errstr(err) ));
+#else
Debug( LDAP_DEBUG_ANY,
"slapd(%ld): setsockopt(TCP_NODELAY) failed "
"errno=%d (%s)\n", (long) s, err, sock_errstr(err) );
+#endif
}
#endif
}
#endif
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
+ "slapd_daemon_task: new connection on %ld\n", (long)s ));
+#else
Debug( LDAP_DEBUG_CONNS, "daemon: new connection on %ld\n",
(long) s, 0, 0 );
-
+#endif
switch ( from.sa_addr.sa_family ) {
# ifdef LDAP_PF_LOCAL
case AF_LOCAL:
if( authid ) ch_free(authid);
if( id < 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+ "slapd_daemon_task: connection_init(%ld, %s, %s) failed.\n",
+ (long)s, peername, slap_listeners[l]->sl_name ));
+#else
Debug( LDAP_DEBUG_ANY,
"daemon: connection_init(%ld, %s, %s) failed.\n",
(long) s,
peername,
slap_listeners[l]->sl_name );
+#endif
slapd_close(s);
continue;
}
}
#ifdef LDAP_DEBUG
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL2,
+ "slapd_daemon_task: activity on " ));
+#else
Debug( LDAP_DEBUG_CONNS, "daemon: activity on:", 0, 0, 0 );
+#endif
#ifdef HAVE_WINSOCK
for ( i = 0; i < readfds.fd_count; i++ ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL2,
+ " %d%s", readfs.fd_array[i], "r", 0 );
+#else
Debug( LDAP_DEBUG_CONNS, " %d%s",
readfds.fd_array[i], "r", 0 );
+#endif
}
for ( i = 0; i < writefds.fd_count; i++ ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL2,
+ " %d%s", writefds.fd_array[i], "w" ));
+#else
Debug( LDAP_DEBUG_CONNS, " %d%s",
writefds.fd_array[i], "w", 0 );
+#endif
}
+
#else
for ( i = 0; i < nfds; i++ ) {
int r, w;
r = FD_ISSET( i, &readfds );
w = FD_ISSET( i, &writefds );
if ( r || w ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL2,
+ " %d%s%s", i,
+ r ? "r" : "", w ? "w" : "" ));
+#else
Debug( LDAP_DEBUG_CONNS, " %d%s%s", i,
r ? "r" : "", w ? "w" : "" );
+#endif
}
}
#endif
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL2, "\n" ));
+#else
Debug( LDAP_DEBUG_CONNS, "\n", 0, 0, 0 );
+#endif
+
#endif
/* loop through the writers */
if ( is_listener ) {
continue;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL2,
+ "slapd_daemon_task: write active on %d\n", wd ));
+#else
Debug( LDAP_DEBUG_CONNS,
"daemon: write active on %d\n",
wd, 0, 0 );
-
+#endif
/*
* NOTE: it is possible that the connection was closed
* and that the stream is now inactive.
continue;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL2,
+ "slapd_daemon_task: read activity on %d\n", rd ));
+#else
Debug ( LDAP_DEBUG_CONNS,
"daemon: read activity on %d\n", rd, 0, 0 );
-
+#endif
/*
* NOTE: it is possible that the connection was closed
* and that the stream is now inactive.
}
if( slapd_shutdown > 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_CRIT,
+ "slapd_daemon_task: shutdown requested and initiated.\n"));
+#else
Debug( LDAP_DEBUG_TRACE,
"daemon: shutdown requested and initiated.\n",
0, 0, 0 );
+#endif
} else if ( slapd_shutdown < 0 ) {
#ifdef HAVE_NT_SERVICE_MANAGER
if (slapd_shutdown == -1)
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_CRIT,
+ "slapd_daemon_task: shutdown initiated by Service Manager.\n"));
+#else
Debug( LDAP_DEBUG_TRACE,
"daemon: shutdown initiated by Service Manager.\n",
0, 0, 0);
+#endif
else
#endif
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_CRIT,
+ "slapd_daemon_task: abnormal condition, shutdown initiated.\n" ));
+#else
Debug( LDAP_DEBUG_TRACE,
"daemon: abnormal condition, shutdown initiated.\n",
0, 0, 0 );
+#endif
} else {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_CRIT,
+ "slapd_daemon_task: no active streams, shutdown initiated.\n" ));
+#else
Debug( LDAP_DEBUG_TRACE,
"daemon: no active streams, shutdown initiated.\n",
0, 0, 0 );
+#endif
}
for ( l = 0; slap_listeners[l] != NULL; l++ ) {
}
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_CRIT,
+ "slapd_daemon_task: shutdown waiting for %d threads to terminate.\n",
+ ldap_pvt_thread_pool_backload(&connection_pool) ));
+#else
Debug( LDAP_DEBUG_ANY,
"slapd shutdown: waiting for %d threads to terminate\n",
ldap_pvt_thread_pool_backload(&connection_pool), 0, 0 );
-
+#endif
ldap_pvt_thread_pool_destroy(&connection_pool, 1);
return NULL;
0, slapd_daemon_task, NULL );
if ( rc != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+ "slapd_daemon: listener ldap_pvt_thread_create failed (%d).\n", rc ));
+#else
Debug( LDAP_DEBUG_ANY,
"listener ldap_pvt_thread_create failed (%d)\n", rc, 0, 0 );
+#endif
return rc;
}
RETSIGTYPE
slap_sig_shutdown( int sig )
{
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_CRIT,
+ "slap_sig_shutdown: signal %d\n", sig ));
+#else
Debug(LDAP_DEBUG_TRACE, "slap_sig_shutdown: signal %d\n", sig, 0, 0);
+#endif
/*
* If the NT Service Manager is controlling the server, we don't
#if HAVE_NT_SERVICE_MANAGER && SIGBREAK
if (is_NT_Service && sig == SIGBREAK)
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "connection", LDAP_LEVEL_CRIT,
+ "slap_sig_shutdown: SIGBREAK ignored.\n" ));
+#else
Debug(LDAP_DEBUG_TRACE, "slap_sig_shutdown: SIGBREAK ignored.\n",
0, 0, 0);
+#endif
else
#endif
slapd_shutdown = sig;
int rc;
int manageDSAit;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "do_delete: conn %d\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_TRACE, "do_delete\n", 0, 0, 0 );
+#endif
/*
* Parse the delete request. It looks like this:
*/
if ( ber_scanf( op->o_ber, "a", &dn ) == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_delete: conn: %d ber_scanf failed\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
+#endif
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "decoding error" );
return SLAPD_DISCONNECT;
}
if( ( rc = get_ctrls( conn, op, 1 ) ) != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "oepration", LDAP_LEVEL_ERR,
+ "do_delete: conn %d get_ctrls failed\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "do_delete: get_ctrls failed\n", 0, 0, 0 );
+#endif
goto cleanup;
}
ndn = ch_strdup( dn );
if( dn_normalize( ndn ) == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_delete: conn %d invalid dn (%s).\n", conn->c_connid, dn ));
+#else
Debug( LDAP_DEBUG_ANY, "do_delete: invalid dn (%s)\n", dn, 0, 0 );
+#endif
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
"invalid DN", NULL, NULL );
goto cleanup;
}
if( ndn == '\0' ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "do_delete: conn %d Attempt to delete root DSE.\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "do_delete: root dse!\n", 0, 0, 0 );
+#endif
/* protocolError would likely be a more appropriate error */
send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
NULL, "cannot delete the root DSE", NULL, NULL );
default:
dn = NULL;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "dn_validate: unknown state %d for dn \"%s\".\n",
+ state, dn_in ));
+#else
Debug( LDAP_DEBUG_ANY,
"dn_validate - unknown state %d\n", state, 0, 0 );
+#endif
break;
}
* or newline.
*/
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
+ "str2entry: \"%s\"\n", s ? s : "NULL" ));
+#else
Debug( LDAP_DEBUG_TRACE, "=> str2entry\n",
s ? s : "NULL", 0, 0 );
+#endif
/* initialize reader/writer lock */
e = (Entry *) ch_malloc( sizeof(Entry) );
if( e == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "str2entry: entry allocation failed.\n" ));
+#else
Debug( LDAP_DEBUG_ANY,
"<= str2entry NULL (entry allocation failed)\n",
0, 0, 0 );
+#endif
return( NULL );
}
}
if ( ldif_parse_line( s, &type, &value.bv_val, &value.bv_len ) != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+ "str2entry: NULL (parse_line)\n" ));
+#else
Debug( LDAP_DEBUG_TRACE,
"<= str2entry NULL (parse_line)\n", 0, 0, 0 );
+#endif
continue;
}
free( type );
if ( e->e_dn != NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+ "str2entry: entry %ld has multiple dns \"%s\" and \"%s\" (second ignored)\n",
+ e->e_id, e->e_dn, value.bv_val != NULL ? value.bv_val : "" ));
+#else
Debug( LDAP_DEBUG_ANY,
"str2entry: entry %ld has multiple dns \"%s\" and \"%s\" (second ignored)\n",
e->e_id, e->e_dn,
value.bv_val != NULL ? value.bv_val : "" );
+#endif
if( value.bv_val != NULL ) free( value.bv_val );
continue;
}
rc = slap_str2ad( type, &ad, &text );
if( rc != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+ "str2entry: str2ad(%s): %s\n", type, text ));
+#else
Debug( slapMode & SLAP_TOOL_MODE
? LDAP_DEBUG_ANY : LDAP_DEBUG_TRACE,
"<= str2entry: str2ad(%s): %s\n", type, text, 0 );
-
+#endif
if( slapMode & SLAP_TOOL_MODE ) {
entry_free( e );
free( value.bv_val );
rc = slap_str2undef_ad( type, &ad, &text );
if( rc != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+ "str2entry: str2undef_ad(%s): %s\n", type, text ));
+#else
Debug( LDAP_DEBUG_ANY,
"<= str2entry: str2undef_ad(%s): %s\n",
type, text, 0 );
+#endif
entry_free( e );
free( value.bv_val );
free( type );
ad->ad_type->sat_syntax->ssyn_validate;
if( !validate ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "str2entry: no validator for syntax %s\n",
+ ad->ad_type->sat_syntax->ssyn_oid ));
+#else
Debug( LDAP_DEBUG_ANY,
"str2entry: no validator for syntax %s\n",
ad->ad_type->sat_syntax->ssyn_oid, 0, 0 );
+#endif
entry_free( e );
free( value.bv_val );
free( type );
rc = validate( ad->ad_type->sat_syntax, &value );
if( rc != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "str2entry: invalid value for syntax %s\n",
+ ad->ad_type->sat_syntax->ssyn_oid ));
+#else
Debug( LDAP_DEBUG_ANY,
"str2entry: invalid value for syntax %s\n",
ad->ad_type->sat_syntax->ssyn_oid, 0, 0 );
+#endif
entry_free( e );
free( value.bv_val );
free( type );
ad_free( ad, 1 );
if( rc != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+ "str2entry: NULL (attr_merge)\n" ));
+#else
Debug( LDAP_DEBUG_ANY,
"<= str2entry NULL (attr_merge)\n", 0, 0, 0 );
+#endif
entry_free( e );
free( value.bv_val );
free( type );
/* check to make sure there was a dn: line */
if ( e->e_dn == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "str2entry: entry %ld has no dn.\n", e->e_id ));
+#else
Debug( LDAP_DEBUG_ANY, "str2entry: entry %ld has no dn\n",
e->e_id, 0, 0 );
+#endif
entry_free( e );
return( NULL );
}
e->e_ndn = ch_strdup( e->e_dn );
(void) dn_normalize( e->e_ndn );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL2,
+ "str2entry(%s) -> 0x%lx\n", e->e_dn, (unsigned long)e ));
+#else
Debug(LDAP_DEBUG_TRACE, "<= str2entry(%s) -> 0x%lx\n",
e->e_dn, (unsigned long) e, 0 );
-
+#endif
return( e );
}
ber = ber_init( bv );
if( ber == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "entry_decode: ber_init failed\n" ));
+#else
Debug( LDAP_DEBUG_ANY,
"<= entry_decode: ber_init failed\n",
0, 0, 0 );
+#endif
return LDAP_LOCAL_ERROR;
}
e = (Entry *) ch_malloc( sizeof(Entry) );
if( e == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "entry_decode: entry allocation failed.\n" ));
+#else
Debug( LDAP_DEBUG_ANY,
"<= entry_decode: entry allocation failed\n",
0, 0, 0 );
+#endif
return LDAP_LOCAL_ERROR;
}
return LDAP_PROTOCOL_ERROR;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL2,
+ "entry_decode: \"%s\"\n", e->e_dn ));
+#else
Debug( LDAP_DEBUG_TRACE,
"entry_decode: \"%s\"\n",
e->e_dn, 0, 0 );
-
+#endif
/* get the attrs */
for ( tag = ber_first_element( ber, &len, &last );
tag != LBER_DEFAULT;
tag = ber_scanf( ber, "{O{V}}", &type, &vals );
if ( tag == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "entry_decode: decoding error (%s)\n", e->e_dn ));
+#else
Debug( LDAP_DEBUG_ANY, "entry_decode: decoding error\n", 0, 0, 0 );
+#endif
entry_free( e );
return LDAP_PROTOCOL_ERROR;
}
if ( vals == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "entry_decode: no values for type %s\n", type ));
+#else
Debug( LDAP_DEBUG_ANY, "entry_decode: no values for type %s\n",
type, 0, 0 );
+#endif
ber_bvfree( type );
entry_free( e );
return LDAP_PROTOCOL_ERROR;
rc = slap_bv2ad( type, &ad, &text );
if( rc != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "entry_decode: str2ad(%s): %s\n", type, text ));
+#else
Debug( LDAP_DEBUG_TRACE,
"<= entry_decode: str2ad(%s): %s\n", type, text, 0 );
-
+#endif
rc = slap_bv2undef_ad( type, &ad, &text );
if( rc != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "entry_decode: str2undef_ad(%s): %s\n", type, text));
+#else
Debug( LDAP_DEBUG_ANY,
"<= entry_decode: str2undef_ad(%s): %s\n",
type, text, 0 );
+#endif
ber_bvfree( type );
ber_bvecfree( vals );
entry_free( e );
ad_free( ad, 1 );
if( rc != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "entry_decode: attr_merge failed\n"));
+#else
Debug( LDAP_DEBUG_ANY,
"<= entry_decode: attr_merge failed\n", 0, 0, 0 );
+#endif
ber_bvfree( type );
ber_bvecfree( vals );
entry_free( e );
return LDAP_PROTOCOL_ERROR;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+ "entry_decode: %s\n", e->e_dn ));
+#else
Debug(LDAP_DEBUG_TRACE, "<= entry_decode(%s)\n",
e->e_dn, 0, 0 );
+#endif
*entry = e;
return LDAP_SUCCESS;
Attribute *a;
BerElement *ber;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "entry_encode: id: 0x%08lx \"%s\"\n",
+ e->e_id, e->e_dn ));
+#else
Debug( LDAP_DEBUG_TRACE, "=> entry_encode(0x%08lx): %s\n",
e->e_id, e->e_dn, 0 );
-
+#endif
ber = ber_alloc_t( LBER_USE_DER );
if( ber == NULL ) {
goto done;
done:
ber_free( ber, 1 );
if( rc ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "entry_encode: id=0x%08lx failed (%d)\n", e->e_id, rc ));
+#else
Debug( LDAP_DEBUG_ANY, "=> entry_encode(0x%08lx): failed (%d)\n",
e->e_id, rc, 0 );
+#endif
}
return rc;
}
struct berval *rspdata;
LDAPControl **rspctrls;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "do_extended: conn %s\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_TRACE, "do_extended\n", 0, 0, 0 );
-
+#endif
reqoid = NULL;
reqdata = NULL;
if( op->o_protocol < LDAP_VERSION3 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_extended: protocol version (%d) too low.\n", op->o_protocol ));
+#else
Debug( LDAP_DEBUG_ANY, "do_extended: protocol version (%d) too low\n",
op->o_protocol, 0 ,0 );
+#endif
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "requires LDAPv3" );
rc = -1;
}
if ( ber_scanf( op->o_ber, "{a" /*}*/, &reqoid ) == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_extended: conn %d ber_scanf failed\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "do_extended: ber_scanf failed\n", 0, 0 ,0 );
+#endif
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "decoding error" );
rc = -1;
}
if( !(ext = find_extop(supp_ext_list, reqoid)) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_extended: conn %d unsupported operation \"%s\"\n",
+ conn->c_connid, reqoid ));
+#else
Debug( LDAP_DEBUG_ANY, "do_extended: unsupported operation \"%s\"\n",
reqoid, 0 ,0 );
+#endif
send_ldap_result( conn, op, rc = LDAP_PROTOCOL_ERROR,
NULL, "unsupported extended operation", NULL, NULL );
goto done;
if( ber_peek_tag( op->o_ber, &len ) == LDAP_TAG_EXOP_REQ_VALUE ) {
if( ber_scanf( op->o_ber, "O", &reqdata ) == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_extended: conn %d ber_scanf failed\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "do_extended: ber_scanf failed\n", 0, 0 ,0 );
+#endif
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "decoding error" );
rc = -1;
}
if( (rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_extended: conn %d get_ctrls failed\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "do_extended: get_ctrls failed\n", 0, 0 ,0 );
+#endif
return rc;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+ "do_extended: conn %d oid=%d\n.", conn->c_connid, reqoid ));
+#else
Debug( LDAP_DEBUG_ARGS, "do_extended: oid=%s\n", reqoid, 0 ,0 );
-
+#endif
rspoid = NULL;
rspdata = NULL;
rspctrls = NULL;
return(ext);
}
return(NULL);
-}
\ No newline at end of file
+}
char *ftmp = NULL;
struct berval escaped;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY, "get_filter: conn %d\n",
+ conn->c_connid ));
+#else
Debug( LDAP_DEBUG_FILTER, "begin get_filter\n", 0, 0, 0 );
-
+#endif
/*
* A filter looks like this coming in:
* Filter ::= CHOICE {
switch ( f->f_choice ) {
case LDAP_FILTER_EQUALITY:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL2,
+ "get_filter: conn %d EQUALITY\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_FILTER, "EQUALITY\n", 0, 0, 0 );
-
+#endif
err = get_ava( ber, &f->f_ava, SLAP_MR_EQUALITY, text );
if ( err != LDAP_SUCCESS ) {
break;
break;
case LDAP_FILTER_SUBSTRINGS:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "get_filter: conn %d SUBSTRINGS\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_FILTER, "SUBSTRINGS\n", 0, 0, 0 );
+#endif
err = get_substring_filter( conn, ber, f, fstr, text );
break;
case LDAP_FILTER_GE:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "get_filter: conn %d GE\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_FILTER, "GE\n", 0, 0, 0 );
-
+#endif
err = get_ava( ber, &f->f_ava, SLAP_MR_ORDERING, text );
if ( err != LDAP_SUCCESS ) {
break;
break;
case LDAP_FILTER_LE:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "get_filter: conn %d LE\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_FILTER, "LE\n", 0, 0, 0 );
-
+#endif
err = get_ava( ber, &f->f_ava, SLAP_MR_ORDERING, text );
if ( err != LDAP_SUCCESS ) {
break;
case LDAP_FILTER_PRESENT: {
struct berval type;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "get_filter: conn %d PRESENT\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_FILTER, "PRESENT\n", 0, 0, 0 );
-
+#endif
if ( ber_scanf( ber, "o", &type ) == LBER_ERROR ) {
err = SLAPD_DISCONNECT;
*text = "error decoding filter";
} break;
case LDAP_FILTER_APPROX:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "get_filter: conn %d APPROX\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_FILTER, "APPROX\n", 0, 0, 0 );
-
+#endif
err = get_ava( ber, &f->f_ava, SLAP_MR_EQUALITY_APPROX, text );
if ( err != LDAP_SUCCESS ) {
break;
break;
case LDAP_FILTER_AND:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "get_filter: conn %d AND\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_FILTER, "AND\n", 0, 0, 0 );
+#endif
err = get_filter_list( conn, ber, &f->f_and, &ftmp, text );
if ( err != LDAP_SUCCESS ) {
break;
break;
case LDAP_FILTER_OR:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "get_filter: conn %d OR\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_FILTER, "OR\n", 0, 0, 0 );
+#endif
err = get_filter_list( conn, ber, &f->f_and, &ftmp, text );
if ( err != LDAP_SUCCESS ) {
break;
break;
case LDAP_FILTER_NOT:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "get_filter: conn %d NOT\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_FILTER, "NOT\n", 0, 0, 0 );
+#endif
(void) ber_skip_tag( ber, &len );
err = get_filter( conn, ber, &f->f_not, &ftmp, text );
if ( err != LDAP_SUCCESS ) {
break;
case LDAP_FILTER_EXT:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "get_filter: conn %d EXTENSIBLE\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_FILTER, "EXTENSIBLE\n", 0, 0, 0 );
+#endif
err = get_mra( ber, &f->f_mra, text );
if ( err != LDAP_SUCCESS ) {
default:
(void) ber_skip_tag( ber, &len );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
+ "get_filter: conn %d unknown filter type=%lu\n",
+ conn->c_connid, f->f_choice ));
+#else
Debug( LDAP_DEBUG_ANY, "get_filter: unknown filter type=%lu\n",
f->f_choice, 0, 0 );
+#endif
f->f_choice = SLAPD_FILTER_COMPUTED;
f->f_result = SLAPD_COMPARE_UNDEFINED;
*fstr = ch_strdup( "(undefined)" );
*filt = f;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL2,
+ "get_filter: conn %d exit\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_FILTER, "end get_filter %d\n", err, 0, 0 );
+#endif
return( err );
}
ber_len_t len;
char *last, *ftmp;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
+ "get_filter_list: conn %d start\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_FILTER, "begin get_filter_list\n", 0, 0, 0 );
-
+#endif
*fstr = NULL;
new = f;
for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT;
}
*new = NULL;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
+ "get_filter_list: conn %d exit\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_FILTER, "end get_filter_list\n", 0, 0, 0 );
+#endif
return( LDAP_SUCCESS );
}
struct berval *nvalue;
*text = "error decoding filter";
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
+ "get_substring_filter: conn %d begin\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_FILTER, "begin get_substring_filter\n", 0, 0, 0 );
-
+#endif
if ( ber_scanf( ber, "{o" /*}*/, &type ) == LBER_ERROR ) {
return SLAPD_DISCONNECT;
}
default:
rc = LDAP_PROTOCOL_ERROR;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
+ "get_filter_substring: conn %d unknown substring choice=%ld\n",
+ conn->c_connid, (long)tag ));
+#else
Debug( LDAP_DEBUG_FILTER,
" unknown substring choice=%ld\n",
(long) tag, 0, 0 );
-
+#endif
ber_bvfree( value );
goto return_error;
}
switch ( tag ) {
case LDAP_SUBSTRING_INITIAL:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "get_substring_filter: conn %d INITIAL\n",
+ conn->c_connid ));
+#else
Debug( LDAP_DEBUG_FILTER, " INITIAL\n", 0, 0, 0 );
+#endif
if ( f->f_sub_initial != NULL ) {
ber_bvfree( value );
goto return_error;
break;
case LDAP_SUBSTRING_ANY:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "get_substring_filter: conn %d ANY\n",
+ conn->c_connid ));
+#else
Debug( LDAP_DEBUG_FILTER, " ANY\n", 0, 0, 0 );
+#endif
if( ber_bvecadd( &f->f_sub_any, value ) < 0 ) {
ber_bvfree( value );
goto return_error;
break;
case LDAP_SUBSTRING_FINAL:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "get_substring_filter: conn %d FINAL\n",
+ conn->c_connid ));
+#else
Debug( LDAP_DEBUG_FILTER, " FINAL\n", 0, 0, 0 );
+#endif
if ( f->f_sub_final != NULL ) {
ber_bvfree( value );
goto return_error;
break;
default:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_INFO,
+ "get_substring_filter: conn %d unknown substring type %ld\n",
+ conn->c_connid, (long)tag ));
+#else
Debug( LDAP_DEBUG_FILTER,
" unknown substring type=%ld\n",
(long) tag, 0, 0 );
+#endif
ber_bvfree( value );
return_error:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_INFO,
+ "get_substring_filter: conn %d error %ld\n",
+ conn->c_connid, (long)rc ));
+#else
Debug( LDAP_DEBUG_FILTER, " error=%ld\n",
(long) rc, 0, 0 );
-
+#endif
if( fstr ) {
free( *fstr );
*fstr = NULL;
strcat( *fstr, /*(*/ ")" );
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
+ "get_substring_filter: conn %d exit\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_FILTER, "end get_substring_filter\n", 0, 0, 0 );
+#endif
return( LDAP_SUCCESS );
}
break;
default:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
+ "filter_free: unknown filter type %lu\n", f->f_choice ));
+#else
Debug( LDAP_DEBUG_ANY, "filter_free: unknown filter type=%lu\n",
f->f_choice, 0, 0 );
+#endif
break;
}
{
int rc;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
+ "test_filter: begin\n" ));
+#else
Debug( LDAP_DEBUG_FILTER, "=> test_filter\n", 0, 0, 0 );
+#endif
+
switch ( f->f_choice ) {
case SLAPD_FILTER_COMPUTED:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "test_filter: COMPUTED %s (%d)\n",
+ f->f_result == LDAP_COMPARE_FALSE ? "false" :
+ f->f_result == LDAP_COMPARE_TRUE ? "true" :
+ f->f_result == SLAPD_COMPARE_UNDEFINED ? "undefined" :
+ "error",
+ f->f_result ));
+#else
Debug( LDAP_DEBUG_FILTER, " COMPUTED %s (%d)\n",
f->f_result == LDAP_COMPARE_FALSE ? "false" :
f->f_result == LDAP_COMPARE_TRUE ? "true" :
f->f_result == SLAPD_COMPARE_UNDEFINED ? "undefined" : "error",
f->f_result, 0 );
+#endif
+
rc = f->f_result;
break;
case LDAP_FILTER_EQUALITY:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "test_filter: EQUALITY\n" ));
+#else
Debug( LDAP_DEBUG_FILTER, " EQUALITY\n", 0, 0, 0 );
+#endif
+
rc = test_ava_filter( be, conn, op, e, f->f_ava,
LDAP_FILTER_EQUALITY );
break;
case LDAP_FILTER_SUBSTRINGS:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "test_filter SUBSTRINGS\n" ));
+#else
Debug( LDAP_DEBUG_FILTER, " SUBSTRINGS\n", 0, 0, 0 );
+#endif
+
rc = test_substrings_filter( be, conn, op, e, f );
break;
break;
case LDAP_FILTER_PRESENT:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "test_filter: PRESENT\n" ));
+#else
Debug( LDAP_DEBUG_FILTER, " PRESENT\n", 0, 0, 0 );
+#endif
+
rc = test_presence_filter( be, conn, op, e, f->f_desc );
break;
case LDAP_FILTER_APPROX:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "test_filter: APPROX\n" ));
+#else
Debug( LDAP_DEBUG_FILTER, " APPROX\n", 0, 0, 0 );
+#endif
rc = test_ava_filter( be, conn, op, e, f->f_ava,
LDAP_FILTER_APPROX );
break;
case LDAP_FILTER_AND:
- Debug( LDAP_DEBUG_FILTER, " AND\n", 0, 0, 0 );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "test_filter: AND\n" ));
+#else
+ Debug( LDAP_DEBUG_FILTER, " AND\n", 0, 0, 0 );
+#endif
+
rc = test_filter_and( be, conn, op, e, f->f_and );
break;
case LDAP_FILTER_OR:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "test_filter: OR\n" ));
+#else
Debug( LDAP_DEBUG_FILTER, " OR\n", 0, 0, 0 );
+#endif
+
rc = test_filter_or( be, conn, op, e, f->f_or );
break;
case LDAP_FILTER_NOT:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "test_filter: NOT\n" ));
+#else
Debug( LDAP_DEBUG_FILTER, " NOT\n", 0, 0, 0 );
+#endif
+
rc = test_filter( be, conn, op, e, f->f_not );
switch( rc ) {
#ifdef SLAPD_EXT_FILTERS
case LDAP_FILTER_EXT:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "test_filter: EXT\n" ));
+#else
Debug( LDAP_DEBUG_FILTER, " EXT\n", 0, 0, 0 );
+#endif
+
rc = test_mra_filter( be, conn, op, e, f->f_mra );
break;
#endif
default:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_INFO,
+ "test_filter: unknown filter type %lu\n",
+ f->f_choice ));
+#else
Debug( LDAP_DEBUG_ANY, " unknown filter type %lu\n",
f->f_choice, 0, 0 );
+#endif
+
rc = LDAP_PROTOCOL_ERROR;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
+ "test_filter: return=%d\n", rc ));
+#else
Debug( LDAP_DEBUG_FILTER, "<= test_filter %d\n", rc, 0, 0 );
+#endif
+
return( rc );
}
Filter *f;
int rtn = LDAP_COMPARE_TRUE;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
+ "test_filter_and: begin\n" ));
+#else
Debug( LDAP_DEBUG_FILTER, "=> test_filter_and\n", 0, 0, 0 );
+#endif
+
for ( f = flist; f != NULL; f = f->f_next ) {
int rc = test_filter( be, conn, op, e, f );
}
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
+ "test_filter_and: rc=%d\n", rtn ));
+#else
Debug( LDAP_DEBUG_FILTER, "<= test_filter_and %d\n", rtn, 0, 0 );
+#endif
+
return rtn;
}
Filter *f;
int rtn = LDAP_COMPARE_FALSE;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
+ "test_filter_or: begin\n" ));
+#else
Debug( LDAP_DEBUG_FILTER, "=> test_filter_or\n", 0, 0, 0 );
+#endif
+
for ( f = flist; f != NULL; f = f->f_next ) {
int rc = test_filter( be, conn, op, e, f );
}
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
+ "test_filter_or: result=%d\n", rtn ));
+#else
Debug( LDAP_DEBUG_FILTER, "<= test_filter_or %d\n", rtn, 0, 0 );
+#endif
+
return rtn;
}
{
Attribute *a;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
+ "test_substrings_filter: begin\n" ));
+#else
Debug( LDAP_DEBUG_FILTER, "begin test_substrings_filter\n", 0, 0, 0 );
+#endif
+
if ( be != NULL && ! access_allowed( be, conn, op, e,
f->f_sub_desc, NULL, ACL_SEARCH ) )
}
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
+ "test_substrings_filter: return FALSE\n" ));
+#else
Debug( LDAP_DEBUG_FILTER, "end test_substrings_filter 1\n", 0, 0, 0 );
+#endif
+
return LDAP_COMPARE_FALSE;
}
assert( mode );
if( slapMode != SLAP_UNDEFINED_MODE ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
+ "init: %s init called twice (old=%d, new=%d)\n",
+ name, slapMode, mode ));
+#else
Debug( LDAP_DEBUG_ANY,
"%s init: init called twice (old=%d, new=%d)\n",
name, slapMode, mode );
+#endif
+
return 1;
}
switch ( slapMode & SLAP_MODE ) {
case SLAP_SERVER_MODE:
case SLAP_TOOL_MODE:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+ "init: %s initiation, initiated %s.\n",
+ name, (mode & SLAP_MODE) == SLAP_TOOL_MODE ? "tool" : "server" ));
+#else
Debug( LDAP_DEBUG_TRACE,
"%s init: initiated %s.\n", name,
(mode & SLAP_MODE) == SLAP_TOOL_MODE ? "tool" : "server",
0 );
+#endif
+
slap_name = name;
break;
default:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "init: %s init, undefined mode (%d).\n", name, mode ));
+#else
Debug( LDAP_DEBUG_ANY,
"%s init: undefined mode (%d).\n", name, mode, 0 );
+#endif
+
rc = 1;
break;
}
{
int rc;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
+ "slap_startup: %s started\n", slap_name ));
+#else
Debug( LDAP_DEBUG_TRACE,
"%s startup: initiated.\n",
slap_name, 0, 0 );
+#endif
+
rc = backend_startup( be );
{
int rc;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
+ "slap_shutdown: %s shutdown initiated.\n", slap_name));
+#else
Debug( LDAP_DEBUG_TRACE,
"%s shutdown: initiated\n",
slap_name, 0, 0 );
+#endif
+
slap_sasl_destroy();
{
int rc;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "slap_destroy: %s freeing system resources.\n",
+ slap_name ));
+#else
Debug( LDAP_DEBUG_TRACE,
"%s shutdown: freeing system resources.\n",
slap_name, 0, 0 );
+#endif
+
rc = backend_destroy();
strcpy( buf, fname );
strcat( buf, ".lock" );
if ( (*lfp = fopen( buf, "w" )) == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "lock_fopen: could not open lock file \"%s\".\n", buf ));
+#else
Debug( LDAP_DEBUG_ANY, "could not open \"%s\"\n", buf, 0, 0 );
+#endif
+
return( NULL );
}
/* open the log file */
if ( (fp = fopen( fname, type )) == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "lock_fopen: could not open log file \"%s\".\n", buf ));
+#else
Debug( LDAP_DEBUG_ANY, "could not open \"%s\"\n", fname, 0, 0 );
+#endif
+
ldap_unlockf( fileno(*lfp) );
fclose( *lfp );
*lfp = NULL;
if ( i != NULL )
{
slap_debug = *i;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "main: new debug level from registry is: %d\n", slap_debug ));
+#else
Debug( LDAP_DEBUG_ANY, "new debug level from registry is: %d\n", slap_debug, 0, 0 );
+#endif
}
newUrls = (char *) getRegParam(regService, "Urls");
ch_free(urls);
urls = ch_strdup(newUrls);
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "main: new urls from registry: %s\n", urls ));
+#else
Debug(LDAP_DEBUG_ANY, "new urls from registry: %s\n",
urls, 0, 0);
+#endif
+
}
newConfigFile = (char*)getRegParam( regService, "ConfigFile" );
if ( newConfigFile != NULL )
{
configfile = newConfigFile;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "main: new config file from registry is: %s\n", configfile ));
+#else
Debug ( LDAP_DEBUG_ANY, "new config file from registry is: %s\n", configfile, 0, 0 );
+#endif
+
}
}
#endif
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &slap_debug);
ldif_debug = slap_debug;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "%s", Versionstr ));
+#else
Debug( LDAP_DEBUG_TRACE, "%s", Versionstr, 0, 0 );
+#endif
+
if( serverName == NULL ) {
if ( (serverName = strrchr( argv[0], *LDAP_DIRSEP )) == NULL ) {
}
if ( schema_init( ) != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
+ "main: schema initialization error\n" ));
+#else
Debug( LDAP_DEBUG_ANY,
"schema initialization error\n",
0, 0, 0 );
+#endif
+
goto destroy;
}
}
if ( schema_prep( ) != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
+ "main: schema prep error\n"));
+#else
Debug( LDAP_DEBUG_ANY,
"schema prep error\n",
0, 0, 0 );
+#endif
+
goto destroy;
}
{
FILE *fp;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "main: slapd starting.\n" ));
+#else
Debug( LDAP_DEBUG_ANY, "slapd starting\n", 0, 0, 0 );
+#endif
+
if (( slapd_pid_file != NULL ) &&
(( fp = fopen( slapd_pid_file, "w" )) != NULL ))
LogSlapdStoppedEvent( serverName );
#endif
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
+ "main: slapd stopped.\n" ));
+#else
Debug( LDAP_DEBUG_ANY, "slapd stopped.\n", 0, 0, 0 );
+#endif
+
#ifdef HAVE_NT_SERVICE_MANAGER
ReportSlapdShutdownComplete();
const char *text;
int manageDSAit;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "do_modify: enter\n" ));
+#else
Debug( LDAP_DEBUG_TRACE, "do_modify\n", 0, 0, 0 );
+#endif
+
/*
* Parse the modify request. It looks like this:
*/
if ( ber_scanf( op->o_ber, "{a" /*}*/, &dn ) == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_modify: ber_scanf failed\n" ));
+#else
Debug( LDAP_DEBUG_ANY, "do_modify: ber_scanf failed\n", 0, 0, 0 );
+#endif
+
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "decoding error" );
return SLAPD_DISCONNECT;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
+ "do_modify: dn (%s)\n", dn ));
+#else
Debug( LDAP_DEBUG_ARGS, "do_modify: dn (%s)\n", dn, 0, 0 );
+#endif
+
/* collect modifications & save for later */
switch( mop ) {
case LDAP_MOD_ADD:
if ( (*modtail)->ml_bvalues == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_modify: modify/add operation (%ld) requires values\n",
+ (long)mop ));
+#else
Debug( LDAP_DEBUG_ANY,
"do_modify: modify/add operation (%ld) requires values\n",
(long) mop, 0, 0 );
+#endif
+
send_ldap_result( conn, op, LDAP_PROTOCOL_ERROR,
NULL, "modify/add operation requires values",
NULL, NULL );
break;
default: {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_modify: invalid modify operation (%ld)\n",
+ (long)mop ));
+#else
Debug( LDAP_DEBUG_ANY,
"do_modify: invalid modify operation (%ld)\n",
(long) mop, 0, 0 );
+#endif
+
send_ldap_result( conn, op, LDAP_PROTOCOL_ERROR,
NULL, "unrecognized modify operation", NULL, NULL );
rc = LDAP_PROTOCOL_ERROR;
*modtail = NULL;
if( (rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_modify: get_ctrls failed\n" ));
+#else
Debug( LDAP_DEBUG_ANY, "do_modify: get_ctrls failed\n", 0, 0, 0 );
+#endif
+
goto cleanup;
}
ndn = ch_strdup( dn );
if( dn_normalize( ndn ) == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_modify: invalid dn (%s)\n", dn ));
+#else
Debug( LDAP_DEBUG_ANY, "do_modify: invalid dn (%s)\n", dn, 0, 0 );
+#endif
+
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
"invalid DN", NULL, NULL );
goto cleanup;
}
if( ndn == '\0' ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_modify: attempt to modify root DSE.\n" ));
+#else
Debug( LDAP_DEBUG_ANY, "do_modify: root dse!\n", 0, 0, 0 );
+#endif
+
send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
NULL, "modify upon the root DSE not supported", NULL, NULL );
goto cleanup;
}
#ifdef LDAP_DEBUG
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+ "do_modify: modifications:\n" ));
+#else
Debug( LDAP_DEBUG_ARGS, "modifications:\n", 0, 0, 0 );
+#endif
+
for ( tmp = modlist; tmp != NULL; tmp = tmp->ml_next ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+ "\t%s: %s\n", tmp->ml_op == LDAP_MOD_ADD ?
+ "add" : (tmp->ml_op == LDAP_MOD_DELETE ?
+ "delete" : "replace"), tmp->ml_type ));
+#else
Debug( LDAP_DEBUG_ARGS, "\t%s: %s\n",
tmp->ml_op == LDAP_MOD_ADD
? "add" : (tmp->ml_op == LDAP_MOD_DELETE
? "delete" : "replace"), tmp->ml_type, 0 );
+#endif
+
}
#endif
ad->ad_type->sat_syntax->ssyn_validate;
if( !validate ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "modlist2mods: no validator for syntax %S\n",
+ ad->ad_type->sat_syntax->ssyn_oid ));
+#else
Debug( LDAP_DEBUG_TRACE,
"modlist2mods: no validator for syntax %s\n",
ad->ad_type->sat_syntax->ssyn_oid, 0, 0 );
+#endif
+
slap_mods_free( mod );
*text = "no validator for syntax";
return LDAP_INVALID_SYNTAX;
const char *text;
int manageDSAit;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "do_modrdn: begin\n" ));
+#else
Debug( LDAP_DEBUG_TRACE, "do_modrdn\n", 0, 0, 0 );
+#endif
+
/*
* Parse the modrdn request. It looks like this:
if ( ber_scanf( op->o_ber, "{aab", &dn, &newrdn, &deloldrdn )
== LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_modrdn: ber_scanf failed\n" ));
+#else
Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
+#endif
+
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "decoding error" );
return SLAPD_DISCONNECT;
/* Conection record indicates v2 but field
* newSuperior is present: report error.
*/
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_modrdn: (v2) invalid field newSuperior.\n" ));
+#else
Debug( LDAP_DEBUG_ANY,
"modrdn(v2): invalid field newSuperior!\n",
0, 0, 0 );
+#endif
+
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "newSuperior requires LDAPv3" );
rc = SLAPD_DISCONNECT;
if ( ber_scanf( op->o_ber, "a", &newSuperior )
== LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_modrdn: ber_scanf(\"a\") failed\n" ));
+#else
Debug( LDAP_DEBUG_ANY, "ber_scanf(\"a\") failed\n",
0, 0, 0 );
+#endif
+
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "decoding error" );
rc = SLAPD_DISCONNECT;
nnewSuperior = ch_strdup( newSuperior );
if( dn_normalize( nnewSuperior ) == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_modrdn: invalid new superior (%s)\n", newSuperior ));
+#else
Debug( LDAP_DEBUG_ANY, "do_modrdn: invalid new superior (%s)\n",
newSuperior, 0, 0 );
+#endif
+
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
"invalid new superior DN", NULL, NULL );
goto cleanup;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
+ "do_modrdn: dn (%s) newrdn (%s) newsuperior(%s)\n",
+ dn, newrdn, newSuperior != NULL ? newSuperior : "" ));
+#else
Debug( LDAP_DEBUG_ARGS,
"do_modrdn: dn (%s) newrdn (%s) newsuperior (%s)\n",
dn, newrdn,
newSuperior != NULL ? newSuperior : "" );
+#endif
+
if ( ber_scanf( op->o_ber, /*{*/ "}") == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_modrdn: ber_scanf failed\n" ));
+#else
Debug( LDAP_DEBUG_ANY, "do_modrdn: ber_scanf failed\n", 0, 0, 0 );
+#endif
+
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "decoding error" );
rc = SLAPD_DISCONNECT;
}
if( (rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_modrdn: get_ctrls failed\n" ));
+#else
Debug( LDAP_DEBUG_ANY, "do_modrdn: get_ctrls failed\n", 0, 0, 0 );
+#endif
+
/* get_ctrls has sent results. Now clean up. */
goto cleanup;
}
ndn = ch_strdup( dn );
if( dn_normalize( ndn ) == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_modrdn: invalid dn (%s)\n", dn ));
+#else
Debug( LDAP_DEBUG_ANY, "do_modrdn: invalid dn (%s)\n", dn, 0, 0 );
+#endif
+
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
"invalid DN", NULL, NULL );
goto cleanup;
}
if( !rdn_validate( newrdn ) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_modrdn: invalid rdn (%s).\n", newrdn ));
+#else
Debug( LDAP_DEBUG_ANY, "do_modrdn: invalid rdn (%s)\n", newrdn, 0, 0 );
+#endif
+
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
"invalid RDN", NULL, NULL );
goto cleanup;
}
if( ndn == '\0' ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "do_modrdn: attempt to modify root DSE.\n" ));
+#else
Debug( LDAP_DEBUG_ANY, "do_modrdn: root dse!\n", 0, 0, 0 );
+#endif
+
send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
NULL, "cannot rename the root DSE", NULL, NULL );
goto cleanup;
{
if (lt_dlinit()) {
const char *error = lt_dlerror();
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "module", LDAP_LEVEL_CRIT,
+ "module_init: lt_ldinit failed: %s\n", error ));
+#else
Debug(LDAP_DEBUG_ANY, "lt_dlinit failed: %s\n", error, 0, 0);
+#endif
+
return -1;
}
return 0;
if (lt_dlexit()) {
const char *error = lt_dlerror();
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "module", LDAP_LEVEL_CRIT,
+ "module_kill: lt_dlexit failed: %s\n", error ));
+#else
Debug(LDAP_DEBUG_ANY, "lt_dlexit failed: %s\n", error, 0, 0);
+#endif
+
return -1;
}
return 0;
module = (module_loaded_t *)ch_calloc(1, sizeof(module_loaded_t));
if (module == NULL) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "module", LDAP_LEVEL_CRIT,
+ "module_load: (%s) out of memory.\n", file_name ));
+#else
Debug(LDAP_DEBUG_ANY, "module_load failed: (%s) out of memory\n", file_name,
0, 0);
+#endif
+
return -1;
}
*/
if ((module->lib = lt_dlopen(file_name)) == NULL) {
error = lt_dlerror();
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "module", LDAP_LEVEL_CRIT,
+ "module_load: lt_dlopen failed: (%s) %s.\n",
+ file_name, error ));
+#else
Debug(LDAP_DEBUG_ANY, "lt_dlopen failed: (%s) %s\n", file_name,
error, 0);
+#endif
+
ch_free(module);
return -1;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "module", LDAP_LEVEL_INFO,
+ "module_load: loaded module %s\n", file_name ));
+#else
Debug(LDAP_DEBUG_CONFIG, "loaded module %s\n", file_name, 0, 0);
+#endif
+
if ((initialize = lt_dlsym(module->lib, "init_module")) == NULL) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "module", LDAP_LEVEL_ERR,
+ "module_load: module %s : no init_module() function found\n",
+ file_name ));
+#else
Debug(LDAP_DEBUG_CONFIG, "module %s: no init_module() function found\n",
file_name, 0, 0);
+#endif
+
lt_dlclose(module->lib);
ch_free(module);
return -1;
*/
rc = initialize(argc, argv);
if (rc == -1) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "module", LDAP_LEVEL_ERR,
+ "module_load: module %s init_module() failed\n", file_name));
+#else
Debug(LDAP_DEBUG_CONFIG, "module %s: init_module() failed\n",
file_name, 0, 0);
+#endif
+
lt_dlclose(module->lib);
ch_free(module);
return rc;
if (rc >= (sizeof(module_regtable) / sizeof(struct module_regtable_t))
|| module_regtable[rc].proc == NULL)
{
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "module", LDAP_LEVEL_ERR,
+ "module_load: module %s: unknown registration type (%d).\n", file_name));
+#else
Debug(LDAP_DEBUG_CONFIG, "module %s: unknown registration type (%d)\n",
file_name, rc, 0);
+#endif
+
module_unload(module);
return -1;
}
rc = (module_regtable[rc].proc)(module, file_name);
if (rc != 0) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "module", LDAP_LEVEL_ERR,
+ "module_load: module %s:%s could not be registered.\n",
+ file_name, module_regtable[rc].type ));
+#else
Debug(LDAP_DEBUG_CONFIG, "module %s: %s module could not be registered\n",
file_name, module_regtable[rc].type, 0);
+#endif
+
module_unload(module);
return rc;
}
module->next = module_list;
module_list = module;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "module", LDAP_LEVEL_INFO,
+ "module_load: module %s:%s registered\n", file_name,
+ module_regtable[rc].type ));
+#else
Debug(LDAP_DEBUG_CONFIG, "module %s: %s module registered\n",
file_name, module_regtable[rc].type, 0);
+#endif
+
return 0;
}
const char *err;
if( usage == SLAP_MR_NONE ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "register_matching_rule: %s not usable\n", desc ));
+#else
Debug( LDAP_DEBUG_ANY, "register_matching_rule: not usable %s\n",
desc, 0, 0 );
+#endif
+
return -1;
}
/* ignore for now */
if( amr == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "register_matching_rule: could not locate associated matching rule %s for %s\n",
+ associated, desc ));
+#else
Debug( LDAP_DEBUG_ANY, "register_matching_rule: could not locate "
"associated matching rule %s for %s\n",
associated, desc, 0 );
+#endif
+
return -1;
}
#endif
mr = ldap_str2matchingrule( desc, &code, &err, LDAP_SCHEMA_ALLOW_ALL);
if ( !mr ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "register_matching_rule: %s before %s in %s.\n",
+ ldap_scherr2str(code), err, desc ));
+#else
Debug( LDAP_DEBUG_ANY, "Error in register_matching_rule: %s before %s in %s\n",
ldap_scherr2str(code), err, desc );
+#endif
+
return( -1 );
}
ldap_memfree( mr );
if ( code ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "register_matching_rule: %s for %s in %s.\n",
+ scherr2str(code), err, desc ));
+#else
Debug( LDAP_DEBUG_ANY, "Error in register_matching_rule: %s for %s in %s\n",
scherr2str(code), err, desc );
+#endif
+
return( -1 );
}
rc = ber_scanf( ber, "{t", &tag );
if( rc == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "get_mra: ber_scanf (\"{t\") failure\n" ));
+#else
Debug( LDAP_DEBUG_ANY, " get_mra ber_scanf\n", 0, 0, 0 );
+#endif
+
*text = "Error parsing matching rule assertion";
mra_free( ma, 1 );
return SLAPD_DISCONNECT;
if ( tag == LDAP_FILTER_EXT_OID ) {
rc = ber_scanf( ber, "a", &ma->ma_rule_text );
if ( rc == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "get_mra: ber_scanf(\"a\") failure.\n" ));
+#else
Debug( LDAP_DEBUG_ANY, " get_mra ber_scanf for mr\n", 0, 0, 0 );
+#endif
+
*text = "Error parsing matching rule in matching rule assertion";
mra_free( ma, 1 );
return SLAPD_DISCONNECT;
rc = ber_scanf( ber, "t", &tag );
if( rc == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "get_mra: ber_scanf (\"t\") failure\n" ));
+#else
Debug( LDAP_DEBUG_ANY, " get_mra ber_scanf\n", 0, 0, 0 );
+#endif
+
*text = "Error parsing matching rule assertion";
mra_free( ma, 1 );
return SLAPD_DISCONNECT;
if ( tag == LDAP_FILTER_EXT_TYPE ) {
rc = ber_scanf( ber, "o", &type );
if ( rc == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "get_mra: ber_scanf (\"o\") failure.\n" ));
+#else
Debug( LDAP_DEBUG_ANY, " get_mra ber_scanf for ad\n", 0, 0, 0 );
+#endif
+
*text = "Error parsing attribute description in matching rule assertion";
return SLAPD_DISCONNECT;
}
rc = ber_scanf( ber, "t", &tag );
if( rc == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "get_mra: ber_scanf (\"t\") failure.\n" ));
+#else
Debug( LDAP_DEBUG_ANY, " get_mra ber_scanf\n", 0, 0, 0 );
+#endif
+
*text = "Error parsing matching rule assertion";
mra_free( ma, 1 );
return SLAPD_DISCONNECT;
}
if ( tag != LDAP_FILTER_EXT_VALUE ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "get_mra: ber_scanf missing value\n" ));
+#else
Debug( LDAP_DEBUG_ANY, " get_mra ber_scanf missing value\n", 0, 0, 0 );
+#endif
+
*text = "Missing value in matching rule assertion";
mra_free( ma, 1 );
return SLAPD_DISCONNECT;
rc = ber_scanf( ber, "o", &value );
if( rc == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "get_mra: ber_scanf (\"o\") failure.\n" ));
+#else
Debug( LDAP_DEBUG_ANY, " get_mra ber_scanf\n", 0, 0, 0 );
+#endif
+
*text = "Error decoding value in matching rule assertion";
mra_free( ma, 1 );
return SLAPD_DISCONNECT;
}
if( rc == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "get_mra: ber_scanf failure\n"));
+#else
Debug( LDAP_DEBUG_ANY, " get_mra ber_scanf\n", 0, 0, 0 );
+#endif
+
*text = "Error decoding dnattrs matching rule assertion";
mra_free( ma, 1 );
return SLAPD_DISCONNECT;
if( attr == NULL ) {
/* no objectClass attribute */
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "is_entry_objectclass: dn(%s), oid (%s), no objectlcass attribute.\n",
+ e->e_dn == NULL ? "" : e->e_dn, oc->soc_oclass.oc_oid ));
+#else
Debug( LDAP_DEBUG_ANY, "is_entry_objectclass(\"%s\", \"%s\") "
"no objectClass attribute\n",
e->e_dn == NULL ? "" : e->e_dn,
oc->soc_oclass.oc_oid, 0 );
+#endif
+
return 0;
}
; /* NULL */
if ( *tmp == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "slap_op_remove: can't find op %ld.\n",
+ (long)op->o_msgid ));
+#else
Debug( LDAP_DEBUG_ANY, "op_delete: can't find op %ld\n",
(long) op->o_msgid, 0, 0 );
+#endif
+
return -1;
}
ber = ber_init( reqdata );
if( ber == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "slap_passwd_parse: ber_init failed\n" ));
+#else
Debug( LDAP_DEBUG_TRACE, "slap_passwd_parse: ber_init failed\n",
0, 0, 0 );
+#endif
+
*text = "password decoding error";
return LDAP_PROTOCOL_ERROR;
}
if( tag == LDAP_TAG_EXOP_X_MODIFY_PASSWD_ID ) {
if( id == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "slap_passwd_parse: ID not allowed.\n"));
+#else
Debug( LDAP_DEBUG_TRACE, "slap_passwd_parse: ID not allowed.\n",
0, 0, 0 );
+#endif
+
*text = "user must change own password";
rc = LDAP_UNWILLING_TO_PERFORM;
goto done;
tag = ber_scanf( ber, "O", id );
if( tag == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "slap_passwd_parse: ID parse failed.\n"));
+#else
Debug( LDAP_DEBUG_TRACE, "slap_passwd_parse: ID parse failed.\n",
0, 0, 0 );
+#endif
+
goto decoding_error;
}
if( tag == LDAP_TAG_EXOP_X_MODIFY_PASSWD_OLD ) {
if( oldpass == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "slap_passwd_parse: OLD not allowed.\n" ));
+#else
Debug( LDAP_DEBUG_TRACE, "slap_passwd_parse: OLD not allowed.\n",
0, 0, 0 );
+#endif
+
*text = "use bind to verify old password";
rc = LDAP_UNWILLING_TO_PERFORM;
goto done;
tag = ber_scanf( ber, "O", oldpass );
if( tag == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "slap_passwd_parse: ID parse failed.\n" ));
+#else
Debug( LDAP_DEBUG_TRACE, "slap_passwd_parse: ID parse failed.\n",
0, 0, 0 );
+#endif
+
goto decoding_error;
}
if( tag == LDAP_TAG_EXOP_X_MODIFY_PASSWD_NEW ) {
if( newpass == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "slap_passwd_parse: NEW not allowed.\n" ));
+#else
Debug( LDAP_DEBUG_TRACE, "slap_passwd_parse: NEW not allowed.\n",
0, 0, 0 );
+#endif
+
*text = "user specified passwords disallowed";
rc = LDAP_UNWILLING_TO_PERFORM;
goto done;
tag = ber_scanf( ber, "O", newpass );
if( tag == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "slap_passwd_parse: OLD parse failed.\n"));
+#else
Debug( LDAP_DEBUG_TRACE, "slap_passwd_parse: OLD parse failed.\n",
0, 0, 0 );
+#endif
+
goto decoding_error;
}
if( len != 0 ) {
decoding_error:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "slap_passwd_parse: decoding error, len=%ld\n", (long)len ));
+#else
Debug( LDAP_DEBUG_TRACE,
"slap_passwd_parse: decoding error, len=%ld\n",
(long) len, 0, 0 );
+#endif
+
*text = "data decoding error";
rc = LDAP_PROTOCOL_ERROR;
assert( cred != NULL );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "slap_passwd_return: %ld\n",(long)cred->bv_len ));
+#else
Debug( LDAP_DEBUG_TRACE, "slap_passwd_return: %ld\n",
(long) cred->bv_len, 0, 0 );
+#endif
+
if( ber == NULL ) return NULL;
struct berval * slap_passwd_generate( void )
{
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "slap_passwd_generate: begin\n" ));
+#else
Debug( LDAP_DEBUG_TRACE, "slap_passwd_generate\n", 0, 0, 0 );
+#endif
+
/*
* generate passwords of only 8 characters as some getpass(3)
* it's a hard error and return.
*/
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "send_ldap_ber: conn %d ber_flush failed err=%d (%s)\n",
+ conn ? conn->c_connid : 0, err, sock_errstr(err) ));
+#else
Debug( LDAP_DEBUG_CONNS, "ber_flush failed errno=%d reason=\"%s\"\n",
err, sock_errstr(err), 0 );
+#endif
+
if ( err != EWOULDBLOCK && err != EAGAIN ) {
connection_closing( conn );
ber = ber_alloc_t( LBER_USE_DER );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "send_ldap_response: conn %d msgid=%ld tag=%ld err=%ld\n",
+ conn ? conn->c_connid : 0, (long)msgid, (long)tag, (long)err ));
+#else
Debug( LDAP_DEBUG_TRACE,
"send_ldap_response: msgid=%ld tag=%ld err=%ld\n",
(long) msgid, (long) tag, (long) err );
+#endif
+
if( ref ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
+ "send_ldap_response: conn %d ref=\"%s\"\n",
+ conn ? conn->c_connid : 0,
+ ref[0] && ref[0]->bv_val ? ref[0]->bv_val : "NULL" ));
+#else
Debug( LDAP_DEBUG_ARGS, "send_ldap_response: ref=\"%s\"\n",
ref[0] && ref[0]->bv_val ? ref[0]->bv_val : "NULL",
NULL, NULL );
+#endif
+
}
if ( ber == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "send_ldap_response: conn %d ber_alloc failed\n",
+ conn ? conn->c_connid : 0 ));
+#else
Debug( LDAP_DEBUG_ANY, "ber_alloc failed\n", 0, 0, 0 );
+#endif
+
return;
}
}
if ( rc == -1 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "send_ldap_response: conn %d ber_printf failed\n",
+ conn ? conn->c_connid : 0 ));
+#else
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
+#endif
+
ber_free( ber, 1 );
return;
}
ber_free( ber, 1 );
if ( bytes < 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "send_ldap_response: conn %d ber write failed\n",
+ conn ? conn->c_connid : 0 ));
+#else
Debug( LDAP_DEBUG_ANY,
"send_ldap_response: ber write failed\n",
0, 0, 0 );
+#endif
+
return;
}
assert( LDAP_UNSOLICITED_ERROR( err ) );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "send_ldap_disconnect: conn %d %d:%s\n",
+ conn ? conn->c_connid : 0, err, text ? text : "" ));
+#else
Debug( LDAP_DEBUG_TRACE,
"send_ldap_disconnect %d:%s\n",
err, text ? text : "", NULL );
+#endif
+
if ( op->o_protocol < LDAP_VERSION3 ) {
reqoid = NULL;
assert( !LDAP_API_ERROR( err ) );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "send_ldap_result : conn %ld op=%ld p=%d\n",
+ (long)op->o_connid, (long)op->o_opid, op->o_protocol ));
+#else
Debug( LDAP_DEBUG_TRACE,
"send_ldap_result: conn=%ld op=%ld p=%d\n",
(long) op->o_connid, (long) op->o_opid, op->o_protocol );
+#endif
+
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
+ "send_ldap_result: conn=%ld err=%d matched=\"%s\" text=\"%s\"\n",
+ (long)op->o_connid, err, matched ? matched : "", text ? text : "" ));
+#else
Debug( LDAP_DEBUG_ARGS,
"send_ldap_result: err=%d matched=\"%s\" text=\"%s\"\n",
err, matched ? matched : "", text ? text : "" );
+#endif
+
if( ref ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
+ "send_ldap_result: referral=\"%s\"\n",
+ ref[0] && ref[0]->bv_val ? ref[0]->bv_val : "NULL" ));
+#else
Debug( LDAP_DEBUG_ARGS,
"send_ldap_result: referral=\"%s\"\n",
ref[0] && ref[0]->bv_val ? ref[0]->bv_val : "NULL",
NULL, NULL );
+#endif
+
}
assert( err != LDAP_PARTIAL_RESULTS );
ber_tag_t tag;
ber_int_t msgid;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "send_ldap_sasl: conn %d err=%ld len=%ld\n",
+ op->o_connid, (long)err, cred ? cred->bv_len : -1 ));
+#else
Debug( LDAP_DEBUG_TRACE, "send_ldap_sasl: err=%ld len=%ld\n",
(long) err, cred ? cred->bv_len : -1, NULL );
+#endif
+
tag = req2res( op->o_tag );
msgid = (tag != LBER_SEQUENCE) ? op->o_msgid : 0;
ber_tag_t tag;
ber_int_t msgid;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "send_ldap_extended: conn %d err=%ld oid=%s len=%ld\n",
+ op->o_connid, (long)err, rspoid ? rspoid : "",
+ rspdata != NULL ? (long)rspdata->bv_len : (long)0 ));
+#else
Debug( LDAP_DEBUG_TRACE,
"send_ldap_extended err=%ld oid=%s len=%ld\n",
(long) err,
rspoid ? rspoid : "",
rspdata != NULL ? (long) rspdata->bv_len : (long) 0 );
+#endif
+
tag = req2res( op->o_tag );
msgid = (tag != LBER_SEQUENCE) ? op->o_msgid : 0;
char *tmp = NULL;
assert( !LDAP_API_ERROR( err ) );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "send_search_result: conn %d err=%d matched=\"%s\"\n",
+ op->o_connid, err, matched ? matched : "",
+ text ? text : "" ));
+#else
Debug( LDAP_DEBUG_TRACE,
"send_search_result: err=%d matched=\"%s\" text=\"%s\"\n",
err, matched ? matched : "", text ? text : "" );
+#endif
+
assert( err != LDAP_PARTIAL_RESULTS );
AttributeDescription *ad_entry = slap_schema.si_ad_entry;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "send_search_entry: conn %d dn=\"%s\"%s\n",
+ op->o_connid, e->e_dn,
+ attrsonly ? " (attrsOnly)" : "" ));
+#else
Debug( LDAP_DEBUG_TRACE,
"=> send_search_entry: dn=\"%s\"%s\n",
e->e_dn, attrsonly ? " (attrsOnly)" : "", 0 );
+#endif
+
if ( ! access_allowed( be, conn, op, e,
ad_entry, NULL, ACL_READ ) )
{
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_INFO,
+ "send_search_entry: conn %d access to entry (%s) not allowed\n",
+ op->o_connid, e->e_dn ));
+#else
Debug( LDAP_DEBUG_ACL,
"send_search_entry: access to entry not allowed\n",
0, 0, 0 );
+#endif
+
return( 1 );
}
ber = ber_alloc_t( LBER_USE_DER );
if ( ber == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "send_search_entry: conn %d ber_alloc failed\n",
+ op->o_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "ber_alloc failed\n", 0, 0, 0 );
+#endif
+
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "BER allocation error", NULL, NULL );
goto error_return;
LDAP_RES_SEARCH_ENTRY, e->e_dn );
if ( rc == -1 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "send_search_entry: conn %d ber_printf failed\n",
+ op->o_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
+#endif
+
ber_free( ber, 1 );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "encoding DN error", NULL, NULL );
}
if ( ! access_allowed( be, conn, op, e, desc, NULL, ACL_READ ) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_INFO,
+ "send_search_entry: conn %d access to attribute %s not allowed\n",
+ op->o_connid, desc->ad_cname->bv_val ));
+#else
Debug( LDAP_DEBUG_ACL, "acl: access to attribute %s not allowed\n",
desc->ad_cname->bv_val, 0, 0 );
+#endif
+
continue;
}
if (( rc = ber_printf( ber, "{s[" /*]}*/ , type )) == -1 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "send_search_entry: conn %d ber_printf failed\n",
+ op->o_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
+#endif
+
ber_free( ber, 1 );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "encoding description error", NULL, NULL );
if ( ! access_allowed( be, conn, op, e,
desc, a->a_vals[i], ACL_READ ) )
{
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_INFO,
+ "send_search_entry: conn %d access to attribute %s, value %d not allowed\n",
+ op->o_connid, desc->ad_cname->bv_val, i ));
+#else
Debug( LDAP_DEBUG_ACL,
"acl: access to attribute %s, value %d not allowed\n",
desc->ad_cname->bv_val, i, 0 );
+#endif
+
continue;
}
if (( rc = ber_printf( ber, "O", a->a_vals[i] )) == -1 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "send_search_entry: conn %d ber_printf failed.\n",
+ op->o_connid ));
+#else
Debug( LDAP_DEBUG_ANY,
"ber_printf failed\n", 0, 0, 0 );
+#endif
+
ber_free( ber, 1 );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "encoding values error", NULL, NULL );
}
if (( rc = ber_printf( ber, /*{[*/ "]N}" )) == -1 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "send_search_entry: conn %d ber_printf failed\n",
+ op->o_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
+#endif
+
ber_free( ber, 1 );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "encode end error", NULL, NULL );
}
if ( ! access_allowed( be, conn, op, e, desc, NULL, ACL_READ ) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_INFO,
+ "send_search_entry: conn %s access to attribute %s not allowed\n",
+ op->o_connid, desc->ad_cname->bv_val ));
+#else
Debug( LDAP_DEBUG_ACL, "acl: access to attribute %s not allowed\n",
desc->ad_cname->bv_val, 0, 0 );
+#endif
+
continue;
}
rc = ber_printf( ber, "{s[" /*]}*/ , desc->ad_cname->bv_val );
if ( rc == -1 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "send_search_entry: conn %d ber_printf failed\n",
+ op->o_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
+#endif
+
ber_free( ber, 1 );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "encoding description error", NULL, NULL );
if ( ! access_allowed( be, conn, op, e,
desc, a->a_vals[i], ACL_READ ) )
{
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_INFO,
+ "send_search_entry: conn %d access to %s, value %d not allowed\n",
+ op->o_connid, desc->ad_cname->bv_val, i ));
+#else
Debug( LDAP_DEBUG_ACL,
"acl: access to attribute %s, value %d not allowed\n",
desc->ad_cname->bv_val, i, 0 );
+#endif
+
continue;
}
if (( rc = ber_printf( ber, "O", a->a_vals[i] )) == -1 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "send_search_entry: conn %d ber_printf failed\n",
+ op->o_connid ));
+#else
Debug( LDAP_DEBUG_ANY,
"ber_printf failed\n", 0, 0, 0 );
+#endif
+
ber_free( ber, 1 );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "encoding values error", NULL, NULL );
}
if (( rc = ber_printf( ber, /*{[*/ "]N}" )) == -1 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "send_search_entry: conn %d ber_printf failed\n",
+ op->o_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
+#endif
+
ber_free( ber, 1 );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "encode end error", NULL, NULL );
rc = ber_printf( ber, /*{{{*/ "}N}N}" );
if ( rc == -1 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "send_search_entry: conn %d ber_printf failed\n",
+ op->o_connid ));
+#else
Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
+#endif
+
ber_free( ber, 1 );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "encode entry end error", NULL, NULL );
ber_free( ber, 1 );
if ( bytes < 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "send_ldap_response: conn %d ber write failed.\n",
+ op->o_connid ));
+#else
Debug( LDAP_DEBUG_ANY,
"send_ldap_response: ber write failed\n",
0, 0, 0 );
+#endif
+
return -1;
}
Statslog( LDAP_DEBUG_STATS2, "conn=%ld op=%ld ENTRY dn=\"%s\"\n",
(long) conn->c_connid, (long) op->o_opid, e->e_dn, 0, 0 );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "send_search_entry: conn %d exit.\n",
+ op->o_connid ));
+#else
Debug( LDAP_DEBUG_TRACE, "<= send_search_entry\n", 0, 0, 0 );
+#endif
+
rc = 0;
AttributeDescription *ad_ref = slap_schema.si_ad_ref;
AttributeDescription *ad_entry = slap_schema.si_ad_entry;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "send_search_reference: conn %d dn=\"%s\"\n",
+ op->o_connid, e->e_dn ));
+#else
Debug( LDAP_DEBUG_TRACE,
"=> send_search_reference: dn=\"%s\"\n",
e->e_dn, 0, 0 );
+#endif
+
if ( ! access_allowed( be, conn, op, e,
ad_entry, NULL, ACL_READ ) )
{
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_INFO,
+ "send_search_reference: conn %d access to entry %s not allowed\n",
+ op->o_connid, e->e_dn ));
+#else
Debug( LDAP_DEBUG_ACL,
"send_search_reference: access to entry not allowed\n",
0, 0, 0 );
+#endif
+
return( 1 );
}
if ( ! access_allowed( be, conn, op, e,
ad_ref, NULL, ACL_READ ) )
{
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "acl", LDAP_LEVEL_INFO,
+ "send_search_reference: conn %d access to reference not allowed.\n",
+ op->o_connid ));
+#else
Debug( LDAP_DEBUG_ACL,
"send_search_reference: access to reference not allowed\n",
0, 0, 0 );
+#endif
+
return( 1 );
}
if( refs == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "send_search_reference: null ref in (%s).\n",
+ op->o_connid, e->e_dn ));
+#else
Debug( LDAP_DEBUG_ANY,
"send_search_reference: null ref in (%s)\n",
e->e_dn, 0, 0 );
+#endif
+
return( 1 );
}
ber = ber_alloc_t( LBER_USE_DER );
if ( ber == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "send_search_reference: conn %d ber_alloc failed\n",
+ op->o_connid ));
+#else
Debug( LDAP_DEBUG_ANY,
"send_search_reference: ber_alloc failed\n", 0, 0, 0 );
+#endif
+
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "alloc BER error", NULL, NULL );
return -1;
LDAP_RES_SEARCH_REFERENCE, refs );
if ( rc == -1 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "send_search_reference: conn %d ber_printf failed.\n",
+ op->o_connid ));
+#else
Debug( LDAP_DEBUG_ANY,
"send_search_reference: ber_printf failed\n", 0, 0, 0 );
+#endif
+
ber_free( ber, 1 );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "encode DN error", NULL, NULL );
Statslog( LDAP_DEBUG_STATS2, "conn=%ld op=%ld ENTRY dn=\"%s\"\n",
(long) conn->c_connid, (long) op->o_opid, e->e_dn, 0, 0 );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "send_search_reference: conn %d exit.\n", op->o_connid ));
+#else
Debug( LDAP_DEBUG_TRACE, "<= send_search_reference\n", 0, 0, 0 );
+#endif
+
return 0;
}
*info = NULL;
if ( strncasecmp( s, "RESULT", 6 ) != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "str2result: (%s), expecting \"RESULT\"\n", s ));
+#else
Debug( LDAP_DEBUG_ANY, "str2result (%s) expecting \"RESULT\"\n",
s, 0, 0 );
+#endif
+
return( -1 );
}
*info = c;
}
} else {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "str2result: (%s) unknown.\n", s ));
+#else
Debug( LDAP_DEBUG_ANY, "str2result (%s) unknown\n",
s, 0, 0 );
+#endif
+
rc = -1;
}
}
return SASL_BADPARAM;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ "SASL [conn=%d] %s: %s\n",
+ conn ? conn->c_connid : -1,
+ label, message ));
+#else
Debug( level, "SASL [conn=%d] %s: %s\n",
conn ? conn->c_connid: -1,
label, message );
+#endif
+
return SASL_OK;
}
sasl_conn_t *ctx;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ "slap_sasl_getdn: conn %d id=%s\n",
+ conn ? conn->c_connid : -1,
+ id ? (*id ? id : "<empty>") : "NULL" ));
+#else
Debug( LDAP_DEBUG_ARGS, "slap_sasl_getdn: id=%s\n",
id?(*id?id:"<empty>"):"NULL",0,0 );
+#endif
+
/* Blatantly anonymous ID */
len = strlen( "anonymous" );
/* Figure out how much data we have for the dn */
rc = sasl_getprop( ctx, SASL_REALM, (void **)&c );
if( rc != SASL_OK ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ERR,
+ "slap_sasl_getdn: getprop(REALM) failed.\n" ));
+#else
Debug(LDAP_DEBUG_TRACE,
"getdn: getprop(REALM) failed!\n", 0,0,0);
+#endif
+
ch_free( dn );
*dnptr = NULL;
return( LDAP_OPERATIONS_ERROR );
}
strcpy( dn+len, ",cn=authzid" );
len += len1;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ "getdn: u:id converted to %s.\n", dn ));
+#else
Debug( LDAP_DEBUG_TRACE, "getdn: u:id converted to %s\n", dn,0,0 );
+#endif
+
}
/* DN strings that are a cn=authzid identity to run through regexp */
sprintf( dn, "dn:%s", c1 );
ch_free( c1 );
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ "slap_sasl_getdn: dn:id converted to %s.\n", dn ));
+#else
Debug( LDAP_DEBUG_TRACE, "getdn: dn:id converted to %s\n", dn,0,0 );
+#endif
+
}
}
*user = NULL;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ "slap_sas_authorize: conn %d authcid=\"%s\" authzid=\"%s\"\n",
+ conn ? conn->c_connid : -1,
+ authcid ? authcid : "<empty>",
+ authzid ? authzid : "<empty>" ));
+#else
Debug( LDAP_DEBUG_ARGS, "SASL Authorize [conn=%ld]: "
"authcid=\"%s\" authzid=\"%s\"\n",
(long) (conn ? conn->c_connid : -1),
authcid ? authcid : "<empty>",
authzid ? authzid : "<empty>" );
+#endif
+
/* Convert the identities to DN's. If no authzid was given, client will
be bound as the DN matching their username */
return SASL_NOAUTHZ;
}
if( ( authzid == NULL ) || !strcmp( authcid,authzid ) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ "slap_sasl_authorize: conn %d Using authcDN=%s\n",
+ conn ? conn->c_connid : -1, authcDN ));
+#else
Debug( LDAP_DEBUG_TRACE, "SASL Authorize [conn=%ld]: "
"Using authcDN=%s\n", (long) (conn ? conn->c_connid : -1), authcDN,0 );
+#endif
+
*user = authcDN;
*errstr = NULL;
return SASL_OK;
rc = slap_sasl_authorized( authcDN, authzDN );
if( rc ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_INFO,
+ "slap_sasl_authorize: conn %ld authorization disallowed (%d)\n",
+ (long)(conn ? conn->c_connid : -1), rc ));
+#else
Debug( LDAP_DEBUG_TRACE, "SASL Authorize [conn=%ld]: "
" authorization disallowed (%d)\n",
(long) (conn ? conn->c_connid : -1), rc, 0 );
+#endif
+
*errstr = "not authorized";
ch_free( authcDN );
ch_free( authzDN );
return SASL_NOAUTHZ;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ "slap_sasl_authorize: conn %d authorization allowed\n",
+ (long)(conn ? conn->c_connid : -1 ) );
+#else
Debug( LDAP_DEBUG_TRACE, "SASL Authorize [conn=%ld]: "
" authorization allowed\n",
(long) (conn ? conn->c_connid : -1), 0, 0 );
+#endif
+
ch_free( authcDN );
*user = authzDN;
rc = sasl_server_init( server_callbacks, "slapd" );
if( rc != SASL_OK ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_INFO,
+ "slap_sasl_init: init failed.\n" ));
+#else
Debug( LDAP_DEBUG_ANY, "sasl_server_init failed\n",
0, 0, 0 );
+#endif
+
return -1;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_INFO,
+ "slap_sasl_init: initialized!\n"));
+#else
Debug( LDAP_DEBUG_TRACE, "slap_sasl_init: initialized!\n",
0, 0, 0 );
+#endif
+
/* default security properties */
memset( &sasl_secprops, '\0', sizeof(sasl_secprops) );
session_callbacks, SASL_SECURITY_LAYER, &ctx );
if( sc != SASL_OK ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ERR,
+ "slap_sasl_open: sasl_server_new failed: %d\n", sc ));
+#else
Debug( LDAP_DEBUG_ANY, "sasl_server_new failed: %d\n",
sc, 0, 0 );
+#endif
+
return -1;
}
SASL_SEC_PROPS, &sasl_secprops );
if( sc != SASL_OK ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ERR,
+ "slap_sasl_open: sasl_setprop failed: %d \n", sc ));
+#else
Debug( LDAP_DEBUG_ANY, "sasl_setprop failed: %d\n",
sc, 0, 0 );
+#endif
+
slap_sasl_close( conn );
return -1;
}
&mechstr, NULL, NULL );
if( sc != SASL_OK ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ERR,
+ "slap_sasl_mechs: sasl_listmech failed: %d\n", sc ));
+#else
Debug( LDAP_DEBUG_ANY, "slap_sasl_listmech failed: %d\n",
sc, 0, 0 );
+#endif
+
return NULL;
}
const char *errstr;
int sc;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ "sasl_bind: conn %ld dn=\"%s\" mech=%s datalen=%d\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,
conn->c_sasl_bind_in_progress ? "<continuing>":conn->c_sasl_bind_mech,
cred ? cred->bv_len : 0 );
+#endif
+
if( ctx == NULL ) {
send_ldap_result( conn, op, LDAP_UNAVAILABLE,
SASL_USERNAME, (void **)&username );
if ( sc != SASL_OK ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ERR,
+ "slap_sasl_bind: getprop(USERNAME) failed: %d\n", sc ));
+#else
Debug(LDAP_DEBUG_TRACE,
"slap_sasl_bind: getprop(USERNAME) failed!\n",
0, 0, 0);
+#endif
+
send_ldap_result( conn, op, rc = slap_sasl_err2ldap( sc ),
NULL, "no SASL username", NULL, NULL );
NULL, errstr, NULL, NULL );
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ "slap_sasl_bind: rc=%d\n", rc ));
+#else
Debug(LDAP_DEBUG_TRACE, "<== slap_sasl_bind: rc=%d\n", rc, 0, 0);
+#endif
+
#else
send_ldap_result( conn, op, rc = LDAP_UNAVAILABLE,
*scope = -1;
*filter = NULL;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ "slap_parseURI: parsing %s\n", uri ));
+#else
Debug( LDAP_DEBUG_TRACE, "slap_parseURI: parsing %s\n", uri, 0, 0 );
+#endif
+
/* If it does not look like a URI, assume it is a DN */
if( !strncasecmp( uri, "dn:", 3 ) ) {
/* Precompile matching pattern */
rc = regcomp( ®->workspace, reg->match, REG_EXTENDED|REG_ICASE );
if ( rc ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ERR,
+ "slap_sasl_regexp_config: \"%s\" could not be compiled.\n"
+ reg->match ));
+#else
Debug( LDAP_DEBUG_ANY,
"SASL match pattern %s could not be compiled by regexp engine\n",
reg->match, 0, 0 );
+#endif
+
return( LDAP_OPERATIONS_ERROR );
}
}
if ( *c == '$' ) {
if ( n == SASLREGEX_REPLACE ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ERR,
+ "slap_sasl_regexp_config: \"%s\" has too many $n placeholders (max %d)\n",
+ reg->replace, SASLREGEX_REPLACE ));
+#else
Debug( LDAP_DEBUG_ANY,
"SASL replace pattern %s has too many $n placeholders (max %d)\n",
reg->replace, SASLREGEX_REPLACE, 0 );
+#endif
+
return( LDAP_OPERATIONS_ERROR );
}
reg->offset[n] = c - reg->replace;
SaslRegexp_t *reg;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ "slap_sasl_regexp: converting SASL name %s\n", saslname ));
+#else
Debug( LDAP_DEBUG_TRACE, "slap_sasl_regexp: converting SASL name %s\n",
saslname, 0, 0 );
+#endif
+
if (( saslname == NULL ) || ( nSaslRegexp == 0 ))
return( NULL );
}
uri[insert] = '\0';
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ "slap_sasl_regexp: converted SASL name to %s\n", uri ));
+#else
Debug( LDAP_DEBUG_TRACE,
"slap_sasl_regexp: converted SASL name to %s\n", uri, 0, 0 );
+#endif
+
return( uri );
}
LDAPMessage *res=NULL, *msg;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ "slap_sasl2dn: converting SASL name %s to DN.\n", saslname ));
+#else
Debug( LDAP_DEBUG_TRACE,
"==>slap_sasl2dn: Converting SASL name %s to a DN\n", saslname, 0,0 );
+#endif
+
/* Convert the SASL name into an LDAP URI */
uri = slap_sasl_regexp( saslname );
/* Must do an internal search */
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_DETAIL1,
+ "slap_sasl2dn: performing internal search (base=%s, scope=%s)\n",
+ searchbase, scope ));
+#else
Debug( LDAP_DEBUG_TRACE,
"slap_sasl2dn: performing internal search (base=%s, scope=%d)\n",
searchbase, scope, 0 );
+#endif
+
be = select_backend( searchbase, 0 );
if(( be == NULL ) || ( be->be_search == NULL))
/* Make sure exactly one entry was returned */
rc = ldap_count_entries( client, res );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_DETAIL1,
+ "slap_sasl2dn: search DN returned %d entries\n", rc ));
+#else
Debug( LDAP_DEBUG_TRACE,
"slap_sasl2dn: search DN returned %d entries\n", rc,0,0 );
+#endif
+
if( rc != 1 )
goto FINISHED;
if( res ) ldap_msgfree( res );
if( client ) ldap_unbind( client );
if( DN ) dn_normalize( DN );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ "slap_sasl2dn: Converted SASL name to %s\n", DN ? DN : "<nothing>" ));
+#else
Debug( LDAP_DEBUG_TRACE, "<==slap_sasl2dn: Converted SASL name to %s\n",
DN ? DN : "<nothing>", 0, 0 );
+#endif
+
return( DN );
}
regex_t reg;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ "slap_sasl_match: comparing DN %s to rule %s\n", assertDN, rule );
+#else
Debug( LDAP_DEBUG_TRACE,
"===>slap_sasl_match: comparing DN %s to rule %s\n", assertDN, rule, 0 );
+#endif
+
rc = slap_parseURI( rule, &searchbase, &scope, &filter );
if( rc != LDAP_SUCCESS )
/* Must run an internal search. */
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_DETAIL1,
+ "slap_sasl_match: performing internal search (base=%s, scope=%d)\n",
+ searchbase, scope ));
+#else
Debug( LDAP_DEBUG_TRACE,
"slap_sasl_match: performing internal search (base=%s, scope=%d)\n",
searchbase, scope, 0 );
+#endif
+
be = select_backend( searchbase, 0 );
if(( be == NULL ) || ( be->be_search == NULL)) {
if( conn ) connection_internal_close( conn );
if( res ) ldap_msgfree( res );
if( client ) ldap_unbind( client );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ "slap_sasl_match: comparison returned %d\n", rc ));
+#else
Debug( LDAP_DEBUG_TRACE,
"<===slap_sasl_match: comparison returned %d\n", rc, 0, 0);
+#endif
+
return( rc );
}
AttributeDescription *ad=NULL;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ "slap_sasl_check_authz: does %s match %s rule in %s?\n",
+ assertDN, attr, searchDN ));
+#else
Debug( LDAP_DEBUG_TRACE,
"==>slap_sasl_check_authz: does %s match %s rule in %s?\n",
assertDN, attr, searchDN);
+#endif
+
rc = slap_str2ad( attr, &ad, &errmsg );
if( rc != LDAP_SUCCESS )
goto COMPLETE;
if( vals ) ber_bvecfree( vals );
if( ad ) ad_free( ad, 1 );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ "slap_sasl_check_authz: %s check returning %s\n", attr, rc ));
+#else
Debug( LDAP_DEBUG_TRACE,
"<==slap_sasl_check_authz: %s check returning %d\n", attr, rc, 0);
+#endif
+
return( rc );
}
goto DONE;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ "slap_sasl_authorized: can %s become %s?\n", authcDN, authzDN ));
+#else
Debug( LDAP_DEBUG_TRACE,
"==>slap_sasl_authorized: can %s become %s?\n", authcDN, authzDN, 0 );
+#endif
+
/* If person is authorizing to self, succeed */
if ( !strcmp( authcDN, authzDN ) ) {
rc = LDAP_INAPPROPRIATE_AUTH;
DONE:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "sasl", LDAP_LEVEL_ENTRY,
+ "slap_sasl_authorized: return %s\n", rc ));
+#else
Debug( LDAP_DEBUG_TRACE, "<== slap_sasl_authorized: return %d\n",rc,0,0 );
+#endif
+
return( rc );
}
/* find the object class attribute - could error out here */
if ( (aoc = attr_find( e->e_attrs, ad_objectClass )) == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "schema", LDAP_LEVEL_INFO,
+ "entry_schema_check: No object class for entry (%s).\n", e->e_dn ));
+#else
Debug( LDAP_DEBUG_ANY, "No object class for entry (%s)\n",
e->e_dn, 0, 0 );
+#endif
+
*text = "no objectClass attribute";
return LDAP_OBJECT_CLASS_VIOLATION;
}
/* check that the entry has required attrs for each oc */
for ( i = 0; aoc->a_vals[i] != NULL; i++ ) {
if ( (oc = oc_find( aoc->a_vals[i]->bv_val )) == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "schema", LDAP_LEVEL_INFO,
+ "entry_schema_check: dn (%s), objectclass \"%s\" not recognized\n",
+ e->e_dn, aoc->a_vals[i]->bv_val ));
+#else
Debug( LDAP_DEBUG_ANY,
"entry_check_schema(%s): objectclass \"%s\" not recognized\n",
e->e_dn, aoc->a_vals[i]->bv_val, 0 );
+#endif
+
*text = "unrecognized object class";
return LDAP_OBJECT_CLASS_VIOLATION;
char *s = oc_check_required( e, aoc->a_vals[i] );
if (s != NULL) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "schema", LDAP_LEVEL_INFO,
+ "entry_schema_check: dn (%s) oc \"%s\" requires att \"%s\"\n",
+ e->e_dn, aoc->a_vals[i]->bv_val, s ));
+#else
Debug( LDAP_DEBUG_ANY,
"Entry (%s), oc \"%s\" requires attr \"%s\"\n",
e->e_dn, aoc->a_vals[i]->bv_val, s );
+#endif
+
*text = "missing required attribute";
return LDAP_OBJECT_CLASS_VIOLATION;
}
ret = oc_check_allowed( a->a_desc->ad_type, aoc->a_vals );
if ( ret != 0 ) {
char *type = a->a_desc->ad_cname->bv_val;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "schema", LDAP_LEVEL_INFO,
+ "entry_schema_check: Entry (%s) attr \"%s\" not allowed.\n",
+ e->e_dn, type ));
+#else
Debug( LDAP_DEBUG_ANY,
"Entry (%s), attr \"%s\" not allowed\n",
e->e_dn, type, 0 );
+#endif
+
*text = "attribute not allowed";
break;
}
int i;
Attribute *a;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
+ "oc_check_required: dn (%s), objectclass \"%s\"\n",
+ e->e_dn, ocname->bv_val ));
+#else
Debug( LDAP_DEBUG_TRACE,
"oc_check_required entry (%s), objectclass \"%s\"\n",
e->e_dn, ocname->bv_val, 0 );
+#endif
+
/* find global oc defn. it we don't know about it assume it's ok */
if ( (oc = oc_find( ocname->bv_val )) == NULL ) {
ObjectClass *oc;
int i, j;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
+ "oc_check_allowed: type \"%s\"\n", at->sat_cname ));
+#else
Debug( LDAP_DEBUG_TRACE,
"oc_check_allowed type \"%s\"\n",
at->sat_cname, 0, 0 );
+#endif
+
/* always allow objectclass attribute */
if ( strcasecmp( at->sat_cname, "objectclass" ) == 0 ) {
#endif
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
+ "dnMatch: %d\n %s\n %s\n", match,
+ value->bv_val, asserted->bv_val ));
+#else
Debug( LDAP_DEBUG_ARGS, "dnMatch %d\n\t\"%s\"\n\t\"%s\"\n",
match, value->bv_val, asserted->bv_val );
+#endif
+
*matchp = match;
return LDAP_SUCCESS;
ch_free( stored );
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
+ "objectIdentifierFirstComponentMatch: %d\n %s\n %s\n",
+ match, value->bv_val, asserted->bv_val ));
+#else
Debug( LDAP_DEBUG_ARGS, "objectIdentifierFirstComponentMatch "
"%d\n\t\"%s\"\n\t\"%s\"\n",
match, value->bv_val, asserted->bv_val );
+#endif
+
if( rc == LDAP_SUCCESS ) *matchp = match;
return rc;
}
#if 0
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
+ "objectClassMatch(%s, %s) = %d\n",
+ value->bv_val, a->bv_val, *matchp ));
+#else
Debug( LDAP_DEBUG_TRACE, "objectClassMatch(%s,%s) = %d\n",
value->bv_val, a->bv_val, *matchp );
+#endif
+
#endif
return LDAP_SUCCESS;
*matchp = ( asserted != oc );
#if 0
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
+ "structuralObjectClassMatch( %s, %s ) = %d\n",
+ value->bv_val, a->bv_val, *matchp ));
+#else
Debug( LDAP_DEBUG_TRACE, "structuralObjectClassMatch(%s,%s) = %d\n",
value->bv_val, a->bv_val, *matchp );
+#endif
+
#endif
return LDAP_SUCCESS;
const char *text;
int manageDSAit;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "do_search: conn %d\n", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_TRACE, "do_search\n", 0, 0, 0 );
- LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY, "conn: %d do_search\n",
- conn->c_connid));
+#endif
+
/*
* Parse the search request. It looks like this:
*
goto return_results;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
+ "do_search \"%s\" %d %d %d %d %d\n", base, scope,
+ deref, sizelimit, timelimit, attrsonly ));
+#else
Debug( LDAP_DEBUG_ARGS, "SRCH \"%s\" %d %d", base, scope, deref );
Debug( LDAP_DEBUG_ARGS, " %d %d %d\n", sizelimit, timelimit,
attrsonly);
+#endif
/* filter - returns a "normalized" version */
rc = get_filter( conn, op->o_ber, &filter, &fstr, &text );
goto return_results;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
+ "do_search: conn %d filter: %s\n", conn->c_connid, fstr ));
+#else
Debug( LDAP_DEBUG_ARGS, " filter: %s\n", fstr, 0, 0 );
+#endif
+
/* attributes */
if ( ber_scanf( op->o_ber, /*{*/ "{v}}", &attrs ) == LBER_ERROR ) {
}
if( (rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "do_search: conn %d get_ctrls failed (%d)\n",
+ conn->c_connid, rc ));
+#else
Debug( LDAP_DEBUG_ANY, "do_search: get_ctrls failed\n", 0, 0, 0 );
+#endif
+
goto return_results;
}
rc = 0;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
+ "do_search: conn %d attrs:", conn->c_connid ));
+#else
Debug( LDAP_DEBUG_ARGS, " attrs:", 0, 0, 0 );
+#endif
+
if ( attrs != NULL ) {
for ( i = 0; attrs[i] != NULL; i++ ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
+ "do_search: %s", attrs[i] ));
+#else
Debug( LDAP_DEBUG_ARGS, " %s", attrs[i], 0, 0 );
+#endif
+
}
}
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ARGS, "\n" ));
+#else
Debug( LDAP_DEBUG_ARGS, "\n", 0, 0, 0 );
+#endif
+
Statslog( LDAP_DEBUG_STATS,
"conn=%ld op=%d SRCH base=\"%s\" scope=%d filter=\"%s\"\n",
Filter *f = NULL;
char *end, *freeme;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
+ "str2filter: \"%s\"\n", str ));
+#else
Debug( LDAP_DEBUG_FILTER, "str2filter \"%s\"\n", str, 0, 0 );
+#endif
+
if ( str == NULL || *str == '\0' ) {
return( NULL );
str++;
switch ( *str ) {
case '&':
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "str2filter: AND\n" ));
+#else
Debug( LDAP_DEBUG_FILTER, "str2filter: AND\n",
0, 0, 0 );
+#endif
+
str++;
f = str2list( str, LDAP_FILTER_AND );
break;
case '|':
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "str2filter: OR\n" ));
+#else
Debug( LDAP_DEBUG_FILTER, "put_filter: OR\n",
0, 0, 0 );
+#endif
+
str++;
f = str2list( str, LDAP_FILTER_OR );
break;
case '!':
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "str2filter: NOT\n" ));
+#else
Debug( LDAP_DEBUG_FILTER, "put_filter: NOT\n",
0, 0, 0 );
+#endif
+
str++;
f = str2list( str, LDAP_FILTER_NOT );
break;
default:
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "str2filter: simple\n" ));
+#else
Debug( LDAP_DEBUG_FILTER, "str2filter: simple\n",
0, 0, 0 );
+#endif
+
f = str2simple( str );
break;
break;
default: /* assume it's a simple type=value filter */
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_DETAIL1,
+ "str2filter: default\n" ));
+#else
Debug( LDAP_DEBUG_FILTER, "str2filter: default\n", 0, 0,
0 );
+#endif
+
f = str2simple( str );
break;
char *next;
char save;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
+ "str2list: \"%s\"\n", str ));
+#else
Debug( LDAP_DEBUG_FILTER, "str2list \"%s\"\n", str, 0, 0 );
+#endif
+
f = (Filter *) ch_calloc( 1, sizeof(Filter) );
f->f_choice = ftype;
int rc;
const char *text;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
+ "str2simple: \"%s\"\n", str ));
+#else
Debug( LDAP_DEBUG_FILTER, "str2simple \"%s\"\n", str, 0, 0 );
+#endif
+
if ( (s = strchr( str, '=' )) == NULL ) {
return( NULL );
char *nextstar, *val, *freeme;
int gotstar;
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
+ "str2subvals: \"%s\"\n", in ));
+#else
Debug( LDAP_DEBUG_FILTER, "str2subvals \"%s\"\n", in, 0, 0 );
+#endif
+
if( in == NULL ) return 0;
dn = ch_malloc( diff + strlen(be->be_suffixAlias[i+1]) + 1 );
strncpy( dn, oldDN, diff );
strcpy( &dn[diff], be->be_suffixAlias[i+1] );
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "suffix_alias: converted \"%s\" to \"%s\"\n",
+ oldDN, dn ));
+#else
Debug( LDAP_DEBUG_ARGS,
"suffix_alias: converted \"%s\" to \"%s\"\n",
oldDN, dn, 0);
+#endif
+
free (oldDN);
break;
}
syn = ldap_str2syntax( desc, &code, &err, LDAP_SCHEMA_ALLOW_ALL);
if ( !syn ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "schema", LDAP_LEVEL_ERR,
+ "register_syntax: Error - %s before %s in %s.\n",
+ ldap_scherr2str(code), err, desc ));
+#else
Debug( LDAP_DEBUG_ANY, "Error in register_syntax: %s before %s in %s\n",
ldap_scherr2str(code), err, desc );
+#endif
+
return( -1 );
}
ldap_memfree( syn );
if ( code ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "schema", LDAP_LEVEL_ERR,
+ "register_syntax: Error - %s %s in %s\n",
+ scherr2str(code), err, desc ));
+#else
Debug( LDAP_DEBUG_ANY, "Error in register_syntax: %s %s in %s\n",
scherr2str(code), err, desc );
+#endif
+
return( -1 );
}
}
val.bv_len = strlen( val.bv_val );
#if 0
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
+ "syn_schema_info: Merging syn [%ld] %s\n",
+ (long)val.bv_len, val.bv_val ));
+#else
Debug( LDAP_DEBUG_TRACE, "Merging syn [%ld] %s\n",
(long) val.bv_len, val.bv_val, 0 );
+#endif
+
#endif
attr_merge( e, ad_ldapSyntaxes, vals );
ldap_memfree( val.bv_val );
Operation *op
)
{
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+ "do_unbind: conn %d\n", conn ? conn->c_connid : -1 ));
+#else
Debug( LDAP_DEBUG_TRACE, "do_unbind\n", 0, 0, 0 );
+#endif
+
/*
* Parse the unbind request. It looks like this:
pwd = getpwnam( user );
did_getpw:
if ( pwd == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "slap_init_user: No passwd entry for user %s\n",
+ user ));
+#else
Debug( LDAP_DEBUG_ANY, "No passwd entry for user %s\n",
user, 0, 0 );
+#endif
+
exit( EXIT_FAILURE );
}
if ( got_uid ) {
gid = grp->gr_gid;
did_group:
if ( grp == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "slap_init_user: No group entry for group %s\n", group));
+#else
Debug( LDAP_DEBUG_ANY, "No group entry for group %s\n",
group, 0, 0 );
+#endif
+
exit( EXIT_FAILURE );
}
}
if ( user ) {
if ( getuid() == 0 && initgroups( user, gid ) != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "slap_init_user: Could not set the group access (gid) list.\n" ));
+#else
Debug( LDAP_DEBUG_ANY,
"Could not set the group access (gid) list\n", 0, 0, 0 );
+#endif
+
exit( EXIT_FAILURE );
}
free( user );
if ( got_gid ) {
if ( setgid( gid ) != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "slap_init_user: could not set real group id to %d\n", (int)gid));
+#else
Debug( LDAP_DEBUG_ANY, "Could not set real group id to %d\n",
(int) gid, 0, 0 );
+#endif
+
exit( EXIT_FAILURE );
}
#ifdef HAVE_SETEGID
if ( setegid( gid ) != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "slap_init_user: Could not set effective group id to %d\n",(int)gid));
+#else
Debug( LDAP_DEBUG_ANY, "Could not set effective group id to %d\n",
(int) gid, 0, 0 );
+#endif
+
exit( EXIT_FAILURE );
}
#endif
if ( got_uid ) {
if ( setuid( uid ) != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "slap_init_user: Could not set real user id to %d\n", (int)uid ));
+#else
Debug( LDAP_DEBUG_ANY, "Could not set real user id to %d\n",
(int) uid, 0, 0 );
+#endif
+
exit( EXIT_FAILURE );
}
#ifdef HAVE_SETEUID
if ( seteuid( uid ) != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+ "slap_init_user: Could not set effective user id to %d\n", (int)uid ));
+#else
Debug( LDAP_DEBUG_ANY, "Could not set effective user id to %d\n",
(int) uid, 0, 0 );
+#endif
+
exit( EXIT_FAILURE );
}
#endif