diff options
author | cos <cos> | 2015-12-06 22:32:36 +0100 |
---|---|---|
committer | cos <cos> | 2016-07-17 20:10:58 +0200 |
commit | f97a907b9c3a52ef78ebe12223157bac9399e042 (patch) | |
tree | 81ccff7e9e5c34127a3c3d820fa46950ea865cb7 | |
parent | 7ab3e35b073fe488315c6f9603151d2302a0261b (diff) | |
download | mat-f97a907b9c3a52ef78ebe12223157bac9399e042.zip |
Have authenticate_session modify a file when an argument is provided.
-rwxr-xr-x | authenticate_session | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/authenticate_session b/authenticate_session index 8995080..4ff6ace 100755 --- a/authenticate_session +++ b/authenticate_session @@ -2,4 +2,17 @@ AUTH="'authenticated' => 'yes'" -sed "s/\('_SESSION_REMOTE_ADDR'\)/$AUTH, \1/" +replace_stream() +{ + sed "s/\('_SESSION_REMOTE_ADDR'\)/$AUTH, \1/" +} + +if [ "$1" ]; +then + cd /tmp + mv "$1" "$1".unauthenticated + cat "$1".unauthenticated|replace_stream > "$1" + chown www-data.www-data "$1" +else + replace_stream +fi |