[PATCH] polkitd: add logging for successfully loaded rules

Trapp, Michael michael.trapp at sap.com
Thu Jul 20 13:22:29 UTC 2023


Hi Jan,

that’s interesting, I can see the log messages during polkitd startup but not during runtime.
I’ve double checked with a request which triggers polkit authorization and I can’t see the logs during runtime.

If you prefer to have the logging bound to the ‘—no-debug’ switch, I’m fine with that.
But I haven’t checked the code for the required changes.

Kind regards
Michael



On 20.07.23, 13:09, "Jan Rybar" <jrybar at redhat.com> wrote:

Hello Michael,

Thanks for the patch! I'm not sure it's really safe to write out about every loaded script though, because that will flood the journal with tens of messages on every polkit event. The parsers log every error during loading the files and I believe there are not that many .rules files to have trouble listing their directories. Right?
I'm sure we can think up an ideal (or at least sufficient) solution. What I'm thinking about is passing the --no-debug switch to duktapeauthority.c and listing the loaded rules only in debug mode. Would that be ok?

Cheers,
Jan

On Thu, Jul 20, 2023 at 10:44 AM Michael Trapp <michael.trapp at sap.com<mailto:michael.trapp at sap.com>> wrote:
Log each successfully loaded rule file. At the moment there is only
a summary message wich does not include any further information
about the loaded files.
---
 src/polkitbackend/polkitbackendjsauthority.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp
index 004748a..9373bf5 100644
--- a/src/polkitbackend/polkitbackendjsauthority.cpp
+++ b/src/polkitbackend/polkitbackendjsauthority.cpp
@@ -240,6 +240,9 @@ load_scripts (PolkitBackendJsAuthority  *authority)
         }

       //g_print ("Successfully loaded and evaluated script `%s'\n", filename);
+      polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
+                                    "Successfully loaded and evaluated script %s",
+                                    filename);

       num_scripts++;
     }
--
2.39.2 (Apple Git-143)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/polkit-devel/attachments/20230720/725a8c9d/attachment.htm>


More information about the polkit-devel mailing list