Skip to content

Commit a360b70

Browse files
committed
enable ageing out pam pw (postgresql only)
1 parent 3959cc4 commit a360b70

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

irods/test/pam.bats/funcs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,14 @@ finalize_pam_login_for_alice() {
117117
test_specific_cleanup() {
118118
eval "$CLEANUP"
119119
}
120+
121+
# PostgreSQL only
122+
age_out_pam_password() {
123+
local id=$(iquest %s "select USER_ID where USER_NAME = '$1'")
124+
local offset=$(sudo su - postgres -c "psql -t ICAT -c 'select pass_expiry_ts from r_user_password where user_id = $id'")
125+
local mtime=$(sudo su - postgres -c "psql -t ICAT -c 'select modify_ts from r_user_password where user_id = $id'")
126+
mtime=$(sed 's/^\s*0//' <<<"$mtime")
127+
((offset+=1))
128+
local new_time=$((mtime - offset))
129+
sudo su - postgres -c "psql ICAT -c 'update r_user_password set create_ts=$new_time, modify_ts=$new_time where user_id=$id'"
130+
}

0 commit comments

Comments
 (0)