summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1996-08-16 13:03:26 +0000
committerAndrew Tridgell <tridge@samba.org>1996-08-16 13:03:26 +0000
commitf63d4c830aa88d20ababe4c3543bff7becc3a506 (patch)
tree286125d72593631440f3b92c85dac62b3ec2e42f /source3/nmbd
parentb990567a8c8afe8a085eb7865c7704925334a4b5 (diff)
downloadsamba-f63d4c830aa88d20ababe4c3543bff7becc3a506.tar.gz
samba-f63d4c830aa88d20ababe4c3543bff7becc3a506.tar.bz2
samba-f63d4c830aa88d20ababe4c3543bff7becc3a506.zip
- added the "remote announce" option
- made the lp_string() code able to handle any length string - got rid of the obsolete lmhosts code, instead users should use "interfaces" and "remote announce". lmhosts now is just used as a IP to netbios name map - cleanup the inet_address() code (This used to be commit be2b67940302b2e63890cb865fe3948c2206ea91)
Diffstat (limited to 'source3/nmbd')
-rw-r--r--source3/nmbd/nmbd.c120
1 files changed, 51 insertions, 69 deletions
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 04751f6f56..1ee11edbcf 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -229,80 +229,60 @@ static void load_hosts_file(char *fname)
while (!feof(f))
{
+ pstring ip,name,flags,extra;
+ struct subnet_record *d;
+ char *ptr;
+ int count = 0;
+ struct in_addr ipaddr;
+ enum name_source source = LMHOSTS;
+
if (!fgets_slash(line,sizeof(pstring),f)) continue;
if (*line == '#') continue;
- {
- BOOL group=False;
-
- pstring ip,name,mask,flags,extra;
-
- char *ptr;
- int count = 0;
- struct in_addr ipaddr;
- struct in_addr ipmask;
- enum name_source source = LMHOSTS;
-
- strcpy(ip,"");
- strcpy(name,"");
- strcpy(mask,"");
- strcpy(flags,"");
- strcpy(extra,"");
-
- ptr = line;
-
- if (next_token(&ptr,ip ,NULL)) ++count;
- if (next_token(&ptr,name ,NULL)) ++count;
- if (next_token(&ptr,mask ,NULL)) ++count;
- if (next_token(&ptr,flags,NULL)) ++count;
- if (next_token(&ptr,extra,NULL)) ++count;
-
- if (count <= 0) continue;
-
- if (count > 0 && count < 2) {
- DEBUG(0,("Ill formed hosts line [%s]\n",line));
- continue;
- }
-
- /* work out if we need to shuffle the tokens along due to the
- optional subnet mask argument */
-
- if (strchr(mask, 'G') || strchr(mask, 'S') || strchr(mask, 'M')) {
- strcpy(flags, mask );
- /* default action for no subnet mask */
- strcpy(mask, "");
- }
-
- DEBUG(4, ("lmhost entry: %s %s %s %s\n", ip, name, mask, flags));
-
- if (strchr(flags,'G') || strchr(flags,'S'))
- group = True;
-
- if (strchr(flags,'M') && !group) {
- source = SELF;
- strcpy(myname,name);
- }
-
- ipaddr = *interpret_addr2(ip);
- if (*mask)
- ipmask = *interpret_addr2(mask);
- else
- ipmask = *iface_nmask(ipaddr);
-
- if (group) {
- add_subnet_entry(ipaddr, ipmask, name, True, True);
- } else {
- struct subnet_record *d = find_subnet(ipaddr);
- if (d)
- {
- add_netbios_entry(d,name,0x00,NB_ACTIVE,0,source,ipaddr,True,True);
- add_netbios_entry(d,name,0x20,NB_ACTIVE,0,source,ipaddr,True,True);
+ strcpy(ip,"");
+ strcpy(name,"");
+ strcpy(flags,"");
+
+ ptr = line;
+
+ if (next_token(&ptr,ip ,NULL)) ++count;
+ if (next_token(&ptr,name ,NULL)) ++count;
+ if (next_token(&ptr,flags,NULL)) ++count;
+ if (next_token(&ptr,extra,NULL)) ++count;
+
+ if (count <= 0) continue;
+
+ if (count > 0 && count < 2) {
+ DEBUG(0,("Ill formed hosts line [%s]\n",line));
+ continue;
}
- }
+
+ if (count >= 4) {
+ DEBUG(0,("too many columns in %s (obsolete syntax)\n",fname));
+ continue;
+ }
+
+ DEBUG(4, ("lmhost entry: %s %s %s\n", ip, name, flags));
+
+ if (strchr(flags,'G') || strchr(flags,'S')) {
+ DEBUG(0,("group flag in %s ignored (obsolete)\n",fname));
+ continue;
}
+
+ if (strchr(flags,'M')) {
+ source = SELF;
+ strcpy(myname,name);
+ }
+
+ ipaddr = *interpret_addr2(ip);
+ d = find_subnet(ipaddr);
+ if (d) {
+ add_netbios_entry(d,name,0x00,NB_ACTIVE,0,source,ipaddr,True,True);
+ add_netbios_entry(d,name,0x20,NB_ACTIVE,0,source,ipaddr,True,True);
+ }
}
-
+
fclose(f);
}
@@ -325,7 +305,7 @@ static void process(void)
announce_host();
-#if 1
+#if 0
/* XXXX what was this stuff supposed to do? It sent
ANN_GetBackupListReq packets which I think should only be
sent when trying to find out who to browse with */
@@ -335,6 +315,8 @@ static void process(void)
announce_master();
+ announce_remote();
+
query_refresh_names();
expire_names_and_servers();
@@ -468,7 +450,7 @@ static void usage(char *pname)
{
case 's':
strcpy(servicesf,optarg);
- break;
+ break;
case 'C':
strcpy(ServerComment,optarg);
break;