[systemd-commits] 3 commits - Makefile.am src/login src/pam-module.c src/test-engine.c test/Makefile test/a.service test/b.service test/c.service test/d.service test/e.service test/f.service test/g.service test/h.service test1/default.target test1/exec-demo.service test1/fifo-demo.service test1/fifo-demo.socket test1/mail-transfer-agent.service test1/mail-transfer-agent.socket test1/multiuser.target test1/multiuser.target.wants test1/permissions.service test1/postfix.service test1/postfix.socket test1/syslog.service test1/syslog.socket test1/systemd-logger.service test1/systemd-logger.socket test2/Makefile test2/a.service test2/b.service test2/c.service test2/d.service test2/e.service test2/f.service test2/g.service test2/h.service
Lennart Poettering
lennart at kemper.freedesktop.org
Sat Dec 31 09:07:20 PST 2011
Makefile.am | 8
src/login/pam-module.c | 618 ++++++++++++++++
src/pam-module.c | 618 ----------------
src/test-engine.c | 2
test/Makefile | 7
test/a.service | 7
test/b.service | 6
test/c.service | 6
test/d.service | 8
test/e.service | 8
test/f.service | 5
test/g.service | 6
test/h.service | 6
test1/default.target | 1
test1/exec-demo.service | 9
test1/fifo-demo.service | 8
test1/fifo-demo.socket | 6
test1/mail-transfer-agent.service | 1
test1/mail-transfer-agent.socket | 1
test1/multiuser.target | 2
test1/multiuser.target.wants/exec-demo.service | 1
test1/multiuser.target.wants/fifo-demo.socket | 1
test1/multiuser.target.wants/mail-transfer-agent.socket | 1
test1/multiuser.target.wants/permissions.service | 1
test1/multiuser.target.wants/systemd-logger.socket | 1
test1/permissions.service | 11
test1/postfix.service | 7
test1/postfix.socket | 13
test1/syslog.service | 5
test1/syslog.socket | 8
test1/systemd-logger.service | 13
test1/systemd-logger.socket | 5
test2/Makefile | 7
test2/a.service | 7
test2/b.service | 6
test2/c.service | 6
test2/d.service | 8
test2/e.service | 8
test2/f.service | 5
test2/g.service | 6
test2/h.service | 6
41 files changed, 682 insertions(+), 777 deletions(-)
New commits:
commit c47ac9992f3274597802cde47922bb9809185eaf
Author: Lennart Poettering <lennart at poettering.net>
Date: Sat Dec 31 18:06:44 2011 +0100
build-sys: fix mageia kbd mappings
diff --git a/Makefile.am b/Makefile.am
index 99ccca4..515e1ff 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -134,16 +134,16 @@ AM_CPPFLAGS += \
-DKBD_SETFONT=\"/usr/bin/setfont\" \
-DDEFAULT_FONT=\"LatArCyrHeb-16\"
else
+if TARGET_MAGEIA
AM_CPPFLAGS += \
-DKBD_LOADKEYS=\"/bin/loadkeys\" \
-DKBD_SETFONT=\"/bin/setfont\" \
- -DDEFAULT_FONT=\"latarcyrheb-sun16\"
+ -DDEFAULT_FONT=\"LatArCyrHeb-16\"
else
-if TARGET_MAGEIA
AM_CPPFLAGS += \
-DKBD_LOADKEYS=\"/bin/loadkeys\" \
-DKBD_SETFONT=\"/bin/setfont\" \
- -DDEFAULT_FONT=\"LatArCyrHeb-16\"
+ -DDEFAULT_FONT=\"latarcyrheb-sun16\"
endif
endif
endif
commit be5f4385d61d512f0c3c75b70df9f77eac2b8331
Author: Lennart Poettering <lennart at poettering.net>
Date: Sat Dec 31 18:06:21 2011 +0100
login: move the PAM module to src/login/ since it is just a client to logind
diff --git a/Makefile.am b/Makefile.am
index 694335f..99ccca4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1732,7 +1732,7 @@ libsystemd_login_la_LIBADD = \
if HAVE_PAM
pam_systemd_la_SOURCES = \
- src/pam-module.c \
+ src/login/pam-module.c \
src/dbus-common.c
pam_systemd_la_CFLAGS = \
diff --git a/src/login/pam-module.c b/src/login/pam-module.c
new file mode 100644
index 0000000..14e706b
--- /dev/null
+++ b/src/login/pam-module.c
@@ -0,0 +1,618 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+ This file is part of systemd.
+
+ Copyright 2010 Lennart Poettering
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/file.h>
+#include <pwd.h>
+#include <endian.h>
+#include <sys/capability.h>
+
+#include <security/pam_modules.h>
+#include <security/_pam_macros.h>
+#include <security/pam_modutil.h>
+#include <security/pam_ext.h>
+#include <security/pam_misc.h>
+
+#include "util.h"
+#include "macro.h"
+#include "sd-daemon.h"
+#include "strv.h"
+#include "dbus-common.h"
+#include "def.h"
+#include "socket-util.h"
+
+static int parse_argv(pam_handle_t *handle,
+ int argc, const char **argv,
+ char ***controllers,
+ char ***reset_controllers,
+ bool *kill_processes,
+ char ***kill_only_users,
+ char ***kill_exclude_users,
+ bool *debug) {
+
+ unsigned i;
+
+ assert(argc >= 0);
+ assert(argc == 0 || argv);
+
+ for (i = 0; i < (unsigned) argc; i++) {
+ int k;
+
+ if (startswith(argv[i], "kill-session-processes=")) {
+ if ((k = parse_boolean(argv[i] + 23)) < 0) {
+ pam_syslog(handle, LOG_ERR, "Failed to parse kill-session-processes= argument.");
+ return k;
+ }
+
+ if (kill_processes)
+ *kill_processes = k;
+
+ } else if (startswith(argv[i], "kill-session=")) {
+ /* As compatibility for old versions */
+
+ if ((k = parse_boolean(argv[i] + 13)) < 0) {
+ pam_syslog(handle, LOG_ERR, "Failed to parse kill-session= argument.");
+ return k;
+ }
+
+ if (kill_processes)
+ *kill_processes = k;
+
+ } else if (startswith(argv[i], "controllers=")) {
+
+ if (controllers) {
+ char **l;
+
+ if (!(l = strv_split(argv[i] + 12, ","))) {
+ pam_syslog(handle, LOG_ERR, "Out of memory.");
+ return -ENOMEM;
+ }
+
+ strv_free(*controllers);
+ *controllers = l;
+ }
+
+ } else if (startswith(argv[i], "reset-controllers=")) {
+
+ if (reset_controllers) {
+ char **l;
+
+ if (!(l = strv_split(argv[i] + 18, ","))) {
+ pam_syslog(handle, LOG_ERR, "Out of memory.");
+ return -ENOMEM;
+ }
+
+ strv_free(*reset_controllers);
+ *reset_controllers = l;
+ }
+
+ } else if (startswith(argv[i], "kill-only-users=")) {
+
+ if (kill_only_users) {
+ char **l;
+
+ if (!(l = strv_split(argv[i] + 16, ","))) {
+ pam_syslog(handle, LOG_ERR, "Out of memory.");
+ return -ENOMEM;
+ }
+
+ strv_free(*kill_only_users);
+ *kill_only_users = l;
+ }
+
+ } else if (startswith(argv[i], "kill-exclude-users=")) {
+
+ if (kill_exclude_users) {
+ char **l;
+
+ if (!(l = strv_split(argv[i] + 19, ","))) {
+ pam_syslog(handle, LOG_ERR, "Out of memory.");
+ return -ENOMEM;
+ }
+
+ strv_free(*kill_exclude_users);
+ *kill_exclude_users = l;
+ }
+
+ } else if (startswith(argv[i], "debug=")) {
+ if ((k = parse_boolean(argv[i] + 6)) < 0) {
+ pam_syslog(handle, LOG_ERR, "Failed to parse debug= argument.");
+ return k;
+ }
+
+ if (debug)
+ *debug = k;
+
+ } else if (startswith(argv[i], "create-session=") ||
+ startswith(argv[i], "kill-user=")) {
+
+ pam_syslog(handle, LOG_WARNING, "Option %s not supported anymore, ignoring.", argv[i]);
+
+ } else {
+ pam_syslog(handle, LOG_ERR, "Unknown parameter '%s'.", argv[i]);
+ return -EINVAL;
+ }
+ }
+
+ return 0;
+}
+
+static int get_user_data(
+ pam_handle_t *handle,
+ const char **ret_username,
+ struct passwd **ret_pw) {
+
+ const char *username = NULL;
+ struct passwd *pw = NULL;
+ uid_t uid;
+ int r;
+
+ assert(handle);
+ assert(ret_username);
+ assert(ret_pw);
+
+ r = audit_loginuid_from_pid(0, &uid);
+ if (r >= 0)
+ pw = pam_modutil_getpwuid(handle, uid);
+ else {
+ r = pam_get_user(handle, &username, NULL);
+ if (r != PAM_SUCCESS) {
+ pam_syslog(handle, LOG_ERR, "Failed to get user name.");
+ return r;
+ }
+
+ if (isempty(username)) {
+ pam_syslog(handle, LOG_ERR, "User name not valid.");
+ return PAM_AUTH_ERR;
+ }
+
+ pw = pam_modutil_getpwnam(handle, username);
+ }
+
+ if (!pw) {
+ pam_syslog(handle, LOG_ERR, "Failed to get user data.");
+ return PAM_USER_UNKNOWN;
+ }
+
+ *ret_pw = pw;
+ *ret_username = username ? username : pw->pw_name;
+
+ return PAM_SUCCESS;
+}
+
+static bool check_user_lists(
+ pam_handle_t *handle,
+ uid_t uid,
+ char **kill_only_users,
+ char **kill_exclude_users) {
+
+ const char *name = NULL;
+ char **l;
+
+ assert(handle);
+
+ if (uid == 0)
+ name = "root"; /* Avoid obvious NSS requests, to suppress network traffic */
+ else {
+ struct passwd *pw;
+
+ pw = pam_modutil_getpwuid(handle, uid);
+ if (pw)
+ name = pw->pw_name;
+ }
+
+ STRV_FOREACH(l, kill_exclude_users) {
+ uid_t u;
+
+ if (parse_uid(*l, &u) >= 0)
+ if (u == uid)
+ return false;
+
+ if (name && streq(name, *l))
+ return false;
+ }
+
+ if (strv_isempty(kill_only_users))
+ return true;
+
+ STRV_FOREACH(l, kill_only_users) {
+ uid_t u;
+
+ if (parse_uid(*l, &u) >= 0)
+ if (u == uid)
+ return true;
+
+ if (name && streq(name, *l))
+ return true;
+ }
+
+ return false;
+}
+
+static int get_seat_from_display(const char *display, const char **seat, uint32_t *vtnr) {
+ char *p = NULL;
+ int r;
+ int fd;
+ union sockaddr_union sa;
+ struct ucred ucred;
+ socklen_t l;
+ char *tty;
+ int v;
+
+ assert(display);
+ assert(seat);
+ assert(vtnr);
+
+ /* We deduce the X11 socket from the display name, then use
+ * SO_PEERCRED to determine the X11 server process, ask for
+ * the controlling tty of that and if it's a VC then we know
+ * the seat and the virtual terminal. Sounds ugly, is only
+ * semi-ugly. */
+
+ r = socket_from_display(display, &p);
+ if (r < 0)
+ return r;
+
+ fd = socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0);
+ if (fd < 0) {
+ free(p);
+ return -errno;
+ }
+
+ zero(sa);
+ sa.un.sun_family = AF_UNIX;
+ strncpy(sa.un.sun_path, p, sizeof(sa.un.sun_path)-1);
+ free(p);
+
+ if (connect(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path)) < 0) {
+ close_nointr_nofail(fd);
+ return -errno;
+ }
+
+ l = sizeof(ucred);
+ r = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &l);
+ close_nointr_nofail(fd);
+
+ if (r < 0)
+ return -errno;
+
+ r = get_ctty(ucred.pid, NULL, &tty);
+ if (r < 0)
+ return r;
+
+ v = vtnr_from_tty(tty);
+ free(tty);
+
+ if (v < 0)
+ return v;
+ else if (v == 0)
+ return -ENOENT;
+
+ *seat = "seat0";
+ *vtnr = (uint32_t) v;
+
+ return 0;
+}
+
+_public_ PAM_EXTERN int pam_sm_open_session(
+ pam_handle_t *handle,
+ int flags,
+ int argc, const char **argv) {
+
+ struct passwd *pw;
+ bool kill_processes = false, debug = false;
+ const char *username, *id, *object_path, *runtime_path, *service = NULL, *tty = NULL, *display = NULL, *remote_user = NULL, *remote_host = NULL, *seat = NULL, *type, *cvtnr = NULL;
+ char **controllers = NULL, **reset_controllers = NULL, **kill_only_users = NULL, **kill_exclude_users = NULL;
+ DBusError error;
+ uint32_t uid, pid;
+ DBusMessageIter iter;
+ dbus_bool_t kp;
+ int session_fd = -1;
+ DBusConnection *bus = NULL;
+ DBusMessage *m = NULL, *reply = NULL;
+ dbus_bool_t remote;
+ int r;
+ uint32_t vtnr = 0;
+
+ assert(handle);
+
+ dbus_error_init(&error);
+
+ /* pam_syslog(handle, LOG_INFO, "pam-systemd initializing"); */
+
+ /* Make this a NOP on non-systemd systems */
+ if (sd_booted() <= 0)
+ return PAM_SUCCESS;
+
+ if (parse_argv(handle,
+ argc, argv,
+ &controllers, &reset_controllers,
+ &kill_processes, &kill_only_users, &kill_exclude_users,
+ &debug) < 0) {
+ r = PAM_SESSION_ERR;
+ goto finish;
+ }
+
+ r = get_user_data(handle, &username, &pw);
+ if (r != PAM_SUCCESS)
+ goto finish;
+
+ /* Make sure we don't enter a loop by talking to
+ * systemd-logind when it is actually waiting for the
+ * background to finish start-up. If the service is
+ * "systemd-shared" we simply set XDG_RUNTIME_DIR and
+ * leave. */
+
+ pam_get_item(handle, PAM_SERVICE, (const void**) &service);
+ if (streq_ptr(service, "systemd-shared")) {
+ char *p, *rt = NULL;
+
+ if (asprintf(&p, "/run/systemd/users/%lu", (unsigned long) pw->pw_uid) < 0) {
+ r = PAM_BUF_ERR;
+ goto finish;
+ }
+
+ r = parse_env_file(p, NEWLINE,
+ "RUNTIME", &rt,
+ NULL);
+ free(p);
+
+ if (r < 0 && r != -ENOENT) {
+ r = PAM_SESSION_ERR;
+ free(rt);
+ goto finish;
+ }
+
+ if (rt) {
+ r = pam_misc_setenv(handle, "XDG_RUNTIME_DIR", rt, 0);
+ free(rt);
+
+ if (r != PAM_SUCCESS) {
+ pam_syslog(handle, LOG_ERR, "Failed to set runtime dir.");
+ goto finish;
+ }
+ }
+
+ r = PAM_SUCCESS;
+ goto finish;
+ }
+
+ if (kill_processes)
+ kill_processes = check_user_lists(handle, pw->pw_uid, kill_only_users, kill_exclude_users);
+
+ dbus_connection_set_change_sigpipe(FALSE);
+
+ bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error);
+ if (!bus) {
+ pam_syslog(handle, LOG_ERR, "Failed to connect to system bus: %s", bus_error_message(&error));
+ r = PAM_SESSION_ERR;
+ goto finish;
+ }
+
+ m = dbus_message_new_method_call(
+ "org.freedesktop.login1",
+ "/org/freedesktop/login1",
+ "org.freedesktop.login1.Manager",
+ "CreateSession");
+
+ if (!m) {
+ pam_syslog(handle, LOG_ERR, "Could not allocate create session message.");
+ r = PAM_BUF_ERR;
+ goto finish;
+ }
+
+ uid = pw->pw_uid;
+ pid = getpid();
+
+ pam_get_item(handle, PAM_XDISPLAY, (const void**) &display);
+ pam_get_item(handle, PAM_TTY, (const void**) &tty);
+ pam_get_item(handle, PAM_RUSER, (const void**) &remote_user);
+ pam_get_item(handle, PAM_RHOST, (const void**) &remote_host);
+ seat = pam_getenv(handle, "XDG_SEAT");
+ cvtnr = pam_getenv(handle, "XDG_VTNR");
+
+ service = strempty(service);
+ tty = strempty(tty);
+ display = strempty(display);
+ remote_user = strempty(remote_user);
+ remote_host = strempty(remote_host);
+ seat = strempty(seat);
+
+ if (strchr(tty, ':')) {
+ /* A tty with a colon is usually an X11 display, place
+ * there to show up in utmp. We rearrange things and
+ * don't pretend that an X display was a tty */
+
+ if (isempty(display))
+ display = tty;
+ tty = "";
+ } else if (streq(tty, "cron")) {
+ /* cron has been setting PAM_TTY to "cron" for a very long time
+ * and it cannot stop doing that for compatibility reasons. */
+ tty = "";
+ }
+
+ if (!isempty(cvtnr))
+ safe_atou32(cvtnr, &vtnr);
+
+ if (!isempty(display) && isempty(seat) && vtnr <= 0)
+ get_seat_from_display(display, &seat, &vtnr);
+
+ type = !isempty(display) ? "x11" :
+ !isempty(tty) ? "tty" : "unspecified";
+
+ remote = !isempty(remote_host) && !streq(remote_host, "localhost") && !streq(remote_host, "localhost.localdomain");
+
+ if (!dbus_message_append_args(m,
+ DBUS_TYPE_UINT32, &uid,
+ DBUS_TYPE_UINT32, &pid,
+ DBUS_TYPE_STRING, &service,
+ DBUS_TYPE_STRING, &type,
+ DBUS_TYPE_STRING, &seat,
+ DBUS_TYPE_UINT32, &vtnr,
+ DBUS_TYPE_STRING, &tty,
+ DBUS_TYPE_STRING, &display,
+ DBUS_TYPE_BOOLEAN, &remote,
+ DBUS_TYPE_STRING, &remote_user,
+ DBUS_TYPE_STRING, &remote_host,
+ DBUS_TYPE_INVALID)) {
+ pam_syslog(handle, LOG_ERR, "Could not attach parameters to message.");
+ r = PAM_BUF_ERR;
+ goto finish;
+ }
+
+ dbus_message_iter_init_append(m, &iter);
+
+ r = bus_append_strv_iter(&iter, controllers);
+ if (r < 0) {
+ pam_syslog(handle, LOG_ERR, "Could not attach parameter to message.");
+ r = PAM_BUF_ERR;
+ goto finish;
+ }
+
+ r = bus_append_strv_iter(&iter, reset_controllers);
+ if (r < 0) {
+ pam_syslog(handle, LOG_ERR, "Could not attach parameter to message.");
+ r = PAM_BUF_ERR;
+ goto finish;
+ }
+
+ kp = kill_processes;
+ if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &kp)) {
+ pam_syslog(handle, LOG_ERR, "Could not attach parameter to message.");
+ r = PAM_BUF_ERR;
+ goto finish;
+ }
+
+ if (debug)
+ pam_syslog(handle, LOG_DEBUG, "Asking logind to create session: "
+ "uid=%u pid=%u service=%s type=%s seat=%s vtnr=%u tty=%s display=%s remote=%s remote_user=%s remote_host=%s",
+ uid, pid, service, type, seat, vtnr, tty, display, yes_no(remote), remote_user, remote_host);
+
+ reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error);
+ if (!reply) {
+ pam_syslog(handle, LOG_ERR, "Failed to create session: %s", bus_error_message(&error));
+ r = PAM_SESSION_ERR;
+ goto finish;
+ }
+
+ if (!dbus_message_get_args(reply, &error,
+ DBUS_TYPE_STRING, &id,
+ DBUS_TYPE_OBJECT_PATH, &object_path,
+ DBUS_TYPE_STRING, &runtime_path,
+ DBUS_TYPE_UNIX_FD, &session_fd,
+ DBUS_TYPE_STRING, &seat,
+ DBUS_TYPE_UINT32, &vtnr,
+ DBUS_TYPE_INVALID)) {
+ pam_syslog(handle, LOG_ERR, "Failed to parse message: %s", bus_error_message(&error));
+ r = PAM_SESSION_ERR;
+ goto finish;
+ }
+
+ if (debug)
+ pam_syslog(handle, LOG_DEBUG, "Reply from logind: "
+ "id=%s object_path=%s runtime_path=%s session_fd=%d seat=%s vtnr=%u",
+ id, object_path, runtime_path, session_fd, seat, vtnr);
+
+ r = pam_misc_setenv(handle, "XDG_SESSION_ID", id, 0);
+ if (r != PAM_SUCCESS) {
+ pam_syslog(handle, LOG_ERR, "Failed to set session id.");
+ goto finish;
+ }
+
+ r = pam_misc_setenv(handle, "XDG_RUNTIME_DIR", runtime_path, 0);
+ if (r != PAM_SUCCESS) {
+ pam_syslog(handle, LOG_ERR, "Failed to set runtime dir.");
+ goto finish;
+ }
+
+ if (!isempty(seat)) {
+ r = pam_misc_setenv(handle, "XDG_SEAT", seat, 0);
+ if (r != PAM_SUCCESS) {
+ pam_syslog(handle, LOG_ERR, "Failed to set seat.");
+ goto finish;
+ }
+ }
+
+ if (vtnr > 0) {
+ char buf[11];
+ snprintf(buf, sizeof(buf), "%u", vtnr);
+ char_array_0(buf);
+
+ r = pam_misc_setenv(handle, "XDG_VTNR", buf, 0);
+ if (r != PAM_SUCCESS) {
+ pam_syslog(handle, LOG_ERR, "Failed to set virtual terminal number.");
+ goto finish;
+ }
+ }
+
+ if (session_fd >= 0) {
+ r = pam_set_data(handle, "systemd.session-fd", INT_TO_PTR(session_fd+1), NULL);
+ if (r != PAM_SUCCESS) {
+ pam_syslog(handle, LOG_ERR, "Failed to install session fd.");
+ return r;
+ }
+ }
+
+ session_fd = -1;
+
+ r = PAM_SUCCESS;
+
+finish:
+ strv_free(controllers);
+ strv_free(reset_controllers);
+ strv_free(kill_only_users);
+ strv_free(kill_exclude_users);
+
+ dbus_error_free(&error);
+
+ if (bus) {
+ dbus_connection_close(bus);
+ dbus_connection_unref(bus);
+ }
+
+ if (m)
+ dbus_message_unref(m);
+
+ if (reply)
+ dbus_message_unref(reply);
+
+ if (session_fd >= 0)
+ close_nointr_nofail(session_fd);
+
+ return r;
+}
+
+_public_ PAM_EXTERN int pam_sm_close_session(
+ pam_handle_t *handle,
+ int flags,
+ int argc, const char **argv) {
+
+ const void *p = NULL;
+
+ pam_get_data(handle, "systemd.session-fd", &p);
+
+ if (p)
+ close_nointr(PTR_TO_INT(p) - 1);
+
+ return PAM_SUCCESS;
+}
diff --git a/src/pam-module.c b/src/pam-module.c
deleted file mode 100644
index 14e706b..0000000
--- a/src/pam-module.c
+++ /dev/null
@@ -1,618 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2010 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/file.h>
-#include <pwd.h>
-#include <endian.h>
-#include <sys/capability.h>
-
-#include <security/pam_modules.h>
-#include <security/_pam_macros.h>
-#include <security/pam_modutil.h>
-#include <security/pam_ext.h>
-#include <security/pam_misc.h>
-
-#include "util.h"
-#include "macro.h"
-#include "sd-daemon.h"
-#include "strv.h"
-#include "dbus-common.h"
-#include "def.h"
-#include "socket-util.h"
-
-static int parse_argv(pam_handle_t *handle,
- int argc, const char **argv,
- char ***controllers,
- char ***reset_controllers,
- bool *kill_processes,
- char ***kill_only_users,
- char ***kill_exclude_users,
- bool *debug) {
-
- unsigned i;
-
- assert(argc >= 0);
- assert(argc == 0 || argv);
-
- for (i = 0; i < (unsigned) argc; i++) {
- int k;
-
- if (startswith(argv[i], "kill-session-processes=")) {
- if ((k = parse_boolean(argv[i] + 23)) < 0) {
- pam_syslog(handle, LOG_ERR, "Failed to parse kill-session-processes= argument.");
- return k;
- }
-
- if (kill_processes)
- *kill_processes = k;
-
- } else if (startswith(argv[i], "kill-session=")) {
- /* As compatibility for old versions */
-
- if ((k = parse_boolean(argv[i] + 13)) < 0) {
- pam_syslog(handle, LOG_ERR, "Failed to parse kill-session= argument.");
- return k;
- }
-
- if (kill_processes)
- *kill_processes = k;
-
- } else if (startswith(argv[i], "controllers=")) {
-
- if (controllers) {
- char **l;
-
- if (!(l = strv_split(argv[i] + 12, ","))) {
- pam_syslog(handle, LOG_ERR, "Out of memory.");
- return -ENOMEM;
- }
-
- strv_free(*controllers);
- *controllers = l;
- }
-
- } else if (startswith(argv[i], "reset-controllers=")) {
-
- if (reset_controllers) {
- char **l;
-
- if (!(l = strv_split(argv[i] + 18, ","))) {
- pam_syslog(handle, LOG_ERR, "Out of memory.");
- return -ENOMEM;
- }
-
- strv_free(*reset_controllers);
- *reset_controllers = l;
- }
-
- } else if (startswith(argv[i], "kill-only-users=")) {
-
- if (kill_only_users) {
- char **l;
-
- if (!(l = strv_split(argv[i] + 16, ","))) {
- pam_syslog(handle, LOG_ERR, "Out of memory.");
- return -ENOMEM;
- }
-
- strv_free(*kill_only_users);
- *kill_only_users = l;
- }
-
- } else if (startswith(argv[i], "kill-exclude-users=")) {
-
- if (kill_exclude_users) {
- char **l;
-
- if (!(l = strv_split(argv[i] + 19, ","))) {
- pam_syslog(handle, LOG_ERR, "Out of memory.");
- return -ENOMEM;
- }
-
- strv_free(*kill_exclude_users);
- *kill_exclude_users = l;
- }
-
- } else if (startswith(argv[i], "debug=")) {
- if ((k = parse_boolean(argv[i] + 6)) < 0) {
- pam_syslog(handle, LOG_ERR, "Failed to parse debug= argument.");
- return k;
- }
-
- if (debug)
- *debug = k;
-
- } else if (startswith(argv[i], "create-session=") ||
- startswith(argv[i], "kill-user=")) {
-
- pam_syslog(handle, LOG_WARNING, "Option %s not supported anymore, ignoring.", argv[i]);
-
- } else {
- pam_syslog(handle, LOG_ERR, "Unknown parameter '%s'.", argv[i]);
- return -EINVAL;
- }
- }
-
- return 0;
-}
-
-static int get_user_data(
- pam_handle_t *handle,
- const char **ret_username,
- struct passwd **ret_pw) {
-
- const char *username = NULL;
- struct passwd *pw = NULL;
- uid_t uid;
- int r;
-
- assert(handle);
- assert(ret_username);
- assert(ret_pw);
-
- r = audit_loginuid_from_pid(0, &uid);
- if (r >= 0)
- pw = pam_modutil_getpwuid(handle, uid);
- else {
- r = pam_get_user(handle, &username, NULL);
- if (r != PAM_SUCCESS) {
- pam_syslog(handle, LOG_ERR, "Failed to get user name.");
- return r;
- }
-
- if (isempty(username)) {
- pam_syslog(handle, LOG_ERR, "User name not valid.");
- return PAM_AUTH_ERR;
- }
-
- pw = pam_modutil_getpwnam(handle, username);
- }
-
- if (!pw) {
- pam_syslog(handle, LOG_ERR, "Failed to get user data.");
- return PAM_USER_UNKNOWN;
- }
-
- *ret_pw = pw;
- *ret_username = username ? username : pw->pw_name;
-
- return PAM_SUCCESS;
-}
-
-static bool check_user_lists(
- pam_handle_t *handle,
- uid_t uid,
- char **kill_only_users,
- char **kill_exclude_users) {
-
- const char *name = NULL;
- char **l;
-
- assert(handle);
-
- if (uid == 0)
- name = "root"; /* Avoid obvious NSS requests, to suppress network traffic */
- else {
- struct passwd *pw;
-
- pw = pam_modutil_getpwuid(handle, uid);
- if (pw)
- name = pw->pw_name;
- }
-
- STRV_FOREACH(l, kill_exclude_users) {
- uid_t u;
-
- if (parse_uid(*l, &u) >= 0)
- if (u == uid)
- return false;
-
- if (name && streq(name, *l))
- return false;
- }
-
- if (strv_isempty(kill_only_users))
- return true;
-
- STRV_FOREACH(l, kill_only_users) {
- uid_t u;
-
- if (parse_uid(*l, &u) >= 0)
- if (u == uid)
- return true;
-
- if (name && streq(name, *l))
- return true;
- }
-
- return false;
-}
-
-static int get_seat_from_display(const char *display, const char **seat, uint32_t *vtnr) {
- char *p = NULL;
- int r;
- int fd;
- union sockaddr_union sa;
- struct ucred ucred;
- socklen_t l;
- char *tty;
- int v;
-
- assert(display);
- assert(seat);
- assert(vtnr);
-
- /* We deduce the X11 socket from the display name, then use
- * SO_PEERCRED to determine the X11 server process, ask for
- * the controlling tty of that and if it's a VC then we know
- * the seat and the virtual terminal. Sounds ugly, is only
- * semi-ugly. */
-
- r = socket_from_display(display, &p);
- if (r < 0)
- return r;
-
- fd = socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0);
- if (fd < 0) {
- free(p);
- return -errno;
- }
-
- zero(sa);
- sa.un.sun_family = AF_UNIX;
- strncpy(sa.un.sun_path, p, sizeof(sa.un.sun_path)-1);
- free(p);
-
- if (connect(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path)) < 0) {
- close_nointr_nofail(fd);
- return -errno;
- }
-
- l = sizeof(ucred);
- r = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &l);
- close_nointr_nofail(fd);
-
- if (r < 0)
- return -errno;
-
- r = get_ctty(ucred.pid, NULL, &tty);
- if (r < 0)
- return r;
-
- v = vtnr_from_tty(tty);
- free(tty);
-
- if (v < 0)
- return v;
- else if (v == 0)
- return -ENOENT;
-
- *seat = "seat0";
- *vtnr = (uint32_t) v;
-
- return 0;
-}
-
-_public_ PAM_EXTERN int pam_sm_open_session(
- pam_handle_t *handle,
- int flags,
- int argc, const char **argv) {
-
- struct passwd *pw;
- bool kill_processes = false, debug = false;
- const char *username, *id, *object_path, *runtime_path, *service = NULL, *tty = NULL, *display = NULL, *remote_user = NULL, *remote_host = NULL, *seat = NULL, *type, *cvtnr = NULL;
- char **controllers = NULL, **reset_controllers = NULL, **kill_only_users = NULL, **kill_exclude_users = NULL;
- DBusError error;
- uint32_t uid, pid;
- DBusMessageIter iter;
- dbus_bool_t kp;
- int session_fd = -1;
- DBusConnection *bus = NULL;
- DBusMessage *m = NULL, *reply = NULL;
- dbus_bool_t remote;
- int r;
- uint32_t vtnr = 0;
-
- assert(handle);
-
- dbus_error_init(&error);
-
- /* pam_syslog(handle, LOG_INFO, "pam-systemd initializing"); */
-
- /* Make this a NOP on non-systemd systems */
- if (sd_booted() <= 0)
- return PAM_SUCCESS;
-
- if (parse_argv(handle,
- argc, argv,
- &controllers, &reset_controllers,
- &kill_processes, &kill_only_users, &kill_exclude_users,
- &debug) < 0) {
- r = PAM_SESSION_ERR;
- goto finish;
- }
-
- r = get_user_data(handle, &username, &pw);
- if (r != PAM_SUCCESS)
- goto finish;
-
- /* Make sure we don't enter a loop by talking to
- * systemd-logind when it is actually waiting for the
- * background to finish start-up. If the service is
- * "systemd-shared" we simply set XDG_RUNTIME_DIR and
- * leave. */
-
- pam_get_item(handle, PAM_SERVICE, (const void**) &service);
- if (streq_ptr(service, "systemd-shared")) {
- char *p, *rt = NULL;
-
- if (asprintf(&p, "/run/systemd/users/%lu", (unsigned long) pw->pw_uid) < 0) {
- r = PAM_BUF_ERR;
- goto finish;
- }
-
- r = parse_env_file(p, NEWLINE,
- "RUNTIME", &rt,
- NULL);
- free(p);
-
- if (r < 0 && r != -ENOENT) {
- r = PAM_SESSION_ERR;
- free(rt);
- goto finish;
- }
-
- if (rt) {
- r = pam_misc_setenv(handle, "XDG_RUNTIME_DIR", rt, 0);
- free(rt);
-
- if (r != PAM_SUCCESS) {
- pam_syslog(handle, LOG_ERR, "Failed to set runtime dir.");
- goto finish;
- }
- }
-
- r = PAM_SUCCESS;
- goto finish;
- }
-
- if (kill_processes)
- kill_processes = check_user_lists(handle, pw->pw_uid, kill_only_users, kill_exclude_users);
-
- dbus_connection_set_change_sigpipe(FALSE);
-
- bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error);
- if (!bus) {
- pam_syslog(handle, LOG_ERR, "Failed to connect to system bus: %s", bus_error_message(&error));
- r = PAM_SESSION_ERR;
- goto finish;
- }
-
- m = dbus_message_new_method_call(
- "org.freedesktop.login1",
- "/org/freedesktop/login1",
- "org.freedesktop.login1.Manager",
- "CreateSession");
-
- if (!m) {
- pam_syslog(handle, LOG_ERR, "Could not allocate create session message.");
- r = PAM_BUF_ERR;
- goto finish;
- }
-
- uid = pw->pw_uid;
- pid = getpid();
-
- pam_get_item(handle, PAM_XDISPLAY, (const void**) &display);
- pam_get_item(handle, PAM_TTY, (const void**) &tty);
- pam_get_item(handle, PAM_RUSER, (const void**) &remote_user);
- pam_get_item(handle, PAM_RHOST, (const void**) &remote_host);
- seat = pam_getenv(handle, "XDG_SEAT");
- cvtnr = pam_getenv(handle, "XDG_VTNR");
-
- service = strempty(service);
- tty = strempty(tty);
- display = strempty(display);
- remote_user = strempty(remote_user);
- remote_host = strempty(remote_host);
- seat = strempty(seat);
-
- if (strchr(tty, ':')) {
- /* A tty with a colon is usually an X11 display, place
- * there to show up in utmp. We rearrange things and
- * don't pretend that an X display was a tty */
-
- if (isempty(display))
- display = tty;
- tty = "";
- } else if (streq(tty, "cron")) {
- /* cron has been setting PAM_TTY to "cron" for a very long time
- * and it cannot stop doing that for compatibility reasons. */
- tty = "";
- }
-
- if (!isempty(cvtnr))
- safe_atou32(cvtnr, &vtnr);
-
- if (!isempty(display) && isempty(seat) && vtnr <= 0)
- get_seat_from_display(display, &seat, &vtnr);
-
- type = !isempty(display) ? "x11" :
- !isempty(tty) ? "tty" : "unspecified";
-
- remote = !isempty(remote_host) && !streq(remote_host, "localhost") && !streq(remote_host, "localhost.localdomain");
-
- if (!dbus_message_append_args(m,
- DBUS_TYPE_UINT32, &uid,
- DBUS_TYPE_UINT32, &pid,
- DBUS_TYPE_STRING, &service,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &seat,
- DBUS_TYPE_UINT32, &vtnr,
- DBUS_TYPE_STRING, &tty,
- DBUS_TYPE_STRING, &display,
- DBUS_TYPE_BOOLEAN, &remote,
- DBUS_TYPE_STRING, &remote_user,
- DBUS_TYPE_STRING, &remote_host,
- DBUS_TYPE_INVALID)) {
- pam_syslog(handle, LOG_ERR, "Could not attach parameters to message.");
- r = PAM_BUF_ERR;
- goto finish;
- }
-
- dbus_message_iter_init_append(m, &iter);
-
- r = bus_append_strv_iter(&iter, controllers);
- if (r < 0) {
- pam_syslog(handle, LOG_ERR, "Could not attach parameter to message.");
- r = PAM_BUF_ERR;
- goto finish;
- }
-
- r = bus_append_strv_iter(&iter, reset_controllers);
- if (r < 0) {
- pam_syslog(handle, LOG_ERR, "Could not attach parameter to message.");
- r = PAM_BUF_ERR;
- goto finish;
- }
-
- kp = kill_processes;
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &kp)) {
- pam_syslog(handle, LOG_ERR, "Could not attach parameter to message.");
- r = PAM_BUF_ERR;
- goto finish;
- }
-
- if (debug)
- pam_syslog(handle, LOG_DEBUG, "Asking logind to create session: "
- "uid=%u pid=%u service=%s type=%s seat=%s vtnr=%u tty=%s display=%s remote=%s remote_user=%s remote_host=%s",
- uid, pid, service, type, seat, vtnr, tty, display, yes_no(remote), remote_user, remote_host);
-
- reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error);
- if (!reply) {
- pam_syslog(handle, LOG_ERR, "Failed to create session: %s", bus_error_message(&error));
- r = PAM_SESSION_ERR;
- goto finish;
- }
-
- if (!dbus_message_get_args(reply, &error,
- DBUS_TYPE_STRING, &id,
- DBUS_TYPE_OBJECT_PATH, &object_path,
- DBUS_TYPE_STRING, &runtime_path,
- DBUS_TYPE_UNIX_FD, &session_fd,
- DBUS_TYPE_STRING, &seat,
- DBUS_TYPE_UINT32, &vtnr,
- DBUS_TYPE_INVALID)) {
- pam_syslog(handle, LOG_ERR, "Failed to parse message: %s", bus_error_message(&error));
- r = PAM_SESSION_ERR;
- goto finish;
- }
-
- if (debug)
- pam_syslog(handle, LOG_DEBUG, "Reply from logind: "
- "id=%s object_path=%s runtime_path=%s session_fd=%d seat=%s vtnr=%u",
- id, object_path, runtime_path, session_fd, seat, vtnr);
-
- r = pam_misc_setenv(handle, "XDG_SESSION_ID", id, 0);
- if (r != PAM_SUCCESS) {
- pam_syslog(handle, LOG_ERR, "Failed to set session id.");
- goto finish;
- }
-
- r = pam_misc_setenv(handle, "XDG_RUNTIME_DIR", runtime_path, 0);
- if (r != PAM_SUCCESS) {
- pam_syslog(handle, LOG_ERR, "Failed to set runtime dir.");
- goto finish;
- }
-
- if (!isempty(seat)) {
- r = pam_misc_setenv(handle, "XDG_SEAT", seat, 0);
- if (r != PAM_SUCCESS) {
- pam_syslog(handle, LOG_ERR, "Failed to set seat.");
- goto finish;
- }
- }
-
- if (vtnr > 0) {
- char buf[11];
- snprintf(buf, sizeof(buf), "%u", vtnr);
- char_array_0(buf);
-
- r = pam_misc_setenv(handle, "XDG_VTNR", buf, 0);
- if (r != PAM_SUCCESS) {
- pam_syslog(handle, LOG_ERR, "Failed to set virtual terminal number.");
- goto finish;
- }
- }
-
- if (session_fd >= 0) {
- r = pam_set_data(handle, "systemd.session-fd", INT_TO_PTR(session_fd+1), NULL);
- if (r != PAM_SUCCESS) {
- pam_syslog(handle, LOG_ERR, "Failed to install session fd.");
- return r;
- }
- }
-
- session_fd = -1;
-
- r = PAM_SUCCESS;
-
-finish:
- strv_free(controllers);
- strv_free(reset_controllers);
- strv_free(kill_only_users);
- strv_free(kill_exclude_users);
-
- dbus_error_free(&error);
-
- if (bus) {
- dbus_connection_close(bus);
- dbus_connection_unref(bus);
- }
-
- if (m)
- dbus_message_unref(m);
-
- if (reply)
- dbus_message_unref(reply);
-
- if (session_fd >= 0)
- close_nointr_nofail(session_fd);
-
- return r;
-}
-
-_public_ PAM_EXTERN int pam_sm_close_session(
- pam_handle_t *handle,
- int flags,
- int argc, const char **argv) {
-
- const void *p = NULL;
-
- pam_get_data(handle, "systemd.session-fd", &p);
-
- if (p)
- close_nointr(PTR_TO_INT(p) - 1);
-
- return PAM_SUCCESS;
-}
commit 5e2c93666f2590614214a33027002b431ebafebc
Author: Lennart Poettering <lennart at poettering.net>
Date: Sat Dec 31 13:48:35 2011 +0100
test: rename test directory
diff --git a/src/test-engine.c b/src/test-engine.c
index 60619b9..46a2d2c 100644
--- a/src/test-engine.c
+++ b/src/test-engine.c
@@ -31,7 +31,7 @@ int main(int argc, char *argv[]) {
Unit *a = NULL, *b = NULL, *c = NULL, *d = NULL, *e = NULL, *g = NULL, *h = NULL;
Job *j;
- assert_se(set_unit_path("test2") >= 0);
+ assert_se(set_unit_path("test") >= 0);
assert_se(manager_new(MANAGER_SYSTEM, &m) >= 0);
diff --git a/test/Makefile b/test/Makefile
new file mode 100644
index 0000000..9aa46b4
--- /dev/null
+++ b/test/Makefile
@@ -0,0 +1,7 @@
+# Just a little hook script to easy building when in this directory
+
+all:
+ $(MAKE) -C ..
+
+clean:
+ $(MAKE) -C .. clean
diff --git a/test/a.service b/test/a.service
new file mode 100644
index 0000000..4168d2d
--- /dev/null
+++ b/test/a.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=A
+Requires=b.service
+Before=b.service
+
+[Service]
+ExecStart=/bin/true
diff --git a/test/b.service b/test/b.service
new file mode 100644
index 0000000..e03bae3
--- /dev/null
+++ b/test/b.service
@@ -0,0 +1,6 @@
+[Unit]
+Description=B
+Wants=f.service
+
+[Service]
+ExecStart=/bin/true
diff --git a/test/c.service b/test/c.service
new file mode 100644
index 0000000..e2f60a8
--- /dev/null
+++ b/test/c.service
@@ -0,0 +1,6 @@
+[Unit]
+Description=C
+Requires=a.service
+
+[Service]
+ExecStart=/bin/true
diff --git a/test/d.service b/test/d.service
new file mode 100644
index 0000000..921fd2e
--- /dev/null
+++ b/test/d.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=D:Cyclic
+After=b.service
+Before=a.service
+Requires=a.service
+
+[Service]
+ExecStart=/bin/true
diff --git a/test/e.service b/test/e.service
new file mode 100644
index 0000000..5ba98c7
--- /dev/null
+++ b/test/e.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=E:Cyclic
+After=b.service
+Before=a.service
+Wants=a.service
+
+[Service]
+ExecStart=/bin/true
diff --git a/test/f.service b/test/f.service
new file mode 100644
index 0000000..7dde681
--- /dev/null
+++ b/test/f.service
@@ -0,0 +1,5 @@
+[Unit]
+Description=F
+
+[Service]
+ExecStart=/bin/true
diff --git a/test/g.service b/test/g.service
new file mode 100644
index 0000000..cbfa82a
--- /dev/null
+++ b/test/g.service
@@ -0,0 +1,6 @@
+[Unit]
+Description=G
+Conflicts=e.service
+
+[Service]
+ExecStart=/bin/true
diff --git a/test/h.service b/test/h.service
new file mode 100644
index 0000000..74a7751
--- /dev/null
+++ b/test/h.service
@@ -0,0 +1,6 @@
+[Unit]
+Description=H
+Wants=g.service
+
+[Service]
+ExecStart=/bin/true
diff --git a/test1/default.target b/test1/default.target
deleted file mode 120000
index 264d980..0000000
--- a/test1/default.target
+++ /dev/null
@@ -1 +0,0 @@
-multiuser.target
\ No newline at end of file
diff --git a/test1/exec-demo.service b/test1/exec-demo.service
deleted file mode 100644
index 5802e37..0000000
--- a/test1/exec-demo.service
+++ /dev/null
@@ -1,9 +0,0 @@
-[Meta]
-Description=Simple Execution Demo
-
-[Service]
-ExecStartPre=/bin/ps -eo pid,uid,args,cgroup
-ExecStartPre=/bin/cat /etc/hosts
-ExecStart=/bin/bash -c '/bin/sleep 5 &'
-Type=forking
-Output=syslog
diff --git a/test1/fifo-demo.service b/test1/fifo-demo.service
deleted file mode 100644
index 51b1996..0000000
--- a/test1/fifo-demo.service
+++ /dev/null
@@ -1,8 +0,0 @@
-[Meta]
-Description=FIFO Activation Demo Service
-
-[Service]
-ExecStartPre=/bin/echo "Wow, es geht los!"
-#ExecStart=/bin/bash -c 'read a <&3 ; echo "GOT: $a"'
-ExecStart=/bin/bash -c 'cat <&3'
-Type=simple
diff --git a/test1/fifo-demo.socket b/test1/fifo-demo.socket
deleted file mode 100644
index 75ce7a6..0000000
--- a/test1/fifo-demo.socket
+++ /dev/null
@@ -1,6 +0,0 @@
-[Meta]
-Description=FIFO Activation Demo Socket
-
-[Socket]
-ListenFIFO=/tmp/systemd-fifo-demo
-ExecStartPost=/bin/echo "OK, we're ready, now write something to /tmp/systemd-fifo-demo"
diff --git a/test1/mail-transfer-agent.service b/test1/mail-transfer-agent.service
deleted file mode 120000
index bca89da..0000000
--- a/test1/mail-transfer-agent.service
+++ /dev/null
@@ -1 +0,0 @@
-postfix.service
\ No newline at end of file
diff --git a/test1/mail-transfer-agent.socket b/test1/mail-transfer-agent.socket
deleted file mode 120000
index daf3277..0000000
--- a/test1/mail-transfer-agent.socket
+++ /dev/null
@@ -1 +0,0 @@
-postfix.socket
\ No newline at end of file
diff --git a/test1/multiuser.target b/test1/multiuser.target
deleted file mode 100644
index f105e3c..0000000
--- a/test1/multiuser.target
+++ /dev/null
@@ -1,2 +0,0 @@
-[Meta]
-Description=Multi-User Target
diff --git a/test1/multiuser.target.wants/exec-demo.service b/test1/multiuser.target.wants/exec-demo.service
deleted file mode 120000
index 0ec1e35..0000000
--- a/test1/multiuser.target.wants/exec-demo.service
+++ /dev/null
@@ -1 +0,0 @@
-../exec-demo.service
\ No newline at end of file
diff --git a/test1/multiuser.target.wants/fifo-demo.socket b/test1/multiuser.target.wants/fifo-demo.socket
deleted file mode 120000
index 4c3d621..0000000
--- a/test1/multiuser.target.wants/fifo-demo.socket
+++ /dev/null
@@ -1 +0,0 @@
-../fifo-demo.socket
\ No newline at end of file
diff --git a/test1/multiuser.target.wants/mail-transfer-agent.socket b/test1/multiuser.target.wants/mail-transfer-agent.socket
deleted file mode 120000
index 3c3a2db..0000000
--- a/test1/multiuser.target.wants/mail-transfer-agent.socket
+++ /dev/null
@@ -1 +0,0 @@
-../mail-transfer-agent.socket
\ No newline at end of file
diff --git a/test1/multiuser.target.wants/permissions.service b/test1/multiuser.target.wants/permissions.service
deleted file mode 120000
index 98f3d5f..0000000
--- a/test1/multiuser.target.wants/permissions.service
+++ /dev/null
@@ -1 +0,0 @@
-../permissions.service
\ No newline at end of file
diff --git a/test1/multiuser.target.wants/systemd-logger.socket b/test1/multiuser.target.wants/systemd-logger.socket
deleted file mode 120000
index 4ce0a61..0000000
--- a/test1/multiuser.target.wants/systemd-logger.socket
+++ /dev/null
@@ -1 +0,0 @@
-../systemd-logger.socket
\ No newline at end of file
diff --git a/test1/permissions.service b/test1/permissions.service
deleted file mode 100644
index cb0664f..0000000
--- a/test1/permissions.service
+++ /dev/null
@@ -1,11 +0,0 @@
-[Meta]
-Description=Permission Enforcement checker
-
-[Service]
-ExecStart=/usr/bin/id
-ExecStartPost=/usr/bin/env
-ExecStartPost=/bin/sleep 5
-Type=oneshot
-Capabilities=all= cap_dac_override=eip
-User=nobody
-Group=nobody
diff --git a/test1/postfix.service b/test1/postfix.service
deleted file mode 100644
index fbf39ec..0000000
--- a/test1/postfix.service
+++ /dev/null
@@ -1,7 +0,0 @@
-[Meta]
-Names=mail-transfer-agent.service
-Description=Postfix Mail Server
-Requires=syslog.socket
-
-[Service]
-ExecStart=/usr/bin/postfix
diff --git a/test1/postfix.socket b/test1/postfix.socket
deleted file mode 100644
index 9d650a1..0000000
--- a/test1/postfix.socket
+++ /dev/null
@@ -1,13 +0,0 @@
-[Meta]
-Description=Postfix SMTP Socket
-
-[Socket]
-ListenStream=53333
-ListenFIFO=/tmp/systemd-postfix-fifo
-ExecStartPre=/bin/echo "About to create sockets..."
-ExecStartPre=/bin/echo "About to create sockets... 2"
-ExecStartPost=/bin/echo "Created sockets..."
-ExecStopPre=/bin/echo "About to delete sockets..."
-ExecStopPost=/bin/echo "Deleted sockets..."
-ExecStopPost=/bin/echo "Deleted sockets... 2"
-#BindToDevice=eth0
diff --git a/test1/syslog.service b/test1/syslog.service
deleted file mode 100644
index 8fe47ae..0000000
--- a/test1/syslog.service
+++ /dev/null
@@ -1,5 +0,0 @@
-[Meta]
-Description=System Logging Daemon
-
-[Service]
-ExecStart=/usr/bin/rsyslogd --foobar 'waldo'
diff --git a/test1/syslog.socket b/test1/syslog.socket
deleted file mode 100644
index f2d3297..0000000
--- a/test1/syslog.socket
+++ /dev/null
@@ -1,8 +0,0 @@
-[Meta]
-Description=Syslog Socket
-
-[Socket]
-ListenDatagram=/tmp/foobar/waldo/systemd-syslog-socket
-ListenStream=eth0:3456
-DirectoryMode=0700
-SocketMode=0600
diff --git a/test1/systemd-logger.service b/test1/systemd-logger.service
deleted file mode 100644
index c406d26..0000000
--- a/test1/systemd-logger.service
+++ /dev/null
@@ -1,13 +0,0 @@
-[Meta]
-Description=systemd Logging Daemon
-
-[Service]
-ExecStart=/home/lennart/projects/systemd/systemd-logger
-Type=simple
-TimerSlackNS=1000000
-OOMScoreAdjust=40
-LimitCORE=0
-LimitFSIZE=0
-LimitLOCKS=0
-LimitMEMLOCK=0
-LimitNOFILE=512
diff --git a/test1/systemd-logger.socket b/test1/systemd-logger.socket
deleted file mode 100644
index eb012c8..0000000
--- a/test1/systemd-logger.socket
+++ /dev/null
@@ -1,5 +0,0 @@
-[Meta]
-Description=systemd Logging Socket
-
-[Socket]
-ListenStream=@/org/freedesktop/systemd1/logger
diff --git a/test2/Makefile b/test2/Makefile
deleted file mode 100644
index 9aa46b4..0000000
--- a/test2/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# Just a little hook script to easy building when in this directory
-
-all:
- $(MAKE) -C ..
-
-clean:
- $(MAKE) -C .. clean
diff --git a/test2/a.service b/test2/a.service
deleted file mode 100644
index 4168d2d..0000000
--- a/test2/a.service
+++ /dev/null
@@ -1,7 +0,0 @@
-[Unit]
-Description=A
-Requires=b.service
-Before=b.service
-
-[Service]
-ExecStart=/bin/true
diff --git a/test2/b.service b/test2/b.service
deleted file mode 100644
index e03bae3..0000000
--- a/test2/b.service
+++ /dev/null
@@ -1,6 +0,0 @@
-[Unit]
-Description=B
-Wants=f.service
-
-[Service]
-ExecStart=/bin/true
diff --git a/test2/c.service b/test2/c.service
deleted file mode 100644
index e2f60a8..0000000
--- a/test2/c.service
+++ /dev/null
@@ -1,6 +0,0 @@
-[Unit]
-Description=C
-Requires=a.service
-
-[Service]
-ExecStart=/bin/true
diff --git a/test2/d.service b/test2/d.service
deleted file mode 100644
index 921fd2e..0000000
--- a/test2/d.service
+++ /dev/null
@@ -1,8 +0,0 @@
-[Unit]
-Description=D:Cyclic
-After=b.service
-Before=a.service
-Requires=a.service
-
-[Service]
-ExecStart=/bin/true
diff --git a/test2/e.service b/test2/e.service
deleted file mode 100644
index 5ba98c7..0000000
--- a/test2/e.service
+++ /dev/null
@@ -1,8 +0,0 @@
-[Unit]
-Description=E:Cyclic
-After=b.service
-Before=a.service
-Wants=a.service
-
-[Service]
-ExecStart=/bin/true
diff --git a/test2/f.service b/test2/f.service
deleted file mode 100644
index 7dde681..0000000
--- a/test2/f.service
+++ /dev/null
@@ -1,5 +0,0 @@
-[Unit]
-Description=F
-
-[Service]
-ExecStart=/bin/true
diff --git a/test2/g.service b/test2/g.service
deleted file mode 100644
index cbfa82a..0000000
--- a/test2/g.service
+++ /dev/null
@@ -1,6 +0,0 @@
-[Unit]
-Description=G
-Conflicts=e.service
-
-[Service]
-ExecStart=/bin/true
diff --git a/test2/h.service b/test2/h.service
deleted file mode 100644
index 74a7751..0000000
--- a/test2/h.service
+++ /dev/null
@@ -1,6 +0,0 @@
-[Unit]
-Description=H
-Wants=g.service
-
-[Service]
-ExecStart=/bin/true
More information about the systemd-commits
mailing list