diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2022-05-20 13:24:57 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2022-05-25 11:14:34 +0200 |
commit | 638841281ec1db3010687b00dcabe17173790571 (patch) | |
tree | f25c1d5994038decd812070e712c7bc33a167d83 /src | |
parent | 38a69011bdc26d7a9894e6b8351d780d87ed4b0a (diff) |
base-sim: disallow SIM user operations in eSIM without profiles
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-base-sim.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/mm-base-sim.c b/src/mm-base-sim.c index 7719cc5f..e1ccedb5 100644 --- a/src/mm-base-sim.c +++ b/src/mm-base-sim.c @@ -264,6 +264,16 @@ handle_change_pin_auth_ready (MMBaseModem *modem, return; } + if (IS_ESIM_WITHOUT_PROFILES (ctx->self)) { + g_dbus_method_invocation_return_error (ctx->invocation, + MM_CORE_ERROR, + MM_CORE_ERROR_UNSUPPORTED, + "Cannot change PIN: " + "eSIM without profiles"); + handle_change_pin_context_free (ctx); + return; + } + MM_BASE_SIM_GET_CLASS (ctx->self)->change_pin (ctx->self, ctx->old_pin, ctx->new_pin, @@ -445,6 +455,16 @@ handle_enable_pin_auth_ready (MMBaseModem *modem, return; } + if (IS_ESIM_WITHOUT_PROFILES (ctx->self)) { + g_dbus_method_invocation_return_error (ctx->invocation, + MM_CORE_ERROR, + MM_CORE_ERROR_UNSUPPORTED, + "Cannot enable/disable PIN: " + "eSIM without profiles"); + handle_enable_pin_context_free (ctx); + return; + } + MM_BASE_SIM_GET_CLASS (ctx->self)->enable_pin (ctx->self, ctx->pin, ctx->enabled, @@ -847,6 +867,16 @@ handle_send_pin_auth_ready (MMBaseModem *modem, return; } + if (IS_ESIM_WITHOUT_PROFILES (ctx->self)) { + g_dbus_method_invocation_return_error (ctx->invocation, + MM_CORE_ERROR, + MM_CORE_ERROR_UNSUPPORTED, + "Cannot send PIN: " + "eSIM without profiles"); + handle_send_pin_context_free (ctx); + return; + } + mm_base_sim_send_pin (ctx->self, ctx->pin, (GAsyncReadyCallback)handle_send_pin_ready, @@ -946,6 +976,16 @@ handle_send_puk_auth_ready (MMBaseModem *modem, return; } + if (IS_ESIM_WITHOUT_PROFILES (ctx->self)) { + g_dbus_method_invocation_return_error (ctx->invocation, + MM_CORE_ERROR, + MM_CORE_ERROR_UNSUPPORTED, + "Cannot send PUK: " + "eSIM without profiles"); + handle_send_puk_context_free (ctx); + return; + } + mm_base_sim_send_puk (ctx->self, ctx->puk, ctx->new_pin, @@ -1499,6 +1539,16 @@ handle_set_preferred_networks_auth_ready (MMBaseModem *modem, return; } + if (IS_ESIM_WITHOUT_PROFILES (ctx->self)) { + g_dbus_method_invocation_return_error (ctx->invocation, + MM_CORE_ERROR, + MM_CORE_ERROR_UNSUPPORTED, + "Cannot set preferred networks: " + "eSIM without profiles"); + handle_set_preferred_networks_context_free (ctx); + return; + } + if (!MM_BASE_SIM_GET_CLASS (ctx->self)->set_preferred_networks || !MM_BASE_SIM_GET_CLASS (ctx->self)->set_preferred_networks_finish) { g_dbus_method_invocation_return_error (ctx->invocation, |