r23779: Change from v2 or later to v3 or later.
[abartlet/samba.git/.git] / source3 / nmbd / nmbd_namelistdb.c
index baaf5dbd5489f2bdfa70ff61fc7dd77a3b1bae0b..736c9fd325ebb3da1c717590bf74a5e05e30cc20 100644 (file)
@@ -7,7 +7,7 @@
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -80,14 +80,13 @@ static void upcase_name( struct nmb_name *target, const struct nmb_name *source
 void remove_name_from_namelist(struct subnet_record *subrec, 
                                struct name_record *namerec )
 {
-       if (subrec == wins_server_subnet) {
+       if (subrec == wins_server_subnet) 
                remove_name_from_wins_namelist(namerec);
-               return;
-       } 
-
-       subrec->namelist_changed = True;
+       else {
+               subrec->namelist_changed = True;
+               DLIST_REMOVE(subrec->namelist, namerec);
+       }
 
-       DLIST_REMOVE(subrec->namelist, namerec);
        SAFE_FREE(namerec->data.ip);
        ZERO_STRUCTP(namerec);
        SAFE_FREE(namerec);
@@ -121,7 +120,7 @@ struct name_record *find_name_on_subnet(struct subnet_record *subrec,
                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",
@@ -565,15 +564,31 @@ void dump_name_record( struct name_record *namerec, XFILE *fp)
        x_fprintf(fp,"Source = %s\nb_flags = %x\t", src_type, namerec->data.nb_flags);
 
        if(namerec->data.death_time != PERMANENT_TTL) {
+               const char *asct;
                tm = localtime(&namerec->data.death_time);
-               x_fprintf(fp, "death_time = %s\t", asctime(tm));
+               if (!tm) {
+                       return;
+               }
+               asct = asctime(tm);
+               if (!asct) {
+                       return;
+               }
+               x_fprintf(fp, "death_time = %s\t", asct);
        } else {
                x_fprintf(fp, "death_time = PERMANENT\t");
        }
 
        if(namerec->data.refresh_time != PERMANENT_TTL) {
+               const char *asct;
                tm = localtime(&namerec->data.refresh_time);
-               x_fprintf(fp, "refresh_time = %s\n", asctime(tm));
+               if (!tm) {
+                       return;
+               }
+               asct = asctime(tm);
+               if (!asct) {
+                       return;
+               }
+               x_fprintf(fp, "refresh_time = %s\n", asct);
        } else {
                x_fprintf(fp, "refresh_time = PERMANENT\n");
        }