diff options
Diffstat (limited to '')
24 files changed, 400 insertions, 0 deletions
diff --git a/tests/su/02/env_FOO-options_- b/tests/su/02/env_FOO-options_- new file mode 120000 index 0000000..11a6d1a --- /dev/null +++ b/tests/su/02/env_FOO-options_- @@ -0,0 +1 @@ +run_env_test.sh
\ No newline at end of file diff --git a/tests/su/02/env_FOO-options_--login b/tests/su/02/env_FOO-options_--login new file mode 120000 index 0000000..11a6d1a --- /dev/null +++ b/tests/su/02/env_FOO-options_--login @@ -0,0 +1 @@ +run_env_test.sh
\ No newline at end of file diff --git a/tests/su/02/env_FOO-options_--login.exp b/tests/su/02/env_FOO-options_--login.exp new file mode 100755 index 0000000..8cd7679 --- /dev/null +++ b/tests/su/02/env_FOO-options_--login.exp @@ -0,0 +1,48 @@ +#!/usr/bin/expect + +if {$argc == 1} { + set command [lindex $argv 0] +} else { + set command "" +} + + +set timeout 2 +expect_after default {puts "\nFAIL"; exit 1} + +spawn /bin/bash +expect "# " + +send "id\r" +expect "uid=0(root) gid=0(root) groups=0(root)\r" +expect "# " + +send "export FOO=bar\r" +expect "# " + +#============================================================================= +# +# su --login, make a login shell +# +#============================================================================= +send "/bin/su --login $command myuser\r" +expect "$ " + +send "id\n" +expect "uid=424242(myuser) gid=424242(myuser) groups=424242(myuser)\r" +expect "$ " + +send_user "\n# FOO should be empty" +send "\r" +expect "$ " + +send "echo \"FOO=\\\"\$FOO\\\"\"\r" +expect "FOO=\"\"\r" +expect "$ " + +send "exit\r" +expect "# " + +puts "\nPASS" +exit 0 + diff --git a/tests/su/02/env_FOO-options_--login_bash b/tests/su/02/env_FOO-options_--login_bash new file mode 120000 index 0000000..11a6d1a --- /dev/null +++ b/tests/su/02/env_FOO-options_--login_bash @@ -0,0 +1 @@ +run_env_test.sh
\ No newline at end of file diff --git a/tests/su/02/env_FOO-options_--preserve-environment b/tests/su/02/env_FOO-options_--preserve-environment new file mode 120000 index 0000000..11a6d1a --- /dev/null +++ b/tests/su/02/env_FOO-options_--preserve-environment @@ -0,0 +1 @@ +run_env_test.sh
\ No newline at end of file diff --git a/tests/su/02/env_FOO-options_--preserve-environment.exp b/tests/su/02/env_FOO-options_--preserve-environment.exp new file mode 100755 index 0000000..88932bb --- /dev/null +++ b/tests/su/02/env_FOO-options_--preserve-environment.exp @@ -0,0 +1,48 @@ +#!/usr/bin/expect + +if {$argc == 1} { + set command [lindex $argv 0] +} else { + set command "" +} + + +set timeout 2 +expect_after default {puts "\nFAIL"; exit 1} + +spawn /bin/bash +expect "# " + +send "id\r" +expect "uid=0(root) gid=0(root) groups=0(root)\r" +expect "# " + +send "export FOO=bar\r" +expect "# " + +#============================================================================= +# +# su --preserve-environment, as for regular su, environment is preserved +# +#============================================================================= +send "/bin/su $command -m myuser\r" +expect "$ " + +send "id\n" +expect "uid=424242(myuser) gid=424242(myuser) groups=424242(myuser)\r" +expect "$ " + +send_user "\n# FOO should be 'bar'" +send "\r" +expect "$ " + +send "echo \"FOO=\\\"\$FOO\\\"\"\r" +expect "FOO=\"bar\"\r" +expect "$ " + +send "exit\r" +expect "# " + +puts "\nPASS" +exit 0 + diff --git a/tests/su/02/env_FOO-options_--preserve-environment_bash b/tests/su/02/env_FOO-options_--preserve-environment_bash new file mode 120000 index 0000000..11a6d1a --- /dev/null +++ b/tests/su/02/env_FOO-options_--preserve-environment_bash @@ -0,0 +1 @@ +run_env_test.sh
\ No newline at end of file diff --git a/tests/su/02/env_FOO-options_-.exp b/tests/su/02/env_FOO-options_-.exp new file mode 100755 index 0000000..6ba3e00 --- /dev/null +++ b/tests/su/02/env_FOO-options_-.exp @@ -0,0 +1,48 @@ +#!/usr/bin/expect + +if {$argc == 1} { + set command [lindex $argv 0] +} else { + set command "" +} + + +set timeout 2 +expect_after default {puts "\nFAIL"; exit 1} + +spawn /bin/bash +expect "# " + +send "id\r" +expect "uid=0(root) gid=0(root) groups=0(root)\r" +expect "# " + +send "export FOO=bar\r" +expect "# " + +#============================================================================= +# +# su -, make a login shell +# +#============================================================================= +send "/bin/su - $command myuser\r" +expect "$ " + +send "id\n" +expect "uid=424242(myuser) gid=424242(myuser) groups=424242(myuser)\r" +expect "$ " + +send_user "\n# FOO should be empty" +send "\r" +expect "$ " + +send "echo \"FOO=\\\"\$FOO\\\"\"\r" +expect "FOO=\"\"\r" +expect "$ " + +send "exit\r" +expect "# " + +puts "\nPASS" +exit 0 + diff --git a/tests/su/02/env_FOO-options_-_bash b/tests/su/02/env_FOO-options_-_bash new file mode 120000 index 0000000..11a6d1a --- /dev/null +++ b/tests/su/02/env_FOO-options_-_bash @@ -0,0 +1 @@ +run_env_test.sh
\ No newline at end of file diff --git a/tests/su/02/env_FOO-options_-l b/tests/su/02/env_FOO-options_-l new file mode 120000 index 0000000..11a6d1a --- /dev/null +++ b/tests/su/02/env_FOO-options_-l @@ -0,0 +1 @@ +run_env_test.sh
\ No newline at end of file diff --git a/tests/su/02/env_FOO-options_-l-m b/tests/su/02/env_FOO-options_-l-m new file mode 120000 index 0000000..11a6d1a --- /dev/null +++ b/tests/su/02/env_FOO-options_-l-m @@ -0,0 +1 @@ +run_env_test.sh
\ No newline at end of file diff --git a/tests/su/02/env_FOO-options_-l-m.exp b/tests/su/02/env_FOO-options_-l-m.exp new file mode 100755 index 0000000..8b187a6 --- /dev/null +++ b/tests/su/02/env_FOO-options_-l-m.exp @@ -0,0 +1,48 @@ +#!/usr/bin/expect + +if {$argc == 1} { + set command [lindex $argv 0] +} else { + set command "" +} + + +set timeout 2 +expect_after default {puts "\nFAIL"; exit 1} + +spawn /bin/bash +expect "# " + +send "id\r" +expect "uid=0(root) gid=0(root) groups=0(root)\r" +expect "# " + +send "export FOO=bar\r" +expect "# " + +#============================================================================= +# +# su -l -m, make a login shell, but preserve environment +# +#============================================================================= +send "/bin/su -l -m $command myuser\r" +expect "$ " + +send "id\n" +expect "uid=424242(myuser) gid=424242(myuser) groups=424242(myuser)\r" +expect "$ " + +send_user "\n# FOO should be 'bar'" +send "\r" +expect "$ " + +send "echo \"FOO=\\\"\$FOO\\\"\"\r" +expect "FOO=\"bar\"\r" +expect "$ " + +send "exit\r" +expect "# " + +puts "\nPASS" +exit 0 + diff --git a/tests/su/02/env_FOO-options_-l-m_bash b/tests/su/02/env_FOO-options_-l-m_bash new file mode 120000 index 0000000..11a6d1a --- /dev/null +++ b/tests/su/02/env_FOO-options_-l-m_bash @@ -0,0 +1 @@ +run_env_test.sh
\ No newline at end of file diff --git a/tests/su/02/env_FOO-options_-l.exp b/tests/su/02/env_FOO-options_-l.exp new file mode 100755 index 0000000..a23f8c4 --- /dev/null +++ b/tests/su/02/env_FOO-options_-l.exp @@ -0,0 +1,48 @@ +#!/usr/bin/expect + +if {$argc == 1} { + set command [lindex $argv 0] +} else { + set command "" +} + + +set timeout 2 +expect_after default {puts "\nFAIL"; exit 1} + +spawn /bin/bash +expect "# " + +send "id\r" +expect "uid=0(root) gid=0(root) groups=0(root)\r" +expect "# " + +send "export FOO=bar\r" +expect "# " + +#============================================================================= +# +# su -l, make a login shell +# +#============================================================================= +send "/bin/su - $command myuser\r" +expect "$ " + +send "id\n" +expect "uid=424242(myuser) gid=424242(myuser) groups=424242(myuser)\r" +expect "$ " + +send_user "\n# FOO should be empty" +send "\r" +expect "$ " + +send "echo \"FOO=\\\"\$FOO\\\"\"\r" +expect "FOO=\"\"\r" +expect "$ " + +send "exit\r" +expect "# " + +puts "\nPASS" +exit 0 + diff --git a/tests/su/02/env_FOO-options_-l_bash b/tests/su/02/env_FOO-options_-l_bash new file mode 120000 index 0000000..11a6d1a --- /dev/null +++ b/tests/su/02/env_FOO-options_-l_bash @@ -0,0 +1 @@ +run_env_test.sh
\ No newline at end of file diff --git a/tests/su/02/env_FOO-options_-m b/tests/su/02/env_FOO-options_-m new file mode 120000 index 0000000..11a6d1a --- /dev/null +++ b/tests/su/02/env_FOO-options_-m @@ -0,0 +1 @@ +run_env_test.sh
\ No newline at end of file diff --git a/tests/su/02/env_FOO-options_-m.exp b/tests/su/02/env_FOO-options_-m.exp new file mode 100755 index 0000000..061aacb --- /dev/null +++ b/tests/su/02/env_FOO-options_-m.exp @@ -0,0 +1,48 @@ +#!/usr/bin/expect + +if {$argc == 1} { + set command [lindex $argv 0] +} else { + set command "" +} + + +set timeout 2 +expect_after default {puts "\nFAIL"; exit 1} + +spawn /bin/bash +expect "# " + +send "id\r" +expect "uid=0(root) gid=0(root) groups=0(root)\r" +expect "# " + +send "export FOO=bar\r" +expect "# " + +#============================================================================= +# +# su -m, as for regular su, environment is preserved +# +#============================================================================= +send "/bin/su $command -m myuser\r" +expect "$ " + +send "id\n" +expect "uid=424242(myuser) gid=424242(myuser) groups=424242(myuser)\r" +expect "$ " + +send_user "\n# FOO should be 'bar'" +send "\r" +expect "$ " + +send "echo \"FOO=\\\"\$FOO\\\"\"\r" +expect "FOO=\"bar\"\r" +expect "$ " + +send "exit\r" +expect "# " + +puts "\nPASS" +exit 0 + diff --git a/tests/su/02/env_FOO-options_-m_bash b/tests/su/02/env_FOO-options_-m_bash new file mode 120000 index 0000000..11a6d1a --- /dev/null +++ b/tests/su/02/env_FOO-options_-m_bash @@ -0,0 +1 @@ +run_env_test.sh
\ No newline at end of file diff --git a/tests/su/02/env_FOO-options_-p b/tests/su/02/env_FOO-options_-p new file mode 120000 index 0000000..11a6d1a --- /dev/null +++ b/tests/su/02/env_FOO-options_-p @@ -0,0 +1 @@ +run_env_test.sh
\ No newline at end of file diff --git a/tests/su/02/env_FOO-options_-p- b/tests/su/02/env_FOO-options_-p- new file mode 120000 index 0000000..11a6d1a --- /dev/null +++ b/tests/su/02/env_FOO-options_-p- @@ -0,0 +1 @@ +run_env_test.sh
\ No newline at end of file diff --git a/tests/su/02/env_FOO-options_-p-.exp b/tests/su/02/env_FOO-options_-p-.exp new file mode 100755 index 0000000..fc84896 --- /dev/null +++ b/tests/su/02/env_FOO-options_-p-.exp @@ -0,0 +1,48 @@ +#!/usr/bin/expect + +if {$argc == 1} { + set command [lindex $argv 0] +} else { + set command "" +} + + +set timeout 2 +expect_after default {puts "\nFAIL"; exit 1} + +spawn /bin/bash +expect "# " + +send "id\r" +expect "uid=0(root) gid=0(root) groups=0(root)\r" +expect "# " + +send "export FOO=bar\r" +expect "# " + +#============================================================================= +# +# su -p -, make a login shell, but preserve environment +# +#============================================================================= +send "/bin/su -p $command - myuser\r" +expect "$ " + +send "id\n" +expect "uid=424242(myuser) gid=424242(myuser) groups=424242(myuser)\r" +expect "$ " + +send_user "\n# FOO should be 'bar'" +send "\r" +expect "$ " + +send "echo \"FOO=\\\"\$FOO\\\"\"\r" +expect "FOO=\"bar\"\r" +expect "$ " + +send "exit\r" +expect "# " + +puts "\nPASS" +exit 0 + diff --git a/tests/su/02/env_FOO-options_-p-_bash b/tests/su/02/env_FOO-options_-p-_bash new file mode 120000 index 0000000..11a6d1a --- /dev/null +++ b/tests/su/02/env_FOO-options_-p-_bash @@ -0,0 +1 @@ +run_env_test.sh
\ No newline at end of file diff --git a/tests/su/02/env_FOO-options_-p.exp b/tests/su/02/env_FOO-options_-p.exp new file mode 100755 index 0000000..061aacb --- /dev/null +++ b/tests/su/02/env_FOO-options_-p.exp @@ -0,0 +1,48 @@ +#!/usr/bin/expect + +if {$argc == 1} { + set command [lindex $argv 0] +} else { + set command "" +} + + +set timeout 2 +expect_after default {puts "\nFAIL"; exit 1} + +spawn /bin/bash +expect "# " + +send "id\r" +expect "uid=0(root) gid=0(root) groups=0(root)\r" +expect "# " + +send "export FOO=bar\r" +expect "# " + +#============================================================================= +# +# su -m, as for regular su, environment is preserved +# +#============================================================================= +send "/bin/su $command -m myuser\r" +expect "$ " + +send "id\n" +expect "uid=424242(myuser) gid=424242(myuser) groups=424242(myuser)\r" +expect "$ " + +send_user "\n# FOO should be 'bar'" +send "\r" +expect "$ " + +send "echo \"FOO=\\\"\$FOO\\\"\"\r" +expect "FOO=\"bar\"\r" +expect "$ " + +send "exit\r" +expect "# " + +puts "\nPASS" +exit 0 + diff --git a/tests/su/02/env_FOO-options_-p_bash b/tests/su/02/env_FOO-options_-p_bash new file mode 120000 index 0000000..11a6d1a --- /dev/null +++ b/tests/su/02/env_FOO-options_-p_bash @@ -0,0 +1 @@ +run_env_test.sh
\ No newline at end of file |