mm-log: hiding personal info while logging

During mm logging, some of the information like simIccId, Telephone
numbers need to be hidden from displaying in the logs to protect
some of the user information.

Implemented for MBIM requiring libmbim 1.27.6, which is the
development version that includes the needed API.
This commit is contained in:
som
2022-04-01 20:27:47 +05:30
committed by Aleksander Morgado
parent 4207ee61b7
commit 1e08f9ca2c
7 changed files with 19 additions and 2 deletions

View File

@@ -386,7 +386,7 @@ dnl-----------------------------------------------------------------------------
dnl MBIM support (enabled by default) dnl MBIM support (enabled by default)
dnl dnl
LIBMBIM_VERSION=1.27.5 LIBMBIM_VERSION=1.27.6
AC_ARG_WITH(mbim, AS_HELP_STRING([--without-mbim], [Build without MBIM support]), [], [with_mbim=yes]) AC_ARG_WITH(mbim, AS_HELP_STRING([--without-mbim], [Build without MBIM support]), [], [with_mbim=yes])
AM_CONDITIONAL(WITH_MBIM, test "x$with_mbim" = "xyes") AM_CONDITIONAL(WITH_MBIM, test "x$with_mbim" = "xyes")

View File

@@ -237,7 +237,7 @@ config_h.set('WITH_AT_COMMAND_VIA_DBUS', enable_at_command_via_dbus)
# MBIM support (enabled by default) # MBIM support (enabled by default)
enable_mbim = get_option('mbim') enable_mbim = get_option('mbim')
if enable_mbim if enable_mbim
mbim_glib_dep = dependency('mbim-glib', version: '>= 1.27.3') mbim_glib_dep = dependency('mbim-glib', version: '>= 1.27.6')
endif endif
config_h.set('WITH_MBIM', enable_mbim) config_h.set('WITH_MBIM', enable_mbim)

View File

@@ -165,6 +165,7 @@ main (int argc, char *argv[])
mm_context_get_log_journal (), mm_context_get_log_journal (),
mm_context_get_log_timestamps (), mm_context_get_log_timestamps (),
mm_context_get_log_relative_timestamps (), mm_context_get_log_relative_timestamps (),
mm_context_get_log_personal_info (),
&error)) { &error)) {
g_printerr ("error: failed to set up logging: %s\n", error->message); g_printerr ("error: failed to set up logging: %s\n", error->message);
g_error_free (error); g_error_free (error);

View File

@@ -134,6 +134,7 @@ static const gchar *log_file;
static gboolean log_journal; static gboolean log_journal;
static gboolean log_show_ts; static gboolean log_show_ts;
static gboolean log_rel_ts; static gboolean log_rel_ts;
static gboolean log_personal_info;
static const GOptionEntry log_entries[] = { static const GOptionEntry log_entries[] = {
{ {
@@ -163,6 +164,11 @@ static const GOptionEntry log_entries[] = {
"Use relative timestamps (from MM start)", "Use relative timestamps (from MM start)",
NULL NULL
}, },
{
"log-personal-info", 0, 0, G_OPTION_ARG_NONE, &log_personal_info,
"Show personal info in logs",
NULL
},
{ NULL } { NULL }
}; };
@@ -210,6 +216,12 @@ mm_context_get_log_relative_timestamps (void)
return log_rel_ts; return log_rel_ts;
} }
gboolean
mm_context_get_log_personal_info (void)
{
return log_personal_info;
}
/*****************************************************************************/ /*****************************************************************************/
/* Test context */ /* Test context */

View File

@@ -41,6 +41,7 @@ const gchar *mm_context_get_log_file (void);
gboolean mm_context_get_log_journal (void); gboolean mm_context_get_log_journal (void);
gboolean mm_context_get_log_timestamps (void); gboolean mm_context_get_log_timestamps (void);
gboolean mm_context_get_log_relative_timestamps (void); gboolean mm_context_get_log_relative_timestamps (void);
gboolean mm_context_get_log_personal_info (void);
/* Testing support */ /* Testing support */
gboolean mm_context_get_test_session (void); gboolean mm_context_get_test_session (void);

View File

@@ -310,6 +310,7 @@ mm_log_setup (const char *level,
gboolean log_journal, gboolean log_journal,
gboolean show_timestamps, gboolean show_timestamps,
gboolean rel_timestamps, gboolean rel_timestamps,
gboolean show_personal_info,
GError **error) GError **error)
{ {
/* levels */ /* levels */
@@ -366,6 +367,7 @@ mm_log_setup (const char *level,
#endif #endif
#if defined WITH_MBIM #if defined WITH_MBIM
mbim_utils_set_show_personal_info (show_personal_info);
g_log_set_handler ("Mbim", g_log_set_handler ("Mbim",
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
log_handler, log_handler,

View File

@@ -60,6 +60,7 @@ gboolean mm_log_setup (const char *level,
gboolean log_journal, gboolean log_journal,
gboolean show_ts, gboolean show_ts,
gboolean rel_ts, gboolean rel_ts,
gboolean show_personal_info,
GError **error); GError **error);
void mm_log_shutdown (void); void mm_log_shutdown (void);