]> git.sur5r.net Git - openldap/commitdiff
Fix BUFSIZ v LINE_MAX issue
authorKurt Zeilenga <kurt@openldap.org>
Fri, 20 Oct 2006 18:52:46 +0000 (18:52 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 20 Oct 2006 18:52:46 +0000 (18:52 +0000)
CHANGES
include/ac/stdlib.h
libraries/libldap/init.c
servers/slapd/config.c

diff --git a/CHANGES b/CHANGES
index fce0a83d4260d6590774abe12c0513b9a8a73314..5e55c6d1f93812263296e508bbde857e847a2a90 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -8,6 +8,7 @@ OpenLDAP 2.3.28 Release
        Added ldapsearch bad filter pattern check (ITS#4647)
        Fixed slapd global access controls initialization (ITS#4654)
        Fixed slapd setting c_sasl_bindop only on SASL binds
+       Fixed slapd max line length issue (ITS#4651)
        Fixed slapd return code not being propagated (ITS#4565)
        Fixed slapd integerBitAndMatch (ITS#4672)
        Fixed slapd syncrepl modrdn new superior (ITS#4695)
index 560ea8170a8ad82f5baa59c28e174eab08c2df97..3ddabbb9da7cb1838fbfec0e479bd5cf948e448a 100644 (file)
 #      define EXIT_FAILURE 1
 #endif
 
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+#if defined(LINE_MAX) 
+#      define AC_LINE_MAX LINE_MAX
+#else
+#      define AC_LINE_MAX 2048 /* POSIX MIN */
+#endif
+
 #endif /* _AC_STDLIB_H */
index 0a6dc2dfcdd307d2532b949e8dae813fce067b5a..4ade449c75dbaf7c43f42fb4fef62ac80b63277b 100644 (file)
@@ -116,7 +116,7 @@ static const struct ol_attribute {
 static void openldap_ldap_init_w_conf(
        const char *file, int userconf )
 {
-       char linebuf[ LINE_MAX ];
+       char linebuf[ AC_LINE_MAX ];
        FILE *fp;
        int i;
        char *cmd, *opt;
index 5146a85c5a4e0a5cfaceb6bd8d46f2b2cc877e7b..8b043a4f009cbd37dad560d8a838aabde151a128 100644 (file)
@@ -1120,7 +1120,7 @@ slap_cf_aux_table_parse( const char *word, void *dst, slap_cf_aux_table *tab0, L
 int
 slap_cf_aux_table_unparse( void *src, struct berval *bv, slap_cf_aux_table *tab0 )
 {
-       char buf[BUFSIZ], *ptr;
+       char buf[AC_LINE_MAX], *ptr;
        slap_cf_aux_table *tab;
        struct berval tmp;
 
@@ -1307,7 +1307,7 @@ strtok_quote( char *line, char *sep, char **quote_ptr )
        return( tmp );
 }
 
-static char    buf[BUFSIZ];
+static char    buf[AC_LINE_MAX];
 static char    *line;
 static size_t lmax, lcur;
 
@@ -1315,7 +1315,7 @@ static size_t lmax, lcur;
        do { \
                size_t len = strlen( buf ); \
                while ( lcur + len + 1 > lmax ) { \
-                       lmax += BUFSIZ; \
+                       lmax += AC_LINE_MAX; \
                        line = (char *) ch_realloc( line, lmax ); \
                } \
                strcpy( line + lcur, buf ); \