nmbd_incomingdgrams.c: Fix for typo.
authorJeremy Allison <jra@samba.org>
Tue, 24 Feb 1998 17:59:34 +0000 (17:59 +0000)
committerJeremy Allison <jra@samba.org>
Tue, 24 Feb 1998 17:59:34 +0000 (17:59 +0000)
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 used to be commit 776ccf5c0641b5aa300236c2612b5f2761d1179f)

source3/lib/util.c
source3/nmbd/nmbd_incomingdgrams.c
source3/nmbd/nmbd_sendannounce.c
source3/utils/nmblookup.c
source3/utils/testparm.c
source3/wsmbstatus.c

index 365a765174242ecb19e14c7d25022f53fc65e813..18614caeed8f6e5b9080f8015496939e1446b024 100644 (file)
@@ -2002,20 +2002,20 @@ read from a socket
 int read_udp_socket(int fd,char *buf,int len)
 {
   int ret;
-  struct sockaddr sock;
+  struct sockaddr_in sock;
   int socklen;
   
   socklen = sizeof(sock);
   bzero((char *)&sock,socklen);
   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) {
     DEBUG(2,("read socket failed. ERRNO=%s\n",strerror(errno)));
     return(0);
   }
 
-  lastip = *(struct in_addr *) &sock.sa_data[2];
-  lastport = ntohs(((struct sockaddr_in *)&sock)->sin_port);
+  lastip = sock.sin_addr;
+  lastport = ntohs(sock.sin_port);
 
   DEBUG(10,("read_udp_socket: lastip %s lastport %d read: %d\n",
              inet_ntoa(lastip), lastport, ret));
index 46d988e89afecd023cd6f46715952cf9fa2bd3c7..80057ef12c9c23e0069161e82bf8694965a27726 100644 (file)
@@ -449,8 +449,8 @@ void process_lm_host_announce(struct subnet_record *subrec, struct packet_struct
 
   if ((osmajor < 36) || (osmajor > 38) || (osminor !=0))
   {
-    DEBUG(5,("process_lm_host_announce: LM Announcement packet does not \
-             "originate from OS/2 Warp client. Ignoring packet.\n"));
+    DEBUG(5,("process_lm_host_announce: LM Announcement packet does not \
+originate from OS/2 Warp client. Ignoring packet.\n"));
     /* Could have been from a Windows machine (with its LM Announce enabled),
        or a Samba server. Then don't disrupt the current browse list. */
     return;
index 62e5f02d8c826a25b3ce03443b120a318cd27055..e39e2514966cb3c27d7c475fbc8c68f0d9d35aba 100644 (file)
@@ -529,7 +529,7 @@ void announce_remote(time_t t)
 
       send_announcement(FIRST_SUBNET, ANN_HostAnnouncement,
                     name,                      /* From nbt name. */
-                    wgroup, 0x1e,              /* To nbt name. */
+                    wgroup, 0x1d,              /* To nbt name. */
                     addr,                      /* To ip. */
                     REMOTE_ANNOUNCE_INTERVAL,  /* Time until next announce. */
                     name,                      /* Name to announce. */
index 5cd5a869a996a91b309db50c99cd556ee22d9935..a73a35cd56c1e255f2488d805ce1eca15cc9fa98 100644 (file)
@@ -170,12 +170,13 @@ int main(int argc,char *argv[])
     exit(1);
   }
 
+  init_structs();
+
   if (!lp_load(servicesf,True)) {
     fprintf(stderr, "Can't load %s - run testparm to debug it\n", servicesf);
   }
 
   load_interfaces();
-  init_structs();
   if (!open_sockets()) return(1);
 
   if (!got_bcast)
index cc35d2d530ef8c66f071fb96d9f294e55c3d3bae..a35a3fd71e0e94e2baab3ba89fe0e6d8ff0d500b 100644 (file)
@@ -38,6 +38,7 @@
 /* these live in util.c */
 extern FILE *dbf;
 extern int DEBUGLEVEL;
+extern pstring myhostname;
 
  int main(int argc, char *argv[])
 {
@@ -60,6 +61,12 @@ extern int DEBUGLEVEL;
 
   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))
     {
       printf("Error loading services.\n");
index fd576620623ccd159314c1853b78b60c481869e0..60c35357b2103ad5054df51b5ad5e259d5fd6ff8 100644 (file)
@@ -43,6 +43,12 @@ static void show_connections(void)
        FILE *f;
        struct connect_record crec;
 
+       if(!get_myname(myhostname,NULL))
+       {
+           printf("Failed to get my hostname.\n");
+           return;
+       }
+
        if (!lp_load(servicesf,False)) {
                printf("Can't load %s - run testparm to debug it\n", servicesf);
                return;