Commit 6eed0200 authored by Xavier Guimard's avatar Xavier Guimard

Try to change gid/uid when possible (#921)

parent cfeea8ec
...@@ -466,14 +466,14 @@ install_bin: install_conf_dir ...@@ -466,14 +466,14 @@ install_bin: install_conf_dir
${SRCCOMMONDIR}/scripts/lemonldap-ng-cli \ ${SRCCOMMONDIR}/scripts/lemonldap-ng-cli \
$(RBINDIR) $(RBINDIR)
@if [ ! "$(APACHEUSER)" ]; then \ @if [ ! "$(APACHEUSER)" ]; then \
$(PERL) -i -pe 's#__APACHEUSER__#nobody#g;' $(RBINDIR)/lmConfigEditor; \ $(PERL) -i -pe 's#__APACHEUSER__#nobody#g;' $(RBINDIR)/lmConfigEditor $(RBINDIR)/lemonldap-ng-cli; \
else \ else \
$(PERL) -i -pe 's#__APACHEUSER__#$(APACHEUSER)#g;' $(RBINDIR)/lmConfigEditor; \ $(PERL) -i -pe 's#__APACHEUSER__#$(APACHEUSER)#g;' $(RBINDIR)/lmConfigEditor $(RBINDIR)/lemonldap-ng-cli; \
fi fi
@if [ ! "$(APACHEGROUP)" ]; then \ @if [ ! "$(APACHEGROUP)" ]; then \
$(PERL) -i -pe 's#__APACHEGROUP__#nobody#g;' $(RBINDIR)/lmConfigEditor; \ $(PERL) -i -pe 's#__APACHEGROUP__#nobody#g;' $(RBINDIR)/lmConfigEditor $(RBINDIR)/lemonldap-ng-cli; \
else \ else \
$(PERL) -i -pe 's#__APACHEGROUP__#$(APACHEGROUP)#g;' $(RBINDIR)/lmConfigEditor; \ $(PERL) -i -pe 's#__APACHEGROUP__#$(APACHEGROUP)#g;' $(RBINDIR)/lmConfigEditor $(RBINDIR)/lemonldap-ng-cli; \
fi fi
@chmod +x $(RBINDIR)/* @chmod +x $(RBINDIR)/*
......
...@@ -2,9 +2,15 @@ ...@@ -2,9 +2,15 @@
use warnings; use warnings;
use strict; use strict;
use POSIX;
my $action; my $action;
eval {
POSIX::setgid( scalar( getgrnam('__APACHEGROUP__') ) );
POSIX::setuid( scalar( getpwnam('__APACHEUSER__') ) );
};
for ( my $i = 0 ; $i < @ARGV ; $i++ ) { for ( my $i = 0 ; $i < @ARGV ; $i++ ) {
if ( $ARGV[$i] =~ /^-/ ) { if ( $ARGV[$i] =~ /^-/ ) {
$i++; $i++;
......
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