diff options
author | Denis Kenzior <denkenz@gmail.com> | 2011-02-18 11:24:08 -0600 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2011-02-18 11:28:43 -0600 |
commit | e8553f53376a33504dd18c4d7bb6d6f309973e0a (patch) | |
tree | 0c42d4927ac8e36a5f52ddc03047c5670c1b41bc /src/sim.c | |
parent | 5543d935c5af4d1894a81cf4a051dfc75059de39 (diff) | |
download | ofono-e8553f53376a33504dd18c4d7bb6d6f309973e0a.tar.bz2 |
sim: Check for SIM lockout condition
When a user tries to lock/unlock/change a PIN and enters it wrongly
several times, it is possible to lock themselves out. In this case we
should drop to a pre-sim state, wait for the user to enter the PUK and
re-init the sim.
Diffstat (limited to 'src/sim.c')
-rw-r--r-- | src/sim.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -624,7 +624,7 @@ static void sim_unlock_cb(const struct ofono_error *error, void *data) DBusMessage *reply = __ofono_error_failed(sim->pending); __ofono_dbus_pending_reply(&sim->pending, reply); - sim_pin_retries_check(sim); + sim_pin_check(sim); return; } @@ -640,7 +640,7 @@ static void sim_lock_cb(const struct ofono_error *error, void *data) DBusMessage *reply = __ofono_error_failed(sim->pending); __ofono_dbus_pending_reply(&sim->pending, reply); - sim_pin_retries_check(sim); + sim_pin_check(sim); return; } @@ -711,7 +711,7 @@ static void sim_change_pin_cb(const struct ofono_error *error, void *data) __ofono_dbus_pending_reply(&sim->pending, __ofono_error_failed(sim->pending)); - sim_pin_retries_check(sim); + sim_pin_check(sim); return; } @@ -2231,6 +2231,15 @@ static void sim_pin_query_cb(const struct ofono_error *error, &pin_name); } + if (pin_type != OFONO_SIM_PASSWORD_NONE && + sim->state == OFONO_SIM_STATE_READY) { + /* Force the sim state out of READY */ + sim_free_main_state(sim); + + sim->state = OFONO_SIM_STATE_INSERTED; + __ofono_modem_sim_reset(__ofono_atom_get_modem(sim->atom)); + } + sim_pin_retries_check(sim); checkdone: |