File:  [LON-CAPA] / doc / loncapafiles / wrap_setuid.piml
Revision 1.53: download - view: text, annotated - select for diffs
Tue May 9 00:55:29 2023 UTC (10 months, 3 weeks ago) by raeburn
Branches: MAIN
CVS tags: version_2_12_X, HEAD
- Support Fedora 36, Fedora 37 and Fedora 38.

<!DOCTYPE piml PUBLIC "-//TUX/DTD piml 1.0 Final//EN" 
	"http://lpml.sourceforge.net/DTD/piml.dtd">
<!-- wrap_setuid.piml -->
<!-- Guy Albertelli -->

<!-- $Id: wrap_setuid.piml,v 1.53 2023/05/09 00:55:29 raeburn Exp $ -->

<!--

This file is part of the LearningOnline Network with CAPA (LON-CAPA).

LON-CAPA is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

LON-CAPA is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with LON-CAPA; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

/home/httpd/html/adm/gpl.txt

http://www.lon-capa.org/

-->

<piml>
<targetroot>/</targetroot>
<files>
<file>
<target dist="default">/home/httpd/perl</target>
<perlscript mode="fg" dist="default">
#print("Not wrapping setuid scripts\n");
</perlscript>
<perlscript mode="fg" dist="suse9.2 suse9.3 sles9 sles10 sles11 sles12 sles15 suse10.1 suse10.2 suse10.3 suse11.1 suse11.2 suse11.3 suse11.4 suse12.1 suse12.2 suse12.3 suse13.1 suse13.2 fedora14 fedora15 fedora16 fedora17 fedora18 fedora19 fedora20 fedora21 fedora22 fedora23 fedora24 fedora25 fedora26 fedora27 fedora28 fedora29 fedora30 fedora31 fedora32 fedora33 fedora34 fedora35 fedora36 fedora37 fedora38 ubuntu12 ubuntu14 ubuntu16 ubuntu18 ubuntu20 ubuntu22 rhes7 centos7 scientific7 oracle7 rhes8 centos8 oracle8 rocky8 alma8 centos8-stream centos9-stream rhes9 oracle9 rocky9 alma9">

$fslist='<TARGET />';
open(FIND,  "find <TARGET /> -xdev -type f \\( -perm -04000 -o -perm -02000 \\) -print|");
while (&lt;FIND&gt;) {
    chop;
    next unless -T;
    print("Fixing ", $_, "\n");
    ($dir,$file) = m|(.*)/(.*)|;
    chdir $dir || die "Can't chdir to $dir";
    ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks)
     = stat($file);
    die("Can't stat $_") unless $ino;
    rename($file,".$file");
    chmod(($mode & 01777), ".$file");# wipe out set[ug]id bits
    open(C,"&gt;.tmp$$.c") || die("Can't write C program for $_");
    $real = "$dir/.$file";
    print C '
        int execv (const char *filename, char *const argv[]);
        int main(argc,argv)
        int argc;
        char **argv;
        {
                execv("' . $real . '",argv);
        }
';
    close C;
    system('/usr/bin/cc', ".tmp$$.c", '-o', $file);
    die("Can't compile new $_") if $?;
    chown($uid, $gid, $file);
    chmod($mode, $file);

    unlink(".tmp$$.c");
    chdir('/');
}

</perlscript>
</file>
</files>
</piml>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>