summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-03-29 00:57:35 +0000
committerJeremy Allison <jra@samba.org>2002-03-29 00:57:35 +0000
commit63cbe1be9a37929bf00fc52615c43502d0035563 (patch)
tree90fc118f3fa3a5d6f981909942fecfe3a9e61a26 /source3
parent825614500c0598b01544ac20f52313d926386e81 (diff)
downloadsamba-63cbe1be9a37929bf00fc52615c43502d0035563.tar.gz
samba-63cbe1be9a37929bf00fc52615c43502d0035563.tar.bz2
samba-63cbe1be9a37929bf00fc52615c43502d0035563.zip
Fix to stop PERMANENT_NAMES being added when nmbd starts up and WINS
server is down. Keep adding refreshible names instead. Jeremy. (This used to be commit f25fcd99fa0d0ec2095d9db42145d236c14748e0)
Diffstat (limited to 'source3')
-rw-r--r--source3/nmbd/nmbd_mynames.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/source3/nmbd/nmbd_mynames.c b/source3/nmbd/nmbd_mynames.c
index a3311fec47..aac188db2b 100644
--- a/source3/nmbd/nmbd_mynames.c
+++ b/source3/nmbd/nmbd_mynames.c
@@ -79,6 +79,35 @@ Exiting.\n", global_myworkgroup, subrec->subnet_name));
initiate_myworkgroup_startup(subrec, work);
}
+/*******************************************************************
+ Utility function to add a name to the unicast subnet, or add in
+ our IP address if it already exists.
+******************************************************************/
+
+static void insert_refresh_name_into_unicast( struct subnet_record *subrec,
+ struct nmb_name *nmbname, uint16 nb_type )
+{
+ struct name_record *namerec;
+
+ if (!we_are_a_wins_client()) {
+ insert_permanent_name_into_unicast(subrec, nmbname, nb_type);
+ return;
+ }
+
+ if((namerec = find_name_on_subnet(unicast_subnet, nmbname, FIND_SELF_NAME)) == NULL)
+ {
+ /* The name needs to be created on the unicast subnet. */
+ (void)add_name_to_subnet( unicast_subnet, nmbname->name,
+ nmbname->name_type, nb_type,
+ MIN(lp_max_ttl(), MAX_REFRESH_TIME), SELF_NAME, 1, &subrec->myip);
+ }
+ else
+ {
+ /* The name already exists on the unicast subnet. Add our local
+ IP for the given broadcast subnet to the name. */
+ add_ip_to_name_record( namerec, subrec->myip);
+ }
+}
/****************************************************************************
Add my workgroup and my given names to the subnet lists.
@@ -114,13 +143,13 @@ BOOL register_my_workgroup_and_names(void)
struct nmb_name nmbname;
make_nmb_name(&nmbname, my_netbios_names[i],0x20);
- insert_permanent_name_into_unicast(subrec, &nmbname, samba_nb_type);
+ insert_refresh_name_into_unicast(subrec, &nmbname, samba_nb_type);
make_nmb_name(&nmbname, my_netbios_names[i],0x3);
- insert_permanent_name_into_unicast(subrec, &nmbname, samba_nb_type);
+ insert_refresh_name_into_unicast(subrec, &nmbname, samba_nb_type);
make_nmb_name(&nmbname, my_netbios_names[i],0x0);
- insert_permanent_name_into_unicast(subrec, &nmbname, samba_nb_type);
+ insert_refresh_name_into_unicast(subrec, &nmbname, samba_nb_type);
}
}
@@ -137,10 +166,10 @@ BOOL register_my_workgroup_and_names(void)
struct nmb_name nmbname;
make_nmb_name(&nmbname, global_myworkgroup, 0x0);
- insert_permanent_name_into_unicast(subrec, &nmbname, samba_nb_type|NB_GROUP);
+ insert_refresh_name_into_unicast(subrec, &nmbname, samba_nb_type|NB_GROUP);
make_nmb_name(&nmbname, global_myworkgroup, 0x1e);
- insert_permanent_name_into_unicast(subrec, &nmbname, samba_nb_type|NB_GROUP);
+ insert_refresh_name_into_unicast(subrec, &nmbname, samba_nb_type|NB_GROUP);
}
/*