diff options
author | Gerald Combs <gerald@wireshark.org> | 2008-03-20 19:18:33 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2008-03-20 19:18:33 +0000 |
commit | c288c1ae058ee453b8def8f342f6546b143e6df5 (patch) | |
tree | 065264fa3fd5abbfae41a152159689962b0ac39a /dumpcap.c | |
parent | d4ba88b677259355bf107d24bceb31801176f489 (diff) | |
download | wireshark-c288c1ae058ee453b8def8f342f6546b143e6df5.tar.gz wireshark-c288c1ae058ee453b8def8f342f6546b143e6df5.tar.bz2 wireshark-c288c1ae058ee453b8def8f342f6546b143e6df5.zip |
Don't call cap_set_proc() unless we were started with elevated
privileges. Otherwise, we might print
dumpcap: cap_set_proc() fail return: Operation not permitted
to stderr.
svn path=/trunk/; revision=24704
Diffstat (limited to 'dumpcap.c')
-rw-r--r-- | dumpcap.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -508,12 +508,15 @@ relinquish_privs_except_capture(void) relinquish_special_privs_perm(); - print_caps("Post drop, pre set"); - cap_set_flag(caps, CAP_EFFECTIVE, cl_len, cap_list, CAP_SET); - if (cap_set_proc(caps)) { - cmdarg_err("cap_set_proc() fail return: %s", strerror(errno)); + if (started_with_special_privs()) { + print_caps("Post drop, pre set"); + cap_set_flag(caps, CAP_EFFECTIVE, cl_len, cap_list, CAP_SET); + if (cap_set_proc(caps)) { + cmdarg_err("cap_set_proc() fail return: %s", strerror(errno)); + } + print_caps("Post drop, post set"); } - print_caps("Post drop, post set"); + cap_free(caps); } #endif /* HAVE_LIBCAP */ |