s3: Fix bug #9085.
[samba.git] / source3 / nmbd / nmbd_winsserver.c
index 96938b011a26c05d888653dc003f27477baa2df7..20436c5813059af0427931af69c78384c0d69a5b 100644 (file)
@@ -124,7 +124,7 @@ static struct name_record *wins_record_to_name_record(TDB_DATA key, TDB_DATA dat
        namerec->data.refresh_time = (time_t)refresh_time;
        namerec->data.id = id_low;
 #if defined(HAVE_LONGLONG)
-       namerec->data.id |= ((SMB_BIG_UINT)id_high << 32);
+       namerec->data.id |= ((uint64_t)id_high << 32);
 #endif
        namerec->data.wins_ip.s_addr = saddr;
        namerec->data.wins_flags = wins_flags,
@@ -412,14 +412,14 @@ static void update_wins_flag(struct name_record *namerec, int flags)
  Return the general ID value and increase it if requested.
 *****************************************************************************/
 
-static void get_global_id_and_update(SMB_BIG_UINT *current_id, bool update)
+static void get_global_id_and_update(uint64_t *current_id, bool update)
 {
        /*
         * it's kept as a static here, to prevent people from messing
         * with the value directly
         */
 
-       static SMB_BIG_UINT general_id = 1;
+       static uint64_t general_id = 1;
 
        DEBUG(5,("get_global_id_and_update: updating version ID: %d\n", (int)general_id));
        
@@ -583,7 +583,7 @@ bool initialise_wins(void)
        }
 
        /* Open the wins.tdb. */
-       wins_tdb = tdb_open_log(lock_path("wins.tdb"), 0, TDB_DEFAULT|TDB_CLEAR_IF_FIRST, O_CREAT|O_RDWR, 0600);
+       wins_tdb = tdb_open_log(state_path("wins.tdb"), 0, TDB_DEFAULT|TDB_CLEAR_IF_FIRST, O_CREAT|O_RDWR, 0600);
        if (!wins_tdb) {
                DEBUG(0,("initialise_wins: failed to open wins.tdb. Error was %s\n",
                        strerror(errno) ));
@@ -701,7 +701,7 @@ bool initialise_wins(void)
                next_token_talloc(frame,&ptr,&ttl_str,NULL);
                for(i = 0; i < num_ips; i++) {
                        next_token_talloc(frame,&ptr, &ip_str, NULL);
-                       (void)interpret_addr2(&ip_list[i], ip_str);
+                       ip_list[i] = interpret_addr2(ip_str);
                }
                next_token_talloc(frame,&ptr,&nb_flags_str,NULL);
 
@@ -835,7 +835,7 @@ void wins_process_name_refresh_request( struct subnet_record *subrec,
        struct in_addr from_ip;
        struct in_addr our_fake_ip;
 
-       (void)interpret_addr2(&our_fake_ip, "0.0.0.0");
+       our_fake_ip = interpret_addr2("0.0.0.0");
        putip( (char *)&from_ip, &nmb->additional->rdata[2] );
 
        if(bcast) {
@@ -1014,7 +1014,7 @@ static void wins_register_query_success(struct subnet_record *subrec,
        DEBUG(3,("wins_register_query_success: Original client at IP %s still wants the \
 name %s. Rejecting registration request.\n", inet_ntoa(ip), nmb_namestr(question_name) ));
 
-       send_wins_name_registration_response(RFS_ERR, 0, orig_reg_packet);
+       send_wins_name_registration_response(ACT_ERR, 0, orig_reg_packet);
 
        orig_reg_packet->locked = False;
        free_packet(orig_reg_packet);
@@ -1142,7 +1142,7 @@ void wins_process_name_registration_request(struct subnet_record *subrec,
        bool registering_group_name = (nb_flags & NB_GROUP) ? True : False;
        struct in_addr our_fake_ip;
 
-       (void)interpret_addr2(&our_fake_ip, "0.0.0.0");
+       our_fake_ip = interpret_addr2("0.0.0.0");
        putip((char *)&from_ip,&nmb->additional->rdata[2]);
 
        if(bcast) {
@@ -1217,7 +1217,7 @@ to register name %s. Name already exists in WINS with source type %d.\n",
         */
 
        if(registering_group_name && (question->name_type != 0x1c)) {
-               (void)interpret_addr2(&from_ip, "255.255.255.255");
+               from_ip = interpret_addr2("255.255.255.255");
        }
 
        /*
@@ -1424,7 +1424,7 @@ static void wins_multihomed_register_query_success(struct subnet_record *subrec,
        int ttl;
        struct in_addr our_fake_ip;
 
-       (void)interpret_addr2(&our_fake_ip, "0.0.0.0");
+       our_fake_ip = interpret_addr2("0.0.0.0");
        memcpy((char *)&orig_reg_packet, userdata->data, sizeof(struct packet_struct *));
 
        nmb = &orig_reg_packet->packet.nmb;
@@ -1515,7 +1515,7 @@ void wins_process_multihomed_name_registration_request( struct subnet_record *su
        struct in_addr our_fake_ip;
        unstring qname;
 
-       (void)interpret_addr2(&our_fake_ip, "0.0.0.0");
+       our_fake_ip = interpret_addr2("0.0.0.0");
        putip((char *)&from_ip,&nmb->additional->rdata[2]);
 
        if(bcast) {
@@ -2141,7 +2141,7 @@ static int wins_processing_traverse_fn(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA
        struct name_record *namerec = NULL;
        struct in_addr our_fake_ip;
 
-       (void)interpret_addr2(&our_fake_ip, "0.0.0.0");
+       our_fake_ip = interpret_addr2("0.0.0.0");
        if (kbuf.dsize != sizeof(unstring) + 1) {
                return 0;
        }
@@ -2366,7 +2366,7 @@ void wins_write_database(time_t t, bool background)
                }
        }
 
-       if (asprintf(&fname, "%s/%s", get_dyn_STATEDIR(), WINS_LIST) < 0) {
+       if (!(fname = state_path(WINS_LIST))) {
                goto err_exit;
        }
        /* This is safe as the 0 length means "don't expand". */
@@ -2394,8 +2394,8 @@ void wins_write_database(time_t t, bool background)
 
   err_exit:
 
-       SAFE_FREE(fname);
        SAFE_FREE(fnamenew);
+       TALLOC_FREE(fname);
 
        if (background) {
                _exit(0);
@@ -2422,7 +2422,7 @@ void nmbd_wins_new_entry(struct messaging_context *msg,
        struct in_addr our_fake_ip;
        int i;
 
-       (void)interpret_addr2(&our_fake_ip, "0.0.0.0");
+       our_fake_ip = interpret_addr2("0.0.0.0");
        if (buf==NULL) {
                return;
        }