From b7b33984fc5b444c99a547fae7274200d042976c Mon Sep 17 00:00:00 2001 From: lars Date: Thu, 30 Mar 2006 00:50:24 +0000 Subject: [PATCH] fix euid/uid/suid-problem with gnupg --- index.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/index.c b/index.c index b35b406..3dd93e0 100644 --- a/index.c +++ b/index.c @@ -5,11 +5,19 @@ /* C wrapper to allow ezmlm-web.cgi to run suid */ /* Copyright (C) 1999/2000, Guy Antony Halse, All Rights Reserved */ +/* Copyright (C) 02005/02006, Lars Kruse, All Rights Reserved */ /* See the README file in this distribution for copyright information */ int main(void) { - /* Change this path to wherever you decided to put ezmlm-web.cgi */ - execv("/usr/local/bin/ezmlm-web.cgi", NULL); + + /* Set the (real) uid to the same value, as the effective uid. + This is necesary, as (the suid) gpg tries to run on behalf of www-data + instead of the presumed user. + I hope, that this will not break on non-linux systems ... */ + setreuid(getuid(), -1); + + /* Change this path to wherever you decided to put ezmlm-web.cgi */ + execv("/usr/local/bin/ezmlm-web.cgi", NULL); /* Note that you could also use the following to allow a specific user to store their mailing lists and configuration file in a different