1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-04 22:21:55 +03:00
Commit Graph

17561 Commits

Author SHA1 Message Date
David Sommerseth
64845bdc82 ask-password: Add --echo to enable echoing the user input
Programs such as OpenVPN may use ask-password for not only retrieving
passwords, but also usernames.  Masking usernames with * seems just silly.

 v2 - Don't mess with termios flags, instead print the input
      instead of an asterix.  Resolves issues with backspace
      and TAB input.

 v3 - Renamed 'do_echo' variables and argument to 'echo'.  Also
      modified the ask_password_{tty,agent,auto} API instead of
      additional wrapper functions.

[zj: undo changes to ask_password_auto, since no callers were using
     the new argument.]
2014-10-05 15:29:41 -04:00
Zbigniew Jędrzejewski-Szmek
75a0da952f bus: add assert to check that we're not freeing a static structure
CID #996315.
2014-10-05 15:29:41 -04:00
David Herrmann
62d5068d63 terminal/idev: don't remove consumed-mods from kbd-matches
XKB consumed mods include modifiers that *didn't* affect the translation,
but might affect it if used. This is very misleading, given that we are
usually not interested in that information. Therefore, keep them in real
mods to behave like X11 does. Maybe at some point, XKB introduces proper
shortcut matching...

Also make evcat display consumed modifiers so we can better debug those
situations.
2014-10-05 18:02:28 +02:00
David Herrmann
34dbefceb1 terminal/screen: perform bold->light conversion only on foreground
Bold glyphs always use light colors. However, this color conversion is
limited to the foreground color, so skip it for backgrounds.
2014-10-05 15:49:26 +02:00
David Herrmann
378c4eed02 terminal/subterm: leave bold-light conversion to parent
We rely on the parent terminal to do color conversion, so also leave
bold->light conversion to the parent. Otherwise, it will be performed
twice and we might apply it on the wrong color.
2014-10-05 15:48:32 +02:00
Tom Gundersen
c7afe4f3d7 terminal/screen: add support for alternate screen buffers
Hook up SM/RM 47/1047-1049 and enable alternate screen buffers for term
applications.

(David: rebased on top of -git, renamed helpers and added docs)
2014-10-05 15:26:54 +02:00
David Herrmann
3ae49a8fdb terminal/screen: save state in separate object
Terminal state can be saved/restored by applications. To simplify our
internal handling, put all affected state into a separate object.
Especially with alternate screen buffers, this will simplify our code
significantly.
2014-10-05 14:57:19 +02:00
David Herrmann
9ed6e68e52 terminal/subterm: skip setting parent's cursor
We draw our own cursor in subterm now, so there's no reason to update the
cursor-position of the parent terminal on each frame. The parent's cursor
is hidden, anyway.
2014-10-05 14:47:57 +02:00
David Herrmann
621dbb0569 terminal: fix TERM_FLAG_* comment
7BIT mode is enabled by default. Fix the comment to state this correctly.
2014-10-05 14:45:33 +02:00
Tom Gundersen
b7af2c8740 terminal: fix restoring of screen flags 2014-10-05 14:17:14 +02:00
Thomas Hindoe Paaboel Andersen
bdf7026e95 test: only use assert_se
The asserts used in the tests should never be allowed to be
optimized away
2014-10-04 23:55:35 +02:00
Tom Gundersen
2355af60dc consoled: add a unit file
The unit file is statically enabled, but still requires --enable-terminal
to actually get installed.
2014-10-04 13:19:18 +02:00
Tom Gundersen
10595afb4c consoled: move from /bin to /lib/systemd
This should not normally be run manually, but rather through systemd.
2014-10-04 13:18:47 +02:00
Tom Gundersen
c71202228f systemd-bus-proxyd: distribute the .in file also for the user version 2014-10-04 13:15:59 +02:00
Zbigniew Jędrzejewski-Szmek
f45d32872c build-sys: fix make distcheck 2014-10-03 22:08:32 -04:00
Zbigniew Jędrzejewski-Szmek
e060073a8f man: say that SecureBits= are space separated 2014-10-03 21:06:52 -04:00
Zbigniew Jędrzejewski-Szmek
cef3566998 sd-id128: do stricter checking of random boot id
If we are bothering to check whether the kernel is not feeding us
bad data, we might as well do it properly.

CID #1237692.
2014-10-03 20:57:30 -04:00
Tobias Hunger
f88dc3edeb fstab-generator: Small cleanup 2014-10-03 20:42:09 -04:00
Zbigniew Jędrzejewski-Szmek
125dd07483 sd-bus: split out cleanup into separate function
m is always non-null at this point. This function is too long anyway.
2014-10-03 20:42:09 -04:00
Zbigniew Jędrzejewski-Szmek
d267c5aa3d core/namespace: remove invalid check
dir cannot be NULL here, because it was allocated with alloca.

CID #1237768.
2014-10-03 20:42:09 -04:00
Zbigniew Jędrzejewski-Szmek
1775f1ebc4 core/namespace: remove invalid check
root cannot be NULL here, because it was allocated with alloca.

CID #1237769.
2014-10-03 20:42:09 -04:00
Zbigniew Jędrzejewski-Szmek
7057bd9931 sd-event: check the value of received signal
Appease coverity report #1237775.

Also rename ss to n, to make it visually different from ss.
2014-10-03 20:42:09 -04:00
Zbigniew Jędrzejewski-Szmek
610158048a man: use more markup in daemon(7) 2014-10-03 20:42:09 -04:00
David Herrmann
ce7b9f50c3 console: add user console daemon
This adds a first draft of systemd-consoled. This is still missing a lot
of features and does some rather primitive rendering. However, it shows
the direction this code is going and serves as basis for further testing.

The systemd-consoled binary should be run as `systemd --user' unit. It
automatically picks up any session marked as Desktop=SYSTEMD-CONSOLE.
Therefore, you can use any login-manager you want (ranging from /bin/login
to gdm) to create sessions for systemd-consoled. However, the sessions
managers must be prepared to set the Desktop= variable properly.

The user-session is called `systemd-console', only the daemon providing
the terminal environment is called `systemd-consoled' (mind the 'd').

So far, only a single terminal session is provided on each opened
user-session. However, we support multiple user-sessions (even across
multiple seats) just fine. In the future, the workspace logic will get
extended so you can have multiple terminal sessions in a single
user-session for easier access.

Note that this is still experimental! Instructions on how to run it will
follow shortly.
2014-10-03 16:07:14 +02:00
David Herrmann
48fed5c55b pty: optimize read loop
As it turns out, I can actually send data to the pty faster than the
terminal can read. Therefore, make sure we read as much data as possible
but bail out early enough to not cause starvation.

Kernel TTY buffers are 4k, so reduce the overall buffer size, but read
more than once if possible (up to 8 times sounds reasonable).
2014-10-03 15:57:00 +02:00
David Herrmann
ce04e2335a terminal/screen: adjust screen age only on update
Instead of increasing the screen-age on redraw, we now increase it only on
real updates. This is effectively the same, but avoids increased age
counters on backbuffer rendering. Therefore, we can now check age counters
against fronbuffers safely, while rendering frames in background.
2014-10-03 15:57:00 +02:00
David Herrmann
56dec05d29 terminal/screen: add color converter
Terminals use pseudo color-codes mixed with 8bit and 24bit colors. Provide
a color-converter so external renderers only have to deal with ARGB32
colors.

This requires a color-palette as input as there's no fixed mapping. We
provide a default, but maybe we wanna support external palettes in the
future.
2014-10-03 15:57:00 +02:00
David Herrmann
cad8fe9a2b terminal/screen: add cursor rendering
This is the most simple way to render cursors: flip attr->inverse of the
cursor cell. This causes the background and foreground colors of the
cursor-cell to be inversed.

Now that we render cursors ourselves, make subterm not call into the
parent terminal to render cursors.
2014-10-03 15:57:00 +02:00
David Herrmann
2ea8d19b21 terminal/screen: mark cursor dirty on enabled/disable
If we hide or show the cursor, we change visual attributes and have to
mark the underlying cell as dirty. Otherwise, the terminal will not be
redrawn.
2014-10-03 15:57:00 +02:00
David Herrmann
884964a963 terminal/idev: add helper to match keyboard shortcuts
Matching keyboard shortcuts on internationalized keyboards is actually
non-trivial. Matching the actual key is easy, but the modifiers can be
used by both, the matching and the translation step. Therefore, XKB
exports "consumed-modifiers" that we use to figure out whether a modifier
was already used by the translation step.

The new IDEV_KBDMATCH() helper can be used to match on any keyboard
shortcut and it will do the right thing.
2014-10-03 15:57:00 +02:00
David Herrmann
f8958c3495 terminal/screen: add keyboard mapping
Implement the feed_keyboard() handling by mapping XKB keys according to
DEC-VT behavior.

Public information on terminal key-mappings is pretty scarce. We only
implement the most basic mapping for now. Further improvements welcome!
2014-10-03 15:57:00 +02:00
David Herrmann
fe741a85c1 terminal/idev: don't map XKB_KEY_NoSymbol as ASCII 0
XKB_KEY_NoSymbol is defined as 0 but does not correspond to a VT key with
ASCII value 0. No such key exists, so don't try to find such a key.
2014-10-03 15:57:00 +02:00
David Herrmann
61d0326a5b terminal/unifont: add built-in fallback glyph
In case we cannot render a glyph, we want a fallback we can display
instead. If we rely on the font itself to provide the fallback character,
we have nothing to display if that character is not available. Therefore,
add a static fallback that we can use at any time.
2014-10-03 15:57:00 +02:00
David Herrmann
cb51a41fa6 terminal/subterm: use screen renderer
Don't hard-code the screen renderer but use the newly introduced
term_screen_draw() helper.
2014-10-03 15:57:00 +02:00
David Herrmann
be50221384 terminal: add screen renderer
We don't want to expose the term_screen internals for rendering.
Therefore, provide an iterator that allows external renderers to draw
terminals.
2014-10-03 15:57:00 +02:00
David Herrmann
1bfa594cf2 terminal/drm: clear 'applied' flag when changing state
If a pipe is enabled/disabled, we have to clear crtc->applied of the
linked CRTC. Otherwise, we will not run a deep modeset, but leave the crtc
in the pre-configured state.
2014-10-03 15:57:00 +02:00
David Herrmann
66695cc343 terminal/grdev: allow arbitrary fb-age contexts
Instead of limiting fb-aging to 64bit integers, allow any arbitrary
context together with a release function to free it once the FB is
destroyed.
2014-10-03 15:57:00 +02:00
David Herrmann
51cff8bded terminal/grdev: provide front and back buffer to renderers
We really want more sophisticated aging than just 64bit integers. So
always provide front *and* back buffers to renderers so they can compare
arbitrary aging information and decide whether to re-render.
2014-10-03 15:57:00 +02:00
David Herrmann
aec3f44651 terminal/drm: provide pipe->target() callback
Instead of looking for available back-buffers on each operation, set it to
NULL and wait for the next frame request. It will call back into the pipe
to request the back-buffer via ->target(), where we can do the same and
look for an available backbuffer.

This simplifies the code and avoids double lookups if we run short of
buffers.
2014-10-03 15:57:00 +02:00
David Herrmann
6a15ce2b3e terminal/grdev: simplify DRM event parsing
Coverity complained about this code and is partially right. We are not
really protected against integer overflows. Sure, unlikely, but lets just
avoid any overflows and properly protect our parser loop.
2014-10-03 15:57:00 +02:00
David Herrmann
f1f5b2a3bd terminal: make utf8 decoder return length
Lets return the parsed length in term_utf8_decode() instead of a buffer
pointer. Store the pointer in the passed argument.

This makes it adhere to the systemd coding-style, were we always avoid
returning pointers, but store them in output arguments. In this case, the
storage is not allocated, so it doesn't fit 100% to this idiom, but still
looks much nicer.
2014-10-03 15:57:00 +02:00
David Herrmann
db1a606610 terminal: fix back-buffer selection on DRM page-flip
We currently select front-buffers as new back-buffer if they happen to be
the last buffer in our framebuffer-array. Fix this by never selecting a
new front buffer as back buffer.
2014-10-03 15:57:00 +02:00
Zbigniew Jędrzejewski-Szmek
754fc0c720 fileio-label: return error when writing fails
The status of actually writing the file was totally ignored.
2014-10-03 08:58:40 -04:00
Jan Synacek
a62e83b48c journalctl: make --utc work everywhere
The --utc option was introduced by commit
9fd290443f.
Howerver, the implementation was incomplete.
2014-10-03 08:38:01 -04:00
Thomas Hindoe Paaboel Andersen
1c92ff85b7 bootchart: use 'n/a' if PRETTY_NAME is not found
Spotted with coverity. If parsing both /etc/os-release and
/usr/lib/os-release fails then null would be passed on. The calls
to parse the two files are allowed to fail. A empty /etc may not
have had the /etc/os-release symlink restored yet and we just
try again in the loop. If for whatever reason that does not happen
then we now pass on 'n/a' instead of null.
2014-10-03 08:31:53 -04:00
Tom Gundersen
7889087d6e man: fix sd_event_set_name compilation 2014-10-03 08:43:53 +02:00
Tom Gundersen
c3b128736d glib-event-glue: remove some unnecessary lines
Not needed in an example. Should still shorten the license, but should make sure it is still complete so people can copy-paste without problems.
2014-10-03 08:43:34 +02:00
Thomas Hindoe Paaboel Andersen
2ad8887a12 test-barrier: add checks after the barrier constructor
Coverity seems to think that we can later end up with the "them"
fd having a negative value. Even after a succesful barrier_create.
Add some test to verify that the constructor went well. If coverity
still complains then it must mean that it thinks the the value is
overwritten later.
2014-10-03 04:04:42 +02:00
Zbigniew Jędrzejewski-Szmek
043f62949e man: add sd_event_set_name(3) 2014-10-02 21:14:26 -04:00
Zbigniew Jędrzejewski-Szmek
ba4b35669e man: add sd_event_get_fd(3)
Example from Tom Gundersen is included using xi:include.
The copyright notice stands out a bit. Maybe it should be removed,
and the code placed in public domain.
2014-10-02 20:49:55 -04:00