Commit Graph

11 Commits

Author SHA1 Message Date
Lennart Poettering c01ff965b4 nss-mymachines: map userns users of containers to real user names
Given a container "foo", that maps user id $UID to container user, using
user namespaces, this NSS module extenstion will now map the $UID to a
name "vu-foo-$TUID" for the translated UID $UID.

Similar, userns groups are mapped to "vg-foo-$TGID" for translated GIDs
of $GID.

This simple change should make userns users more discoverable. Also,
given that many tools like "adduser" check NSS before allocating a UID,
should lower the chance of UID range conflicts between tools.
2015-07-09 14:46:20 -03:00
Lennart Poettering 03976f7b4a sd-bus: introduce new sd_bus_flush_close_unref() call
sd_bus_flush_close_unref() is a call that simply combines sd_bus_flush()
(which writes all unwritten messages out) + sd_bus_close() (which
terminates the connection, releasing all unread messages) +
sd_bus_unref() (which frees the connection).

The combination of this call is used pretty frequently in systemd tools
right before exiting, and should also be relevant for most external
clients, and is hence useful to cover in a call of its own.

Previously the combination of the three calls was already done in the
_cleanup_bus_close_unref_ macro, but this was only available internally.

Also see #327
2015-07-03 19:49:03 +02:00
Thomas Hindoe Paaboel Andersen 66a16e7e9f nss: remove dead code
c > 0 is already guaranteed from earlier checks.

We go from

ms = ALIGN(l+1) +
        sizeof(char*) +
        (c > 0 ? c : 1) * ALIGN(alen) +
        (c > 0 ? c+1 : 2) * sizeof(char*);

to

ms = ALIGN(l+1) +
        sizeof(char*) +
        c * ALIGN(alen) +
        (c+1) * sizeof(char*);

to

ms = ALIGN(l+1) + c * ALIGN(alen) + (c+2) * sizeof(char*);

Found by coverity. Fixes: CID#1237570 and CID#1237610
2014-09-19 00:15:39 +02:00
Lennart Poettering 3a6fb33c54 machined: fix address API signatures 2014-08-04 19:05:06 +02:00
Lennart Poettering 249968612f bus: always explicitly close bus from main programs
Since b5eca3a205 we don't attempt to GC
busses anymore when unsent messages remain that keep their reference,
when they otherwise are not referenced anymore. This means that if we
explicitly want connections to go away, we need to close them.

With this change we will no do so explicitly wherver we connect to the
bus from a main program (and thus know when the bus connection should go
away), or when we create a private bus connection, that really should go
away after our use.

This fixes connection leaks in the NSS and PAM modules.
2014-08-04 16:25:24 +02:00
Lennart Poettering e70df46b97 nss: always explicitly reset all error variables
glibc appears to be broken if we don't explicitly reset all error
variables, let's work around that.

https://bugzilla.redhat.com/show_bug.cgi?id=1125975
2014-08-01 16:06:39 +02:00
Lennart Poettering 0dd25fb9f0 change type for address family to "int"
Let's settle on a single type for all address family values, even if
UNIX is very inconsitent on the precise type otherwise. Given that
socket() is the primary entrypoint for the sockets API, and that uses
"int", and "int" is relatively simple and generic, we settle on "int"
for this.
2014-07-18 16:10:51 +02:00
Lennart Poettering 9d48598533 shared: rename PROTO_ADDRESS_SIZE() to FAMILY_ADDRESS_SIZE()
We mostly use "family" to refer to AF_INET, AF_INET6, etc, let's use
this terminology here, too
2014-07-18 12:38:32 +02:00
Lennart Poettering 634af5665f sd-login: always use "indices" as plural of "index"
So far both "indexes" and "indices" was used. Let's clean this up, and
stick to indices, since it appears to be used more frequently.
2014-07-17 01:48:40 +02:00
Lennart Poettering 555bd6e95b nss: various minor fixes to nss-myhostname + nss-mymachines 2014-07-16 03:30:40 +02:00
Lennart Poettering cabb0bc6b1 nss-mymachines: add new NSS module for automatically resolving addresses of all local containers 2014-07-11 03:15:21 +02:00