git://scientific.zcu.cz
/
jra1mw.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8d5749f
)
- Notification client can bind to addresses specified by hostname (Fixes SB #100721)
author
Zdeněk Šustr
<sustr4@cesnet.cz>
Wed, 6 Mar 2013 09:44:11 +0000
(09:44 +0000)
committer
František Dvořák
<valtri@civ.zcu.cz>
Sat, 9 Mar 2013 20:07:01 +0000
(21:07 +0100)
- Conservative solution: hostname resolution is done multiple times by the client.
- Notification client recognizes square brackets enclosing host address in endpoint specification
org.glite.lb.client/src/notification.c
patch
|
blob
|
blame
|
history
diff --git
a/org.glite.lb.client/src/notification.c
b/org.glite.lb.client/src/notification.c
index
b20663d
..
ff20bbb
100644
(file)
--- a/
org.glite.lb.client/src/notification.c
+++ b/
org.glite.lb.client/src/notification.c
@@
-90,7
+90,12
@@
static void get_name_and_port(const char *address, char **name, int *port)
*port = atoi(p+1);
*p = 0;
}
- *name = strdup(n);
+ if (p = strrchr(n, '[')) {
+ int len = strcspn(p+1, "]");
+ *name = (char*)malloc(sizeof(char*) * (len+1));
+ strncpy(*name, p+1, len);
+ }
+ else *name = strdup(n);
free(n);
}
@@
-102,7
+107,7
@@
static int daemon_listen(edg_wll_Context ctx, const char *name, char *port, int
int gaie;
memset (&hints, '\0', sizeof (hints));
- hints.ai_flags = AI_NUMERIC
HOST | AI_NUMERIC
SERV | AI_PASSIVE | AI_ADDRCONFIG;
+ hints.ai_flags = AI_NUMERICSERV | AI_PASSIVE | AI_ADDRCONFIG;
hints.ai_socktype = SOCK_STREAM;
hints.ai_family = AF_INET6;