summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-07-10 07:57:17 +0000
committerJeremy Allison <jra@samba.org>2001-07-10 07:57:17 +0000
commitc3dd4d9ab1a5f14eb8904e001cb29bb8b7d3626c (patch)
tree344b6832d5cb2e48fd0e77510dc77d0f2e1f88a3
parent193a70550e960c34d68f8cda5743b2f93d232c8f (diff)
downloadsamba-c3dd4d9ab1a5f14eb8904e001cb29bb8b7d3626c.tar.gz
Added Andrew's broken DNS fix. This should help us in misconfigured situations.
Jeremy.
-rw-r--r--source/lib/util_sock.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/source/lib/util_sock.c b/source/lib/util_sock.c
index bc693fd471b..24290e9af44 100644
--- a/source/lib/util_sock.c
+++ b/source/lib/util_sock.c
@@ -780,32 +780,18 @@ open a socket of the specified type, port and address for incoming data
int open_socket_in(int type, int port, int dlevel,uint32 socket_addr, BOOL rebind)
{
- struct hostent *hp;
struct sockaddr_in sock;
- pstring host_name;
int res;
- /* get my host name */
- if (gethostname(host_name, MAXHOSTNAMELEN) == -1)
- { DEBUG(0,("gethostname failed\n")); return -1; }
-
- /* get host info */
- if ((hp = sys_gethostbyname(host_name)) == 0)
- {
- DEBUG(0,( "sys_gethostbyname: Unknown host %s\n",host_name));
- return -1;
- }
-
memset((char *)&sock,'\0',sizeof(sock));
- memcpy((char *)&sock.sin_addr,(char *)hp->h_addr, hp->h_length);
#ifdef HAVE_SOCK_SIN_LEN
sock.sin_len = sizeof(sock);
#endif
sock.sin_port = htons( port );
- sock.sin_family = hp->h_addrtype;
+ sock.sin_family = AF_INET;
sock.sin_addr.s_addr = socket_addr;
- res = socket(hp->h_addrtype, type, 0);
+ res = socket(AF_INET, type, 0);
if (res == -1)
{ DEBUG(0,("socket failed\n")); return -1; }