Because perl-suid does not exist on wheezy.
#SUBDIRS = bin lib www aplinfo
SUBDIRS = aplinfo PVE bin www po
-DEB=${PACKAGE}_${VERSION}-${PACKAGERELEASE}_all.deb
+ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
+
+DEB=${PACKAGE}_${VERSION}-${PACKAGERELEASE}_${ARCH}.deb
all: ${SUBDIRS}
dpkg-deb --build dest
mv dest.deb ${DEB}
rm -rf dest
- lintian ${DEB}
+ # supress lintian error: statically-linked-binary usr/bin/pvemailforward
+ lintian -X binaries ${DEB}
.PHONY: upload
upload: ${DEB} check
pvedaemon \
pveversion \
pvesubscription \
+ pvemailforward.pl \
pveperf
MANS = \
pvesubscription.1 \
pveperf.1
-all: ${MANS}
+all: ${MANS} pvemailforward
%.1: %.1.pod
rm -f $@
vzrestore.1.pod: vzrestore
perl -I.. ./vzrestore printmanpod >$@
+pvemailforward: pvemailforward.c
+ gcc $< -o $@ -g -O2 -Wall -ldl -lc
+
.PHONY: install
install: ${SCRIPTS} ${MANS} pvemailforward
perl -I.. ./pvesh verifyapi
install -d ${BINDIR}
install -m 0755 ${SCRIPTS} ${BINDIR}
- install -m 2755 -g www-data pvemailforward ${BINDIR}
+ install -s -m 2755 -g www-data pvemailforward ${BINDIR}
install -d ${MAN1DIR}
install -m 0644 ${MANS} ${MAN1DIR}
install -d ${PODDIR}
.PHONY: clean
clean:
- rm -rf *~ ${MANS} *.1.pod
+ rm -rf *~ ${MANS} *.1.pod pvemailforward
set -e && for i in ${SUBDIRS}; do ${MAKE} -C $$i $@; done
+++ /dev/null
-#!/usr/bin/perl -w -T
-
-use strict;
-use warnings;
-use PVE::Tools;
-use PVE::SafeSyslog;
-use PVE::AccessControl;
-use PVE::Cluster qw (cfs_read_file);
-
-# NOTE: we need to run this with setgid www-data
-# else we cant read /etc/pve/user.cfg
-
-$( = $); # $GID = $EGID
-
-$ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
-
-initlog('pvemailforward');
-
-
-PVE::Cluster::cfs_update();
-
-eval {
- my $usercfg = cfs_read_file("user.cfg");
- my $rootcfg = $usercfg->{users}->{'root@pam'} || {};
- my $mailto = $rootcfg->{email};
-
- die "user 'root\@pam' does not have a email address\n" if !$mailto;
-
- syslog("info", "forward mail to <$mailto>");
-
- # we never send DSN (avoid mail loops)
- open(CMD, "|sendmail -bm -N never $mailto") ||
- die "can't exec sendmail - $!\n";
- while (<>) { print CMD $_; }
- close(CMD);
-};
-if (my $err = $@) {
- syslog('err', "mail forward failed: $err");
-}
-
-exit(0);
--- /dev/null
+/* see 'man perlsec'
+ *
+ */
+#include <unistd.h>
+#include <stdio.h>
+
+#define REAL_PATH "/usr/bin/pvemailforward.pl"
+
+int main(ac, av)
+char **av;
+{
+ execv(REAL_PATH, av);
+
+ fprintf(stderr, "exec '%s' failed\n", REAL_PATH);
+
+ return -1;
+}
--- /dev/null
+#!/usr/bin/perl -w -T
+
+use strict;
+use warnings;
+use PVE::Tools;
+use PVE::SafeSyslog;
+use PVE::AccessControl;
+use PVE::Cluster qw (cfs_read_file);
+
+# NOTE: we need to run this with setgid www-data
+# else we cant read /etc/pve/user.cfg
+
+$( = $); # $GID = $EGID
+
+$ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
+
+initlog('pvemailforward');
+
+
+PVE::Cluster::cfs_update();
+
+eval {
+ my $usercfg = cfs_read_file("user.cfg");
+ my $rootcfg = $usercfg->{users}->{'root@pam'} || {};
+ my $mailto = $rootcfg->{email};
+
+ die "user 'root\@pam' does not have a email address\n" if !$mailto;
+
+ syslog("info", "forward mail to <$mailto>");
+
+ # we never send DSN (avoid mail loops)
+ open(CMD, "|sendmail -bm -N never $mailto") ||
+ die "can't exec sendmail - $!\n";
+ while (<>) { print CMD $_; }
+ close(CMD);
+};
+if (my $err = $@) {
+ syslog('err', "mail forward failed: $err");
+}
+
+exit(0);