【access usage】How to use access attribute in VIEW、NAMESPACE and COMMAND?

3 views
Skip to first unread message

Shawn Qiu

unread,
Oct 15, 2021, 3:00:50 AMOct 15
to klish-dev
My version of klish is 2.1.4.

I tried to test the effect of access field after reading klish.md. But there were always no difference between writing access and not. For example, even if I specify access="root" for a COMMAND tag and run klish with user not in root group, I could still run the command.

I didn't know why access doesn't take effect. So I tried to read the source code for the answer.Now I find a way to make access being valid. I modify clish/shell/shell_startup.c, see below:

    const char* clish_plugin_default_hook[] = {
        NULL,
        "clish_script@clish",
-       NULL,
+      "clish_hook_access@clish",
        "clish_hook_config@clish",
        "clish_hook_log@clish"
    };

Then execute make and make install. After these the access attribute works.

But I wonder if there is a better way to use access?
It seems like access control is disabled by default, and if it's true, why?
Wishing your reply! Thanks in advance!

serj.kalichev

unread,
Oct 15, 2021, 5:27:21 AMOct 15
to klis...@googlegroups.com

The right way is:

<HOOK name="access" builtin="my_hook_access@my_plugin"/>
<HOOK name="log" builtin="my_hook_log@clish"/>



15.10.2021 10:00, 'Shawn Qiu' via klish-dev пишет:
--
You received this message because you are subscribed to the Google Groups "klish-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to klish-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/klish-dev/f1dcabf7-27b2-4277-9e3e-db04e1f03b39n%40googlegroups.com.

Shawn Qiu

unread,
Oct 21, 2021, 11:59:41 PMOct 21
to klish-dev
That's right! And I understand why by reading source code. I admire your beautiful programs sincerely. It's comfortable to read them.
Thank you!
Reply all
Reply to author
Forward
0 new messages