mcr/tcpdump — pull request #12 by msekletar (2012-05-25 14:48:19+00:00)
Title: Dropping root privileges

I've implemented another method to how to drop root privileges. When tcpdump is configured with some implicit user e.g. tcpdump - special user created only for purposes of running tcpdump, we will drop root privileges everytime. The issue here is that tcpdump is executed in some directory which belong to some other user not user tcpdump, thus it's impossible to create savefile. My patch solves this issue and the issue when running tcpdump with -C flag. Root privileges are dropped but we will keep capability to create files.

This patch is still in development. I've tested it and current state is "works for me". I'd like to see it included in tcpdump. If you will discover some issues such that you can't included it, please inform me and I will try to fix them. I hope you are interested in such a change.

To implement the patch I've used library libcap-ng. I think this library is broadly available on every modern linux distribution. I've added dependency on libcap-ng library so changes in build a link process are required, however patch provides only C code implementing desired functionality.