[asterisk-commits] kpfleming: trunk r44152 - /trunk/main/asterisk.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Oct 2 09:00:11 MST 2006
Author: kpfleming
Date: Mon Oct 2 11:00:11 2006
New Revision: 44152
URL: http://svn.digium.com/view/asterisk?rev=44152&view=rev
Log:
clean up formatting and conformance to code guidelines
revert Mark's change that caused a memory leak (cap_set_proc() does not free the capability structure so we always need to call cap_free())
Modified:
trunk/main/asterisk.c
Modified: trunk/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/main/asterisk.c?rev=44152&r1=44151&r2=44152&view=diff
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Mon Oct 2 11:00:11 2006
@@ -2521,7 +2521,6 @@
if (!is_child_of_nonroot && runuser) {
#ifdef HAVE_CAP
- cap_t cap;
int has_cap = 1;
#endif /* HAVE_CAP */
struct passwd *pw;
@@ -2533,7 +2532,7 @@
#ifdef HAVE_CAP
if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0)) {
ast_log(LOG_WARNING, "Unable to keep capabilities.\n");
- has_cap = 0;
+ has_cap = 0;
}
#endif /* HAVE_CAP */
if (!rungroup) {
@@ -2555,12 +2554,15 @@
ast_verbose("Running as user '%s'\n", runuser);
#ifdef HAVE_CAP
if (has_cap) {
+ cap_t cap;
+
cap = cap_from_text("cap_net_admin=ep");
- if (cap_set_proc(cap)) {
+
+ if (cap_set_proc(cap))
ast_log(LOG_WARNING, "Unable to install capabilities.\n");
- } else if (cap_free(cap)) {
+
+ if (cap_free(cap))
ast_log(LOG_WARNING, "Unable to drop capabilities.\n");
- }
}
#endif /* HAVE_CAP */
}
More information about the asterisk-commits
mailing list