From c052ddd7a56eca701802a2e94e28c1367878cb7e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zden=C4=9Bk=20Salvet?= Date: Fri, 19 Mar 2010 14:44:15 +0000 Subject: [PATCH] Fixed port number extraction. --- org.glite.lb.client/src/notification.c | 2 +- org.glite.lb.server/src/notification.c | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/org.glite.lb.client/src/notification.c b/org.glite.lb.client/src/notification.c index fcecd6b..d4d69f4 100644 --- a/org.glite.lb.client/src/notification.c +++ b/org.glite.lb.client/src/notification.c @@ -83,7 +83,7 @@ static void get_name_and_port(const char *address, char **name, int *port) char *n = NULL, *p; n = strdup(address); - p = strchr(n, ':'); + p = strrchr(n, ':'); if (p) { *port = atoi(p+1); diff --git a/org.glite.lb.server/src/notification.c b/org.glite.lb.server/src/notification.c index 207062f..f35d690 100644 --- a/org.glite.lb.server/src/notification.c +++ b/org.glite.lb.server/src/notification.c @@ -119,12 +119,13 @@ int edg_wll_NotifNewServer( { char *aux; - if ( !(aux = strchr(address_override, ':')) ) + if ( !(aux = strrchr(address_override, ':')) ) { edg_wll_SetError(ctx, EINVAL, "Addres overrirde not in format host:port"); goto cleanup; } - if ( !strncmp(address_override, "0.0.0.0", aux-address_override) ) + if ( !strncmp(address_override, "0.0.0.0", aux-address_override) || + !strncmp(address_override, "::", aux-address_override) ) trio_asprintf(&addr_s, "%s:%s", ctx->connections->serverConnection->peerName, aux+1); } @@ -241,12 +242,13 @@ int edg_wll_NotifBindServer( { char *aux; - if ( !(aux = strchr(address_override, ':')) ) + if ( !(aux = strrchr(address_override, ':')) ) { edg_wll_SetError(ctx, EINVAL, "Addres overrirde not in format host:port"); goto rollback; } - if ( !strncmp(address_override, "0.0.0.0", aux-address_override) ) + if ( !strncmp(address_override, "0.0.0.0", aux-address_override) || + !strncmp(address_override, "::", aux-address_override) ) trio_asprintf(&addr_s, "%s:%s", ctx->connections->serverConnection->peerName, aux+1); } -- 1.8.2.3