Re: [exim] After upgrade to Exim 4.95 or 4.96: "setgroups: I…

Góra strony
Delete this message
Reply to this message
Autor: Lasse Törngren
Data:  
Dla: Andrew C Aitchison
CC: exim-users
Temat: Re: [exim] After upgrade to Exim 4.95 or 4.96: "setgroups: Invalid argument"
Hello Andrew,



Thank you for your feedback, your commitment and the patch. When applying your patch, the compilation gets through without any error. After rebooting and trying this version of Exim 4.96 I get a new error though:



sh-3.2# /usr/local/exim/bin/exim -q

2022-09-22 12:10:08.181 [683] RIKJJJ-0005NK-2O getdegid() != 6



To get my configuration working (with spam and malware control) both “_clamav” user and “Exim” user belongs to the group “mail” which has the group id of 6. I have also tested to create a new specific group for them, but that give the same error.



Do you have any ideas on the new error?



Best regards

Lasse



Från: Andrew C Aitchison <andrew@???>
Datum: torsdag 22 september 2022 11:32
Till: Lasse Törngren <lasse.torngren@???>
Kopia: <exim-users@???>
Ämne: Re: [exim] After upgrade to Exim 4.95 or 4.96: "setgroups: Invalid argument"



On Wed, 21 Sep 2022, Lasse Törngren via Exim-users wrote:



Hello Martin,



I tried your patching of the code and I am getting this error:

The changed code in priv.c:



if (priv_euid == root_uid)

{

if (seteuid(priv_euid) != 0)

    log_write(0, LOG_PANIC_DIE, "seteuid(%d): %s", priv_euid, strerror(errno));


if (setegid(priv_egid) != 0)

    log_write(0, LOG_PANIC_DIE, "setegid(%d): %s", priv_egid, strerror(errno)); 


/*if (priv_ngroups > 0 && setgroups(priv_ngroups, priv_groups) != 0)*/

if (priv_ngroups > 0 && setgroups(priv_ngroups, priv_groups) != 0





#ifndef OS_SETGROUPS_ZERO_DROPS_ALL

&& setgroups(0, NULL) != 0

#endif

&& setgroups(1, group_list) != 0)



    log_write(0, LOG_PANIC_DIE, "exim priv_restore setgroups: %s", strerror(errno));


if (geteuid() != priv_euid)

    log_write(0, LOG_PANIC_DIE, "getdeuid() != %d", priv_euid);


if (getegid() != priv_egid)

    log_write(0, LOG_PANIC_DIE, "getdegid() != %d", priv_egid);


}



Error when compiling:



cc priv.c

priv.c:72:20: error: use of undeclared identifier 'group_list'; did you mean 'lookup_list'?

&& setgroups(1, group_list) != 0)

                   ^~~~~~~~~~


                   lookup_list


./globals.h:713:22: note: 'lookup_list' declared here

extern lookup_info **lookup_list;      /* Array of pointers to available lookups */


                     ^


1 error generated.

make[1]: *** [priv.o] Error 1

make: *** [all] Error 2



I have attached a patch which I believe does what Martin suggested.

This puts the 3 lines of the #ifdef in the middle of the if condition

that calls setgroups.



Thanks for confirming that the error does happen in

the function priv_restore().



--

Andrew C. Aitchison                      Kendal, UK


                    andrew@???