diff options
author | Alexander Sulfrian <alex@spline.inf.fu-berlin.de> | 2016-06-21 03:10:13 +0200 |
---|---|---|
committer | Alexander Sulfrian <alex@spline.inf.fu-berlin.de> | 2016-06-21 03:10:13 +0200 |
commit | ea57f7b2b7b295a06c6cb361f5c1e61f78e7b456 (patch) | |
tree | 422f3c018ce47b0ed1fa8278c4a572b978cd34b8 /Spline | |
parent | 339312c92a71a0943ae34aab27b1026bb3479d0d (diff) | |
download | srs-ea57f7b2b7b295a06c6cb361f5c1e61f78e7b456.tar.gz srs-ea57f7b2b7b295a06c6cb361f5c1e61f78e7b456.tar.bz2 srs-ea57f7b2b7b295a06c6cb361f5c1e61f78e7b456.zip |
Allow ~ in secret_file path
Diffstat (limited to 'Spline')
-rw-r--r-- | Spline/Socketmap/Srs.pm | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Spline/Socketmap/Srs.pm b/Spline/Socketmap/Srs.pm index 5917c00..c4a9623 100644 --- a/Spline/Socketmap/Srs.pm +++ b/Spline/Socketmap/Srs.pm @@ -54,7 +54,15 @@ sub post_configure_hook { # secrets my @secrets = (); if (defined $prop->{secret_file}) { - if (open(my $file, '<', $prop->{secret_file})) { + my $filename = $prop->{secret_file}; + # Replace ~ and ~user: + $filename =~ s{^~([^/]*)}{ + $1 + ? (getpwnam($1))[7] + : (getpwuid($<))[7] + }ex; + + if (open(my $file, '<', $filename)) { while (<$file>) { chomp; push @secrets, $_; @@ -62,7 +70,7 @@ sub post_configure_hook { close($file); } else { - $self->log(1, 'ERROR: Cannot open secret_file: "' . $prop->{secret_file} . '"'); + $self->log(1, 'ERROR: Cannot open secret_file: "' . $filename . '"'); } } |