summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1997-10-17 23:08:07 +0000
committerJeremy Allison <jra@samba.org>1997-10-17 23:08:07 +0000
commitc336a2f08183f63031b0a08b2111669bc36a5f30 (patch)
treee6773bb1bbbde2c829a55ec608f270233f8a925f /source3/nmbd
parenta0a28db75365d974ee05aee9dd4fde1ffc3db72c (diff)
downloadsamba-c336a2f08183f63031b0a08b2111669bc36a5f30.tar.gz
samba-c336a2f08183f63031b0a08b2111669bc36a5f30.tar.bz2
samba-c336a2f08183f63031b0a08b2111669bc36a5f30.zip
.cvsignore: Added make_smbcodepage
interface.c: Added is_local_net(). locking.c: Added Fix for zero length share files from Gerald Werner <wernerg@mfldclin.edu> plus a race condition fix for the fix. nameannounce.c: Made function static. namedbresp.c: extern int ClientDGRAM removed - not used. namedbserver.c: extern int ClientDGRAM removed - not used. namedbsubnet.c: Added code to make sockets per subnet. namepacket.c: Added code to read from all sockets & filter. nameresp.c: extern int ClientDGRAM removed - not used. nameserv.c: Indentation tidyup :-). nameserv.h: Added sockets to struct subnet. nameservresp.c: Improved debug message. nmbd.c: Changed to terminte on listen_for_packets exiting. nmbsync.c: extern int ClientDGRAM & ClientNMB removed - not used. proto.h: The usual. util.c: Fixed debug message. Jeremy (jallison@whistle.com) (This used to be commit 6904c2de080b2a9702800e9e4126386ced20569d)
Diffstat (limited to 'source3/nmbd')
-rw-r--r--source3/nmbd/nmbd.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index c7af54fa13..047284832f 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -34,8 +34,9 @@ pstring servicesf = CONFIGFILE;
extern pstring scope;
-int ClientNMB = -1;
-int ClientDGRAM = -1;
+int ClientNMB = -1;
+int ClientDGRAM = -1;
+int global_nmb_port = -1;
extern pstring myhostname;
static pstring host_file;
@@ -302,7 +303,8 @@ static void process(void)
{
time_t t = time(NULL);
run_election = check_elections();
- listen_for_packets(run_election);
+ if(listen_for_packets(run_election))
+ return;
run_packet_queue();
run_elections(t);
@@ -338,12 +340,19 @@ static BOOL open_sockets(BOOL isdaemon, int port)
return False;
}
+ /* The sockets opened here will be used to receive broadcast
+ packets *only*. Interface specific sockets are opened in
+ make_subnet() in namedbsubnet.c. Thus we bind to the
+ address "0.0.0.0". The parameter 'socket address' is
+ now deprecated.
+ */
+
if (isdaemon)
- ClientNMB = open_socket_in(SOCK_DGRAM, port,0,interpret_addr(lp_socket_address()));
+ ClientNMB = open_socket_in(SOCK_DGRAM, port,0,0);
else
ClientNMB = 0;
- ClientDGRAM = open_socket_in(SOCK_DGRAM,DGRAM_PORT,3,interpret_addr(lp_socket_address()));
+ ClientDGRAM = open_socket_in(SOCK_DGRAM,DGRAM_PORT,3,0);
if (ClientNMB == -1)
return(False);
@@ -353,7 +362,7 @@ static BOOL open_sockets(BOOL isdaemon, int port)
set_socket_options(ClientNMB,"SO_BROADCAST");
set_socket_options(ClientDGRAM,"SO_BROADCAST");
- DEBUG(3,("Sockets opened.\n"));
+ DEBUG(3,("open_sockets: Broadcast sockets opened.\n"));
return True;
}
@@ -460,12 +469,12 @@ static void usage(char *pname)
**************************************************************************/
int main(int argc,char *argv[])
{
- int port = NMB_PORT;
int opt;
extern FILE *dbf;
extern char *optarg;
char pidFile[100] = { 0 };
+ global_nmb_port = NMB_PORT;
*host_file = 0;
StartupTime = time(NULL);
@@ -537,7 +546,7 @@ static void usage(char *pname)
DEBUGLEVEL = atoi(optarg);
break;
case 'p':
- port = atoi(optarg);
+ global_nmb_port = atoi(optarg);
break;
case 'h':
usage(argv[0]);
@@ -618,9 +627,9 @@ static void usage(char *pname)
}
- DEBUG(3,("Opening sockets %d\n", port));
+ DEBUG(3,("Opening sockets %d\n", global_nmb_port));
- if (!open_sockets(is_daemon,port)) return 1;
+ if (!open_sockets(is_daemon,global_nmb_port)) return 1;
load_interfaces();
add_my_subnets(myworkgroup);