]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#8345 Remove LDIF_KLUDGE and defer defaults to _wrap()
authorOndřej Kuzník <ondra@mistotebe.net>
Wed, 3 Mar 2021 10:37:19 +0000 (10:37 +0000)
committerOndřej Kuzník <ondra@mistotebe.net>
Wed, 3 Mar 2021 10:37:19 +0000 (10:37 +0000)
include/ldif.h
libraries/libldap/ldif.c

index 926bb0208e8b2e7c83d66672e8fb2a16634017fc..4ae6468eb8bc759767e1838bfc231428f70f2bc9 100644 (file)
@@ -33,7 +33,7 @@ LDAP_BEGIN_DECL
 /* This is NOT a bogus extern declaration (unlike ldap_debug) */
 LDAP_LDIF_V (int) ldif_debug;
 
-#define LDIF_LINE_WIDTH      76      /* default maximum length of LDIF lines */
+#define LDIF_LINE_WIDTH      78      /* default maximum length of LDIF lines */
 #define LDIF_LINE_WIDTH_MAX  ((ber_len_t)-1) /* maximum length of LDIF lines */
 #define LDIF_LINE_WIDTH_WRAP(wrap) ((wrap) == 0 ? LDIF_LINE_WIDTH : (wrap))
 
@@ -50,9 +50,7 @@ LDAP_LDIF_V (int) ldif_debug;
  * first newline + base64 value + continued lines.  Each continued line
  * needs room for a newline and a leading space character.
  */
-#define LDIF_SIZE_NEEDED(nlen,vlen) \
-    ((nlen) + 4 + LDIF_BASE64_LEN(vlen) \
-    + ((LDIF_BASE64_LEN(vlen) + (nlen) + 3) / (LDIF_LINE_WIDTH-1) * 2 ))
+#define LDIF_SIZE_NEEDED(nlen,vlen) LDIF_SIZE_NEEDED_WRAP(nlen, vlen, 0)
 
 #define LDIF_SIZE_NEEDED_WRAP(nlen,vlen,wrap) \
     ((nlen) + 4 + LDIF_BASE64_LEN(vlen) \
index 7b10b78bcb8243bc698626e098f2bd12feaad3ee..8e84a898d8a430f27af3167d0aec6f8367f17d8e 100644 (file)
@@ -432,9 +432,6 @@ ldif_must_b64_encode( LDAP_CONST char *s )
        return 0;
 }
 
-/* compatibility with U-Mich off by two bug */
-#define LDIF_KLUDGE 2
-
 /* NOTE: only preserved for binary compatibility */
 void
 ldif_sput(
@@ -444,7 +441,7 @@ ldif_sput(
        LDAP_CONST char *val,
        ber_len_t vlen )
 {
-       ldif_sput_wrap( out, type, name, val, vlen, LDIF_LINE_WIDTH+LDIF_KLUDGE );
+       ldif_sput_wrap( out, type, name, val, vlen, 0 );
 }
 
 void
@@ -468,7 +465,7 @@ ldif_sput_wrap(
        ber_len_t i;
 
        if ( !wrap )
-               wrap = LDIF_LINE_WIDTH+LDIF_KLUDGE;
+               wrap = LDIF_LINE_WIDTH;
 
        /* prefix */
        switch( type ) {
@@ -664,7 +661,7 @@ ldif_put(
        LDAP_CONST char *val,
        ber_len_t vlen )
 {
-       return ldif_put_wrap( type, name, val, vlen, LDIF_LINE_WIDTH );
+       return ldif_put_wrap( type, name, val, vlen, 0 );
 }
 
 char *