]> git.sur5r.net Git - openldap/blobdiff - servers/slurpd/config.c
Update BDB version number to 2.7.5... should rewrite this.
[openldap] / servers / slurpd / config.c
index 7c97aaaac850a4fa016e61ddc0d8351c185536b8..e9b5d7e7c1600fd75602cdc0c7973e64a35520db 100644 (file)
 
 #include <stdio.h>
 
+#include <ac/stdlib.h>
 #include <ac/string.h>
 #include <ac/socket.h>
+#include <ac/ctype.h>
 
 #include <lber.h>
 #include <ldap.h>
@@ -53,8 +55,7 @@ slurpd_read_config(
 )
 {
     FILE       *fp;
-    char       buf[BUFSIZ];
-    char       *line, *p;
+    char       *line;
     int                cargc;
     char       *cargv[MAXARGS];
 
@@ -172,11 +173,13 @@ strtok_quote(
            } else {
                inquote = 1;
            }
-           strcpy( next, next + 1 );
+           SAFEMEMCPY( next, next + 1, strlen( next + 1 ) + 1 );
            break;
 
        case '\\':
-           strcpy( next, next + 1 );
+           if ( next[1] )
+               SAFEMEMCPY( next, next + 1, strlen( next + 1 ) + 1 );
+           next++;             /* dont parse the escaped character */
            break;
 
        default:
@@ -227,7 +230,7 @@ getline(
            *p = '\0';
        }
        lineno++;
-       if ( ! isspace( buf[0] ) ) {
+       if ( ! isspace( (unsigned char) buf[0] ) ) {
            return( line );
        }
 
@@ -338,7 +341,7 @@ parse_replica_line(
                ri->ri_port = atoi( hp );
            }
            if ( ri->ri_port <= 0 ) {
-               ri->ri_port = LDAP_PORT;
+               ri->ri_port = 0;
            }
            ri->ri_hostname = strdup( val );
            gots |= GOT_HOST;