svn commit: samba r16665 - in branches/SAMBA_3_0/source/nmbd: .
jra at samba.org
jra at samba.org
Thu Jun 29 00:48:45 GMT 2006
Author: jra
Date: 2006-06-29 00:48:44 +0000 (Thu, 29 Jun 2006)
New Revision: 16665
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16665
Log:
Fix a couple of bugs I discovered now I've looked
closer at the wins server code. Firstly, it needs
to do the searches on the SELF_NAMES correctly,
secondly it needs to flush the in-memory cache
out before returning the 1b names - else it might
get duplicates returned if many 1b queries are
done in quick succession. Jerry, I hate to say
this but you might want to consider this for 3.0.23....
Jeremy.
Modified:
branches/SAMBA_3_0/source/nmbd/nmbd_namelistdb.c
branches/SAMBA_3_0/source/nmbd/nmbd_winsserver.c
Changeset:
Modified: branches/SAMBA_3_0/source/nmbd/nmbd_namelistdb.c
===================================================================
--- branches/SAMBA_3_0/source/nmbd/nmbd_namelistdb.c 2006-06-29 00:48:38 UTC (rev 16664)
+++ branches/SAMBA_3_0/source/nmbd/nmbd_namelistdb.c 2006-06-29 00:48:44 UTC (rev 16665)
@@ -120,7 +120,7 @@
if( self_only && (name_ret->data.source != SELF_NAME) && (name_ret->data.source != PERMANENT_NAME) ) {
DEBUG( 9, ( "find_name_on_subnet: on subnet %s - self name %s NOT FOUND\n",
subrec->subnet_name, nmb_namestr(nmbname) ) );
- return False;
+ return NULL;
}
DEBUG( 9, ("find_name_on_subnet: on subnet %s - found name %s source=%d\n",
Modified: branches/SAMBA_3_0/source/nmbd/nmbd_winsserver.c
===================================================================
--- branches/SAMBA_3_0/source/nmbd/nmbd_winsserver.c 2006-06-29 00:48:38 UTC (rev 16664)
+++ branches/SAMBA_3_0/source/nmbd/nmbd_winsserver.c 2006-06-29 00:48:44 UTC (rev 16665)
@@ -35,6 +35,24 @@
TDB_CONTEXT *wins_tdb;
/****************************************************************************
+ Delete all the temporary name records on the in-memory linked list.
+*****************************************************************************/
+
+static void wins_delete_all_tmp_in_memory_records(void)
+{
+ struct name_record *nr = NULL;
+ struct name_record *nrnext = NULL;
+
+ /* Delete all temporary name records on the wins subnet linked list. */
+ for( nr = wins_server_subnet->namelist; nr; nr = nrnext) {
+ nrnext = nr->next;
+ DLIST_REMOVE(wins_server_subnet->namelist, nr);
+ SAFE_FREE(nr->data.ip);
+ SAFE_FREE(nr);
+ }
+}
+
+/****************************************************************************
Convert a wins.tdb record to a struct name_record. Add in our global_scope().
*****************************************************************************/
@@ -217,6 +235,14 @@
return NULL;
}
+ /* Self names only - these include permanent names. */
+ if( self_only && (namerec->data.source != SELF_NAME) && (namerec->data.source != PERMANENT_NAME) ) {
+ DEBUG( 9, ( "find_name_on_wins_subnet: self name %s NOT FOUND\n", nmb_namestr(nmbname) ) );
+ SAFE_FREE(namerec->data.ip);
+ SAFE_FREE(namerec);
+ return NULL;
+ }
+
/* Search for this name record on the list. Replace it if found. */
for( nr = wins_server_subnet->namelist; nr; nr = nr->next) {
@@ -1739,6 +1765,11 @@
num_ips = 0;
+ /* First, clear the in memory list - we're going to re-populate
+ it with the tdb_traversal in fetch_all_active_wins_1b_names. */
+
+ wins_delete_all_tmp_in_memory_records();
+
fetch_all_active_wins_1b_names();
for( namerec = subrec->namelist; namerec; namerec = namerec->next ) {
@@ -2176,8 +2207,6 @@
void initiate_wins_processing(time_t t)
{
static time_t lasttime = 0;
- struct name_record *nr = NULL;
- struct name_record *nrnext = NULL;
if (!lasttime) {
lasttime = t;
@@ -2193,14 +2222,7 @@
tdb_traverse(wins_tdb, wins_processing_traverse_fn, &t);
-
- /* Delete all temporary name records on the wins subnet linked list. */
- for( nr = wins_server_subnet->namelist; nr; nr = nrnext) {
- nrnext = nr->next;
- DLIST_REMOVE(wins_server_subnet->namelist, nr);
- SAFE_FREE(nr->data.ip);
- SAFE_FREE(nr);
- }
+ wins_delete_all_tmp_in_memory_records();
wins_write_database(t, True);
More information about the samba-cvs
mailing list