#include <ctype.h>
#include <sys/socket.h>
#include <netdb.h>
+#include <linux/kd.h>
#include <glib.h>
#include <glib/gstdio.h>
#define TLM_SESSION_PRIV(obj) \
G_TYPE_INSTANCE_GET_PRIVATE ((obj), TLM_TYPE_SESSION, TlmSessionPrivate)
+#ifndef KDSKBMUTE
+#define KDSKBMUTE 0x4B51
+#endif
+
enum {
PROP_0,
PROP_CONFIG,
if (ioctl (tty_fd, TIOCSPGRP, &tty_pgid)) {
WARN ("ioctl(TIOCSPGRP) failed: %s", strerror(errno));
}
+
+ /* TODO: unset the mode on session cleanup */
+ if (ioctl(tty_fd, KDSKBMUTE, 1) &&
+ ioctl(tty_fd, KDSKBMODE, K_OFF)) {
+ WARN ("ioctl(KDSKBMODE) failed: %s", strerror(errno));
+ }
+
/*if (tcsetpgrp (tty_fd, getpgrp ()))
WARN ("tcsetpgrp() failed: %s", strerror(errno));*/
shell = tlm_user_get_shell (priv->username);
if (shell) _setenv_to_session ("SHELL", shell, priv);
- // seat is not set for fake seats
if (!tlm_config_has_key (priv->config,
- TLM_CONFIG_GENERAL,
- TLM_CONFIG_GENERAL_NSEATS))
+ TLM_CONFIG_GENERAL,
+ TLM_CONFIG_GENERAL_NSEATS))
_setenv_to_session ("XDG_SEAT", priv->seat_id, priv);
const gchar *xdg_data_dirs =
open_max = sysconf (_SC_OPEN_MAX);
for (fd = 3; fd < open_max; fd++) {
if (fcntl (fd, F_SETFD, FD_CLOEXEC) < -1) {
- WARN("Failed to close desriptor '%d', error: %s",
+ WARN ("Failed to close desriptor '%d', error: %s",
fd, strerror(errno));
}
}
g_object_set (G_OBJECT (session), "seat", seat_id, "service", service,
"username", username, "environment", environment, NULL);
+ priv->vtnr = tlm_config_get_uint (priv->config,
+ priv->seat_id,
+ TLM_CONFIG_SEAT_VTNR,
+ 0);
+ gchar *tty_name = priv->vtnr > 0 ?
+ g_strdup_printf ("tty%u", priv->vtnr) : NULL;
priv->auth_session = tlm_auth_session_new (priv->service, priv->username,
- password);
+ password, tty_name);
+ g_free (tty_name);
if (!priv->auth_session) {
error = TLM_GET_ERROR_FOR_ID (TLM_ERROR_SESSION_CREATION_FAILURE,
return FALSE;
}
- priv->vtnr = tlm_config_get_uint (priv->config,
- priv->seat_id,
- TLM_CONFIG_SEAT_VTNR,
- 0);
session_type = tlm_config_get_string (priv->config,
priv->seat_id,
TLM_CONFIG_GENERAL_SESSION_TYPE);
TLM_CONFIG_GENERAL,
TLM_CONFIG_GENERAL_SESSION_TYPE);
if (!tlm_config_has_key (priv->config,
- TLM_CONFIG_GENERAL,
- TLM_CONFIG_GENERAL_NSEATS))
+ TLM_CONFIG_GENERAL,
+ TLM_CONFIG_GENERAL_NSEATS))
tlm_auth_session_putenv (priv->auth_session,
"XDG_SEAT",
priv->seat_id);