From 527ecc7acf4162259bda716ff57d14513c47046c Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 9 Dec 2008 19:34:04 +0000 Subject: 2008-12-09 Joel Sherrill * fileio/init.c: Add explicit creation of /etc/passwd and /etc/group so we have a test case for real password checking. --- testsuites/samples/fileio/init.c | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'testsuites/samples/fileio/init.c') diff --git a/testsuites/samples/fileio/init.c b/testsuites/samples/fileio/init.c index 389cbd023a..ea6651d412 100644 --- a/testsuites/samples/fileio/init.c +++ b/testsuites/samples/fileio/init.c @@ -99,8 +99,9 @@ fstab_t fs_table[] = { #ifdef USE_SHELL #include -void writeScript( +void writeFile( const char *name, + int mode, const char *contents ) { @@ -111,20 +112,52 @@ void writeScript( } rtems_shell_write_file( name, contents ); - sc = chmod ( name, 0777 ); + + sc = chmod ( name, mode ); if ( sc ) { printf( "chmod %s: %s:\n", name, strerror(errno) ); } } +#define writeScript( _name, _contents ) \ + writeFile( _name, 0777, _contents ) + void fileio_start_shell(void) { int sc; + sc = mkdir("/scripts", 0777); if ( sc ) { printf( "mkdir /scripts: %s:\n", strerror(errno) ); } + sc = mkdir("/etc", 0777); + if ( sc ) { + printf( "mkdir /etc: %s:\n", strerror(errno) ); + } + + printf( + "Creating /etc/passwd and group with three useable accounts\n" + "root/pwd , test/pwd, rtems/NO PASSWORD" + ); + + 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" + ); + writeFile( + "/etc/group", + 0644, + "root:x:0:root\n" + "rtems:x:1:rtems\n" + "test:x:2:test\n" + "tty:x:3:tty\n" + ); + writeScript( "/scripts/js", "#! joel\n" -- cgit v1.2.3