initial commit of file from CVS for smeserver-phplist on Sat Sep 7 20:52:04 AEST 2024
This commit is contained in:
13
root/usr/lib/systemd/system/phplist.service
Normal file
13
root/usr/lib/systemd/system/phplist.service
Normal file
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=phplist process queues
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
ExecStartPre=-/sbin/e-smith/service-status phplist
|
||||
ExecStart=/usr/sbin/e-smith/systemd/phplist
|
||||
Restart=always
|
||||
Restartsec=10s
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=sme-server.target
|
2
root/usr/local/bin/phplist
Normal file
2
root/usr/local/bin/phplist
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
/usr/bin/php80 /usr/share/phplist/www/admin/index.php -c /etc/phplist/config.php $*
|
10
root/usr/sbin/e-smith/systemd/phplist
Normal file
10
root/usr/sbin/e-smith/systemd/phplist
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
exec 2>&1
|
||||
|
||||
cd /usr/local/bin/
|
||||
while true; do
|
||||
/usr/local/bin/setuidgid www ./phplist -pprocessbounces
|
||||
/usr/local/bin/setuidgid www ./phplist -pprocessqueue
|
||||
sleep 120
|
||||
done
|
119
root/usr/share/phplist/www/admin/auth/external_auth.inc
Normal file
119
root/usr/share/phplist/www/admin/auth/external_auth.inc
Normal file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
require_once dirname(__FILE__).'/../accesscheck.php';
|
||||
|
||||
$_REQUEST["login"] = $_SERVER["REMOTE_USER"];
|
||||
$_REQUEST["password"] = $_SERVER["REMOTE_USER"];
|
||||
|
||||
class admin_auth {
|
||||
|
||||
function validateLogin($login,$password) {
|
||||
if (isset($_SERVER["REMOTE_USER"]) && $_SERVER["REMOTE_USER"] !== ""){
|
||||
$query = ' select password, disabled, id' .
|
||||
' from %s' .
|
||||
' where loginname = ?';
|
||||
$query = sprintf($query, $GLOBALS['tables']['admin']);
|
||||
$req = Sql_Query_Params($query, array($login));
|
||||
$admindata = Sql_Fetch_Assoc($req);
|
||||
// Nothing in the database yet ? Reject login
|
||||
if (!$admindata['id']){
|
||||
return array(0,s("Login failed"));
|
||||
}
|
||||
elseif ($admindata["disabled"]) {
|
||||
return array(0,s("your account has been disabled"));
|
||||
}
|
||||
else{
|
||||
return array($admindata['id'],"OK");
|
||||
}
|
||||
}
|
||||
else{
|
||||
return array(0,s("Login failed"));
|
||||
}
|
||||
}
|
||||
|
||||
function getPassword($email) {
|
||||
$email = preg_replace("/[;,\"\']/","",$email);
|
||||
$query = sprintf('select email, password, loginname from %s where email = ?', $GLOBALS['tables']['admin']);
|
||||
$req = Sql_Query_Params($query, array($email));
|
||||
if (Sql_Num_Rows($req)) {
|
||||
$row = Sql_Fetch_Row($req);
|
||||
return $row[1];
|
||||
}
|
||||
}
|
||||
|
||||
function validateAccount($id) {
|
||||
/* can only do this after upgrade, which means
|
||||
* that the first login will always fail
|
||||
$query
|
||||
= ' select id, disabled,password,privileges'
|
||||
. ' from %s'
|
||||
. ' where id = ?';
|
||||
*/
|
||||
|
||||
$query
|
||||
= ' select id, disabled,password'
|
||||
. ' from %s'
|
||||
. ' where id = ?';
|
||||
|
||||
$query = sprintf($query, $GLOBALS['tables']['admin']);
|
||||
$req = Sql_Query_Params($query, array($id));
|
||||
$data = Sql_Fetch_Row($req);
|
||||
if (!$data[0]) {
|
||||
return array(0,s("No such account"));
|
||||
} elseif ($data[1]) {
|
||||
return array(0,s("your account has been disabled"));
|
||||
}
|
||||
|
||||
## do this seperately from above, to avoid lock out when the DB hasn't been upgraded.
|
||||
## so, ignore the error
|
||||
$query
|
||||
= ' select privileges'
|
||||
. ' from %s'
|
||||
. ' where id = ?';
|
||||
|
||||
$query = sprintf($query, $GLOBALS['tables']['admin']);
|
||||
$req = Sql_Query_Params($query, array($id),1);
|
||||
if ($req) {
|
||||
$data = Sql_Fetch_Row($req);
|
||||
} else {
|
||||
$data = array();
|
||||
}
|
||||
|
||||
if (!empty($data[0])) {
|
||||
$_SESSION['privileges'] = unserialize($data[0]);
|
||||
}
|
||||
return array(1,"OK");
|
||||
}
|
||||
|
||||
function adminName($id) {
|
||||
$req = Sql_Fetch_Row_Query(sprintf('select loginname from %s where id = %d',$GLOBALS["tables"]["admin"],$id));
|
||||
return $req[0] ? $req[0] : s("Nobody");
|
||||
}
|
||||
|
||||
function adminEmail($id) {
|
||||
$req = Sql_Fetch_Row_Query(sprintf('select email from %s where id = %d',$GLOBALS["tables"]["admin"],$id));
|
||||
return $req[0] ? $req[0] : "";
|
||||
}
|
||||
|
||||
function adminIdForEmail($email) { #Obtain admin Id from a given email address.
|
||||
$req = Sql_Fetch_Row_Query(sprintf('select id from %s where email = "%s"',$GLOBALS["tables"]["admin"],sql_escape($email)));
|
||||
return $req[0] ? $req[0] : "";
|
||||
}
|
||||
|
||||
function isSuperUser($id) {
|
||||
$req = Sql_Fetch_Row_Query(sprintf('select superuser from %s where id = %d',$GLOBALS["tables"]["admin"],$id));
|
||||
return $req[0];
|
||||
}
|
||||
|
||||
function listAdmins() {
|
||||
$result = array();
|
||||
$req = Sql_Query("select id,loginname from {$GLOBALS["tables"]["admin"]} order by loginname");
|
||||
while ($row = Sql_Fetch_Array($req)) {
|
||||
$result[$row["id"]] = $row["loginname"];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user