diff options
author | Pekka Pessi <Pekka.Pessi@nokia.com> | 2010-03-19 19:49:54 +0200 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-03-19 13:48:04 -0500 |
commit | 9a398a1087ebf3c327dcd3ed8191da33fc0d361b (patch) | |
tree | f0f23239935967d79922a3f0628fa5a4624d05d3 /src/sim.c | |
parent | c0c682d5c04f1e1b75c624e26c44c9f11e07b44b (diff) | |
download | ofono-9a398a1087ebf3c327dcd3ed8191da33fc0d361b.tar.bz2 |
Fix: Check password length based on its type
The different password types have different length requirements, so
update is_valid_pin to validate according to the password type being
validated (PIN / PUK / NET)
Diffstat (limited to 'src/sim.c')
-rw-r--r-- | src/sim.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -554,7 +554,7 @@ static DBusMessage *sim_lock_or_unlock(struct ofono_sim *sim, int lock, type == OFONO_SIM_PASSWORD_SIM_PIN2) return __ofono_error_invalid_format(msg); - if (!is_valid_pin(pin)) + if (!is_valid_pin(pin, PIN_TYPE_PIN)) return __ofono_error_invalid_format(msg); sim->pending = dbus_message_ref(msg); @@ -621,10 +621,10 @@ static DBusMessage *sim_change_pin(DBusConnection *conn, DBusMessage *msg, if (password_is_pin(type) == FALSE) return __ofono_error_invalid_format(msg); - if (!is_valid_pin(old)) + if (!is_valid_pin(old, PIN_TYPE_PIN)) return __ofono_error_invalid_format(msg); - if (!is_valid_pin(new)) + if (!is_valid_pin(new, PIN_TYPE_PIN)) return __ofono_error_invalid_format(msg); if (!strcmp(new, old)) @@ -676,7 +676,7 @@ static DBusMessage *sim_enter_pin(DBusConnection *conn, DBusMessage *msg, if (type == OFONO_SIM_PASSWORD_NONE || type != sim->pin_type) return __ofono_error_invalid_format(msg); - if (!is_valid_pin(pin)) + if (!is_valid_pin(pin, PIN_TYPE_PIN)) return __ofono_error_invalid_format(msg); sim->pending = dbus_message_ref(msg); @@ -711,10 +711,10 @@ static DBusMessage *sim_reset_pin(DBusConnection *conn, DBusMessage *msg, if (type == OFONO_SIM_PASSWORD_NONE || type != sim->pin_type) return __ofono_error_invalid_format(msg); - if (!is_valid_pin(puk)) + if (!is_valid_pin(puk, PIN_TYPE_PUK)) return __ofono_error_invalid_format(msg); - if (!is_valid_pin(pin)) + if (!is_valid_pin(pin, PIN_TYPE_PIN)) return __ofono_error_invalid_format(msg); sim->pending = dbus_message_ref(msg); |