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,11 +221,21 @@ handle_change_pin_auth_ready (MMBaseModem *modem,
|
|||||||
return;
|
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,
|
MM_BASE_SIM_GET_CLASS (ctx->self)->change_pin (ctx->self,
|
||||||
ctx->old_pin,
|
ctx->old_pin,
|
||||||
ctx->new_pin,
|
ctx->new_pin,
|
||||||
(GAsyncReadyCallback)handle_change_pin_ready,
|
(GAsyncReadyCallback)handle_change_pin_ready,
|
||||||
ctx);
|
ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -391,11 +401,21 @@ handle_enable_pin_auth_ready (MMBaseModem *modem,
|
|||||||
return;
|
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,
|
MM_BASE_SIM_GET_CLASS (ctx->self)->enable_pin (ctx->self,
|
||||||
ctx->pin,
|
ctx->pin,
|
||||||
ctx->enabled,
|
ctx->enabled,
|
||||||
(GAsyncReadyCallback)handle_enable_pin_ready,
|
(GAsyncReadyCallback)handle_enable_pin_ready,
|
||||||
ctx);
|
ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -782,6 +802,16 @@ handle_send_pin_auth_ready (MMBaseModem *modem,
|
|||||||
return;
|
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,
|
mm_base_sim_send_pin (ctx->self,
|
||||||
ctx->pin,
|
ctx->pin,
|
||||||
(GAsyncReadyCallback)handle_send_pin_ready,
|
(GAsyncReadyCallback)handle_send_pin_ready,
|
||||||
@@ -856,6 +886,16 @@ handle_send_puk_auth_ready (MMBaseModem *modem,
|
|||||||
return;
|
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,
|
mm_base_sim_send_puk (ctx->self,
|
||||||
ctx->puk,
|
ctx->puk,
|
||||||
ctx->new_pin,
|
ctx->new_pin,
|
||||||
|
Reference in New Issue
Block a user