mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox+mailing@cookiesoft.de,
	"barebox@lists.infradead.org" <barebox@lists.infradead.org>
Subject: Re: Using barebox-state as library
Date: Wed, 10 Feb 2021 09:53:34 +0100	[thread overview]
Message-ID: <4a80a490-3c75-4588-272d-45ee15f32ab0@pengutronix.de> (raw)
In-Reply-To: <198822053.215492.1612946220837@office.mailbox.org>

Hello Marcel,

On 10.02.21 09:37, barebox+mailing@cookiesoft.de wrote:
> Hey everyone, 
> 
> I would like to set and read barebox-states during runtime. Unfortunately only a binary is available to be used. 
> But because the variable names and values are from an untrusted environment, I don't like them to be passed to a shell directly. 

I can't follow here. Why can't you run barebox-state with the required arguments? That's what e.g.
RAUC is doing. It can listen on DBus for e.g. a mark-good and then calls barebox-state with the correct
arguments. You can use standard Linux access control mechanisms, so only your daemon's group may use
barebox-state.

> Therefore I would like to use a barebox-state library, which offers some functions, e.g. read_var, set_var, ...

dt-utils and barebox-sate is GPL2-licensed, so if that's acceptable for your daemon, you could
take dt-utils:src/barebox-state.c and replace the argument parsing with whatever. I am not
aware whether someone did that before though.

> An other approach would be some kind of IPC, e.g. dbus or similar, but I'm not sure if that would fit into the simplicity of the current binary. 
> 
> Do you see any other possibilities so fetch and set variables from the barebox-state? 
> Greetings, 
> Marcel

Cheers,
Ahmad

> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2021-02-10  8:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10  8:37 barebox+mailing
2021-02-10  8:53 ` Ahmad Fatoum [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4a80a490-3c75-4588-272d-45ee15f32ab0@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox+mailing@cookiesoft.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox