]> git.sur5r.net Git - openldap/commitdiff
minor cleanup
authorPierangelo Masarati <ando@openldap.org>
Sat, 17 Nov 2001 16:18:07 +0000 (16:18 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 17 Nov 2001 16:18:07 +0000 (16:18 +0000)
22 files changed:
servers/slapd/attr.c
servers/slapd/back-monitor/conn.c
servers/slapd/back-monitor/init.c
servers/slapd/back-monitor/search.c
servers/slapd/bind.c
servers/slapd/compare.c
servers/slapd/config.c
servers/slapd/connection.c
servers/slapd/daemon.c
servers/slapd/dn.c
servers/slapd/entry.c
servers/slapd/main.c
servers/slapd/proto-slap.h
servers/slapd/referral.c
servers/slapd/root_dse.c
servers/slapd/sasl.c
servers/slapd/schema_init.c
servers/slapd/schemaparse.c
servers/slapd/sets.c
servers/slapd/starttls.c
servers/slapd/user.c
servers/slapd/value.c

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