2007-08-14 Dan Williams <dcbw@redhat.com>

* src/NetworkManagerUtils.c
		- (nm_utils_escape_ssid): add "ignore_trailing_null" parameter which
			ignores trailing nulls in the SSID to work around mismatches in
			expectations between WEXT and what the info-daemon passes back.  The
			info-daemon would pass back the correct length, but due to the
			ESSID length issues with WEXT 22 and greater and wpa_supplicant,
			the device would always have an SSID + 1 depending on what versions
			of wpa_supplicant, the kernel, and NM you have.  This was most often
			visible by just quitting the applet and relaunching, which caused
			NM to reassociated to the same network over again when reloading
			the save networks.



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2685 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams
2007-08-15 01:56:02 +00:00
parent 66c11dd988
commit ccb13f0bdd
5 changed files with 29 additions and 13 deletions

View File

@@ -625,14 +625,28 @@ nm_utils_escape_ssid (const char * ssid, guint32 len)
}
gboolean
nm_utils_same_ssid (const GByteArray * ssid1, const GByteArray * ssid2)
nm_utils_same_ssid (const GByteArray * ssid1,
const GByteArray * ssid2,
gboolean ignore_trailing_null)
{
guint32 ssid1_len, ssid2_len;
if (ssid1 == ssid2)
return TRUE;
if ((ssid1 && !ssid2) || (!ssid1 && ssid2))
return FALSE;
if (ssid1->len != ssid2->len)
ssid1_len = ssid1->len;
ssid2_len = ssid2->len;
if (ssid1_len && ssid2_len && ignore_trailing_null) {
if (ssid1->data[ssid1_len - 1] == '\0')
ssid1_len--;
if (ssid2->data[ssid2_len - 1] == '\0')
ssid2_len--;
}
if (ssid1_len != ssid2_len)
return FALSE;
return memcmp (ssid1->data, ssid2->data, ssid1->len) == 0 ? TRUE : FALSE;
return memcmp (ssid1->data, ssid2->data, ssid1_len) == 0 ? TRUE : FALSE;
}