]> git.sur5r.net Git - openldap/commitdiff
Misc cleanup, lint removal, and minor optimizations
authorKurt Zeilenga <kurt@openldap.org>
Sun, 13 Jan 2002 05:00:59 +0000 (05:00 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sun, 13 Jan 2002 05:00:59 +0000 (05:00 +0000)
libraries/liblber/io.c
servers/slapd/aclparse.c
servers/slapd/operational.c
servers/slapd/result.c
servers/slapd/schema_check.c
servers/slapd/slap.h
servers/slapd/tools/slapadd.c

index 23fd80cbf41e6d44d105947764964d6eec16ed58..bde7ce305558d64172bf28b9f073ea66efbc7651 100644 (file)
@@ -461,7 +461,7 @@ ber_get_next(
 
        while (ber->ber_rwptr > (char *)&ber->ber_tag && ber->ber_rwptr <
                (char *)(&ber->ber_usertag + 1)) {
-               int i;
+               ber_slen_t i;
                char buf[sizeof(ber->ber_len)-1];
                ber_len_t tlen = 0;
 
@@ -563,7 +563,7 @@ ber_get_next(
                        }
                        ber->ber_ptr = ber->ber_buf;
                        ber->ber_usertag = 0;
-                       if (i == ber->ber_len) {
+                       if ((ber_len_t)i == ber->ber_len) {
                                goto done;
                        }
                        ber->ber_rwptr = ber->ber_buf + i;
@@ -596,8 +596,8 @@ done:
                if ( ber->ber_debug ) {
 #ifdef NEW_LOGGING
                        LDAP_LOG(( "liblber", LDAP_LEVEL_DETAIL1,
-                                  "ber_get_next: tag 0x%lx len %ld\n",
-                                  ber->ber_tag, ber->ber_len ));
+                               "ber_get_next: tag 0x%lx len %ld\n",
+                               ber->ber_tag, ber->ber_len ));
                        BER_DUMP(( "liblber", LDAP_LEVEL_DETAIL2, ber, 1 ));
 #else
                        ber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug,
index d93f34ce0c25a25343cb83b78fd671e91f9bd2f9..52a45147cb0ee5088c83675b883d6cb6a8c0a08c 100644 (file)
@@ -728,14 +728,7 @@ parse_acl(
                                                }
 
                                        } else {
-                                               rc = slap_str2ad( SLAPD_ACI_ATTR, &b->a_aci_at, &text );
-
-                                               if( rc != LDAP_SUCCESS ) {
-                                                       fprintf( stderr,
-                                                               "%s: line %d: aci \"%s\": %s\n",
-                                                               fname, lineno, SLAPD_ACI_ATTR, text );
-                                                       acl_usage();
-                                               }
+                                               b->a_aci_at = slap_schema.si_ad_aci;
                                        }
 
                                        if( !is_at_syntax( b->a_aci_at->ad_type,
index e08b4c6d8adac3d0dab120326f9a46a1470339e4..1c37cec54365c67dc863ebeb3ef1887463646ccc 100644 (file)
@@ -41,7 +41,9 @@ slap_operational_hasSubordinate( int hs )
        a->a_desc = slap_schema.si_ad_hasSubordinates;
 
        a->a_vals = ch_malloc( 2 * sizeof( struct berval ) );
-       ber_str2bv( hs ? "TRUE" : "FALSE", 0, 1, a->a_vals );
+       ber_str2bv( hs ? "TRUE" : "FALSE",
+               hs ? sizeof("TRUE")-1 : sizeof("FALSE")-1,
+               1, a->a_vals );
        a->a_vals[1].bv_val = NULL;
 
        a->a_next = NULL;
index 2dc5f4620bf88cdd4f49b2808ebbde6d8a6d4135..c79f848d88c4e7278f887796cb93450c48182bc5 100644 (file)
@@ -142,7 +142,6 @@ static long send_ldap_ber(
                    err, sock_errstr(err), 0 );
 #endif
 
-
                if ( err != EWOULDBLOCK && err != EAGAIN ) {
                        connection_closing( conn );
 
@@ -208,7 +207,6 @@ send_ldap_response(
                (long) msgid, (long) tag, (long) err );
 #endif
 
-
        if( ref ) {
 #ifdef NEW_LOGGING
                LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
index 5d5aaa82b113824f835dcce47b6a773f78082466..c9a67e51ee0e0a101e6517cc0dfd1ee898ad13ff 100644 (file)
@@ -69,8 +69,8 @@ entry_schema_check(
                }
 
                if( !collective && is_at_collective( a->a_desc->ad_type ) ) {
-                       snprintf( textbuf, textlen, "attribute '%s' "
-                               "may only appear in collectiveAttributes subentry",
+                       snprintf( textbuf, textlen,
+                               "'%s' can only appear in collectiveAttributes subentry",
                                type );
                        return LDAP_OBJECT_CLASS_VIOLATION;
                }
@@ -226,6 +226,7 @@ entry_schema_check(
                                return rc;
                        }
                }
+
                if ( oc->soc_kind == LDAP_SCHEMA_ABSTRACT ) {
                        /* object class is abstract */
                        if ( oc != slap_schema.si_oc_top &&
index c65907d60eb023e3f743384fa0cd6d15971d8821..d41355a45ad5239d9d2ba34ee192f2a08a646985 100644 (file)
@@ -138,8 +138,6 @@ LDAP_BEGIN_DECL
 #define SLAPD_ROLE_CLASS               "organizationalRole"
 
 #define SLAPD_ACI_SYNTAX               "1.3.6.1.4.1.4203.666.2.1"
-#define SLAPD_ACI_ATTR                 "OpenLDAPaci"
-
 #define SLAPD_OCTETSTRING_SYNTAX "1.3.6.1.4.1.1466.115.121.1.40"
 
 /* change this to "OpenLDAPset" */
@@ -483,6 +481,27 @@ typedef struct slap_object_class {
 #define soc_extensions         soc_oclass.oc_extensions
 } ObjectClass;
 
+#ifdef LDAP_DIT_CONTENT_RULES
+/*
+ * DIT content rule
+ */
+typedef struct slap_content_rule {
+       LDAPContentRule         scr_crule;
+       ObjectClass                     *scr_sclass;
+       ObjectClass                     **scr_auxiliaries;      /* optional */
+       AttributeType           **scr_required;         /* optional */
+       AttributeType           **scr_allowed;          /* optional */
+       AttributeType           **scr_precluded;        /* optional */
+#define scr_oid                        scr_crule.cr_oid
+#define scr_names              scr_crule.cr_names
+#define scr_desc               scr_crule.cr_desc
+#define scr_obsolete           soc_oclass.cr_obsolete
+#define scr_cr_oids_aux                soc_oclass.cr_oc_oids_aux
+#define scr_cr_oids_must       soc_oclass.cr_at_oids_must
+#define scr_cr_oids_may                soc_oclass.cr_at_oids_may
+#define scr_cr_oids_not                soc_oclass.cr_at_oids_not
+} ContentRule;
+#endif
 
 /*
  * represents a recognized attribute description ( type + options )
@@ -1347,41 +1366,36 @@ typedef void (slap_sresult)( struct slap_conn *, struct slap_op *,
 typedef struct slap_op {
        ber_int_t       o_opid;         /* id of this operation           */
        ber_int_t       o_msgid;        /* msgid of the request           */
-#ifdef LDAP_CONNECTIONLESS
-       Sockaddr        o_peeraddr;     /* UDP peer address               */
-#endif
-
-       ldap_pvt_thread_t       o_tid;  /* thread handling this op        */
-
-       BerElement      *o_ber;         /* ber of the request             */
-
+       ber_int_t       o_protocol;     /* version of the LDAP protocol used by client */
        ber_tag_t       o_tag;          /* tag of the request             */
        time_t          o_time;         /* time op was initiated          */
+       unsigned long   o_connid; /* id of conn initiating this op  */
+       ldap_pvt_thread_t       o_tid;  /* thread handling this op        */
 
-       AuthorizationInformation o_authz;
-
-       ber_int_t       o_protocol;     /* version of the LDAP protocol used by client */
+#define SLAP_NO_CONTROL 0
+#define SLAP_NONCRITICAL_CONTROL 1
+#define SLAP_CRITICAL_CONTROL 2
+       char o_managedsait;
+       char o_subentries;
+       char o_subentries_visibility;
 
-       LDAPControl     **o_ctrls;       /* controls */
+       int             o_abandon;      /* abandon flag */
+       ldap_pvt_thread_mutex_t o_abandonmutex; /* protects o_abandon  */
 
-       unsigned long   o_connid; /* id of conn initiating this op  */
+#ifdef LDAP_CONNECTIONLESS
+       Sockaddr        o_peeraddr;     /* UDP peer address               */
+#endif
+       AuthorizationInformation o_authz;
 
-       ldap_pvt_thread_mutex_t o_abandonmutex; /* protects o_abandon  */
-       int             o_abandon;      /* abandon flag */
+       BerElement      *o_ber;         /* ber of the request             */
        slap_response   *o_response;    /* callback function */
        slap_sresult    *o_sresult;     /* search result callback */
+       LDAPControl     **o_ctrls;       /* controls */
 
-       LDAP_STAILQ_ENTRY(slap_op)      o_next; /* next operation in list         */
-       void    *o_private;     /* anything the backend needs     */
        void    *o_glue;        /* for the glue backend */
+       void    *o_private;     /* anything the backend needs */
 
-#define SLAP_NO_CONTROL 0
-#define SLAP_NONCRITICAL_CONTROL 1
-#define SLAP_CRITICAL_CONTROL 2
-
-       char o_managedsait;
-       char o_subentries;
-       char o_subentries_visibility;
+       LDAP_STAILQ_ENTRY(slap_op)      o_next; /* next operation in list         */
 } Operation;
 
 #define get_manageDSAit(op)                            ((int)(op)->o_managedsait)
@@ -1510,7 +1524,7 @@ typedef struct slap_listener {
 #ifdef LDAP_CONNECTIONLESS
        int     sl_is_udp;              /* UDP listener is also data port */
 #endif
-       ber_socket_t            sl_sd;
+       ber_socket_t sl_sd;
        Sockaddr sl_sa;
 #define sl_addr        sl_sa.sa_in_addr
 } Listener;
index cf6f03821d909ad4026760132599f777ab7c70f6..55e0d4fe086ed6974cca8fb202fe663eb67ed7fd 100644 (file)
@@ -22,7 +22,7 @@
 int
 main( int argc, char **argv )
 {
-       char            *buf;
+       char            *buf = NULL;
        int         lineno;
        int         lmax;
        int                     rc = EXIT_SUCCESS;
@@ -42,7 +42,6 @@ main( int argc, char **argv )
                exit( EXIT_FAILURE );
        }
 
-       buf = NULL;
        lmax = 0;
        lineno = 0;
 
@@ -55,7 +54,6 @@ main( int argc, char **argv )
        while( ldif_read_record( ldiffp, &lineno, &buf, &lmax ) ) {
                ID id;
                Entry *e = str2entry( buf );
-               char buf[1024];
                struct berval bvtext = { textlen, textbuf };
 
                if( e == NULL ) {