[asterisk-commits] rmudgett: branch group/issue14292 r172490 - in /team/group/issue14292: ./ app...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 29 17:31:38 CST 2009


Author: rmudgett
Date: Thu Jan 29 17:31:37 2009
New Revision: 172490

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=172490
Log:
Resolved conflict and restarted automerge.

Merged revisions 172451 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/team/group/issue8824

................
  r172451 | root | 2009-01-29 17:20:40 -0600 (Thu, 29 Jan 2009) | 27 lines
  
  Merged revisions 172440-172441 via svnmerge from 
  file:///srv/subversion/repos/asterisk/trunk
  
  ................
    r172440 | rmudgett | 2009-01-29 17:15:20 -0600 (Thu, 29 Jan 2009) | 1 line
    
    Remove tabs from comment
  ................
    r172441 | tilghman | 2009-01-29 17:15:40 -0600 (Thu, 29 Jan 2009) | 16 lines
    
    Merged revisions 172438 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r172438 | tilghman | 2009-01-29 16:54:29 -0600 (Thu, 29 Jan 2009) | 9 lines
      
      Lose the CAP_NET_ADMIN at every fork, instead of at startup.  Otherwise, if
      Asterisk runs as a non-root user and the administrator does a 'restart now',
      Asterisk loses the ability to set QOS on packets.
      (closes issue #14004)
       Reported by: nemo
       Patches: 
             20090105__bug14004.diff.txt uploaded by Corydon76 (license 14)
       Tested by: Corydon76
    ........
  ................
................

Modified:
    team/group/issue14292/   (props changed)
    team/group/issue14292/apps/app_rpt.c
    team/group/issue14292/autoconf/ast_func_fork.m4
    team/group/issue14292/configure
    team/group/issue14292/main/app.c
    team/group/issue14292/main/asterisk.c
    team/group/issue14292/main/cli.c

Propchange: team/group/issue14292/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/group/issue14292/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/group/issue14292/
------------------------------------------------------------------------------
--- issue14068-integrated (original)
+++ issue14068-integrated Thu Jan 29 17:31:37 2009
@@ -1,1 +1,1 @@
-/team/group/issue8824:1-172437
+/team/group/issue8824:1-172479

Propchange: team/group/issue14292/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jan 29 17:31:37 2009
@@ -1,1 +1,1 @@
-/trunk:1-172410
+/trunk:1-172450

Modified: team/group/issue14292/apps/app_rpt.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue14292/apps/app_rpt.c?view=diff&rev=172490&r1=172489&r2=172490
==============================================================================
--- team/group/issue14292/apps/app_rpt.c (original)
+++ team/group/issue14292/apps/app_rpt.c Thu Jan 29 17:31:37 2009
@@ -359,6 +359,8 @@
 #include "asterisk/cdr.h"
 #include "asterisk/options.h"
 #include "asterisk/manager.h"
+#include "asterisk/app.h"
+
 #include <termios.h>
 
 #ifdef	NEW_ASTERISK
@@ -1966,7 +1968,7 @@
 	sprintf(str,"%s?node=%s&time=%u&seqno=%u",myrpt->p.statpost_url,
 		myrpt->name,(unsigned int) now,seq);
 	if (pairs) sprintf(str + strlen(str),"&%s",pairs);
-	if (!(pid = fork()))
+	if (!(pid = ast_safe_fork(0)))
 	{
 		execv(astrs[0],astrs);
 		ast_log(LOG_ERROR, "exec of %s failed.\n", astrs[0]);

Modified: team/group/issue14292/autoconf/ast_func_fork.m4
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue14292/autoconf/ast_func_fork.m4?view=diff&rev=172490&r1=172489&r2=172490
==============================================================================
--- team/group/issue14292/autoconf/ast_func_fork.m4 (original)
+++ team/group/issue14292/autoconf/ast_func_fork.m4 Thu Jan 29 17:31:37 2009
@@ -39,6 +39,8 @@
 fi
 if test "x$ac_cv_func_fork_works" = xyes; then
   AC_DEFINE(HAVE_WORKING_FORK, 1, [Define to 1 if `fork' works.])
+  PBX_WORKING_FORK=1
+  AC_SUBST(PBX_WORKING_FORK)
 fi
 ])# AST_FUNC_FORK
 

Modified: team/group/issue14292/main/app.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue14292/main/app.c?view=diff&rev=172490&r1=172489&r2=172490
==============================================================================
--- team/group/issue14292/main/app.c (original)
+++ team/group/issue14292/main/app.c Thu Jan 29 17:31:37 2009
@@ -36,6 +36,9 @@
 #include <sys/time.h>       /* for getrlimit(2) */
 #include <sys/resource.h>   /* for getrlimit(2) */
 #include <stdlib.h>         /* for closefrom(3) */
+#ifdef HAVE_CAP
+#include <sys/capability.h>
+#endif /* HAVE_CAP */
 
 #include "asterisk/paths.h"	/* use ast_config_AST_DATA_DIR */
 #include "asterisk/channel.h"
@@ -1883,6 +1886,14 @@
 		return pid;
 	} else {
 		/* Child */
+#ifdef HAVE_CAP
+		cap_t cap = cap_from_text("cap_net_admin-eip");
+
+		if (cap_set_proc(cap)) {
+			ast_log(LOG_WARNING, "Unable to remove capabilities.\n");
+		}
+		cap_free(cap);
+#endif
 
 		/* Before we unblock our signals, return our trapped signals back to the defaults */
 		signal(SIGHUP, SIG_DFL);

Modified: team/group/issue14292/main/asterisk.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue14292/main/asterisk.c?view=diff&rev=172490&r1=172489&r2=172490
==============================================================================
--- team/group/issue14292/main/asterisk.c (original)
+++ team/group/issue14292/main/asterisk.c Thu Jan 29 17:31:37 2009
@@ -1013,6 +1013,15 @@
 #endif	
 
 	if (pid == 0) {
+#ifdef HAVE_CAP
+		cap_t cap = cap_from_text("cap_net_admin-eip");
+
+		if (cap_set_proc(cap)) {
+			/* Careful with order! Logging cannot happen after we close FDs */
+			ast_log(LOG_WARNING, "Unable to remove capabilities.\n");
+		}
+		cap_free(cap);
+#endif
 #ifdef HAVE_WORKING_FORK
 		if (ast_opt_high_priority)
 			ast_set_priority(0);
@@ -1036,7 +1045,7 @@
 	}
 
 	ast_unreplace_sigchld();
-#else
+#else /* !defined(HAVE_WORKING_FORK) && !defined(HAVE_WORKING_VFORK) */
 	res = -1;
 #endif
 
@@ -3380,7 +3389,7 @@
 		if (has_cap) {
 			cap_t cap;
 
-			cap = cap_from_text("cap_net_admin=ep");
+			cap = cap_from_text("cap_net_admin=eip");
 
 			if (cap_set_proc(cap))
 				ast_log(LOG_WARNING, "Unable to install capabilities.\n");

Modified: team/group/issue14292/main/cli.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue14292/main/cli.c?view=diff&rev=172490&r1=172489&r2=172490
==============================================================================
--- team/group/issue14292/main/cli.c (original)
+++ team/group/issue14292/main/cli.c Thu Jan 29 17:31:37 2009
@@ -1676,10 +1676,10 @@
  * 1 on match of a full word.
  *
  * The pattern can be
- *   any_word		match for equal
- *   [foo|bar|baz]	optionally, one of these words
- *   {foo|bar|baz}	exactly, one of these words
- *   %			any word
+ *   any_word           match for equal
+ *   [foo|bar|baz]      optionally, one of these words
+ *   {foo|bar|baz}      exactly, one of these words
+ *   %                  any word
  */
 static int word_match(const char *cmd, const char *cli_word)
 {




More information about the asterisk-commits mailing list