From 5aef8a21c6e3cd690afb11d2d69d2e9bac25b6b4 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 25 Jan 2001 02:59:13 +0000 Subject: Fixes from appliance-head for pdc searches. Jeremy. (This used to be commit d04ed97ecab846def8467f313a71ef0e5c4005f6) --- source3/libsmb/namequery.c | 19 +------------------ source3/smbd/password.c | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index 59a3856cfb..173fe12bcb 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -628,23 +628,6 @@ static BOOL resolve_hosts(const char *name, return False; } -/******************************************************** - Resolve a name into an IP address. Use this function if - the string is either an IP address, DNS or host name - or NetBIOS name. This uses the name switch in the - smb.conf to determine the order of name resolution. -*********************************************************/ -BOOL is_ip_address(const char *name) -{ - int i; - for (i=0; name[i]; i++) - if (!(isdigit((int)name[i]) || name[i] == '.')) - return False; - - return True; -} - - /******************************************************** Internal interface to resolve a name into an IP address. Use this function if the string is either an IP address, DNS @@ -775,7 +758,7 @@ BOOL resolve_srv_name(const char* srv_name, fstring dest_host, ret = resolve_name(dest_host, ip, 0x20); } - if (is_ip_address(dest_host)) + if (is_ipaddress(dest_host)) { fstrcpy(dest_host, "*SMBSERVER"); } diff --git a/source3/smbd/password.c b/source3/smbd/password.c index 69ba042155..cdf3e28b03 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -1211,16 +1211,31 @@ use this machine as the password server.\n")); given a name or IP address. ************************************************************************/ -static BOOL connect_to_domain_password_server(struct cli_state *pcli, char *remote_machine, +static BOOL connect_to_domain_password_server(struct cli_state *pcli, + char *server, unsigned char *trust_passwd) { struct in_addr dest_ip; + fstring remote_machine; if(cli_initialise(pcli) == False) { DEBUG(0,("connect_to_domain_password_server: unable to initialize client connection.\n")); return False; } + if (is_ipaddress(server)) { + struct in_addr to_ip; + + if (!inet_aton(server, &to_ip) || + !name_status_find(0x20, to_ip, remote_machine)) { + DEBUG(1, ("connect_to_domain_password_server: Can't " + "resolve name for IP %s\n", server)); + return False; + } + } else { + fstrcpy(remote_machine, server); + } + standard_sub_basic(remote_machine); strupper(remote_machine); -- cgit