summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1996-08-17 15:14:24 +0000
committerSamba Release Account <samba-bugs@samba.org>1996-08-17 15:14:24 +0000
commit3d55e541569e7ab887bddc284bddcafdf86c4d22 (patch)
treea0e33b928d11116e134d580393797843c8f91eae
parent917160dee69bbc198985b6f3232ca2dcda809d8a (diff)
downloadsamba-3d55e541569e7ab887bddc284bddcafdf86c4d22.tar.gz
- fixed wins.dat reloading (it wasn't happening!)
- made nb_flags an unsigned 16 bit int in nameserv.h - nmbd was calling add_my_subnets() with an uninitialised parameter group. removed it. lkcl
-rw-r--r--source/include/nameserv.h2
-rw-r--r--source/namedbname.c80
-rw-r--r--source/nmbd/nmbd.c4
3 files changed, 43 insertions, 43 deletions
diff --git a/source/include/nameserv.h b/source/include/nameserv.h
index a505f403caa..8dc737bdb06 100644
--- a/source/include/nameserv.h
+++ b/source/include/nameserv.h
@@ -126,7 +126,7 @@ struct nmb_name {
struct nmb_ip
{
struct in_addr ip; /* ip address of host that owns this name */
- int nb_flags; /* netbios flags */
+ uint16 nb_flags; /* netbios flags */
};
/* this is the structure used for the local netbios name list */
diff --git a/source/namedbname.c b/source/namedbname.c
index 188e46ff759..081c20e45b2 100644
--- a/source/namedbname.c
+++ b/source/namedbname.c
@@ -230,8 +230,8 @@ void dump_names(void)
{
int i;
- DEBUG(3,("%15s ", inet_ntoa(d->bcast_ip)));
- DEBUG(3,("%15s ", inet_ntoa(d->mask_ip)));
+ DEBUG(3,("%15s ", inet_ntoa(d->bcast_ip)));
+ DEBUG(3,("%15s ", inet_ntoa(d->mask_ip)));
DEBUG(3,("%-19s TTL=%ld ",
namestr(&n->name),
n->death_time?n->death_time-t:0));
@@ -243,29 +243,30 @@ void dump_names(void)
n->ip_flgs[i].nb_flags));
}
- DEBUG(3,("\n"));
+ DEBUG(3,("\n"));
if (f && ip_equal(d->bcast_ip, ipgrp) && n->source == REGISTER)
{
+ fstring data;
+
/* XXXX i have little imagination as to how to output nb_flags as
anything other than as a hexadecimal number :-) */
- fprintf(f,"%s#%02x %ld",
- n->name.name,n->name.name_type, /* XXXX ignore scope for now */
- n->death_time);
+ sprintf(data, "%s#%02x %ld ",
+ n->name.name,n->name.name_type, /* XXXX ignore scope for now */
+ n->death_time);
+ fprintf(f, "%s", data);
+
for (i = 0; i < n->num_ips; i++)
{
- DEBUG(3,("%15s NB=%2x ",
- inet_ntoa(n->ip_flgs[i].ip),
- n->ip_flgs[i].nb_flags));
-
- fprintf(f, "%s %2x ",
- inet_ntoa(n->ip_flgs[i].ip),
- n->ip_flgs[i].nb_flags);
+ sprintf(data, "%s %2x ",
+ inet_ntoa(n->ip_flgs[i].ip),
+ n->ip_flgs[i].nb_flags);
+ fprintf(f, "%s", data);
}
- DEBUG(3,("\n"));
- fprintf(f, "\n");
+ fprintf(f, "\n");
}
+
}
fclose(f);
@@ -310,33 +311,36 @@ void load_netbios_names(void)
pstring name;
int type = 0;
- int nb_flags;
+ unsigned int nb_flags;
time_t ttd;
- struct in_addr ipaddr;
- enum name_source source;
+ struct in_addr ipaddr;
+
+ enum name_source source;
+
char *ptr;
- int count = 0;
+ int count = 0;
+
char *p;
if (!fgets_slash(line,sizeof(pstring),f)) continue;
if (*line == '#') continue;
- ptr = line;
+ ptr = line;
- if (next_token(&ptr,name_str ,NULL)) ++count;
- if (next_token(&ptr,ttd_str ,NULL)) ++count;
- if (next_token(&ptr,ip_str ,NULL)) ++count;
- if (next_token(&ptr,nb_flags_str,NULL)) ++count;
+ if (next_token(&ptr,name_str ,NULL)) ++count;
+ if (next_token(&ptr,ttd_str ,NULL)) ++count;
+ if (next_token(&ptr,ip_str ,NULL)) ++count;
+ if (next_token(&ptr,nb_flags_str,NULL)) ++count;
- if (count <= 0) continue;
+ if (count <= 0) continue;
+
+ if (count != 4) {
+ DEBUG(0,("Ill formed wins line"));
+ DEBUG(0,("[%s]: name#type abs_time ip nb_flags\n",line));
+ continue;
+ }
- if (count != 4) {
- DEBUG(0,("Ill formed wins line"));
- DEBUG(0,("[%s]: name#type ip nb_flags abs_time\n",line));
- continue;
- }
-
/* netbios name. # divides the name from the type (hex): netbios#xx */
strcpy(name,name_str);
@@ -348,10 +352,10 @@ void load_netbios_names(void)
}
/* decode the netbios flags (hex) and the time-to-die (seconds) */
- sscanf(nb_flags_str,"%x",&nb_flags);
- sscanf(ttd_str,"%ld",&ttd);
+ sscanf(nb_flags_str,"%x",&nb_flags);
+ sscanf(ttd_str,"%ld",&ttd);
- ipaddr = *interpret_addr2(ip_str);
+ ipaddr = *interpret_addr2(ip_str);
if (ip_equal(ipaddr,ipzero)) {
source = SELF;
@@ -361,11 +365,11 @@ void load_netbios_names(void)
source = REGISTER;
}
- DEBUG(4, ("add WINS line: %s#%02x %s %ld %2x\n",
- name,type, inet_ntoa(ipaddr), ttd, nb_flags));
+ DEBUG(4, ("add WINS line: %s#%02x %ld %s %2x\n",
+ name,type, ttd, inet_ntoa(ipaddr), nb_flags));
/* add all entries that have 60 seconds or more to live */
- if (ttd - 60 < time(NULL) || ttd == 0)
+ if (ttd - 60 > time(NULL) || ttd == 0)
{
time_t t = (ttd?ttd-time(NULL):0) / 3;
@@ -536,7 +540,7 @@ struct name_record *search_for_name(struct subnet_record **d,
if (!n)
{
struct in_addr dns_ip;
- uint32 a;
+ unsigned long a;
/* only do DNS lookups if the query is for type 0x20 or type 0x0 */
if (!dns_type && name_type != 0x1b)
diff --git a/source/nmbd/nmbd.c b/source/nmbd/nmbd.c
index a4b303923dd..82ea9550f30 100644
--- a/source/nmbd/nmbd.c
+++ b/source/nmbd/nmbd.c
@@ -410,7 +410,6 @@ static void usage(char *pname)
int opt;
extern FILE *dbf;
extern char *optarg;
- fstring group;
*host_file = 0;
@@ -498,9 +497,6 @@ static void usage(char *pname)
set_samba_nb_type();
- if (*group)
- add_my_subnets(group);
-
if (!is_daemon && !is_a_socket(0)) {
DEBUG(0,("standard input is not a socket, assuming -D option\n"));
is_daemon = True;