Re: [systemd-devel] [PATCH] localed: validate set-x11-keymap input

2014-11-11 Thread Lennart Poettering
On Tue, 11.11.14 13:29, Jan Synacek (jsyna...@redhat.com) wrote: > >> Hmm, reading the file over and over and over again sounds less than > >> ideal. Maybe we should intrdouce a struct here and then make > >> xkb_get_keymaps() return an array of structs really? > > > > That sounds ok, I'll see wha

Re: [systemd-devel] [PATCH] localed: validate set-x11-keymap input

2014-11-11 Thread Lennart Poettering
On Tue, 11.11.14 10:03, Jan Synacek (jsyna...@redhat.com) wrote: > >> +r = xkb_validate_keymaps(model, layout, variant, options, > >> &msg); > >> +if (r < 0) { > >> +log_error("Failed to validate X11 keyboard > >> layout: %s", strerror(-r))

Re: [systemd-devel] [PATCH] localed: validate set-x11-keymap input

2014-11-11 Thread Lennart Poettering
On Tue, 11.11.14 13:34, Jan Synacek (jsyna...@redhat.com) wrote: > >> +r = strv_extend(list, l); > >> +if (r < 0) > >> +return log_oom(); > > > > I think, while we are at it, this should really be reworked to use > > GREEDY_REALLOC. See strv_

Re: [systemd-devel] [PATCH] localed: validate set-x11-keymap input

2014-11-11 Thread Jan Synacek
Lennart Poettering writes: > On Tue, 04.11.14 12:05, Jan Synacek (jsyna...@redhat.com) wrote: > > One more addition: > >> +} >> + >> +int xkb_get_keymaps(char ***list, enum keymap_state look_for, const char >> *layout_prefix) >> +{ >> +_cleanup_fclose_ FILE *f; >> +char line[LINE_

Re: [systemd-devel] [PATCH] localed: validate set-x11-keymap input

2014-11-11 Thread Jan Synacek
Jan Synacek writes: > Lennart Poettering writes: >> On Tue, 04.11.14 12:05, Jan Synacek (jsyna...@redhat.com) wrote: >>> +int xkb_validate_keymaps(const char *model, >>> + const char *layouts_arg, >>> + const char *variants_arg, >>> +

Re: [systemd-devel] [PATCH] localed: validate set-x11-keymap input

2014-11-11 Thread Jan Synacek
Lennart Poettering writes: > On Tue, 04.11.14 12:05, Jan Synacek (jsyna...@redhat.com) wrote: > >> diff --git a/src/locale/localectl.c b/src/locale/localectl.c >> index d4a2d29..8f9e4da 100644 >> --- a/src/locale/localectl.c >> +++ b/src/locale/localectl.c >> @@ -46,6 +46,7 @@ >> #include "virt.h

Re: [systemd-devel] [PATCH] localed: validate set-x11-keymap input

2014-11-10 Thread Lennart Poettering
On Tue, 04.11.14 12:05, Jan Synacek (jsyna...@redhat.com) wrote: One more addition: > +} > + > +int xkb_get_keymaps(char ***list, enum keymap_state look_for, const char > *layout_prefix) > +{ > +_cleanup_fclose_ FILE *f; > +char line[LINE_MAX]; > +enum keymap_state state

Re: [systemd-devel] [PATCH] localed: validate set-x11-keymap input

2014-11-10 Thread Lennart Poettering
On Tue, 04.11.14 12:05, Jan Synacek (jsyna...@redhat.com) wrote: > diff --git a/src/locale/localectl.c b/src/locale/localectl.c > index d4a2d29..8f9e4da 100644 > --- a/src/locale/localectl.c > +++ b/src/locale/localectl.c > @@ -46,6 +46,7 @@ > #include "virt.h" > #include "fileio.h" > #include

[systemd-devel] [PATCH] localed: validate set-x11-keymap input

2014-11-04 Thread Jan Synacek
Try to validate the input similarly to how setxkbmap does it. Multiple layouts and variants can be specified, separated by a comma. Variants can also be left out, meaning that the user doesn't want any particular variant for the respective layout. Variants are validated respectively to their layou

[systemd-devel] [PATCH] localed: validate set-x11-keymap input

2014-11-04 Thread Jan Synacek
As mentioned in [1], it would probably be better if the validation errors were just warnings, but I'm not sure if that can be achieved over dbus. [1] http://lists.freedesktop.org/archives/systemd-devel/2014-October/024129.html Jan Synacek (1): localed: validate set-x11-keymap input Makefile.a