keyfile: Drop owner check

In nm_keyfile_plugin_connection_from_file(), disable the "bad owner"
check.
As root you can read all files anyway, or if necessary even chown them,
and for
other users the standard file permissions will do a fine job.

This fixes running "make check" as root.

https://bugzilla.gnome.org/show_bug.cgi?id=701112
This commit is contained in:
Martin Pitt 2013-08-13 23:28:54 +02:00 committed by Pavel Šimerda
parent 80c48a62be
commit 5dc4be54e6

View file

@ -1151,7 +1151,7 @@ nm_keyfile_plugin_connection_from_file (const char *filename, GError **error)
{
GKeyFile *key_file;
struct stat statbuf;
gboolean bad_owner, bad_permissions;
gboolean bad_permissions;
NMConnection *connection = NULL;
NMSettingConnection *s_con;
NMSetting *setting;
@ -1168,13 +1168,12 @@ nm_keyfile_plugin_connection_from_file (const char *filename, GError **error)
return NULL;
}
bad_owner = getuid () != statbuf.st_uid;
bad_permissions = statbuf.st_mode & 0077;
if (bad_owner || bad_permissions) {
if (bad_permissions) {
g_set_error (error, KEYFILE_PLUGIN_ERROR, 0,
"File permissions (%o) or owner (%d) were insecure",
statbuf.st_mode, statbuf.st_uid);
"File permissions (%o) were insecure",
statbuf.st_mode);
return NULL;
}