Mailinglist Archive: yast-commit (2114 mails)

< Previous Next >
[yast-commit] <rest-service> patch_refactor : Add details to exceptions if policy cannot be obtained
  • From: Klaus Kämpf <kkaempf@xxxxxxx>
  • Date: Sat, 26 Sep 2009 17:00:29 +0200
  • Message-id: <E1MrWt6-0002vw-Fp@xxxxxxxxxxxxxxxx>
ref: refs/heads/patch_refactor
commit 7c7e884a11825896abcb89fa697602c639df490e
Author: Klaus Kämpf <kkaempf@xxxxxxx>
Date: Sat Sep 26 17:00:29 2009 +0200

Add details to exceptions if policy cannot be obtained
---
ruby-polkit/src/polkit.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/ruby-polkit/src/polkit.c b/ruby-polkit/src/polkit.c
index ed7a53a..e8fc5ef 100644
--- a/ruby-polkit/src/polkit.c
+++ b/ruby-polkit/src/polkit.c
@@ -119,8 +119,12 @@ method_polkit_check(VALUE self, VALUE act_v, VALUE usr_v)
polkit_result = polkit_context_is_caller_authorized(context, action,
caller, FALSE, &polkit_error);

if (polkit_error_is_set(polkit_error)) {
+ uid_t uid;
+ polkit_caller_get_uid( caller, &uid );
+ struct passwd *passwd = getpwuid(uid);
+
/* polkit_error will be freed before we raise so we must copy the msg */
- exc = new_runtime_error(polkit_error_get_error_message(polkit_error));
+ exc = new_runtime_error("User %s (uid %d) is not authorized: %s",
passwd?passwd->pw_name:"<unknown>", (int)uid,
polkit_error_get_error_message(polkit_error));
goto finish;
}

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages