mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
Removed silly Get_Hostbyname() wrapper as DNS names are case-insensitive
and the use of this function only increased timeouts when Samba queries
a broken DNS server.
(This used to be commit 720fea5360
)
This commit is contained in:
parent
672f554e76
commit
7b01c627c6
@ -495,7 +495,6 @@ BOOL zero_ip(struct in_addr ip);
|
|||||||
char *automount_lookup(char *user_name);
|
char *automount_lookup(char *user_name);
|
||||||
char *automount_lookup(char *user_name);
|
char *automount_lookup(char *user_name);
|
||||||
BOOL same_net(struct in_addr ip1,struct in_addr ip2,struct in_addr mask);
|
BOOL same_net(struct in_addr ip1,struct in_addr ip2,struct in_addr mask);
|
||||||
struct hostent *Get_Hostbyname(const char *name);
|
|
||||||
BOOL process_exists(pid_t pid);
|
BOOL process_exists(pid_t pid);
|
||||||
char *uidtoname(uid_t uid);
|
char *uidtoname(uid_t uid);
|
||||||
char *gidtoname(gid_t gid);
|
char *gidtoname(gid_t gid);
|
||||||
|
@ -803,13 +803,13 @@ uint32 interpret_addr(char *str)
|
|||||||
res = inet_addr(str);
|
res = inet_addr(str);
|
||||||
} else {
|
} else {
|
||||||
/* otherwise assume it's a network name of some sort and use
|
/* otherwise assume it's a network name of some sort and use
|
||||||
Get_Hostbyname */
|
sys_gethostbyname */
|
||||||
if ((hp = Get_Hostbyname(str)) == 0) {
|
if ((hp = sys_gethostbyname(str)) == 0) {
|
||||||
DEBUG(3,("Get_Hostbyname: Unknown host. %s\n",str));
|
DEBUG(3,("sys_gethostbyname: Unknown host. %s\n",str));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(hp->h_addr == NULL) {
|
if(hp->h_addr == NULL) {
|
||||||
DEBUG(3,("Get_Hostbyname: host address is invalid for host %s\n",str));
|
DEBUG(3,("sys_gethostbyname: host address is invalid for host %s\n",str));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
putip((char *)&res,(char *)hp->h_addr);
|
putip((char *)&res,(char *)hp->h_addr);
|
||||||
@ -995,67 +995,6 @@ BOOL same_net(struct in_addr ip1,struct in_addr ip2,struct in_addr mask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
a wrapper for gethostbyname() that tries with all lower and all upper case
|
|
||||||
if the initial name fails
|
|
||||||
****************************************************************************/
|
|
||||||
struct hostent *Get_Hostbyname(const char *name)
|
|
||||||
{
|
|
||||||
char *name2 = strdup(name);
|
|
||||||
struct hostent *ret;
|
|
||||||
|
|
||||||
if (!name2)
|
|
||||||
{
|
|
||||||
DEBUG(0,("Memory allocation error in Get_Hostbyname! panic\n"));
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This next test is redundent and causes some systems (with
|
|
||||||
* broken isalnum() calls) problems.
|
|
||||||
* JRA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (!isalnum(*name2))
|
|
||||||
{
|
|
||||||
free(name2);
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
#endif /* 0 */
|
|
||||||
|
|
||||||
ret = sys_gethostbyname(name2);
|
|
||||||
if (ret != NULL)
|
|
||||||
{
|
|
||||||
free(name2);
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* try with all lowercase */
|
|
||||||
strlower(name2);
|
|
||||||
ret = sys_gethostbyname(name2);
|
|
||||||
if (ret != NULL)
|
|
||||||
{
|
|
||||||
free(name2);
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* try with all uppercase */
|
|
||||||
strupper(name2);
|
|
||||||
ret = sys_gethostbyname(name2);
|
|
||||||
if (ret != NULL)
|
|
||||||
{
|
|
||||||
free(name2);
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* nothing works :-( */
|
|
||||||
free(name2);
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
check if a process exists. Does this work on all unixes?
|
check if a process exists. Does this work on all unixes?
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -791,9 +791,9 @@ int open_socket_in(int type, int port, int dlevel,uint32 socket_addr, BOOL rebin
|
|||||||
{ DEBUG(0,("gethostname failed\n")); return -1; }
|
{ DEBUG(0,("gethostname failed\n")); return -1; }
|
||||||
|
|
||||||
/* get host info */
|
/* get host info */
|
||||||
if ((hp = Get_Hostbyname(host_name)) == 0)
|
if ((hp = sys_gethostbyname(host_name)) == 0)
|
||||||
{
|
{
|
||||||
DEBUG(0,( "Get_Hostbyname: Unknown host %s\n",host_name));
|
DEBUG(0,( "sys_gethostbyname: Unknown host %s\n",host_name));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -945,8 +945,8 @@ static BOOL matchname(char *remotehost,struct in_addr addr)
|
|||||||
struct hostent *hp;
|
struct hostent *hp;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ((hp = Get_Hostbyname(remotehost)) == 0) {
|
if ((hp = sys_gethostbyname(remotehost)) == 0) {
|
||||||
DEBUG(0,("Get_Hostbyname(%s): lookup failure.\n", remotehost));
|
DEBUG(0,("sys_gethostbyname(%s): lookup failure.\n", remotehost));
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -772,7 +772,7 @@ static BOOL resolve_hosts(const char *name,
|
|||||||
|
|
||||||
DEBUG(3,("resolve_hosts: Attempting host lookup for name %s<0x20>\n", name));
|
DEBUG(3,("resolve_hosts: Attempting host lookup for name %s<0x20>\n", name));
|
||||||
|
|
||||||
if (((hp = Get_Hostbyname(name)) != NULL) && (hp->h_addr != NULL)) {
|
if (((hp = sys_gethostbyname(name)) != NULL) && (hp->h_addr != NULL)) {
|
||||||
struct in_addr return_ip;
|
struct in_addr return_ip;
|
||||||
putip((char *)&return_ip,(char *)hp->h_addr);
|
putip((char *)&return_ip,(char *)hp->h_addr);
|
||||||
*return_iplist = (struct in_addr *)malloc(sizeof(struct in_addr));
|
*return_iplist = (struct in_addr *)malloc(sizeof(struct in_addr));
|
||||||
|
Loading…
Reference in New Issue
Block a user