base-sim: only allow operations on active SIMs
If a SIM is inactive we cannot perform any SIM-PIN or SIM-PUK related operation with it.
This commit is contained in:
@@ -221,6 +221,16 @@ handle_change_pin_auth_ready (MMBaseModem *modem,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mm_gdbus_sim_get_active (MM_GDBUS_SIM (ctx->self))) {
|
||||
g_dbus_method_invocation_return_error (ctx->invocation,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_UNSUPPORTED,
|
||||
"Cannot change PIN: "
|
||||
"SIM not currently active");
|
||||
handle_change_pin_context_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
MM_BASE_SIM_GET_CLASS (ctx->self)->change_pin (ctx->self,
|
||||
ctx->old_pin,
|
||||
ctx->new_pin,
|
||||
@@ -391,6 +401,16 @@ handle_enable_pin_auth_ready (MMBaseModem *modem,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mm_gdbus_sim_get_active (MM_GDBUS_SIM (ctx->self))) {
|
||||
g_dbus_method_invocation_return_error (ctx->invocation,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_UNSUPPORTED,
|
||||
"Cannot enable/disable PIN: "
|
||||
"SIM not currently active");
|
||||
handle_enable_pin_context_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
MM_BASE_SIM_GET_CLASS (ctx->self)->enable_pin (ctx->self,
|
||||
ctx->pin,
|
||||
ctx->enabled,
|
||||
@@ -782,6 +802,16 @@ handle_send_pin_auth_ready (MMBaseModem *modem,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mm_gdbus_sim_get_active (MM_GDBUS_SIM (ctx->self))) {
|
||||
g_dbus_method_invocation_return_error (ctx->invocation,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_UNSUPPORTED,
|
||||
"Cannot send PIN: "
|
||||
"SIM not currently active");
|
||||
handle_send_pin_context_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
mm_base_sim_send_pin (ctx->self,
|
||||
ctx->pin,
|
||||
(GAsyncReadyCallback)handle_send_pin_ready,
|
||||
@@ -856,6 +886,16 @@ handle_send_puk_auth_ready (MMBaseModem *modem,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mm_gdbus_sim_get_active (MM_GDBUS_SIM (ctx->self))) {
|
||||
g_dbus_method_invocation_return_error (ctx->invocation,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_UNSUPPORTED,
|
||||
"Cannot send PUK: "
|
||||
"SIM not currently active");
|
||||
handle_send_puk_context_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
mm_base_sim_send_puk (ctx->self,
|
||||
ctx->puk,
|
||||
ctx->new_pin,
|
||||
|
Reference in New Issue
Block a user