summaryrefslogtreecommitdiffstats
path: root/src/Daemon
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-09-09 14:38:41 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-09-09 14:38:41 +0200
commit9418dd78a0a6b85cee403fc6f51f9e710c891487 (patch)
treea82a6412e5ffce9df4b317a6d50ff87a360c2928 /src/Daemon
parentd04a619443303243a649f3f1baa20ad2f3ae1d89 (diff)
downloadabrt-9418dd78a0a6b85cee403fc6f51f9e710c891487.tar.gz
abrt-9418dd78a0a6b85cee403fc6f51f9e710c891487.tar.xz
abrt-9418dd78a0a6b85cee403fc6f51f9e710c891487.zip
styple fixes to polkit code, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'src/Daemon')
-rw-r--r--src/Daemon/Polkit.cpp36
-rw-r--r--src/Daemon/Polkit.h22
-rw-r--r--src/Daemon/Settings.cpp16
3 files changed, 37 insertions, 37 deletions
diff --git a/src/Daemon/Polkit.cpp b/src/Daemon/Polkit.cpp
index 722b788c..8d533696 100644
--- a/src/Daemon/Polkit.cpp
+++ b/src/Daemon/Polkit.cpp
@@ -1,4 +1,4 @@
-/*
+/*
Polkit.cpp - PolicyKit integration for ABRT
Copyright (C) 2009 Daniel Novotny (dnovotny@redhat.com)
@@ -24,39 +24,41 @@
#include "Polkit.h"
-PolkitResult polkit_check_authorization(const char* dbus_name,const char *action_id)
+PolkitResult polkit_check_authorization(const char *dbus_name, const char *action_id)
{
PolkitAuthority *authority;
PolkitSubject *subject;
PolkitAuthorizationResult *result;
GError *error = NULL;
-
+
g_type_init();
authority = polkit_authority_get();
- subject = polkit_system_bus_name_new( dbus_name );
+ subject = polkit_system_bus_name_new(dbus_name);
result = polkit_authority_check_authorization_sync(authority,
- subject,
- action_id,
+ subject,
+ action_id,
NULL,
POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
NULL,
&error);
-
- if (error) {
- g_error_free (error);
+
+ if (error)
+ {
+ g_error_free(error);
return PolkitUnknown;
}
-
+
if (result)
+ {
if (polkit_authorization_result_get_is_challenge(result))
+ /* Can't happen (happens only with
+ * POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE flag) */
return PolkitChallenge;
- else
- if (polkit_authorization_result_get_is_authorized(result))
- return PolkitYes;
- else
- return PolkitNo;
-
+ if (polkit_authorization_result_get_is_authorized(result))
+ return PolkitYes;
+ return PolkitNo;
+ }
+
return PolkitUnknown;
}
-
diff --git a/src/Daemon/Polkit.h b/src/Daemon/Polkit.h
index 04aca64f..a1e54f53 100644
--- a/src/Daemon/Polkit.h
+++ b/src/Daemon/Polkit.h
@@ -22,18 +22,18 @@
#ifndef ABRT_POLKIT_H
#define ABRT_POLKIT_H
-typedef enum {
+typedef enum {
/* Authorization status is unknown */
-PolkitUnknown = 0x0,
-/* Subject is authorized for the action */
-PolkitYes = 0x01,
-/* Subject is not authorized for the action */
-PolkitNo = 0x02,
-/* Challenge is needed for this action, only when flag is
-POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE*/
-PolkitChallenge = 0x03
+ PolkitUnknown = 0x0,
+ /* Subject is authorized for the action */
+ PolkitYes = 0x01,
+ /* Subject is not authorized for the action */
+ PolkitNo = 0x02,
+ /* Challenge is needed for this action, only when flag is
+ * POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE */
+ PolkitChallenge = 0x03
} PolkitResult;
-
-PolkitResult polkit_check_authorization(const char * dbus_name,const char *action_id);
+
+PolkitResult polkit_check_authorization(const char *dbus_name, const char *action_id);
#endif
diff --git a/src/Daemon/Settings.cpp b/src/Daemon/Settings.cpp
index 0eea2bd4..436334ae 100644
--- a/src/Daemon/Settings.cpp
+++ b/src/Daemon/Settings.cpp
@@ -425,22 +425,20 @@ void SaveSettings()
}
/* dbus call to change some .conf file data */
-void SetSettings(const map_abrt_settings_t& pSettings, const char * dbus_sender)
+void SetSettings(const map_abrt_settings_t& pSettings, const char *dbus_sender)
{
bool dirty = false;
int polkit_result;
- if(( polkit_result = polkit_check_authorization(dbus_sender,
- "org.fedoraproject.abrt.save-settings")) != PolkitYes)
+ polkit_result = polkit_check_authorization(dbus_sender,
+ "org.fedoraproject.abrt.save-settings");
+ if (polkit_result != PolkitYes)
{
- log("user %s not authorized, returned %d", dbus_sender,
- polkit_result );
+ log("user %s not authorized, returned %d", dbus_sender, polkit_result);
return;
- } else
- {
- log("user %s succesfully authorized", dbus_sender);
}
-
+ log("user %s succesfully authorized", dbus_sender);
+
map_abrt_settings_t::const_iterator it = pSettings.find(SECTION_COMMON);
map_abrt_settings_t::const_iterator end = pSettings.end();
if (it != end)