summaryrefslogtreecommitdiffstats
path: root/testsuites/samples/fileio/init.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-12-09 19:34:04 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-12-09 19:34:04 +0000
commit527ecc7acf4162259bda716ff57d14513c47046c (patch)
tree585401a6ac6d8ae1f97a9acffa8358a972703d60 /testsuites/samples/fileio/init.c
parent2008-12-09 Jukka Pietarinen <jukka.pietarinen@mrf.fi> (diff)
downloadrtems-527ecc7acf4162259bda716ff57d14513c47046c.tar.bz2
2008-12-09 Joel Sherrill <joel.sherrill@oarcorp.com>
* fileio/init.c: Add explicit creation of /etc/passwd and /etc/group so we have a test case for real password checking.
Diffstat (limited to 'testsuites/samples/fileio/init.c')
-rw-r--r--testsuites/samples/fileio/init.c37
1 files changed, 35 insertions, 2 deletions
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 <rtems/shell.h>
-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"