Skip to content

Commit 6c49ada

Browse files
committed
add/rename scripts 5/8/9
1 parent 3b2e986 commit 6c49ada

3 files changed

Lines changed: 101 additions & 0 deletions

irods/test/scripts/test005_test_special_characters_in_passwords.bats renamed to irods/test/scripts/test005_test_special_characters_in_pam_passwords.bats

File renamed without changes.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env bats
2+
#
3+
# Test creation of .irodsA for iRODS native authentication using the free function,
4+
# irods.client_init.write_native_credentials_to_secrets_file
5+
6+
. "$BATS_TEST_DIRNAME"/test_support_functions
7+
PYTHON=python3
8+
9+
# Setup/prerequisites are same as for login_auth_test.
10+
# Run as ubuntu user with sudo; python_irodsclient must be installed (in either ~/.local or a virtualenv)
11+
#
12+
13+
@test create_irods_secrets_file {
14+
15+
rm -fr ~/.irods
16+
mkdir ~/.irods
17+
cat > ~/.irods/irods_environment.json <<-EOF
18+
{ "irods_host":"$(hostname)",
19+
"irods_port":1247,
20+
"irods_user_name":"rods",
21+
"irods_zone_name":"tempZone"
22+
}
23+
EOF
24+
$PYTHON -c "import irods.client_init; irods.client_init.write_native_irodsA_file('rods')"
25+
26+
# Define the core Python to be run, basically a minimal code block ensuring that we can authenticate to iRODS
27+
# without an exception being raised.
28+
29+
local SCRIPT="
30+
import irods.test.helpers as h
31+
ses = h.make_session()
32+
ses.collections.get(h.home_collection(ses))
33+
print ('env_auth_scheme=%s' % ses.pool.account._original_authentication_scheme)
34+
"
35+
OUTPUT=$($PYTHON -c "$SCRIPT")
36+
# Assert passing value
37+
[ $OUTPUT = "env_auth_scheme=native" ]
38+
39+
# New starting point with no .irodsA, assert iCommands not working
40+
rm -fr ~/.irods/.irodsA
41+
if ! ils 2>/tmp/stderr ; then
42+
true
43+
else
44+
echo 2>/tmp/stderr "ils should fail when no .irodsA is present"
45+
exit 2
46+
fi
47+
48+
# Write another .irodsA
49+
prc_write_irodsA.py native <<<"rods"
50+
51+
# Verify new .irodsA for both iCommands and PRC use.
52+
ils >/tmp/stdout
53+
OUTPUT=$($PYTHON -c "$SCRIPT")
54+
[ $OUTPUT = "env_auth_scheme=native" ]
55+
56+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bats
2+
3+
# Test creation and use of PAM password authentication info in .irodsA when the password itself contains
4+
# special characters (those known to have created issues in the past).
5+
6+
. "$BATS_TEST_DIRNAME"/test_support_functions
7+
PYTHON=python3
8+
9+
# Setup/prerequisites are same as for login_auth_test.
10+
# Run as ubuntu user with sudo; python_irodsclient must be installed (in either ~/.local or a virtualenv)
11+
12+
ALICES_NEW_PAM_PASSWD="new_&@;=_pass"
13+
14+
setup()
15+
{
16+
export SKIP_IINIT_FOR_PASSWORD=1
17+
setup_pam_login_for_alice "$ALICES_OLD_PAM_PASSWD"
18+
unset SKIP_IINIT_FOR_PASSWORD
19+
}
20+
21+
teardown()
22+
{
23+
finalize_pam_login_for_alice
24+
test_specific_cleanup
25+
}
26+
27+
@test main {
28+
irods_server_version ge 4.3.0 || {
29+
skip "Requires at least iRODS server 4.3.0"
30+
return
31+
}
32+
# Old .irodsA is already created, so we delete it and alter the pam password.
33+
sudo chpasswd <<<"alice:$ALICES_NEW_PAM_PASSWD"
34+
prc_write_irodsA.py pam_password <<<"$ALICES_NEW_PAM_PASSWD"
35+
36+
local SCRIPT="
37+
import irods.test.helpers as h
38+
ses = h.make_session()
39+
ses.collections.get(h.home_collection(ses))
40+
print ('env_auth_scheme=%s' % ses.pool.account._original_authentication_scheme)
41+
"
42+
OUTPUT=$($PYTHON -c "$SCRIPT")
43+
# Assert passing value
44+
[[ $OUTPUT = "env_auth_scheme=pam_password" ]]
45+
}

0 commit comments

Comments
 (0)