1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

nmbd_incomingdgrams.c: Fix for typo.

nmbd_sendannounce.c: Remote announcement was announcing to the wrong name !
nmblookup.c: Fix for substitutions not seeing hostname.
testparm.c: Fix for substitutions not seeing hostname.
wsmbstatus.c: Fix for substitutions not seeing hostname.
util.c: Change read_udp_socket to use sockaddr_in rather than dubiously
messing around with an opaque data type (sockaddr).
Jeremy.
This commit is contained in:
Jeremy Allison 0001-01-01 00:00:00 +00:00
parent e58ab3bbe6
commit 776ccf5c06
6 changed files with 22 additions and 8 deletions

View File

@ -2002,20 +2002,20 @@ read from a socket
int read_udp_socket(int fd,char *buf,int len) int read_udp_socket(int fd,char *buf,int len)
{ {
int ret; int ret;
struct sockaddr sock; struct sockaddr_in sock;
int socklen; int socklen;
socklen = sizeof(sock); socklen = sizeof(sock);
bzero((char *)&sock,socklen); bzero((char *)&sock,socklen);
bzero((char *)&lastip,sizeof(lastip)); bzero((char *)&lastip,sizeof(lastip));
ret = recvfrom(fd,buf,len,0,&sock,&socklen); ret = recvfrom(fd,buf,len,0,(struct sockaddr *)&sock,&socklen);
if (ret <= 0) { if (ret <= 0) {
DEBUG(2,("read socket failed. ERRNO=%s\n",strerror(errno))); DEBUG(2,("read socket failed. ERRNO=%s\n",strerror(errno)));
return(0); return(0);
} }
lastip = *(struct in_addr *) &sock.sa_data[2]; lastip = sock.sin_addr;
lastport = ntohs(((struct sockaddr_in *)&sock)->sin_port); lastport = ntohs(sock.sin_port);
DEBUG(10,("read_udp_socket: lastip %s lastport %d read: %d\n", DEBUG(10,("read_udp_socket: lastip %s lastport %d read: %d\n",
inet_ntoa(lastip), lastport, ret)); inet_ntoa(lastip), lastport, ret));

View File

@ -449,8 +449,8 @@ void process_lm_host_announce(struct subnet_record *subrec, struct packet_struct
if ((osmajor < 36) || (osmajor > 38) || (osminor !=0)) if ((osmajor < 36) || (osmajor > 38) || (osminor !=0))
{ {
DEBUG(5,("process_lm_host_announce: LM Announcement packet does not " \ DEBUG(5,("process_lm_host_announce: LM Announcement packet does not \
"originate from OS/2 Warp client. Ignoring packet.\n")); originate from OS/2 Warp client. Ignoring packet.\n"));
/* Could have been from a Windows machine (with its LM Announce enabled), /* Could have been from a Windows machine (with its LM Announce enabled),
or a Samba server. Then don't disrupt the current browse list. */ or a Samba server. Then don't disrupt the current browse list. */
return; return;

View File

@ -529,7 +529,7 @@ void announce_remote(time_t t)
send_announcement(FIRST_SUBNET, ANN_HostAnnouncement, send_announcement(FIRST_SUBNET, ANN_HostAnnouncement,
name, /* From nbt name. */ name, /* From nbt name. */
wgroup, 0x1e, /* To nbt name. */ wgroup, 0x1d, /* To nbt name. */
addr, /* To ip. */ addr, /* To ip. */
REMOTE_ANNOUNCE_INTERVAL, /* Time until next announce. */ REMOTE_ANNOUNCE_INTERVAL, /* Time until next announce. */
name, /* Name to announce. */ name, /* Name to announce. */

View File

@ -170,12 +170,13 @@ int main(int argc,char *argv[])
exit(1); exit(1);
} }
init_structs();
if (!lp_load(servicesf,True)) { if (!lp_load(servicesf,True)) {
fprintf(stderr, "Can't load %s - run testparm to debug it\n", servicesf); fprintf(stderr, "Can't load %s - run testparm to debug it\n", servicesf);
} }
load_interfaces(); load_interfaces();
init_structs();
if (!open_sockets()) return(1); if (!open_sockets()) return(1);
if (!got_bcast) if (!got_bcast)

View File

@ -38,6 +38,7 @@
/* these live in util.c */ /* these live in util.c */
extern FILE *dbf; extern FILE *dbf;
extern int DEBUGLEVEL; extern int DEBUGLEVEL;
extern pstring myhostname;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
@ -60,6 +61,12 @@ extern int DEBUGLEVEL;
printf("Load smb config files from %s\n",configfile); printf("Load smb config files from %s\n",configfile);
if(!get_myname(myhostname,NULL))
{
printf("Failed to get my hostname.\n");
return(1);
}
if (!lp_load(configfile,False)) if (!lp_load(configfile,False))
{ {
printf("Error loading services.\n"); printf("Error loading services.\n");

View File

@ -43,6 +43,12 @@ static void show_connections(void)
FILE *f; FILE *f;
struct connect_record crec; struct connect_record crec;
if(!get_myname(myhostname,NULL))
{
printf("Failed to get my hostname.\n");
return;
}
if (!lp_load(servicesf,False)) { if (!lp_load(servicesf,False)) {
printf("Can't load %s - run testparm to debug it\n", servicesf); printf("Can't load %s - run testparm to debug it\n", servicesf);
return; return;