ri->ri_port = atoi( hp );
}
if ( ri->ri_port <= 0 ) {
- ri->ri_port = 0;
+ ri->ri_port = LDAP_PORT;
}
ri->ri_hostname = strdup( val );
gots |= GOT_HOST;
if ( ldif_parse_line( line, &type, &value, &len ) < 0 ) {
return( NULL );
}
- port = 0;
+ port = LDAP_PORT;
if (( p = strchr( value, ':' )) != NULL ) {
*p = '\0';
p++;
}
if ( ri != NULL ) { /* write a single "replica:" line */
- if ( fprintf( fp, "replica: %s:%d\n", ri->ri_hostname,
- ri->ri_port ) < 0 ) {
+ if ( ri->ri_port != 0 ) {
+ rc = fprintf( fp, "replica: %s:%d\n", ri->ri_hostname,
+ ri->ri_port );
+ } else {
+ rc = fprintf( fp, "replica: %s\n", ri->ri_hostname );
+ }
+ if ( rc < 0 ) {
rc = -1;
goto bad;
}
+ rc = 0;
+
} else { /* write multiple "replica:" lines */
for ( i = 0; re->re_replicas && re->re_replicas[ i ].rh_hostname != NULL; i++ ) {
if ( fprintf( fp, "replica: %s:%d\n",
Ri *ri = (Ri *) ri_arg;
Debug( LDAP_DEBUG_ARGS, "begin replication thread for %s:%d\n",
- ((Ri *)ri)->ri_hostname, ((Ri *)ri)->ri_port, 0 );
+ ri->ri_hostname, ri->ri_port, 0 );
ri->ri_process( ri );