summaryrefslogtreecommitdiff
path: root/source3
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
commit1aedda6160e0748d82a68bcd64f661ea1b80af9d (patch)
treeaf6601b74af5fb703c5484d89a05cdabb170c6dc /source3
parentefb8113d00a4513c1115640004c0905465d3b673 (diff)
downloadsamba-1aedda6160e0748d82a68bcd64f661ea1b80af9d.tar.gz
samba-1aedda6160e0748d82a68bcd64f661ea1b80af9d.tar.bz2
samba-1aedda6160e0748d82a68bcd64f661ea1b80af9d.zip
- 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 (This used to be commit 3d55e541569e7ab887bddc284bddcafdf86c4d22)
Diffstat (limited to 'source3')
-rw-r--r--source3/include/nameserv.h2
-rw-r--r--source3/namedbname.c80
-rw-r--r--source3/nmbd/nmbd.c4
3 files changed, 43 insertions, 43 deletions
diff --git a/source3/include/nameserv.h b/source3/include/nameserv.h
index a505f403ca..8dc737bdb0 100644
--- a/source3/include/nameserv.h
+++ b/source3/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/source3/namedbname.c b/source3/namedbname.c
index 188e46ff75..081c20e45b 100644
--- a/source3/namedbname.c
+++ b/source3/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/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index a4b303923d..82ea9550f3 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/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;