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,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
Converted to store WINS data in a tdb. Dec 2005. JRA.
*/
on the linked list. We will free this later in XXXX().
*****************************************************************************/
-struct name_record *find_name_on_wins_subnet(const struct nmb_name *nmbname, BOOL self_only)
+struct name_record *find_name_on_wins_subnet(const struct nmb_name *nmbname, bool self_only)
{
TDB_DATA data, key;
struct name_record *nr = NULL;
Overwrite or add a given name in the wins.tdb.
*****************************************************************************/
-static BOOL store_or_replace_wins_namerec(const struct name_record *namerec, int tdb_flag)
+static bool store_or_replace_wins_namerec(const struct name_record *namerec, int tdb_flag)
{
TDB_DATA key, data;
int ret;
Overwrite a given name in the wins.tdb.
*****************************************************************************/
-BOOL wins_store_changed_namerec(const struct name_record *namerec)
+bool wins_store_changed_namerec(const struct name_record *namerec)
{
return store_or_replace_wins_namerec(namerec, TDB_REPLACE);
}
Primary interface into creating and overwriting records in the wins.tdb.
*****************************************************************************/
-BOOL add_name_to_wins_subnet(const struct name_record *namerec)
+bool add_name_to_wins_subnet(const struct name_record *namerec)
{
return store_or_replace_wins_namerec(namerec, TDB_INSERT);
}
on the linked list.
*****************************************************************************/
-BOOL remove_name_from_wins_namelist(struct name_record *namerec)
+bool remove_name_from_wins_namelist(struct name_record *namerec)
{
TDB_DATA key;
int ret;
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(SMB_BIG_UINT *current_id, bool update)
{
/*
* it's kept as a static here, to prevent people from messing
Determine if this packet should be allocated to the WINS server.
*****************************************************************************/
-BOOL packet_is_for_wins_server(struct packet_struct *packet)
+bool packet_is_for_wins_server(struct packet_struct *packet)
{
struct nmb_packet *nmb = &packet->packet.nmb;
Load or create the WINS database.
*****************************************************************************/
-BOOL initialise_wins(void)
+bool initialise_wins(void)
{
time_t time_now = time(NULL);
XFILE *fp;
int ttl;
const char *ptr;
char *p;
- BOOL got_token;
- BOOL was_ip;
+ bool got_token;
+ bool was_ip;
int i;
unsigned int hash;
int version;
{
struct nmb_packet *nmb = &p->packet.nmb;
struct nmb_name *question = &nmb->question.question_name;
- BOOL bcast = nmb->header.nm_flags.bcast;
+ bool bcast = nmb->header.nm_flags.bcast;
uint16 nb_flags = get_nb_flags(nmb->additional->rdata);
- BOOL group = (nb_flags & NB_GROUP) ? True : False;
+ bool group = (nb_flags & NB_GROUP) ? True : False;
struct name_record *namerec = NULL;
int ttl = get_ttl_from_packet(nmb);
struct in_addr from_ip;
unstring name;
struct nmb_packet *nmb = &p->packet.nmb;
struct nmb_name *question = &nmb->question.question_name;
- BOOL bcast = nmb->header.nm_flags.bcast;
+ bool bcast = nmb->header.nm_flags.bcast;
uint16 nb_flags = get_nb_flags(nmb->additional->rdata);
int ttl = get_ttl_from_packet(nmb);
struct name_record *namerec = NULL;
struct in_addr from_ip;
- BOOL registering_group_name = (nb_flags & NB_GROUP) ? True : False;
+ bool registering_group_name = (nb_flags & NB_GROUP) ? True : False;
struct in_addr our_fake_ip = *interpret_addr2("0.0.0.0");
putip((char *)&from_ip,&nmb->additional->rdata[2]);
if ( namerec != NULL ) {
pull_ascii_nstring(name, sizeof(name), namerec->name.name);
if( is_myname(name) ) {
- if(!ismyip(from_ip)) {
+ if(!ismyip_v4(from_ip)) {
DEBUG(3,("wins_process_name_registration_request: Attempt to register name %s. Name \
is one of our (WINS server) names. Denying registration.\n", nmb_namestr(question) ));
send_wins_name_registration_response(RFS_ERR, 0, p);
{
struct nmb_packet *nmb = &p->packet.nmb;
struct nmb_name *question = &nmb->question.question_name;
- BOOL bcast = nmb->header.nm_flags.bcast;
+ bool bcast = nmb->header.nm_flags.bcast;
uint16 nb_flags = get_nb_flags(nmb->additional->rdata);
int ttl = get_ttl_from_packet(nmb);
struct name_record *namerec = NULL;
struct in_addr from_ip;
- BOOL group = (nb_flags & NB_GROUP) ? True : False;
+ bool group = (nb_flags & NB_GROUP) ? True : False;
struct in_addr our_fake_ip = *interpret_addr2("0.0.0.0");
unstring qname;
*/
if((namerec != NULL) && (is_myname(namerec->name.name)) ) {
- if(!ismyip(from_ip)) {
+ if(!ismyip_v4(from_ip)) {
DEBUG(3,("wins_process_multihomed_name_registration_request: Attempt to register name %s. Name \
is one of our (WINS server) names. Denying registration.\n", nmb_namestr(question) ));
send_wins_name_registration_response(RFS_ERR, 0, p);
{
struct nmb_packet *nmb = &p->packet.nmb;
struct nmb_name *question = &nmb->question.question_name;
- BOOL bcast = nmb->header.nm_flags.bcast;
+ bool bcast = nmb->header.nm_flags.bcast;
uint16 nb_flags = get_nb_flags(nmb->additional->rdata);
struct name_record *namerec = NULL;
struct in_addr from_ip;
- BOOL releasing_group_name = (nb_flags & NB_GROUP) ? True : False;;
+ bool releasing_group_name = (nb_flags & NB_GROUP) ? True : False;;
putip((char *)&from_ip,&nmb->additional->rdata[2]);
static int wins_processing_traverse_fn(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, void *state)
{
time_t t = *(time_t *)state;
- BOOL store_record = False;
+ bool store_record = False;
struct name_record *namerec = NULL;
struct in_addr our_fake_ip = *interpret_addr2("0.0.0.0");
}
-void wins_write_database(time_t t, BOOL background)
+void wins_write_database(time_t t, bool background)
{
static time_t last_write_time = 0;
pstring fname, fnamenew;
if (tdb_reopen(wins_tdb)) {
DEBUG(0,("wins_write_database: tdb_reopen failed. Error was %s\n",
strerror(errno)));
+ _exit(0);
return;
}
}
struct name_record *namerec = NULL;
struct name_record *new_namerec = NULL;
struct nmb_name question;
- BOOL overwrite=False;
+ bool overwrite=False;
struct in_addr our_fake_ip = *interpret_addr2("0.0.0.0");
int i;