From: Pierangelo Masarati Date: Thu, 8 Sep 2005 15:13:01 +0000 (+0000) Subject: don't bother about the port if none is given (ITS#4012) X-Git-Tag: OPENLDAP_REL_ENG_2_2_MP~462 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=daa7b11ff5a6f45e6945fff2b263ded7d46bce78;p=openldap don't bother about the port if none is given (ITS#4012) --- diff --git a/servers/slurpd/config.c b/servers/slurpd/config.c index 71934ce59e..6fe2e4035e 100644 --- a/servers/slurpd/config.c +++ b/servers/slurpd/config.c @@ -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; diff --git a/servers/slurpd/re.c b/servers/slurpd/re.c index 7a70948783..3633732e5f 100644 --- a/servers/slurpd/re.c +++ b/servers/slurpd/re.c @@ -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", diff --git a/servers/slurpd/replica.c b/servers/slurpd/replica.c index 8a1605e616..a01e0516dc 100644 --- a/servers/slurpd/replica.c +++ b/servers/slurpd/replica.c @@ -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 );