From: Pierangelo Masarati Date: Sat, 1 Jan 2011 20:50:00 +0000 (+0000) Subject: more about ITS#6645 X-Git-Tag: MIGRATION_CVS2GIT~290 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=59b220506de8c7851f7fa5eee81a052554a2b80c;p=openldap more about ITS#6645 --- diff --git a/clients/tools/common.c b/clients/tools/common.c index 0723514389..31ea8b972f 100644 --- a/clients/tools/common.c +++ b/clients/tools/common.c @@ -66,6 +66,7 @@ int nocanon = 0; int referrals = 0; int verbose = 0; int ldif = 0; +ber_len_t ldif_wrap = LDIF_LINE_WIDTH; char *prog = NULL; /* connection */ @@ -312,6 +313,7 @@ N_(" -N do not use reverse DNS to canonicalize SASL host name\n"), N_(" -O props SASL security properties\n"), N_(" -o [= (in seconds, or \"none\" or \"max\")\n"), +N_(" ldif-wrap= (in columns, or \"no\" for no wrapping)\n"), N_(" -p port port on LDAP server\n"), N_(" -Q use SASL Quiet mode\n"), N_(" -R realm SASL realm\n"), @@ -775,11 +777,30 @@ tool_args( int argc, char **argv ) prog, (long)nettimeout.tv_sec ); exit( EXIT_FAILURE ); } + + } else if ( strcasecmp( control, "ldif-wrap" ) == 0 ) { + if ( cvalue == 0 ) { + ldif_wrap = LDIF_LINE_WIDTH; + + } else if ( strcasecmp( cvalue, "no" ) == 0 ) { + ldif_wrap = LDIF_LINE_WIDTH_MAX; + + } else { + unsigned int u; + if ( lutil_atou( &u, cvalue ) ) { + fprintf( stderr, + _("Unable to parse ldif-wrap=\"%s\"\n"), cvalue ); + exit( EXIT_FAILURE ); + } + ldif_wrap = (ber_len_t)u; + } + } else { fprintf( stderr, "Invalid general option name: %s\n", control ); usage(); } + ber_memfree(control); break; case 'O': #ifdef HAVE_CYRUS_SASL @@ -2273,7 +2294,7 @@ tool_write_ldif( int type, char *name, char *value, ber_len_t vallen ) { char *ldif; - if (( ldif = ldif_put( type, name, value, vallen )) == NULL ) { + if (( ldif = ldif_put_wrap( type, name, value, vallen, ldif_wrap )) == NULL ) { return( -1 ); } diff --git a/clients/tools/common.h b/clients/tools/common.h index a668004adc..a0267219c8 100644 --- a/clients/tools/common.h +++ b/clients/tools/common.h @@ -56,6 +56,7 @@ extern int dont; extern int referrals; extern int verbose; extern int ldif; +extern ber_len_t ldif_wrap; extern char *prog; /* connection */ diff --git a/doc/devel/args b/doc/devel/args index 271eed951c..7805eff1c9 100644 --- a/doc/devel/args +++ b/doc/devel/args @@ -27,7 +27,7 @@ ldapwhoami * DE**HI** NO QR UVWXYZ def*h*** *nop* vwxy -h host -n no-op -N no (SASLprep) normalization of simple bind password - -o general connection options (currently nettimeout only) + -o general options (currently nettimeout and ldif-wrap only) -p port -v verbose -V version diff --git a/libraries/liblutil/ldif.c b/libraries/liblutil/ldif.c index c080199151..7f009245fc 100644 --- a/libraries/liblutil/ldif.c +++ b/libraries/liblutil/ldif.c @@ -742,7 +742,7 @@ ldif_put_wrap( } p = buf; - ldif_sput( &p, type, name, val, vlen ); + ldif_sput_wrap( &p, type, name, val, vlen, wrap ); *p = '\0'; return( buf );