diff options
author | Thomas Haller <thaller@redhat.com> | 2014-08-20 18:59:01 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-08-20 19:14:44 +0200 |
commit | b59a82d82ea55ee6b511e7c211572591e570efac (patch) | |
tree | c12ce17e12dbe59fbf2f293426c89c193e9b45ee | |
parent | 6a19e68a7d856629600655a076b0cea4be346799 (diff) |
core: print warning message when skipping invalid device plugin file
https://mail.gnome.org/archives/networkmanager-list/2014-August/msg00042.html
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | src/nm-manager.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c index 2224149f33..80291bed5c 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -1974,6 +1974,7 @@ read_device_factory_paths () paths = g_array_new (FALSE, FALSE, sizeof (struct read_device_factory_paths_data)); while ((item = g_dir_read_name (dir))) { + int errsv; struct read_device_factory_paths_data data; if (!g_str_has_prefix (item, PLUGIN_PREFIX)) @@ -1983,21 +1984,25 @@ read_device_factory_paths () data.path = g_build_filename (NMPLUGINDIR, item, NULL); - if (stat (data.path, &data.st) != 0) - goto continue_with_error; + if (stat (data.path, &data.st) != 0) { + errsv = errno; + nm_log_warn (LOGD_HW, "device plugin: skip invalid file %s (error during stat: %s)", data.path, strerror (errsv)); + goto NEXT; + } if (!S_ISREG (data.st.st_mode)) - goto continue_silently; - if (data.st.st_uid != 0) - goto continue_with_error; - if (data.st.st_mode & (S_IWGRP | S_IWOTH | S_ISUID)) - goto continue_with_error; + goto NEXT; + if (data.st.st_uid != 0) { + nm_log_warn (LOGD_HW, "device plugin: skip invalid file %s (file must be owned by root)", data.path); + goto NEXT; + } + if (data.st.st_mode & (S_IWGRP | S_IWOTH | S_ISUID)) { + nm_log_warn (LOGD_HW, "device plugin: skip invalid file %s (invalid file permissions)", data.path); + goto NEXT; + } g_array_append_val (paths, data); continue; - -continue_with_error: - nm_log_dbg (LOGD_HW, "device plugin: skip invalid file %s", data.path); -continue_silently: +NEXT: g_free (data.path); } g_dir_close (dir); |