Skip to content

Commit

Permalink
Close conf files
Browse files Browse the repository at this point in the history
  • Loading branch information
guimard committed Jan 20, 2025
1 parent 4e65801 commit 1c72250
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Add hook to modify refresh\_token
* Fix offline sessions count
* Add patch for buggy OIDC providers
* Close conf files

## v2.20.1-1 _(2024-11-19)_
* Update to 2.20.1
Expand Down
1 change: 1 addition & 0 deletions base-no-s6/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ RUN echo "# Install packages from ${DEBIAN_VERSION} (${LLNGDIST})" && \
perl -000 -MJSON -i -ne '$_=JSON::from_json($_);$_->{reloadUrls}={};print JSON->new->pretty->canonical->encode($_)' /var/lib/lemonldap-ng/conf/lmConf-1.json && \
perl -i -pe 's/\r//g' /usr/share/perl5/Lemonldap/NG/Common/Conf/DefaultValues.pm && \
echo "patch no-none.patch" && patch -p1 <no-none.patch && \
echo "patch close-conf.patch" && patch -p1 <close-conf.patch && \
echo "patch oidc-op-claims.patch" && patch -p1 <oidc-op-claims.patch && \
rm -f *.patch

Expand Down
12 changes: 12 additions & 0 deletions base-no-s6/close-conf.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/usr/share/perl5/Lemonldap/NG/Common/Conf/Backends/File.pm b/usr/share/perl5/Lemonldap/NG/Common/Conf/Backends/File.pm
index 83ac49ca2..275fcf769 100644
--- a/usr/share/perl5/Lemonldap/NG/Common/Conf/Backends/File.pm
+++ b/usr/share/perl5/Lemonldap/NG/Common/Conf/Backends/File.pm
@@ -123,6 +123,7 @@ sub load {
}
binmode FILE;
$f = join( '', <FILE> );
+ close FILE;
eval { $ret = from_json( $f, { allow_nonref => 1 } ) };
if ($@) {
print STDERR "$@\n";
1 change: 1 addition & 0 deletions base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ RUN echo "# Install packages from ${DEBIAN_VERSION} (${LLNGDIST})" && \
perl -000 -MJSON -i -ne '$_=JSON::from_json($_);$_->{reloadUrls}={};print JSON->new->pretty->canonical->encode($_)' /var/lib/lemonldap-ng/conf/lmConf-1.json && \
perl -i -pe 's/\r//g' /usr/share/perl5/Lemonldap/NG/Common/Conf/DefaultValues.pm && \
echo "patch no-none.patch" && patch -p1 <no-none.patch && \
echo "patch close-conf.patch" && patch -p1 <close-conf.patch && \
echo "patch oidc-op-claims.patch" && patch -p1 <oidc-op-claims.patch && \
rm -f *.patch

Expand Down
12 changes: 12 additions & 0 deletions base/close-conf.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/usr/share/perl5/Lemonldap/NG/Common/Conf/Backends/File.pm b/usr/share/perl5/Lemonldap/NG/Common/Conf/Backends/File.pm
index 83ac49ca2..275fcf769 100644
--- a/usr/share/perl5/Lemonldap/NG/Common/Conf/Backends/File.pm
+++ b/usr/share/perl5/Lemonldap/NG/Common/Conf/Backends/File.pm
@@ -123,6 +123,7 @@ sub load {
}
binmode FILE;
$f = join( '', <FILE> );
+ close FILE;
eval { $ret = from_json( $f, { allow_nonref => 1 } ) };
if ($@) {
print STDERR "$@\n";

0 comments on commit 1c72250

Please sign in to comment.