diff options
| author | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> | 2008-06-10 13:06:26 -0400 |
|---|---|---|
| committer | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> | 2008-06-10 13:06:26 -0400 |
| commit | a013e2dbe99ce306e8f9d1baf18b188ccca96486 (patch) | |
| tree | e40dcb26b56391f63b66c958143cf89ae2331bda /src/plugin.c | |
| parent | 61031a84224acd373064c2f2a557279c250d6793 (diff) | |
| download | slapi-nis-a013e2dbe99ce306e8f9d1baf18b188ccca96486.tar.gz slapi-nis-a013e2dbe99ce306e8f9d1baf18b188ccca96486.tar.xz slapi-nis-a013e2dbe99ce306e8f9d1baf18b188ccca96486.zip | |
- sort out host/network order for port numbers
Diffstat (limited to 'src/plugin.c')
| -rw-r--r-- | src/plugin.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugin.c b/src/plugin.c index 1dc465b..831b89c 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -250,7 +250,7 @@ plugin_state_init(Slapi_PBlock *pb, struct plugin_state **lstate) * directory server's database. */ serv = getservbyname("ypserv", (i & 1) ? "tcp" : "udp"); if (serv != NULL) { - port = serv->s_port; + port = ntohs(serv->s_port); } if (port == 0) { ret = (pf == PF_INET6) ? bindresvport(sockfd, @@ -258,8 +258,8 @@ plugin_state_init(Slapi_PBlock *pb, struct plugin_state **lstate) bindresvport(sockfd, &sin); } else { - sin.sin_port = ntohs(port); - sin6.sin6_port = ntohs(port); + sin.sin_port = htons(port); + sin6.sin6_port = htons(port); ret = (pf == PF_INET6) ? bind(sockfd, (struct sockaddr*) &sin6, sizeof(sin6)) : @@ -277,8 +277,8 @@ plugin_state_init(Slapi_PBlock *pb, struct plugin_state **lstate) continue; } /* Pick out the port number that we got back. */ - port = (pf == PF_INET6) ? htons(sin6.sin6_port) : - htons(sin.sin_port); + port = (pf == PF_INET6) ? ntohs(sin6.sin6_port) : + ntohs(sin.sin_port); /* If it's a listening socket, let the kernel know that we're * ready to accept client connections. */ if (type == SOCK_STREAM) { |
