]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/schemaparse.c
Another concurrency typo.
[openldap] / servers / slapd / schemaparse.c
index 70edf66b8bcc422745e16d5afac4baaa2c0aebf0..900263c84aaa000056f1d0b32fd238a2d4265ab5 100644 (file)
@@ -3,18 +3,16 @@
 #include "portable.h"
 
 #include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include "slap.h"
 
-extern char            **str2charray();
-extern void            charray_merge();
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#include "slap.h"
 
 struct objclass                *global_oc;
 int                    global_schemacheck;
 
-static void            oc_usage();
+static void            oc_usage(void);
 
 void
 parse_oc(
@@ -31,16 +29,17 @@ parse_oc(
        struct objclass **ocp;
 
        oc = (struct objclass *) ch_calloc( 1, sizeof(struct objclass) );
-       oc->oc_name = strdup( argv[1] );
+       oc->oc_name = ch_strdup( argv[1] );
        for ( i = 2; i < argc; i++ ) {
                /* required attributes */
                if ( strcasecmp( argv[i], "requires" ) == 0 ) {
                        do {
                                i++;
                                if ( i < argc ) {
+                                       char **s = str2charray( argv[i], "," );
                                        last = argv[i][strlen( argv[i] ) - 1];
-                                       charray_merge( &oc->oc_required,
-                                               str2charray( argv[i], "," ) );
+                                       charray_merge( &oc->oc_required, s );
+                                       charray_free( s );
                                }
                        } while ( i < argc && last == ',' );
 
@@ -49,9 +48,11 @@ parse_oc(
                        do {
                                i++;
                                if ( i < argc ) {
+                                       char **s = str2charray( argv[i], "," );
                                        last = argv[i][strlen( argv[i] ) - 1];
-                                       charray_merge( &oc->oc_allowed,
-                                               str2charray( argv[i], "," ) );
+                                       
+                                       charray_merge( &oc->oc_allowed, s );
+                                       charray_free( s );
                                }
                        } while ( i < argc && last == ',' );
 
@@ -71,7 +72,7 @@ parse_oc(
 }
 
 static void
-oc_usage()
+oc_usage( void )
 {
        fprintf( stderr, "<oc clause> ::= objectclass <ocname>\n" );
        fprintf( stderr, "                [ requires <attrlist> ]\n" );