r647: fix for setting the called name to by our IP if the called name was *SMBSERVER...
authorGerald Carter <jerry@samba.org>
Tue, 11 May 2004 14:54:54 +0000 (14:54 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:51:32 +0000 (10:51 -0500)
(This used to be commit 8ee268f0ed0c2f75ded9c2ddd66e0953f443c79e)

source3/lib/substitute.c
source3/lib/util.c
source3/param/loadparm.c

index fed11c22982e000d17967bb74d1baf5c084556bb..44e791b7907a6d4b97972ff69ffb8e1361774592 100644 (file)
@@ -40,24 +40,24 @@ void set_local_machine_name(const char* local_name, BOOL perm)
        static BOOL already_perm = False;
        fstring tmp_local_machine;
 
+       fstrcpy(tmp_local_machine,local_name);
+       trim_char(tmp_local_machine,' ',' ');
+
        /*
         * Windows NT/2k uses "*SMBSERVER" and XP uses "*SMBSERV"
         * arrggg!!! 
         */
 
-       if (strequal(local_name, "*SMBSERVER")) 
-               return;
-
-       if (strequal(local_name, "*SMBSERV")) 
+       if ( strequal(tmp_local_machine, "*SMBSERVER") || strequal(tmp_local_machine, "*SMBSERV") )  {
+               fstrcpy( local_machine, client_socket_addr() );
                return;
+       }
 
        if (already_perm)
                return;
 
        already_perm = perm;
 
-       fstrcpy(tmp_local_machine,local_name);
-       trim_char(tmp_local_machine,' ',' ');
        alpha_strcpy(local_machine,tmp_local_machine,SAFE_NETBIOS_CHARS,sizeof(local_machine)-1);
        strlower_m(local_machine);
 }
index e8ffd9d8d2e77337e28c054e5fc12709c0d3f0db..9d7a2648c5b603874c4128d9c044a5dc9a4bb82f 100644 (file)
@@ -1703,24 +1703,6 @@ BOOL is_myname(const char *s)
        return(ret);
 }
 
-/********************************************************************
- Return only the first IP address of our configured interfaces
- as a string
- *******************************************************************/
-
-const char* get_my_primary_ip (void)
-{
-       static fstring ip_string;
-       int n;
-       struct iface_struct nics[MAX_INTERFACES];
-
-       if ((n=get_interfaces(nics, MAX_INTERFACES)) <= 0)
-               return NULL;
-
-       fstrcpy(ip_string, inet_ntoa(nics[0].ip));
-       return ip_string;
-}
-
 BOOL is_myname_or_ipaddr(const char *s)
 {
        /* optimize for the common case */
index b378342372b3bde28ec15c4f6b866ada2e264521..30fbc9713e13e63d9790f6e6a27c0f96371ff126 100644 (file)
@@ -4252,7 +4252,7 @@ const char *get_called_name(void)
        static fstring called_name;
 
        if (!*local_machine) {
-               fstrcpy(called_name, get_my_primary_ip());
+               fstrcpy(called_name, client_socket_addr());
                DEBUG(8,("get_called_name: assuming that client used IP address [%s] as called name.\n",
                         called_name));
                return called_name;