From 50ba2904975aa173457136861789e97ceea8d479 Mon Sep 17 00:00:00 2001
From: Guillaume Rousse <guillaume.rousse@renater.fr>
Date: Tue, 7 Nov 2017 16:32:59 +0100
Subject: [PATCH] make sendmail path configurable

---
 conf/manager.conf.in                | 3 +++
 lib/IdPAccountManager/WebRequest.pm | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/conf/manager.conf.in b/conf/manager.conf.in
index 242db66..dfc6493 100644
--- a/conf/manager.conf.in
+++ b/conf/manager.conf.in
@@ -75,3 +75,6 @@ federation_metadata_file_path = @sysconfdir@/edugain-md.xml
 
 # Valid account profiles
 account_profiles = fullset1, limitedset1, generic1, student1, student2, teacher1, teacher2, alumni1, librarywalkin1, employee1, researcher1
+
+# Path to sendmail executable
+sendmail_path = /usr/sbin/sendmail
diff --git a/lib/IdPAccountManager/WebRequest.pm b/lib/IdPAccountManager/WebRequest.pm
index 4062b86..0f70443 100755
--- a/lib/IdPAccountManager/WebRequest.pm
+++ b/lib/IdPAccountManager/WebRequest.pm
@@ -364,8 +364,9 @@ sub req_generate_token {
 
     my $sender    = $self->{configuration}->{notice_from};
     my $recipient = $self->{in}->{email_address};
+    my $sendmail  = $self->{configuration}->{sendmail_path};
 
-    open(my $handle, '|-', "/usr/sbin/sendmail -f $sender $recipient") or do {
+    open(my $handle, '|-', "$sendmail -f $sender $recipient") or do {
         push @{ $self->{out}->{errors} }, "mail_notification_error";
         $self->{logger}->errorf("Unable to run sendmail executable: %s", $ERRNO);
         return undef;
-- 
GitLab