From ed12fec98c2365593e3b8bac14701112051028ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Fri, 28 Jan 2011 14:24:23 +0100 Subject: [PATCH 56/61] iucvtty: do not specify z/VM user ID as argument to login -h Description: iucvtty: do not specify z/VM user ID as argument to login -h Symptom: When establishing a terminal connection to an iucvtty instance on a target system, iucvconn disconnects due to a timeout of the login program. Users are not able to log in. Problem: iucvtty passes the z/VM user ID of the originating guest virtual machine as argument to the -h option of the login program. The -h option specifies a host name that is used when writing [uw]tmp records. Depending on the implementation of the login program, login calls gethostbyname() to get the FQDN of the hostname. If the target system does not have any working network connection, the DNS query times out. The DNS timeout might be greater than the timeout the login program waits for user input. The login timeout is caused by a SIGALRM signal that is registered before login calls gethostbyname(). If the DNS timeout is greater, login exits. Solution: Do not specify the z/VM user ID when iucvtty starts the login program. The workaround to avoid timeouts is to explicitly specify the login program when starting iucvtty. For example, use "iucvtty TERMID -- /bin/login". --- iucvterm/src/iucvtty.c | 12 +++--------- 1 files changed, 3 insertions(+), 9 deletions(-) diff --git a/iucvterm/src/iucvtty.c b/iucvterm/src/iucvtty.c index b9a2754..ef7e212 100644 --- a/iucvterm/src/iucvtty.c +++ b/iucvterm/src/iucvtty.c @@ -48,21 +48,15 @@ static void sig_handler(int sig) /** * exec_login_prog() - execute a login program * @cmd: Path to the (login) program executable - * @host: Originator host that is passed to /bin/login */ -static int exec_login_prog(char *cmd[], const char *host) +static int exec_login_prog(char *cmd[]) { int rc; if (cmd != NULL) rc = execv(cmd[0], cmd); else - /* for root only: write hostname to [uw]tmp if set */ - if (geteuid() == 0 && host != NULL) - rc = execl("/bin/login", "/bin/login", "-h", host, - (char *) NULL); - else - rc = execl("/bin/login", "/bin/login", (char *) NULL); + rc = execl("/bin/login", "/bin/login", (char *) NULL); return rc; } @@ -110,7 +104,7 @@ static int iucvtty_worker(int client, int master, int slave, exit(2); } setenv("TERM", term_env, 1); - if (exec_login_prog(cfg->cmd_parms, host)) { + if (exec_login_prog(cfg->cmd_parms)) { print_error("Running the login program failed"); iucvtty_tx_error(client, ERR_CANNOT_EXEC_LOGIN); } -- 1.7.3.5