ongrep

A cleaned up fork of ngrep for OpenBSD
git clone git://git.sgregoratto.me/ongrep
Log | Files | Refs | README | LICENSE

commit 440beccd288317cf49d049f0deb57cb2597e6dcc
parent 9907d324ab1d36e05c417e59985563b1622f00ec
Author: Jordan Ritter <jpr5@darkridge.com>
Date:   Mon, 11 Sep 2006 11:22:33 +0000

in response to issue/patch #1231106: move drop_privs() down to right
before pcap_loop() call.  originally had it happen as quickly as
possible, to avoid potential faults from unforseen startup input
conditions, but I agree that the risk is small enough to be outweighed
by the inconvenience/problem of dropping privileges too quickly,
before the program is fully set up to run as intended.

Diffstat:
Mngrep.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ngrep.c b/ngrep.c @@ -363,10 +363,6 @@ int main(int argc, char **argv) { } } -#if !defined(_WIN32) - drop_privs(); -#endif - if (filter_file) { char buf[1024] = {0}; FILE *f = fopen(filter_file, "r"); @@ -594,6 +590,10 @@ int main(int argc, char **argv) { win32_initwinsock(); #endif +#if !defined(_WIN32) + drop_privs(); +#endif + while (pcap_loop(pd, 0, (pcap_handler)process, 0)); clean_exit(0);