don't bother about the port if none is given (ITS#4012)

This commit is contained in:
Pierangelo Masarati 2005-09-08 15:13:01 +00:00
parent 3093f97767
commit daa7b11ff5
3 changed files with 12 additions and 5 deletions

View File

@ -459,7 +459,7 @@ parse_replica_line(
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;

View File

@ -321,7 +321,7 @@ get_repl_hosts(
if ( ldif_parse_line( line, &type, &value, &len ) < 0 ) {
return( NULL );
}
port = 0;
port = LDAP_PORT;
if (( p = strchr( value, ':' )) != NULL ) {
*p = '\0';
p++;
@ -544,11 +544,18 @@ Re_write(
}
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",

View File

@ -52,7 +52,7 @@ replicate(
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 );