summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
authorUrban Müller2019-09-24 14:56:16 +0200
committerUrban Müller2019-09-24 14:56:16 +0200
commit784642327bfb0d3456ce94257c4108f6b577f99a (patch)
treef7be7a5a7d69677207fb5d9bd81e758289c531c8 /it.class
parente04f87ccc76faaf1115601185d254f1694e438a7 (diff)
downloaditools-784642327bfb0d3456ce94257c4108f6b577f99a.tar.gz
itools-784642327bfb0d3456ce94257c4108f6b577f99a.tar.bz2
itools-784642327bfb0d3456ce94257c4108f6b577f99a.zip
use effective uid, avoid it::exec
Diffstat (limited to 'it.class')
-rw-r--r--it.class5
1 files changed, 4 insertions, 1 deletions
diff --git a/it.class b/it.class
index 4d05a2c..ee5b8ad 100644
--- a/it.class
+++ b/it.class
@@ -290,7 +290,10 @@ static function error($p = array())
if (!it::is_live() || array_diff($debugparams, it::match('[-\w]+', $GLOBALS['ULTRAHOME'], ['all' => true]), ["devel", "twin", "utf8check", gethostname()]))
$type = mb_strtolower($type);
- $from = trim(it::exec('echo \"$USER@`hostname`\" "<$USER@`dnsdomainname | grep . || hostname -f`>"'));
+ $hostname = gethostname();
+ $user = posix_getpwuid(posix_geteuid())['name'];
+ $from = "\"$user@$hostname\" <$user@" . gethostbyaddr(gethostbyname($hostname)) .">";
+
it::mail(['From' => $from, 'To' => $p['to'], 'Subject' => $type . substr($p['title'], 0, 160), 'Body' => $body, 'Cc' => $GLOBALS['it_defaultconfig']['error_cc'], 'forcemail' => !it::is_devel()]);
$p['title'] = "Mail: " . $p['title'];
}