816d20be0cf95fc4eb1a8aa716639e73b8ba525e |
|
12-Feb-2018 |
Martti Rannanjärvi <martti.rannanjarvi@dovecot.fi> |
lib: Add restrict_access_flags enum to use with restrict_access[_by_env]()
Swap parameter locations in the functions to make sure plugins are
updated to use the new api. |
de0034cc6bb52585bc82289801435418a7ee7298 |
|
12-Feb-2018 |
Martti Rannanjärvi <martti.rannanjarvi@dovecot.fi> |
lib: Flip drop_setuid_root in restrict_access_settings |
c3d001b0dcb288093afd28a3bec20c62b734e863 |
|
09-Feb-2018 |
Timo Sirainen <timo.sirainen@dovecot.fi> |
lib: restrict_access_by_env() - Preserve RESTRICT_SETEXTRAGROUPS if root isn't dropped
This way service { extra_groups } is preserved for the whole duration of the
process lifetime (e.g. lmtp, doveadm) |
ba05e1999908512693d61c7e88cae04f607ba3c4 |
|
08-Feb-2018 |
Aki Tuomi <aki.tuomi@dovecot.fi> |
lib: Add restrict_access_get/set_dumpable |
bcb4e51a409d94ae670de96afb8483a4f7855294 |
|
01-Jan-2018 |
Stephan Bosch <stephan.bosch@dovecot.fi> |
Updated copyright notices to include the year 2018. |
df65573ad2999461f6bb93e035e54058d8c249a4 |
|
30-Nov-2017 |
Sergey Kitov <sergey.kitov@open-xchange.com> |
lib: Call prctl(PR_SET_DUMPABLE) only when PR_SET_DUMPABLE env variable is set |
f5cc54027974fac157b3dadfa93e551ad7c56b97 |
|
30-Nov-2017 |
Sergey Kitov <sergey.kitov@open-xchange.com> |
lib: Add logging of prctl(PR_SET_DUMPABLE) failure. |
8a2262007b0ccca11703a61788b77fd48b4aebad |
|
14-Sep-2017 |
Aki Tuomi <aki.tuomi@dovecot.fi> |
lib: chdir to / after chroot
Makes static analyzers more happy |
2454dfa32c93c20a8522c6ed42fe057baaac9f9a |
|
01-Jan-2017 |
Stephan Bosch <stephan.bosch@dovecot.fi> |
Updated copyright notices to include the year 2017. |
efe78d3ba24fc866af1c79b9223dc0809ba26cad |
|
24-Dec-2016 |
Stephan Bosch <stephan.bosch@dovecot.fi> |
global: Replaced all instances of memset(p, 0, sizeof(*p)) with the new i_zero() macro.
Used the following script:
C_FILES=`git ls-files *.c`
H_FILES=`git ls-files *.h`
for F in "$C_FILES $H_FILES"; do
echo "$F"
perl -p -i -e 's/safe_memset\(&\(?([^,]*)\)?,\s*0,\s*sizeof\(\g1\)\)/i_zero_safe(&$1)/g' $F
perl -p -i -e 's/safe_memset\(([^,]*),\s*0,\s*sizeof\(\*\g1\)\)/i_zero_safe($1)/g' $F
perl -p -i -e 's/memset\(&\(?([^,]*)\)?,\s*0,\s*sizeof\(\g1\)\)/i_zero(&$1)/g' $F
perl -p -i -e 's/memset\(([^,]*),\s*0,\s*sizeof\(\*\g1\)\)/i_zero($1)/g' $F
done |
42efa99e84af3eec6a7d23a8796034da114e0a24 |
|
19-Oct-2016 |
Aki Tuomi <aki.tuomi@dovecot.fi> |
lib: Copy target_uid from restrict_access_settings
One cannot assign to set->uid, causing compile error. |
ea42ee9ebd6f96e771c16e3fee705fa2e6fe609d |
|
19-Oct-2016 |
Aki Tuomi <aki.tuomi@dovecot.fi> |
lib: Add drop_setuid_root for restrict_access
drop_setuid_root, when set to true, will detect
and try to drop getuid()==0. This is done by
recovering current effective UID to set->uid
if set->uid == -1, and then doing seteuid(0).
It will also drop out any other extra privileges,
such as extra groups not requested for. |
f0339f522dc9c8e2e8a29ef9a3f937c431c6bd1b |
|
06-Jun-2016 |
Timo Sirainen <timo.sirainen@dovecot.fi> |
global: Use only explicit int -> bool conversions
These were checked with a patched clang. |
02c335c23bf5fa225a467c19f2c063fb0dc7b8c3 |
|
12-Jan-2016 |
Timo Sirainen <timo.sirainen@dovecot.fi> |
global: freshen copyright
git ls-files | xargs perl -p -i -e 's/(\d+)-201[0-5]/$1-2016/g;s/ (201[0-5]) Dovecot/ $1-2016 Dovecot/' |
814bf67459ad405a157af0b8940602024d7fadfe |
|
23-Sep-2015 |
Teemu Huovila <teemu.huovila@dovecot.fi> |
Remove now-unnecessary direct stdlib.h #includes. |
7cb128dc4cae2a03a742f63ba7afee23c78e3af0 |
|
05-Jan-2015 |
Phil Carmody <phil@dovecot.fi> |
global: freshen copyright
Robomatically:
git ls-files | xargs perl -p -i -e 's/(\d+)-201[0-4]/$1-2015/g;s/ (201[0-4]) Dovecot/ $1-2015 Dovecot/'
Happy 2015 everyone!
Signed-off-by: Phil Carmody <phil@dovecot.fi> |
a8c5a86d183db25a57bf193c06b41e092ec2e151 |
|
04-Feb-2014 |
Timo Sirainen <tss@iki.fi> |
Updated copyright notices to include year 2014. |
5a580c3a38ced62d4bcc95b8ac7c4f2935b5d294 |
|
02-Feb-2013 |
Timo Sirainen <tss@iki.fi> |
Oops :) Update copyrights to 2013 without breaking all .c files. |
cca4ba2a504d70a9fe9fee37f8433997359de52c |
|
02-Feb-2013 |
Timo Sirainen <tss@iki.fi> |
Updated copyright notices to include year 2013. |
750a396892931b1768eb8046fef5b52c84c2ce27 |
|
29-May-2012 |
Timo Sirainen <tss@iki.fi> |
Fixed assert-crash on some situations when user had no supplementary groups. |
5f5870385cff47efd2f58e7892f251cf13761528 |
|
12-Feb-2012 |
Timo Sirainen <tss@iki.fi> |
Updated copyright notices to include year 2012. |
928f1abfd7b6fcef28350a1b6a6930a3da24b862 |
|
28-Jan-2012 |
Timo Sirainen <tss@iki.fi> |
restrict_access(): If privileged and primary GIDs are the same, ignore privileged GID. |
4b5ba5014f3c75adf46efe7740bd3c9771b376ae |
|
09-Nov-2011 |
Timo Sirainen <tss@iki.fi> |
restrict_access*(): If setuid() fails with EAGAIN, suggest ulimit -u being the problem. |
70afae43cc78ea6ecca83f6c587072c442a15ec1 |
|
17-Mar-2011 |
Timo Sirainen <tss@iki.fi> |
Replaced all getpw/gr*() to use i_getpw/gr*() with improved error handling. |
2e37d45867d081db150ab78dad303b9077aea24f |
|
04-Mar-2011 |
Timo Sirainen <tss@iki.fi> |
Updated copyright notices to include year 2011. |
183bea41fa640dc8117f3eb45ff935cd81377a84 |
|
04-Mar-2011 |
Timo Sirainen <tss@iki.fi> |
Updated copyright notices to include year 2011. |
42c9dff737351b09158515e20bc263662c81a285 |
|
07-Feb-2011 |
Timo Sirainen <tss@iki.fi> |
restrict_access(): Show uid/gid source in setuid()/setgid() failure messages if given. |
8a7a946ae6d5398b60fffb97485667367e8f7318 |
|
31-Aug-2010 |
Timo Sirainen <tss@iki.fi> |
Fixed setgid() failure error message.
Based on patch by Clint Adams |
e8c0c0ba05a76410ef908ab5b694559d25f98ae7 |
|
12-May-2010 |
Timo Sirainen <tss@iki.fi> |
Added restrict_access_get_env()
--HG--
branch : HEAD |
9261dbf0675204898c6557591c7aa376e23a52b2 |
|
07-Apr-2010 |
Timo Sirainen <tss@iki.fi> |
Started using str_to_*() functions instead of libc's ones.
--HG--
branch : HEAD |
d7b81a1e17f5b115cb1b36bf6c6f64295e357dc2 |
|
08-Mar-2010 |
Timo Sirainen <tss@iki.fi> |
Improved setgid/setuid failure's error message.
--HG--
branch : HEAD |
e59faf65ce864fe95dc00f5d52b8323cdbd0608a |
|
25-Jan-2010 |
Timo Sirainen <tss@iki.fi> |
Updated copyright notices to include year 2010.
--HG--
branch : HEAD |
277231b86e49ebceeac26fed003f574708183416 |
|
22-Jun-2009 |
Timo Sirainen <tss@iki.fi> |
Added restrict_get_groups_list() for easily getting list of process's groups.
--HG--
branch : HEAD |
d176f84ce5ca2073f4dfbafb457b9c74f6bf0d76 |
|
24-Apr-2009 |
Timo Sirainen <tss@iki.fi> |
Initial commit for v2.0 master rewrite. Several features are still missing.
--HG--
branch : HEAD |
40ade5c175324fe86711b671f3f5c808c9eb00a0 |
|
10-Apr-2009 |
Timo Sirainen <tss@iki.fi> |
restrict-access: If running as root, don't give "couldn't drop root group privileges" error.
--HG--
branch : HEAD |
8f061b0f360e0e94a2753b26360b07b38de70be9 |
|
10-Apr-2009 |
Timo Sirainen <tss@iki.fi> |
restrict-access: Minor code cleanup.
--HG--
branch : HEAD |
628e629d60a3fb1d9320fe0d38489450bd2cd8cc |
|
10-Apr-2009 |
Timo Sirainen <tss@iki.fi> |
restrict-access: One more root dropping fix.
--HG--
branch : HEAD |
cdfc424ddf1c85f47d9c9b3a855cfdf1b985569a |
|
10-Apr-2009 |
Timo Sirainen <tss@iki.fi> |
restrict-access: More fixes to root checking.
--HG--
branch : HEAD |
1ca9a5cafb8b10ee71abc0d28cca0926f468ccbc |
|
10-Apr-2009 |
Timo Sirainen <tss@iki.fi> |
restrict-access: Another fix to allow running processes as root.
--HG--
branch : HEAD |
9652fd05b562c1fc2e81ad6da99ad42edbbb30c5 |
|
10-Apr-2009 |
Timo Sirainen <tss@iki.fi> |
Fix to previous restrict-access changes.
--HG--
branch : HEAD |
a85d9c3e0b7cb1744a5c8f71501b3039d678c47a |
|
08-Apr-2009 |
Timo Sirainen <tss@iki.fi> |
Cleaned up restrict_access*() API.
--HG--
branch : HEAD |
a55742ae2e6b3fd53c8e2b5b63565d081ecfb1fc |
|
03-Mar-2009 |
Timo Sirainen <tss@iki.fi> |
Improved logging for core dumping. With Linux use PR_SET_DUMPABLE for imap/pop3.
--HG--
branch : HEAD |
528862222dfae36874e51753a6782e3f7acc9ec5 |
|
03-Mar-2009 |
Timo Sirainen <tss@iki.fi> |
Improved logging for core dumping. With Linux use PR_SET_DUMPABLE for imap/pop3.
--HG--
branch : HEAD |
45312f52ff3a3d4c137447be4c7556500c2f8bf2 |
|
06-Jan-2009 |
Timo Sirainen <tss@iki.fi> |
Updated copyright notices to include year 2009.
--HG--
branch : HEAD |
b6afd653db20e6939bc392e1a8597e29e49f815a |
|
18-Dec-2008 |
Timo Sirainen <tss@iki.fi> |
Fix to previous change: Don't lose errno during uid/gid naming.
--HG--
branch : HEAD |
06ec5e4c38e34d7e39cbd5bdf7e63c5e2c45e51d |
|
18-Dec-2008 |
Timo Sirainen <tss@iki.fi> |
If uid/gid changing fails, log also the name of the uid/gid instead of just the number.
--HG--
branch : HEAD |
43bdf736230c7d02cb6db3184e6fc31f2907e3eb |
|
20-Jun-2008 |
Timo Sirainen <tss@iki.fi> |
AIX compiling fix.
--HG--
branch : HEAD |
831701e789b7cd904bdc35c96d0dcbc3c98f422b |
|
19-Jun-2008 |
Timo Sirainen <tss@iki.fi> |
Compiling fix for AIX.
--HG--
branch : HEAD |
b8d232d88018c5cafd2f3be5a181d318137a45f2 |
|
27-May-2008 |
Timo Sirainen <tss@iki.fi> |
Avoid using shadow variables. Unfortunately -Wshadow also complains about
index variable conflicting with index(), which is used in way too many
places to change.
--HG--
branch : HEAD |
22d7fac122468558355291bc215736e42082a4de |
|
09-Mar-2008 |
Timo Sirainen <tss@iki.fi> |
Make sure the primary GID is in supplementary groups when using
mail_privileged_group so when effective GID is switched to the privileged
GID we still have primary GID's access as well.
--HG--
branch : HEAD |
2692e6870c98132727f0f6800fabf2e6df571781 |
|
09-Mar-2008 |
Timo Sirainen <tss@iki.fi> |
mail_privileged_group didn't work with systems where setresgid() wasn't
supported (e.g. OSX, Solaris)
--HG--
branch : HEAD |
0c450f355c18905dd18d1559bf815d6b6332cd26 |
|
04-Mar-2008 |
Timo Sirainen <tss@iki.fi> |
Replaced mail_extra_groups setting with mail_privileged_group and
mail_access_groups settings. mail_privileged_group allows temporary access
to the group when creating mbox INBOX dotlocks.
--HG--
branch : HEAD |
7f97ca94363c9e38fbbaaef204d6d01c54af6fc4 |
|
04-Mar-2008 |
Timo Sirainen <tss@iki.fi> |
Replaced mail_extra_groups setting with mail_privileged_group and
mail_access_groups settings. mail_privileged_group allows temporary access
to the group when creating mbox INBOX dotlocks.
--HG--
branch : HEAD |
19e8adccba16ff419f5675b1575358c2956dce83 |
|
11-Feb-2008 |
Timo Sirainen <tss@iki.fi> |
Renamed T_FRAME_BEGIN/END to T_BEGIN/END. Removed T_FRAME() macro and
replaced them with T_BEGIN/END calls. T_FRAME() made it difficult to debug
code with gdb.
--HG--
branch : HEAD |
30abcf7cbda58078b3bf8b85bbd1e1df6c17d5a3 |
|
06-Jan-2008 |
Timo Sirainen <tss@iki.fi> |
Setting extra groups crashed.
--HG--
branch : HEAD |
ef9c0566c2c9473e085e3dd59a64750cd59df894 |
|
05-Jan-2008 |
Timo Sirainen <tss@iki.fi> |
If RESTRICT_* environments aren't set, don't try to enable group -1.
--HG--
branch : HEAD |
e959e240bb8975cba293a94dbc61712b232904f6 |
|
05-Jan-2008 |
Timo Sirainen <tss@iki.fi> |
Reverted "environment array" changes. It broke overriding imap/pop3 settings
from userdb and the performance improvements weren't all that great anyway.
--HG--
branch : HEAD |
cffa5888a8bd922e0a84f3b3ffe0ab7392e6dc3f |
|
02-Jan-2008 |
Timo Sirainen <tss@iki.fi> |
Build environment using envarr and pass it to execve(). This is faster than
using putenv() directly. restrict_access_*_env() API changed to take
environment array parameter.
--HG--
branch : HEAD |
76b43e4417bab52e913da39b5f5bc2a130d3f149 |
|
01-Jan-2008 |
Timo Sirainen <tss@iki.fi> |
Updated copyright notices to include year 2008.
--HG--
branch : HEAD |
752a892ae980f09bd28876715541b0cda86b6229 |
|
10-Dec-2007 |
Timo Sirainen <tss@iki.fi> |
Don't use empty setgroups() list to drop groups. It doesn't work at least
with OSX.
--HG--
branch : HEAD |
5137c64be6bca222026a4aa9d8b0d71a5becb25e |
|
08-Dec-2007 |
Timo Sirainen <tss@iki.fi> |
Code cleanups and error handling fixes to setting/dropping groups.
--HG--
branch : HEAD |
eddd9bf1a1369aea4a2715f6be1137da6d17d293 |
|
05-Dec-2007 |
Timo Sirainen <tss@iki.fi> |
Replaced t_push/t_pop calls with T_FRAME*() macros.
--HG--
branch : HEAD |
7217dc6c85a949afa612b29fa029c06a759ce196 |
|
03-Nov-2007 |
Timo Sirainen <tss@iki.fi> |
If setgid() fails, includ euid and egid in the log message.
--HG--
branch : HEAD |
ee2854ca90c45c4b083fa6f2d162d127286bb94d |
|
02-Nov-2007 |
Timo Sirainen <tss@iki.fi> |
If setuid() fails, log the current effective uid.
--HG--
branch : HEAD |
e5cd333f26df56785a57837dc88dd37f0e330032 |
|
28-Oct-2007 |
Timo Sirainen <tss@iki.fi> |
If RESTRICT_USER is empty string, don't call initgroups().
--HG--
branch : HEAD |
68e812fd4f0b9da25274f1e4fceb5a36e6f74323 |
|
30-Sep-2007 |
Timo Sirainen <tss@iki.fi> |
Use better error messages for setgroups() failures.
--HG--
branch : HEAD |
89a126810703c666309310d0f3189e9834d70b5b |
|
16-Sep-2007 |
Timo Sirainen <tss@iki.fi> |
Replaced my Copyright notices. The year range always ends with 2007 now.
My name was replaced with "Dovecot authors". In many cases I didn't really
even own the copyright, so this is more correct.
--HG--
branch : HEAD |
be73bfc0b44b744c4ab8147b8a52052f57231caa |
|
28-Mar-2007 |
Timo Sirainen <tss@iki.fi> |
After chrooting try to chroot to $HOME instead of to /. If home doesn't
exist or chrooting fails there, fallback to /.
--HG--
branch : HEAD |
83a1f0299344700e13e9b8ef51f71f295d001810 |
|
03-Dec-2006 |
Timo Sirainen <tss@iki.fi> |
restrict_gid_first/last wasn't working correctly for non-primary groups.
Also restrict_gid_first=0 caused failures if user had 0 in non-primary
groups.
--HG--
branch : HEAD |
6ef7e31619edfaa17ed044b45861d106a86191ef |
|
13-Jan-2006 |
Timo Sirainen <tss@iki.fi> |
Added "bool" type and changed all ints that were used as booleans to bool.
--HG--
branch : HEAD |
14c5f27446549f2e0492d3dbd8da6ce81fb2ba25 |
|
09-Jun-2005 |
Timo Sirainen <tss@iki.fi> |
32bit UID/GIDs were truncated
--HG--
branch : HEAD |
8afe3f0e832b8b3483b692205bbd59c0110a20fd |
|
13-Mar-2005 |
Timo Sirainen <tss@iki.fi> |
If we run out of memory, exit with FATAL_OUTOFMEM status instead of dumping
core. Also changed a few other i_panic() calls to others.
--HG--
branch : HEAD |
c03c700ab8887c2c67e11b5179a2503d71ea9cdb |
|
25-Oct-2004 |
Timo Sirainen <tss@iki.fi> |
getgroups() was used wrongly before and caused problems if there were lots
of groups. Patch by Jeff Rife.
--HG--
branch : HEAD |
9eadac5bdb6d809f0413a07c51c53552ce161756 |
|
18-Oct-2004 |
Timo Sirainen <tss@iki.fi> |
We failed with "Can't drop root group privileges" if root's gid wasn't 0.
This happened often with Solaris. Thanks to Gregory Bond for figuring out.
--HG--
branch : HEAD |
cacb7aee170c6105ec1056c41d0199d8ccae3ba7 |
|
24-Sep-2004 |
Timo Sirainen <tss@iki.fi> |
updated error messages
--HG--
branch : HEAD |
0b153b31283bc5b85394df1912e808fcdc21e43b |
|
27-Aug-2004 |
Timo Sirainen <tss@iki.fi> |
Or actually check also that RESTRICT_GID_FIRST=0 before allowing gid=0 use
--HG--
branch : HEAD |
e2e71ea6440b1758adba6d374eabcfd26358a7da |
|
27-Aug-2004 |
Timo Sirainen <tss@iki.fi> |
Allow group id to be 0 even with disallow_root. So setting valid_first_gid
to 0 now actually works.
--HG--
branch : HEAD |
abe286bb37c58a5c8425d4095d0e6736e7cc6044 |
|
16-Jun-2004 |
Timo Sirainen <tss@iki.fi> |
Added mail_extra_groups setting.
--HG--
branch : HEAD |
5e0ce63bb65db34d7f48b34bbb5545fa791781c4 |
|
26-Aug-2003 |
Timo Sirainen <tss@iki.fi> |
Removed most of the license comments from src/lib/*.c. It's just fine to
keep them in a single COPYING.MIT file. Changed a few other comments as well.
--HG--
branch : HEAD |
90f993b4ba4c13d1e73ee7f312bd188b85604410 |
|
26-May-2003 |
Timo Sirainen <tss@iki.fi> |
Allow first_valid_gid to be 0. Drop any supplementary groups not in valid
gid range.
--HG--
branch : HEAD |
de1ec079c58e6278a24dc1a84a08510e5ee7e45f |
|
04-Mar-2003 |
Timo Sirainen <tss@iki.fi> |
Removed restrict_access_clean_env() and env_remove(). They're not needed.
--HG--
branch : HEAD |
6086c1babba050999c2945edada676a1106554cc |
|
21-Feb-2003 |
Timo Sirainen <tss@iki.fi> |
Added env_remove() and restrict_access_clear_env().
--HG--
branch : HEAD |
b841e1770ae1e1f4afa3cc87650858adbc27d5fb |
|
14-Jan-2003 |
Timo Sirainen <tss@iki.fi> |
Don't check for dropped root gid privileges if our uid is still root.
--HG--
branch : HEAD |
555ebb032f9b8f0cdb66f27ce7374734833e7cac |
|
19-Dec-2002 |
Timo Sirainen <tss@iki.fi> |
Buffer related cleanups. Use PATH_MAX instead of hardcoded 1024 for paths.
Added str_path() and str_ppath() functions. i_snprintf() now returns only -1
or 0 depending on if buffer got full. dec2str() returns the string allocated
from data stack. Instead of just casting to (long) or (int), we now use
dec2str() with printf-like functions. Added o_stream_send_str(). Added
strocpy() and replaced all strcpy()s and strncpy()s with it.
Pretty much untested, hope it doesn't break too badly :)
--HG--
branch : HEAD |
aff95d423ca04ac801d55bbb3e29cc18d630f97a |
|
18-Dec-2002 |
Timo Sirainen <tss@iki.fi> |
Drop root privileges earlier. Close syslog more later in imap-master when
forking new processes, so that any errors get logged. Make sure that all
errors show up in log files - use specific exit status codes if we can't
write to log file. Make sure imap and login processes always drop root
privileges even if master process didn't ask for it for some reason.
putenv() wasn't verified to succeed - luckily we never allowed large user
given data there.
--HG--
branch : HEAD |
53f7fdb513cde5319e76444c03923041f1c48fef |
|
18-Dec-2002 |
Timo Sirainen <tss@iki.fi> |
Don't bother trying to use setreuid(), setuid() check should be enough and
openbsd complains about it being deprecated.
--HG--
branch : HEAD |
6abc464b8f5aac60ea635769e4bc0a64c0fb43c5 |
|
17-Dec-2002 |
Timo Sirainen <tss@iki.fi> |
Clear separation of virtual and system usernames. passwd-file didn't work
before if the user didn't exist in system. Prefixed also all setuid/etc.
restriction environments with RESTRICT_.
--HG--
branch : HEAD |
a128456c8530046dd9a998386f383160e70b532f |
|
26-Nov-2002 |
Timo Sirainen <tss@iki.fi> |
Created env_put() and env_clean() for a bit easier handling of environment
variables.
--HG--
branch : HEAD |
0b7a602d536242ebdc446d5ceaf0c92ed3062fb7 |
|
06-Oct-2002 |
Timo Sirainen <tss@iki.fi> |
kludge: localtime() must be called before chroot(), or the timezone isn't
known. fixes wrong timestamps with login process.
--HG--
branch : HEAD |
66251e6ab31e5cc153fe5cae608e416dacafe9cd |
|
08-Aug-2002 |
Timo Sirainen <tss@iki.fi> |
Initial revision
--HG--
branch : HEAD |