mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-06 01:10:33 +01:00
settings: rename NM_SYSCONFIG_SETTINGS_ERROR -> NM_SETTINGS_ERROR
This commit is contained in:
parent
83ab4ec2ee
commit
3f64bf5e36
10 changed files with 189 additions and 190 deletions
|
|
@ -18,8 +18,8 @@ libsettings_la_SOURCES = \
|
|||
nm-inotify-helper.c \
|
||||
nm-inotify-helper.h \
|
||||
nm-polkit-helpers.h \
|
||||
nm-system-config-error.c \
|
||||
nm-system-config-error.h \
|
||||
nm-settings-error.c \
|
||||
nm-settings-error.h \
|
||||
nm-system-config-interface.c \
|
||||
nm-system-config-interface.h \
|
||||
nm-sysconfig-connection.c \
|
||||
|
|
|
|||
75
src/settings/nm-settings-error.c
Normal file
75
src/settings/nm-settings-error.c
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/* NetworkManager system settings service
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2008 Novell, Inc.
|
||||
* Copyright (C) 2008 - 2010 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include "nm-settings-error.h"
|
||||
|
||||
GQuark
|
||||
nm_settings_error_quark (void)
|
||||
{
|
||||
static GQuark ret = 0;
|
||||
|
||||
if (ret == 0)
|
||||
ret = g_quark_from_static_string ("nm-settings-error");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
|
||||
|
||||
GType
|
||||
nm_settings_error_get_type (void)
|
||||
{
|
||||
static GType etype = 0;
|
||||
|
||||
if (etype == 0) {
|
||||
static const GEnumValue values[] = {
|
||||
ENUM_ENTRY (NM_SETTINGS_ERROR_GENERAL, "GeneralError"),
|
||||
|
||||
/* The connection was invalid. */
|
||||
ENUM_ENTRY (NM_SETTINGS_ERROR_INVALID_CONNECTION, "InvalidConnection"),
|
||||
/* The connection is read-only; modifications are not allowed. */
|
||||
ENUM_ENTRY (NM_SETTINGS_ERROR_READ_ONLY_CONNECTION, "ReadOnlyConnection"),
|
||||
/* A bug in the settings service caused the error. */
|
||||
ENUM_ENTRY (NM_SETTINGS_ERROR_INTERNAL_ERROR, "InternalError"),
|
||||
/* Retrieval or request of secrets failed. */
|
||||
ENUM_ENTRY (NM_SETTINGS_ERROR_SECRETS_UNAVAILABLE, "SecretsUnavailable"),
|
||||
/* The request for secrets was canceled. */
|
||||
ENUM_ENTRY (NM_SETTINGS_ERROR_SECRETS_REQUEST_CANCELED, "SecretsRequestCanceled"),
|
||||
/* The request could not be completed because permission was denied. */
|
||||
ENUM_ENTRY (NM_SETTINGS_ERROR_PERMISSION_DENIED, "PermissionDenied"),
|
||||
/* The requested setting does not existing in this connection. */
|
||||
ENUM_ENTRY (NM_SETTINGS_ERROR_INVALID_SETTING, "InvalidSetting"),
|
||||
|
||||
ENUM_ENTRY (NM_SETTINGS_ERROR_NOT_PRIVILEGED, "NotPrivileged"),
|
||||
ENUM_ENTRY (NM_SETTINGS_ERROR_ADD_NOT_SUPPORTED, "AddNotSupported"),
|
||||
ENUM_ENTRY (NM_SETTINGS_ERROR_UPDATE_NOT_SUPPORTED, "UpdateNotSupported"),
|
||||
ENUM_ENTRY (NM_SETTINGS_ERROR_DELETE_NOT_SUPPORTED, "DeleteNotSupported"),
|
||||
ENUM_ENTRY (NM_SETTINGS_ERROR_ADD_FAILED, "AddFailed"),
|
||||
ENUM_ENTRY (NM_SETTINGS_ERROR_SAVE_HOSTNAME_NOT_SUPPORTED, "SaveHostnameNotSupported"),
|
||||
ENUM_ENTRY (NM_SETTINGS_ERROR_SAVE_HOSTNAME_FAILED, "SaveHostnameFailed"),
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
|
||||
etype = g_enum_register_static ("NMSettingsError", values);
|
||||
}
|
||||
|
||||
return etype;
|
||||
}
|
||||
52
src/settings/nm-settings-error.h
Normal file
52
src/settings/nm-settings-error.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/* NetworkManager system settings service
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2008 Novell, Inc.
|
||||
* Copyright (C) 2008 - 2010 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef NM_SETTINGS_ERROR_H
|
||||
#define NM_SETTINGS_ERROR_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
enum {
|
||||
NM_SETTINGS_ERROR_GENERAL = 0,
|
||||
NM_SETTINGS_ERROR_INVALID_CONNECTION,
|
||||
NM_SETTINGS_ERROR_READ_ONLY_CONNECTION,
|
||||
NM_SETTINGS_ERROR_INTERNAL_ERROR,
|
||||
NM_SETTINGS_ERROR_SECRETS_UNAVAILABLE,
|
||||
NM_SETTINGS_ERROR_SECRETS_REQUEST_CANCELED,
|
||||
NM_SETTINGS_ERROR_PERMISSION_DENIED,
|
||||
NM_SETTINGS_ERROR_INVALID_SETTING,
|
||||
NM_SETTINGS_ERROR_NOT_PRIVILEGED,
|
||||
NM_SETTINGS_ERROR_ADD_NOT_SUPPORTED,
|
||||
NM_SETTINGS_ERROR_UPDATE_NOT_SUPPORTED,
|
||||
NM_SETTINGS_ERROR_DELETE_NOT_SUPPORTED,
|
||||
NM_SETTINGS_ERROR_ADD_FAILED,
|
||||
NM_SETTINGS_ERROR_SAVE_HOSTNAME_NOT_SUPPORTED,
|
||||
NM_SETTINGS_ERROR_SAVE_HOSTNAME_FAILED,
|
||||
};
|
||||
|
||||
#define NM_SETTINGS_ERROR (nm_settings_error_quark ())
|
||||
#define NM_TYPE_SETTINGS_ERROR (nm_settings_error_get_type ())
|
||||
|
||||
GQuark nm_settings_error_quark (void);
|
||||
GType nm_settings_error_get_type (void);
|
||||
|
||||
#endif /* NM_SETTINGS_ERROR_H */
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
#include "nm-settings.h"
|
||||
#include "nm-sysconfig-connection.h"
|
||||
#include "nm-polkit-helpers.h"
|
||||
#include "nm-system-config-error.h"
|
||||
#include "nm-settings-error.h"
|
||||
#include "nm-default-wired-connection.h"
|
||||
#include "nm-logging.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
|
|
@ -794,8 +794,8 @@ pk_add_cb (GObject *object, GAsyncResult *result, gpointer user_data)
|
|||
|
||||
/* If NMSettings is already gone, do nothing */
|
||||
if (call->disposed) {
|
||||
error = g_error_new_literal (NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_GENERAL,
|
||||
error = g_error_new_literal (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_GENERAL,
|
||||
"Request was canceled.");
|
||||
dbus_g_method_return_error (call->context, error);
|
||||
g_error_free (error);
|
||||
|
|
@ -818,8 +818,8 @@ pk_add_cb (GObject *object, GAsyncResult *result, gpointer user_data)
|
|||
|
||||
/* Caller didn't successfully authenticate */
|
||||
if (!polkit_authorization_result_get_is_authorized (pk_result)) {
|
||||
error = g_error_new_literal (NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_NOT_PRIVILEGED,
|
||||
error = g_error_new_literal (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_NOT_PRIVILEGED,
|
||||
"Insufficient privileges.");
|
||||
dbus_g_method_return_error (call->context, error);
|
||||
goto out;
|
||||
|
|
@ -828,8 +828,8 @@ pk_add_cb (GObject *object, GAsyncResult *result, gpointer user_data)
|
|||
if (add_new_connection (self, call->connection, &add_error))
|
||||
dbus_g_method_return (call->context);
|
||||
else {
|
||||
error = g_error_new (NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_ADD_FAILED,
|
||||
error = g_error_new (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_ADD_FAILED,
|
||||
"Saving connection failed: (%d) %s",
|
||||
add_error ? add_error->code : -1,
|
||||
(add_error && add_error->message) ? add_error->message : "(unknown)");
|
||||
|
|
@ -864,8 +864,8 @@ impl_settings_add_connection (NMSettings *self,
|
|||
|
||||
/* Do any of the plugins support adding? */
|
||||
if (!get_plugin (self, NM_SYSTEM_CONFIG_INTERFACE_CAP_MODIFY_CONNECTIONS)) {
|
||||
error = g_error_new_literal (NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_ADD_NOT_SUPPORTED,
|
||||
error = g_error_new_literal (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_ADD_NOT_SUPPORTED,
|
||||
"None of the registered plugins support add.");
|
||||
dbus_g_method_return_error (context, error);
|
||||
g_error_free (error);
|
||||
|
|
@ -900,8 +900,8 @@ pk_hostname_cb (GObject *object, GAsyncResult *result, gpointer user_data)
|
|||
|
||||
/* If our NMSysconfigConnection is already gone, do nothing */
|
||||
if (call->disposed) {
|
||||
error = g_error_new_literal (NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_GENERAL,
|
||||
error = g_error_new_literal (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_GENERAL,
|
||||
"Request was canceled.");
|
||||
dbus_g_method_return_error (call->context, error);
|
||||
g_error_free (error);
|
||||
|
|
@ -924,8 +924,8 @@ pk_hostname_cb (GObject *object, GAsyncResult *result, gpointer user_data)
|
|||
|
||||
/* Caller didn't successfully authenticate */
|
||||
if (!polkit_authorization_result_get_is_authorized (pk_result)) {
|
||||
error = g_error_new_literal (NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_NOT_PRIVILEGED,
|
||||
error = g_error_new_literal (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_NOT_PRIVILEGED,
|
||||
"Insufficient privileges.");
|
||||
dbus_g_method_return_error (call->context, error);
|
||||
goto out;
|
||||
|
|
@ -945,8 +945,8 @@ pk_hostname_cb (GObject *object, GAsyncResult *result, gpointer user_data)
|
|||
if (success) {
|
||||
dbus_g_method_return (call->context);
|
||||
} else {
|
||||
error = g_error_new_literal (NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_SAVE_HOSTNAME_FAILED,
|
||||
error = g_error_new_literal (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_SAVE_HOSTNAME_FAILED,
|
||||
"Saving the hostname failed.");
|
||||
dbus_g_method_return_error (call->context, error);
|
||||
}
|
||||
|
|
@ -969,8 +969,8 @@ impl_settings_save_hostname (NMSettings *self,
|
|||
|
||||
/* Do any of the plugins support setting the hostname? */
|
||||
if (!get_plugin (self, NM_SYSTEM_CONFIG_INTERFACE_CAP_MODIFY_HOSTNAME)) {
|
||||
error = g_error_new_literal (NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_SAVE_HOSTNAME_NOT_SUPPORTED,
|
||||
error = g_error_new_literal (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_SAVE_HOSTNAME_NOT_SUPPORTED,
|
||||
"None of the registered plugins support setting the hostname.");
|
||||
dbus_g_method_return_error (context, error);
|
||||
g_error_free (error);
|
||||
|
|
@ -1516,9 +1516,9 @@ nm_settings_class_init (NMSettingsClass *class)
|
|||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
dbus_g_error_domain_register (NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
dbus_g_error_domain_register (NM_SETTINGS_ERROR,
|
||||
NM_DBUS_IFACE_SETTINGS,
|
||||
NM_TYPE_SYSCONFIG_SETTINGS_ERROR);
|
||||
NM_TYPE_SETTINGS_ERROR);
|
||||
|
||||
/* And register all the settings errors with D-Bus */
|
||||
dbus_g_error_domain_register (NM_CONNECTION_ERROR, NULL, NM_TYPE_CONNECTION_ERROR);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include "nm-sysconfig-connection.h"
|
||||
#include "nm-session-monitor.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
#include "nm-system-config-error.h"
|
||||
#include "nm-settings-error.h"
|
||||
#include "nm-dbus-glib-types.h"
|
||||
#include "nm-polkit-helpers.h"
|
||||
#include "nm-logging.h"
|
||||
|
|
@ -132,8 +132,8 @@ uid_in_acl (NMConnection *self,
|
|||
/* Reject the request if the request comes from no session at all */
|
||||
if (nm_session_monitor_uid_has_session (smon, uid, &user, &local)) {
|
||||
g_set_error (error,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_PERMISSION_DENIED,
|
||||
NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_PERMISSION_DENIED,
|
||||
"No session found for uid %d (%s)",
|
||||
uid,
|
||||
local && local->message ? local->message : "unknown");
|
||||
|
|
@ -143,8 +143,8 @@ uid_in_acl (NMConnection *self,
|
|||
|
||||
if (!user) {
|
||||
g_set_error (error,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_PERMISSION_DENIED,
|
||||
NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_PERMISSION_DENIED,
|
||||
"Could not determine username for uid %d",
|
||||
uid);
|
||||
return FALSE;
|
||||
|
|
@ -170,8 +170,8 @@ uid_in_acl (NMConnection *self,
|
|||
}
|
||||
|
||||
g_set_error (error,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_PERMISSION_DENIED,
|
||||
NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_PERMISSION_DENIED,
|
||||
"uid %d has no permission to perform this operation",
|
||||
uid);
|
||||
return FALSE;
|
||||
|
|
@ -339,8 +339,8 @@ nm_sysconfig_connection_commit_changes (NMSysconfigConnection *connection,
|
|||
callback,
|
||||
user_data);
|
||||
} else {
|
||||
GError *error = g_error_new (NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_INTERNAL_ERROR,
|
||||
GError *error = g_error_new (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_INTERNAL_ERROR,
|
||||
"%s: %s:%d commit_changes() unimplemented", __func__, __FILE__, __LINE__);
|
||||
callback (connection, error, user_data);
|
||||
g_error_free (error);
|
||||
|
|
@ -361,8 +361,8 @@ nm_sysconfig_connection_delete (NMSysconfigConnection *connection,
|
|||
callback,
|
||||
user_data);
|
||||
} else {
|
||||
GError *error = g_error_new (NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_INTERNAL_ERROR,
|
||||
GError *error = g_error_new (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_INTERNAL_ERROR,
|
||||
"%s: %s:%d delete() unimplemented", __func__, __FILE__, __LINE__);
|
||||
callback (connection, error, user_data);
|
||||
g_error_free (error);
|
||||
|
|
@ -389,8 +389,8 @@ nm_sysconfig_connection_get_secrets (NMSysconfigConnection *connection,
|
|||
callback,
|
||||
user_data);
|
||||
} else {
|
||||
GError *error = g_error_new (NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_INTERNAL_ERROR,
|
||||
GError *error = g_error_new (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_INTERNAL_ERROR,
|
||||
"%s: %s:%d get_secrets() unimplemented", __func__, __FILE__, __LINE__);
|
||||
callback (connection, NULL, error, user_data);
|
||||
g_error_free (error);
|
||||
|
|
@ -531,8 +531,8 @@ get_secrets (NMSysconfigConnection *connection,
|
|||
* nm_sysconfig_connection_replace_settings().
|
||||
*/
|
||||
if (!priv->secrets) {
|
||||
error = g_error_new (NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_INVALID_CONNECTION,
|
||||
error = g_error_new (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_INVALID_CONNECTION,
|
||||
"%s.%d - Internal error; secrets cache invalid.",
|
||||
__FILE__, __LINE__);
|
||||
(*callback) (connection, NULL, error, user_data);
|
||||
|
|
@ -542,8 +542,8 @@ get_secrets (NMSysconfigConnection *connection,
|
|||
|
||||
setting = nm_connection_get_setting_by_name (priv->secrets, setting_name);
|
||||
if (!setting) {
|
||||
error = g_error_new (NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_INVALID_SETTING,
|
||||
error = g_error_new (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_INVALID_SETTING,
|
||||
"%s.%d - Connection didn't have requested setting '%s'.",
|
||||
__FILE__, __LINE__, setting_name);
|
||||
(*callback) (connection, NULL, error, user_data);
|
||||
|
|
@ -605,8 +605,8 @@ auth_pk_cb (GObject *object, GAsyncResult *result, gpointer user_data)
|
|||
GError *error = NULL;
|
||||
|
||||
if (info->disposed) {
|
||||
error = g_error_new_literal (NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_GENERAL,
|
||||
error = g_error_new_literal (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_GENERAL,
|
||||
"Request was canceled.");
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -618,8 +618,8 @@ auth_pk_cb (GObject *object, GAsyncResult *result, gpointer user_data)
|
|||
goto out;
|
||||
|
||||
if (!polkit_authorization_result_get_is_authorized (pk_result)) {
|
||||
error = g_error_new_literal (NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_NOT_PRIVILEGED,
|
||||
error = g_error_new_literal (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_NOT_PRIVILEGED,
|
||||
"Insufficient privileges.");
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -650,8 +650,8 @@ auth_start (NMSysconfigConnection *self,
|
|||
|
||||
/* Get the caller's UID */
|
||||
if (!nm_auth_get_caller_uid (context, NULL, &sender_uid, &error_desc)) {
|
||||
error = g_error_new_literal (NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_PERMISSION_DENIED,
|
||||
error = g_error_new_literal (NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_PERMISSION_DENIED,
|
||||
error_desc);
|
||||
goto error;
|
||||
}
|
||||
|
|
@ -714,8 +714,8 @@ check_writable (NMConnection *connection, GError **error)
|
|||
NM_TYPE_SETTING_CONNECTION);
|
||||
if (!s_con) {
|
||||
g_set_error_literal (error,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_INVALID_CONNECTION,
|
||||
NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_INVALID_CONNECTION,
|
||||
"Connection did not have required 'connection' setting");
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -726,8 +726,8 @@ check_writable (NMConnection *connection, GError **error)
|
|||
*/
|
||||
if (nm_setting_connection_get_read_only (s_con)) {
|
||||
g_set_error_literal (error,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_READ_ONLY_CONNECTION,
|
||||
NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_READ_ONLY_CONNECTION,
|
||||
"Connection is read-only");
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,75 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/* NetworkManager system settings service
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2008 Novell, Inc.
|
||||
* Copyright (C) 2008 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include "nm-system-config-error.h"
|
||||
|
||||
GQuark
|
||||
nm_sysconfig_settings_error_quark (void)
|
||||
{
|
||||
static GQuark ret = 0;
|
||||
|
||||
if (ret == 0)
|
||||
ret = g_quark_from_static_string ("nm_sysconfig_settings_error");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
|
||||
|
||||
GType
|
||||
nm_sysconfig_settings_error_get_type (void)
|
||||
{
|
||||
static GType etype = 0;
|
||||
|
||||
if (etype == 0) {
|
||||
static const GEnumValue values[] = {
|
||||
ENUM_ENTRY (NM_SYSCONFIG_SETTINGS_ERROR_GENERAL, "GeneralError"),
|
||||
|
||||
/* The connection was invalid. */
|
||||
ENUM_ENTRY (NM_SYSCONFIG_SETTINGS_ERROR_INVALID_CONNECTION, "InvalidConnection"),
|
||||
/* The connection is read-only; modifications are not allowed. */
|
||||
ENUM_ENTRY (NM_SYSCONFIG_SETTINGS_ERROR_READ_ONLY_CONNECTION, "ReadOnlyConnection"),
|
||||
/* A bug in the settings service caused the error. */
|
||||
ENUM_ENTRY (NM_SYSCONFIG_SETTINGS_ERROR_INTERNAL_ERROR, "InternalError"),
|
||||
/* Retrieval or request of secrets failed. */
|
||||
ENUM_ENTRY (NM_SYSCONFIG_SETTINGS_ERROR_SECRETS_UNAVAILABLE, "SecretsUnavailable"),
|
||||
/* The request for secrets was canceled. */
|
||||
ENUM_ENTRY (NM_SYSCONFIG_SETTINGS_ERROR_SECRETS_REQUEST_CANCELED, "SecretsRequestCanceled"),
|
||||
/* The request could not be completed because permission was denied. */
|
||||
ENUM_ENTRY (NM_SYSCONFIG_SETTINGS_ERROR_PERMISSION_DENIED, "PermissionDenied"),
|
||||
/* The requested setting does not existing in this connection. */
|
||||
ENUM_ENTRY (NM_SYSCONFIG_SETTINGS_ERROR_INVALID_SETTING, "InvalidSetting"),
|
||||
|
||||
ENUM_ENTRY (NM_SYSCONFIG_SETTINGS_ERROR_NOT_PRIVILEGED, "NotPrivileged"),
|
||||
ENUM_ENTRY (NM_SYSCONFIG_SETTINGS_ERROR_ADD_NOT_SUPPORTED, "AddNotSupported"),
|
||||
ENUM_ENTRY (NM_SYSCONFIG_SETTINGS_ERROR_UPDATE_NOT_SUPPORTED, "UpdateNotSupported"),
|
||||
ENUM_ENTRY (NM_SYSCONFIG_SETTINGS_ERROR_DELETE_NOT_SUPPORTED, "DeleteNotSupported"),
|
||||
ENUM_ENTRY (NM_SYSCONFIG_SETTINGS_ERROR_ADD_FAILED, "AddFailed"),
|
||||
ENUM_ENTRY (NM_SYSCONFIG_SETTINGS_ERROR_SAVE_HOSTNAME_NOT_SUPPORTED, "SaveHostnameNotSupported"),
|
||||
ENUM_ENTRY (NM_SYSCONFIG_SETTINGS_ERROR_SAVE_HOSTNAME_FAILED, "SaveHostnameFailed"),
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
|
||||
etype = g_enum_register_static ("NMSysconfigSettingsError", values);
|
||||
}
|
||||
|
||||
return etype;
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/* NetworkManager system settings service
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright (C) 2008 Novell, Inc.
|
||||
* Copyright (C) 2008 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef NM_SYSTEM_CONFIG_ERROR_H
|
||||
#define NM_SYSTEM_CONFIG_ERROR_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
enum {
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_GENERAL = 0,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_INVALID_CONNECTION,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_READ_ONLY_CONNECTION,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_INTERNAL_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_SECRETS_UNAVAILABLE,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_SECRETS_REQUEST_CANCELED,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_PERMISSION_DENIED,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_INVALID_SETTING,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_NOT_PRIVILEGED,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_ADD_NOT_SUPPORTED,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_UPDATE_NOT_SUPPORTED,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_DELETE_NOT_SUPPORTED,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_ADD_FAILED,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_SAVE_HOSTNAME_NOT_SUPPORTED,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_SAVE_HOSTNAME_FAILED,
|
||||
};
|
||||
|
||||
#define NM_SYSCONFIG_SETTINGS_ERROR (nm_sysconfig_settings_error_quark ())
|
||||
#define NM_TYPE_SYSCONFIG_SETTINGS_ERROR (nm_sysconfig_settings_error_get_type ())
|
||||
|
||||
GQuark nm_sysconfig_settings_error_quark (void);
|
||||
GType nm_sysconfig_settings_error_get_type (void);
|
||||
|
||||
#endif /* NM_SYSTEM_CONFIG_ERROR_H */
|
||||
|
|
@ -43,7 +43,7 @@
|
|||
#include "nm-dbus-glib-types.h"
|
||||
#include "plugin.h"
|
||||
#include "nm-system-config-interface.h"
|
||||
#include "nm-system-config-error.h"
|
||||
#include "nm-settings-error.h"
|
||||
|
||||
#include "nm-ifcfg-connection.h"
|
||||
#include "nm-inotify-helper.h"
|
||||
|
|
@ -544,8 +544,8 @@ impl_ifcfgrh_get_ifcfg_details (SCPluginIfcfg *plugin,
|
|||
|
||||
if (!g_path_is_absolute (in_ifcfg)) {
|
||||
g_set_error (error,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_INVALID_CONNECTION,
|
||||
NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_INVALID_CONNECTION,
|
||||
"ifcfg path '%s' is not absolute", in_ifcfg);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -553,8 +553,8 @@ impl_ifcfgrh_get_ifcfg_details (SCPluginIfcfg *plugin,
|
|||
connection = g_hash_table_lookup (priv->connections, in_ifcfg);
|
||||
if (!connection || nm_ifcfg_connection_get_unmanaged_spec (connection)) {
|
||||
g_set_error (error,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_INVALID_CONNECTION,
|
||||
NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_INVALID_CONNECTION,
|
||||
"ifcfg file '%s' unknown", in_ifcfg);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -562,8 +562,8 @@ impl_ifcfgrh_get_ifcfg_details (SCPluginIfcfg *plugin,
|
|||
s_con = (NMSettingConnection *) nm_connection_get_setting (NM_CONNECTION (connection), NM_TYPE_SETTING_CONNECTION);
|
||||
if (!s_con) {
|
||||
g_set_error (error,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_INTERNAL_ERROR,
|
||||
NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_INTERNAL_ERROR,
|
||||
"unable to retrieve the connection setting");
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -571,8 +571,8 @@ impl_ifcfgrh_get_ifcfg_details (SCPluginIfcfg *plugin,
|
|||
uuid = nm_setting_connection_get_uuid (s_con);
|
||||
if (!uuid) {
|
||||
g_set_error (error,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_INTERNAL_ERROR,
|
||||
NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_INTERNAL_ERROR,
|
||||
"unable to get the UUID");
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -580,8 +580,8 @@ impl_ifcfgrh_get_ifcfg_details (SCPluginIfcfg *plugin,
|
|||
path = nm_connection_get_path (NM_CONNECTION (connection));
|
||||
if (!path) {
|
||||
g_set_error (error,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_INTERNAL_ERROR,
|
||||
NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_INTERNAL_ERROR,
|
||||
"unable to get the connection D-Bus path");
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include <nm-setting-wireless-security.h>
|
||||
#include <nm-sysconfig-connection.h>
|
||||
#include <nm-system-config-interface.h>
|
||||
#include <nm-system-config-error.h>
|
||||
#include <nm-settings-error.h>
|
||||
#include "nm-ifupdown-connection.h"
|
||||
#include "parser.h"
|
||||
|
||||
|
|
@ -72,8 +72,8 @@ get_secrets (NMSysconfigConnection *connection,
|
|||
/* FIXME: Only wifi secrets are supported for now */
|
||||
if (strcmp (setting_name, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)) {
|
||||
g_set_error (&error,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_GENERAL,
|
||||
NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_GENERAL,
|
||||
"%s.%d - security setting name not supported '%s'.",
|
||||
__FILE__, __LINE__, setting_name);
|
||||
PLUGIN_PRINT ("SCPlugin-Ifupdown", "%s", error->message);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@
|
|||
#include <ctype.h>
|
||||
|
||||
#include "nm-dbus-glib-types.h"
|
||||
#include "nm-system-config-error.h"
|
||||
#include "writer.h"
|
||||
#include "common.h"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue