Commit c2ba461d authored by Leigh Stoller's avatar Leigh Stoller

Allow SUEXEC() to take user/group/project class objects. Mostly cause we

need to watch for group names longer then FreeBSD max, and convert to
unix_gid, and easier to fix the caller code if I do that in one place.
parent b40b6046
<?php
#
# Copyright (c) 2000-2017 University of Utah and the Flux Group.
# Copyright (c) 2000-2018 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -453,6 +453,43 @@ function SUEXEC($uid, $gid, $cmdandargs, $action) {
global $suexec_output, $suexec_output_array;
global $TBMAIL_LOGS;
#
# Allow for uid/gid to be user/group/project objects.
#
if (is_object($uid)) {
$object = $gid;
if (is_a($object, "User")) {
$uid = $object->uid();
}
else {
error_log("SUEXEC: Bad uid argument");
return -1;
}
}
if (is_object($gid)) {
$object = $gid;
if (is_a($object, "Project")) {
$gid = $object->pid();
# For debugging, better if we use name if we can, but if the
# name is longer then 16 chars, need to use unix gid.
if (strlen($gid) > 16) {
$gid = $object->unix_gid();
}
}
elseif (is_a($object, "Group")) {
$gid = $object->gid();
# For debugging, better if we use name if we can, but if the
# name is longer then 16 chars, need to use unix gid.
if (strlen($gid) > 16) {
$gid = $object->unix_gid();
}
}
else {
error_log("SUEXEC: Bad gid argument");
return -1;
}
}
$mail_tblog = 0;
if ($action & SUEXEC_ACTION_MAIL_TBLOGS) {
$action &= ~SUEXEC_ACTION_MAIL_TBLOGS;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment