summaryrefslogtreecommitdiff
path: root/cesar/cp/sta/mgr
diff options
context:
space:
mode:
authorlaranjeiro2009-03-27 09:06:32 +0000
committerlaranjeiro2009-03-27 09:06:32 +0000
commit2e300750d73098add4859d3ac5e1603d91ee5abe (patch)
treeaed47c714ee8b3f5cf10495cf21a246f21dd1414 /cesar/cp/sta/mgr
parenta577e1e919da2fa88dec068831b49e5a11451be8 (diff)
cp/sta/mgr: Fix the cp_sta_set_authentication to not assert when the TEI is
null. * returns if the TEI is 0. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@4314 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/cp/sta/mgr')
-rw-r--r--cesar/cp/sta/mgr/src/sta.c4
-rw-r--r--cesar/cp/sta/mgr/test/src/station_test.c21
2 files changed, 23 insertions, 2 deletions
diff --git a/cesar/cp/sta/mgr/src/sta.c b/cesar/cp/sta/mgr/src/sta.c
index 6fed00f5d3..1d8da281e3 100644
--- a/cesar/cp/sta/mgr/src/sta.c
+++ b/cesar/cp/sta/mgr/src/sta.c
@@ -189,11 +189,11 @@ cp_sta_set_authenticated (cp_t *ctx,
dbg_assert (sta);
/* If our AVLN. */
- if (((cp_sta_private_t *)sta)->net == ctx->sta_mgr.our_avln)
+ if ((((cp_sta_private_t *)sta)->net == ctx->sta_mgr.our_avln)
+ && (MAC_TEI_IS_STA (cp_sta_get_tei (sta))))
{
sta_t *sta_store;
dbg_assert (ctx->mac_store);
- dbg_assert (cp_sta_get_tei (sta));
sta_store = mac_store_sta_get (ctx->mac_store, cp_sta_get_tei (sta));
diff --git a/cesar/cp/sta/mgr/test/src/station_test.c b/cesar/cp/sta/mgr/test/src/station_test.c
index 374be9958b..d5a533f321 100644
--- a/cesar/cp/sta/mgr/test/src/station_test.c
+++ b/cesar/cp/sta/mgr/test/src/station_test.c
@@ -235,6 +235,27 @@ test_case_authenticated (test_t test)
mac_store_uninit (cp.mac_store);
}
test_end;
+
+ test_begin (test, "set authentication TEI = 0")
+ {
+ cp_t cp;
+ cp_net_t net;
+ cp_sta_private_t station;
+ cp_sta_t *sta = (cp_sta_t *) &station;
+
+ memset (&station, 0, sizeof (cp_sta_private_t));
+ memset (&cp, 0, sizeof (cp_t));
+
+ /* configure the test. */
+ cp.mac_store = mac_store_init ();
+ cp.sta_mgr.our_avln = &net;
+ station.tei = 0;
+ station.net = &net;
+
+ cp_sta_set_authenticated (&cp, sta, false);
+ mac_store_uninit (cp.mac_store);
+ }
+ test_end;
}
void