Commit Graph

161 Commits

Author SHA1 Message Date
Nathaniel Chen ebe5d6d0d0 hostnamed: allow more special characters in pretty hostname
this addresses the bug at:
  https://bugs.freedesktop.org/show_bug.cgi?id=59311
  https://bugzilla.redhat.com/show_bug.cgi?id=895299

hostnamectl is supposed to allow a range of special characters for
the 'pretty' hostname:
  $ hostnamectl set-hostname --pretty "Nathaniels Desktop !@#$%"
..however, it rejects apostrophes, double quotes, and backslashes.
The manual for hostnamectl suggests that this should be allowed.

It makes sense to reject \0, \n, etc. pretty_string_is_safe() is
the same as string_is_safe(), but allows more special characters.
2013-03-05 20:54:05 +01:00
Harald Hoyer a5c32cff1f honor SELinux labels, when creating and writing config files
Also split out some fileio functions to fileio.c and provide a SELinux
aware pendant in fileio-label.c

see https://bugzilla.redhat.com/show_bug.cgi?id=881577
2013-02-14 16:19:38 +01:00
Lennart Poettering 4d1a690438 env: considerably beef up environment cleaning logic
Now, actually check if the environment variable names and values used
are valid, before accepting them. With this in place are at some places
more rigid than POSIX, and less rigid at others. For example, this code
allows lower-case environment variables (which POSIX suggests not to
use), but it will not allow non-UTF8 variable values.

All in all this should be a good middle ground of what to allow and what
not to allow as environment variables.

(This also splits out all environment related calls into env-util.[ch])
2013-02-11 03:54:50 +01:00
Lennart Poettering 7871c8e932 hostnamed: make chassis type configurable via /etc/machine-info
For many usecases it is useful to store the chassis type somewhere, and
/etc/machine-info sounds like a good place. Ideally we could always
detect the chassis type from firmware, but frequently that's not
available and in many embedded devices probably entirely unrealistic.

This patch adds a configurable setting CHASSIS= to /etc/machine-info and
exposes this via hostnamectl/hostnamed. hostnamed will guess the chassis
type from DMI if nothing is set explicitly. I also added support for
detecting it from ACPI, which should be more useful as ACPI 5.0 actually
knows a "tablet" chassis type, which neither DMI nor previous ACPI
versions knew.

This also enables DMI-based and ACPI-based detection for non-x86 systems
as ACPI is apparently coming to ARM platforms soon.

I tried to minimize the vocabulary of chassis types understood and
added: desktop, laptop, server, tablet, handset. This is much less than
either APCI or DMI know. If we need more types later on we can easily
add them.
2012-12-24 19:03:59 +01:00
Lennart Poettering 0b507b17a7 dbus: add some more safety checks before accepting data from bus clients 2012-10-03 13:29:20 -04:00
Shawn Landden 0d0f0c50d3 log.h: new log_oom() -> int -ENOMEM, use it
also a number of minor fixups and bug fixes: spelling, oom errors
that didn't print errors, not properly forwarding error codes,
few more consistency issues, et cetera
2012-07-26 11:48:26 +02:00
Shawn Landden 669241a076 use "Out of memory." consistantly (or with "\n")
glibc/glib both use "out of memory" consistantly so maybe we should
consider that instead of this.

Eliminates one string out of a number of binaries. Also fixes extra newline
in udev/scsi_id
2012-07-25 11:23:57 +02:00
Lennart Poettering 5430f7f2bc relicense to LGPLv2.1 (with exceptions)
We finally got the OK from all contributors with non-trivial commits to
relicense systemd from GPL2+ to LGPL2.1+.

Some udev bits continue to be GPL2+ for now, but we are looking into
relicensing them too, to allow free copy/paste of all code within
systemd.

The bits that used to be MIT continue to be MIT.

The big benefit of the relicensing is that closed source code may now
link against libsystemd-login.so and friends.
2012-04-12 00:24:39 +02:00
Lennart Poettering 89f134406a logind: introduce CanReboot/CanPowerOff bus calls 2012-02-11 00:13:10 +01:00
Michal Schmidt d200735e13 dbus: more efficient implementation of properties
The way the various properties[] arrays are initialized is inefficient:
 - only the .data members change at runtime, yet the whole arrays of
   properties with all the fields are constructed on the stack one by
   one by the code.
 - there's duplication, eg. the properties of "org.freedesktop.systemd1.Unit"
   are repeated in several unit types.

Fix it by moving the information about properties into static const
sections. Instead of storing the .data directly in the property, store
a constant offset from a run-time base.
The small arrays of struct BusBoundProperties bind together the constant
information with the right runtime information (the base pointer).

On my system the code shrinks by 60 KB, data increases by 10 KB.
2012-01-16 13:34:42 +01:00
Kay Sievers 00c36f274b hostnamed: move sources to subdirectory 2011-12-31 07:03:33 +01:00
Renamed from src/hostnamed.c (Browse further)