#endif
-/* Fake hostname for ut_host specified on command line. */
-static char *fakehost;
#ifdef DEBUGGING
# include "closestream.h"
op->flags |= F_RTSCTS;
break;
case 'H':
- fakehost = optarg;
+ op->fakehost = optarg;
break;
case 'i':
op->flags &= ~F_ISSUE;
/* Update the utmp file. */
#ifdef SYSV_STYLE
- agetty_update_utmp(&options, fakehost);
+ agetty_update_utmp(&options);
#endif
if (options.delay)
sleep(options.delay);
sigaction(SIGQUIT, &sa_quit, NULL);
sigaction(SIGINT, &sa_int, NULL);
- agetty_init_login_argv(login_argv, &login_argc, &options, fakehost);
+ agetty_init_login_argv(login_argv, &login_argc, &options);
if (options.chroot) {
if (chroot(options.chroot) < 0)
char *erasechars; /* string with erase chars */
char *killchars; /* string with kill chars */
char *username; /* login name, given to /bin/login */
+ char *fakehost; /* fake hostname for ut_host */
char *osrelease; /* /etc/os-release data */
unsigned int delay; /* Sleep seconds before prompt */
int nice; /* Run login with this priority */
extern char *agetty_xgethostname(void);
extern char *agetty_xgetdomainname(void);
-extern void agetty_update_utmp(struct agetty_options *op, const char *fakehost);
+extern void agetty_update_utmp(struct agetty_options *op);
extern void agetty_parse_speeds(struct agetty_options *op, char *arg);
extern char *agetty_parse_initstring(const char *arg);
extern void agetty_init_login_argv(char *argv[], int *argc,
- struct agetty_options *op, const char *fakehost);
+ struct agetty_options *op);
enum {
CLOCAL_MODE_AUTO = 0,
}
#ifdef SYSV_STYLE
-void agetty_update_utmp(struct agetty_options *op, const char *fakehost)
+void agetty_update_utmp(struct agetty_options *op)
{
struct utmpx ut;
time_t t;
str2memcpy(ut.ut_user, "LOGIN", sizeof(ut.ut_user));
str2memcpy(ut.ut_line, line, sizeof(ut.ut_line));
- if (fakehost)
- str2memcpy(ut.ut_host, fakehost, sizeof(ut.ut_host));
+ if (op->fakehost)
+ str2memcpy(ut.ut_host, op->fakehost, sizeof(ut.ut_host));
time(&t);
ut.ut_tv.tv_sec = t;
ut.ut_type = LOGIN_PROCESS;
}
void agetty_init_login_argv(char *argv[], int *argc,
- struct agetty_options *op, const char *fakehost)
+ struct agetty_options *op)
{
*argc = 0;
argv[(*argc)++] = op->login;
login_options_to_argv(argv, argc, op->logopt, op->username);
} else {
if (op->flags & F_REMOTE) {
- if (fakehost) {
+ if (op->fakehost) {
argv[(*argc)++] = "-h";
- argv[(*argc)++] = (char *) fakehost;
+ argv[(*argc)++] = op->fakehost;
} else if (op->flags & F_NOHOSTNAME)
argv[(*argc)++] = "-H";
}