base-sim: disallow SIM user operations in eSIM without profiles

This commit is contained in:
Aleksander Morgado
2022-05-25 11:14:34 +02:00
parent 38a69011bd
commit 638841281e
+50
View File
@@ -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,