[Wifidog] Auth server changed loop

Philippe April isf_lists at philippeapril.com
Tue Feb 1 07:29:29 EST 2005


I was just coding (too much) and found some weird logs... and then this:

	if (auth_server->last_ip == NULL) {
		auth_server->last_ip = strdup(inet_ntoa(*h_addr));
		if (auth_server->last_ip == NULL) {
			debug(LOG_CRIT, "Could not allocate memory, Banzai!");
			exit(-1);
		}
	} else {
		tmp_addr = strdup(inet_ntoa(*h_addr));
		if (strcmp(auth_server->last_ip, tmp_addr) == 0) {
			free(auth_server->last_ip);
			auth_server->last_ip = tmp_addr;
			fw_clear_authservers();
			fw_set_authservers();
		} else {
			free(tmp_addr);
		}
	}

strcmp() returns 0 when it's the same.

Is it just me or this is doing exactly the opposite of what we want?

I'm pretty sure, I'm just verifying.

That'd mean everytime we check if the authserver is still ok, we clear 
the list ... and if it's bad, we don't act. That'd explain the last 
issues last time benoit's IP changed.

Philippe April


-------------- next part --------------
_______________________________________________
Wifidog mailing list
Wifidog at isf.waglo.com
http://isf.waglo.com/mailman/listinfo/wifidog_isf.waglo.com


More information about the Wifidog mailing list