shell: Use crypt_r() in rtems_shell_login_check()

Use '*" to disable shell login instead of '!' according to the Linux man
page.  Use getpwnam_r() instead of getpwnam().  Do not access the user
environment directly.  Update the user environment only after a
successful login check.
This commit is contained in:
Sebastian Huber
2014-11-14 14:31:54 +01:00
parent 002f351e15
commit acf9a8dd54
8 changed files with 224 additions and 23 deletions

View File

@@ -13,6 +13,7 @@
#define CONFIGURE_INIT
#include "system.h"
#include <crypt.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
@@ -641,10 +642,11 @@ static void fileio_start_shell(void)
writeFile(
"/etc/passwd",
0644,
"root:7QR4o148UPtb.:0:0:root::/:/bin/sh\n"
"rtems:*:1:1:RTEMS Application::/:/bin/sh\n"
"test:8Yy.AaxynxbLI:2:2:test account::/:/bin/sh\n"
"tty:!:3:3:tty owner::/:/bin/false\n"
"root:$6$$FuPOhnllx6lhW2qqlnmWvZQLJ8Thr/09I7ESTdb9VbnTOn5.65"
"/Vh2Mqa6FoKXwT0nHS/O7F0KfrDc6Svb/sH.:0:0:root::/:/bin/sh\n"
"rtems::1:1:RTEMS Application::/:/bin/sh\n"
"test:$1$$oPu1Xt2Pw0ngIc7LyDHqu1:2:2:test account::/:/bin/sh\n"
"tty:*:3:3:tty owner::/:/bin/false\n"
);
writeFile(
"/etc/group",
@@ -1225,6 +1227,9 @@ Init (rtems_task_argument ignored)
TEST_BEGIN();
crypt_add_format(&crypt_md5_format);
crypt_add_format(&crypt_sha512_format);
status = rtems_shell_wait_for_input(
STDIN_FILENO,
20,