Print the content of pre-login message (/etc/issue)

This commit is contained in:
SeekBytes
2022-04-30 16:12:19 +02:00
committed by GitHub
parent 0130725518
commit 1e4a1f5852
+12 -1
View File
@@ -145,6 +145,17 @@ static inline int setup_env(passwd_t *pwd)
int main(int argc, char **argv)
{
// Print /etc/issue if it exists
// TODO: Parsing /etc/issue for special characters (such as `\t` for time)
int issues_fd = open("/etc/issue", O_RDONLY, 0600);
if (issues_fd != -1){
char buffer[256];
if(read(issues_fd, buffer, sizeof(char)*256) != -1){
printf("%s \n", buffer);
}
}
passwd_t *pwd;
char username[50], password[50];
do {
@@ -191,4 +202,4 @@ int main(int argc, char **argv)
return 1;
}
return 0;
}
}