pmods = NULL;
dn = newrdn = NULL;
- while ( rc == 0 && ( line = str_getline( &rbuf )) != NULL ) {
+ while ( rc == 0 && ( line = ldif_getline( &rbuf )) != NULL ) {
++linenum;
if ( expect_sep && strcasecmp( line, T_MODSEPSTR ) == 0 ) {
expect_sep = 0;
continue;
}
- if ( str_parse_line( line, &type, &value, &vlen ) < 0 ) {
+ if ( ldif_parse_line( line, &type, &value, &vlen ) < 0 ) {
fprintf( stderr, "%s: invalid format (line %d of entry: %s\n",
prog, linenum, dn == NULL ? "" : dn );
rc = LDAP_PARAM_ERROR;
((tlen) + 4 + LDIF_BASE64_LEN(vlen) \
+ ((LDIF_BASE64_LEN(vlen) + (tlen) + 3) / LINE_WIDTH * 2 ))
-int str_parse_line LDAP_P(( char *line, char **type, char **value, int *vlen));
-char * str_getline LDAP_P(( char **next ));
-void put_type_and_value LDAP_P(( char **out, char *t, char *val, int vlen ));
+int ldif_parse_line LDAP_P(( char *line, char **type, char **value, int *vlen));
+char * ldif_getline LDAP_P(( char **next ));
+void ldif_put_type_and_value LDAP_P(( char **out, char *t, char *val, int vlen ));
char *ldif_type_and_value LDAP_P(( char *type, char *val, int vlen ));
+
LDAP_END_DECL
#endif /* _LDIF_H */
};
/*
- * str_parse_line - takes a line of the form "type:[:] value" and splits it
+ * ldif_parse_line - takes a line of the form "type:[:] value" and splits it
* into components "type" and "value". if a double colon separates type from
* value, then value is encoded in base 64, and parse_line un-decodes it
* (in place) before returning.
*/
int
-str_parse_line(
+ldif_parse_line(
char *line,
char **type,
char **value,
}
/*
- * str_getline - return the next "line" (minus newline) of input from a
+ * ldif_getline - return the next "line" (minus newline) of input from a
* string buffer of lines separated by newlines, terminated by \n\n
* or \0. this routine handles continued lines, bundling them into
* a single big line before returning. if a line begins with a white
*/
char *
-str_getline( char **next )
+ldif_getline( char **next )
{
char *l;
char c;
}
void
-put_type_and_value( char **out, char *t, char *val, int vlen )
+ldif_put_type_and_value( char **out, char *t, char *val, int vlen )
{
unsigned char *byte, *p, *stop;
unsigned char buf[3];
}
p = buf;
- put_type_and_value( &p, type, val, vlen );
+ ldif_put_type_and_value( &p, type, val, vlen );
*p = '\0';
return( buf );
next = s;
if ( isdigit( *s ) ) {
e->e_id = atoi( s );
- if ( (s = str_getline( &next )) == NULL ) {
+ if ( (s = ldif_getline( &next )) == NULL ) {
Debug( LDAP_DEBUG_TRACE,
"<= str2entry NULL (missing newline after id)\n",
0, 0, 0 );
vals[0] = &bval;
vals[1] = NULL;
ptype[0] = '\0';
- while ( (s = str_getline( &next )) != NULL ) {
+ while ( (s = ldif_getline( &next )) != NULL ) {
if ( *s == '\n' || *s == '\0' ) {
break;
}
- if ( str_parse_line( s, &type, &value, &vlen ) != 0 ) {
+ if ( ldif_parse_line( s, &type, &value, &vlen ) != 0 ) {
Debug( LDAP_DEBUG_TRACE,
"<= str2entry NULL (parse_line)\n", 0, 0, 0 );
continue;
/* put "dn: <dn>" */
tmplen = strlen( e->e_dn );
MAKE_SPACE( LDIF_SIZE_NEEDED( 2, tmplen ));
- put_type_and_value( (char **) &ecur, "dn", e->e_dn, tmplen );
+ ldif_put_type_and_value( (char **) &ecur, "dn", e->e_dn, tmplen );
}
/* put the attributes */
bv = a->a_vals[i];
tmplen = strlen( a->a_type );
MAKE_SPACE( LDIF_SIZE_NEEDED( tmplen, bv->bv_len ));
- put_type_and_value( (char **) &ecur, a->a_type,
+ ldif_put_type_and_value( (char **) &ecur, a->a_type,
bv->bv_val, bv->bv_len );
}
}
buf = (char *) ch_malloc( len );
bufp = buf;
- put_type_and_value( &bufp, mods->mod_type,
+ ldif_put_type_and_value( &bufp, mods->mod_type,
mods->mod_bvalues[i]->bv_val,
mods->mod_bvalues[i]->bv_len );
*bufp = '\0';
}
s = buf;
elineno = 0;
- while ( (linep = str_getline( &s )) != NULL ) {
+ while ( (linep = ldif_getline( &s )) != NULL ) {
elineno++;
- if ( str_parse_line( linep, &type, &val,
+ if ( ldif_parse_line( linep, &type, &val,
&vlen ) != 0 ) {
Debug( LDAP_DEBUG_PARSE,
"bad line %d in entry ending at line %d ignored\n",
if ( * buf != '\n' ) {
id++;
s = buf;
- while ( (linep = str_getline( &s )) != NULL ) {
- if ( str_parse_line( linep, &type, &val,
+ while ( (linep = ldif_getline( &s )) != NULL ) {
+ if ( ldif_parse_line( linep, &type, &val,
&vlen ) != 0 ) {
Debug( LDAP_DEBUG_PARSE,
"bad line %d ignored\n",
}
s = buf;
elineno = 0;
- while ( (linep = str_getline( &s )) != NULL ) {
+ while ( (linep = ldif_getline( &s )) != NULL ) {
elineno++;
- if ( str_parse_line( linep, &type, &val,
+ if ( ldif_parse_line( linep, &type, &val,
&vlen ) != 0 ) {
Debug( LDAP_DEBUG_PARSE,
"bad line %d in entry ending at line %d ignored\n",
id++;
s = buf;
elineno = 0;
- while ( (linep = str_getline( &s )) != NULL ) {
+ while ( (linep = ldif_getline( &s )) != NULL ) {
elineno++;
- if ( str_parse_line( linep, &type, &val, &vlen )
+ if ( ldif_parse_line( linep, &type, &val, &vlen )
!= 0 ) {
Debug( LDAP_DEBUG_PARSE,
"bad line %d in entry ending at line %d ignored\n",
re->re_refcnt = sglob->num_replicas;
for (;;) {
- if (( state == GOT_ALL ) || ( buf = str_getline( &rp )) == NULL ) {
+ if (( state == GOT_ALL ) || ( buf = ldif_getline( &rp )) == NULL ) {
break;
}
/*
continue;
}
buflen = ( long ) strlen( buf );
- if ( str_parse_line( buf, &type, &value, &len ) < 0 ) {
+ if ( ldif_parse_line( buf, &type, &value, &len ) < 0 ) {
Debug( LDAP_DEBUG_ANY,
"Error: Re_parse: malformed replog file\n",
0, 0, 0 );
}
for (;;) {
- if (( buf = str_getline( &rp )) == NULL ) {
+ if (( buf = ldif_getline( &rp )) == NULL ) {
break;
}
buflen = ( long ) strlen( buf );
type = "-";
value = NULL;
} else {
- if ( str_parse_line( buf, &type, &value, &len ) < 0 ) {
+ if ( ldif_parse_line( buf, &type, &value, &len ) < 0 ) {
Debug( LDAP_DEBUG_ANY,
"Error: malformed replog line \"%s\"\n",
buf, 0, 0 );
for (;;) {
/* If this is a reject log, we need to skip over the ERROR: line */
if ( !strncmp( *r_rp, ERROR_STR, strlen( ERROR_STR ))) {
- line = str_getline( r_rp );
+ line = ldif_getline( r_rp );
if ( line == NULL ) {
break;
}
if ( strncasecmp( *r_rp, "replica:", 7 )) {
break;
}
- line = str_getline( r_rp );
+ line = ldif_getline( r_rp );
if ( line == NULL ) {
break;
}
- if ( str_parse_line( line, &type, &value, &len ) < 0 ) {
+ if ( ldif_parse_line( line, &type, &value, &len ) < 0 ) {
return( NULL );
}
port = 0;