The Samba-Bugzilla – Attachment 478 Details for
Bug 1238
Printers installed pointing to real hostname/netbios instead of netbios alias client requested
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
set_local_machine_name (like set_remote_machine_name) for port 445 connections
samba-3.0.2a-localname.patch (text/plain), 2.57 KB, created by
Daniel Jarboe
on 2004-04-27 12:49:20 UTC
(
hide
)
Description:
set_local_machine_name (like set_remote_machine_name) for port 445 connections
Filename:
MIME Type:
Creator:
Daniel Jarboe
Created:
2004-04-27 12:49:20 UTC
Size:
2.57 KB
patch
obsolete
>--- source/lib/util_sock.c.orig 2004-02-06 17:40:30.000000000 -0500 >+++ source/lib/util_sock.c 2004-04-27 15:22:15.000000000 -0400 >@@ -932,6 +932,65 @@ > } > > /******************************************************************* >+ Return the DNS name of the local end of a socket. >+******************************************************************/ >+ >+char *get_local_name(int fd, BOOL force_lookup) >+{ >+ static pstring name_buf; >+ pstring tmp_name; >+ static fstring addr_buf; >+ struct hostent *hp; >+ struct in_addr addr; >+ char *p; >+ >+ /* reverse lookups can be *very* expensive, but hopefully name for a >+ local socket address can be found quickly. Do same checks as >+ get_peer_name. */ >+ if (!lp_hostname_lookups() && (force_lookup == False)) { >+ return get_socket_addr(fd); >+ } >+ >+ p = get_socket_addr(fd); >+ >+ /* it might be the same as the last one - save some DNS work */ >+ if (strcmp(p, addr_buf) == 0) >+ return name_buf; >+ >+ pstrcpy(name_buf,"UNKNOWN"); >+ if (fd == -1) >+ return name_buf; >+ >+ fstrcpy(addr_buf, p); >+ >+ addr = *interpret_addr2(p); >+ >+ /* Look up the remote host name. */ >+ if ((hp = gethostbyaddr((char *)&addr.s_addr, sizeof(addr.s_addr), AF_INET)) == 0) { >+ DEBUG(1,("Gethostbyaddr failed for %s\n",p)); >+ pstrcpy(name_buf, p); >+ } else { >+ pstrcpy(name_buf,(char *)hp->h_name); >+ if (!matchname(name_buf, addr)) { >+ DEBUG(0,("Matchname failed on %s %s\n",name_buf,p)); >+ pstrcpy(name_buf,"UNKNOWN"); >+ } >+ } >+ >+ /* can't pass the same source and dest strings in when you >+ use --enable-developer or the clobber_region() call will >+ get you */ >+ >+ pstrcpy( tmp_name, name_buf ); >+ alpha_strcpy(name_buf, tmp_name, "_-.", sizeof(name_buf)); >+ if (strstr(name_buf,"..")) { >+ pstrcpy(name_buf, "UNKNOWN"); >+ } >+ >+ return name_buf; >+} >+ >+/******************************************************************* > Return the IP addr of the remote end of a socket as a string. > ******************************************************************/ > >--- source/smbd/server.c.orig 2004-01-16 12:47:53.000000000 -0500 >+++ source/smbd/server.c 2004-04-27 15:22:27.000000000 -0400 >@@ -399,6 +399,11 @@ > /* this is needed so that we get decent entries > in smbstatus for port 445 connects */ > set_remote_machine_name(get_peer_addr(smbd_server_fd()), False); >+ >+ /* this is needed for a decent get_called_name >+ for port 445 connects. Otherwise, we end up >+ global_myname() from init_names() */ >+ set_local_machine_name(get_local_name(smbd_server_fd(), True), False); > > /* Reset global variables in util.c so > that client substitutions will be
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1238
: 478