if motd is set in login.conf, output its contents before starting the
shell git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11217 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -418,6 +418,19 @@ checknologin(void)
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* print contents of a file */
|
||||||
|
static void
|
||||||
|
show_file(const char *file)
|
||||||
|
{
|
||||||
|
FILE *f;
|
||||||
|
char buf[BUFSIZ];
|
||||||
|
if((f = fopen(file, "r")) == NULL)
|
||||||
|
return;
|
||||||
|
while (fgets(buf, sizeof(buf), f))
|
||||||
|
fputs(buf, stdout);
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actually log in the user. `pwd' contains all the relevant
|
* Actually log in the user. `pwd' contains all the relevant
|
||||||
* information about the user. `ttyn' is the complete name of the tty
|
* information about the user. `ttyn' is the complete name of the tty
|
||||||
@@ -611,6 +624,18 @@ do_login(const struct passwd *pwd, char *tty, char *ttyn)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
const char *str = login_conf_get_string("motd");
|
||||||
|
char buf[MAXPATHLEN];
|
||||||
|
|
||||||
|
if(str != NULL) {
|
||||||
|
while(strsep_copy(&str, ",", buf, sizeof(buf)) != -1) {
|
||||||
|
if(buf[0] == '\0')
|
||||||
|
continue;
|
||||||
|
show_file(buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
add_env("HOME", home_dir);
|
add_env("HOME", home_dir);
|
||||||
add_env("USER", pwd->pw_name);
|
add_env("USER", pwd->pw_name);
|
||||||
add_env("LOGNAME", pwd->pw_name);
|
add_env("LOGNAME", pwd->pw_name);
|
||||||
|
Reference in New Issue
Block a user