7088521 fbconfig may use or write to files it shouldn't
authorAlan Coopersmith <Alan.Coopersmith@Oracle.COM>
Sat, 10 Sep 2011 23:06:14 -0700
changeset 1208 eaa15317ee26
parent 1207 996eb6e88a18
child 1209 22287ad0188b
7088521 fbconfig may use or write to files it shouldn't
open-src/app/gfx-utils/sun-src/fbconf_xorg/fbc/fbc.h
open-src/app/gfx-utils/sun-src/fbconf_xorg/fbc/fbc_getargs.c
open-src/app/gfx-utils/sun-src/fbconfig/exec_attr
open-src/app/gfx-utils/sun-src/fbconfig/fbconfig.c
--- a/open-src/app/gfx-utils/sun-src/fbconf_xorg/fbc/fbc.h	Fri Sep 09 20:42:44 2011 -0700
+++ b/open-src/app/gfx-utils/sun-src/fbconf_xorg/fbc/fbc.h	Sat Sep 10 23:06:14 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -87,7 +87,7 @@
 #define	FBC_FILE_PATH_MACHINE	"/etc/X11/xorg.conf"
 
 #define	FBC_FILE_KEYWD_SYSTEM	"system"
-#define	FBC_FILE_PATH_SYSTEM	"/usr/X11/xorg.conf"
+#define	FBC_FILE_PATH_SYSTEM	"/usr/lib/X11/xorg.conf"
 
 #define	FBC_DEFAULT_CONFIG_LOC	FBC_FILE_KEYWD_MACHINE	/* "machine" */
 
--- a/open-src/app/gfx-utils/sun-src/fbconf_xorg/fbc/fbc_getargs.c	Fri Sep 09 20:42:44 2011 -0700
+++ b/open-src/app/gfx-utils/sun-src/fbconf_xorg/fbc/fbc_getargs.c	Sat Sep 10 23:06:14 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -29,6 +29,7 @@
 #include <stdio.h>		/* fprintf(), fputs() */
 #include <stdlib.h>		/* exit(), malloc(), strtof(), strtol() */
 #include <string.h>		/* strchr(), strcmp(), strlen() */
+#include <unistd.h>		/* issetugid() */
 
 #include "fbc.h"		/* Common fbconf_xorg(1M) definitions */
 #include "fbc_error.h"		/* Error reporting */
@@ -874,6 +875,13 @@
 		 */
 		fbvar->config_file_loc  = NULL;
 		fbvar->config_file_path = argv[*arg+1];
+
+		if (issetugid()) {
+		    fbc_errormsg("%s %s not allowed with added privileges\n",
+				 argv[*arg], argv[*arg+1]);
+		    fbvar->usage(stderr, fbvar);
+		    exit(FBC_EXIT_USAGE);
+		}
 	} else {
 		/*
 		 * Look up the configuration file location keyword
--- a/open-src/app/gfx-utils/sun-src/fbconfig/exec_attr	Fri Sep 09 20:42:44 2011 -0700
+++ b/open-src/app/gfx-utils/sun-src/fbconfig/exec_attr	Sat Sep 10 23:06:14 2011 -0700
@@ -1,1 +1,1 @@
-Desktop Configuration:solaris:cmd:RO::/usr/sbin/fbconfig:uid=0
+Desktop Configuration:solaris:cmd:RO::/usr/sbin/fbconfig:euid=0
--- a/open-src/app/gfx-utils/sun-src/fbconfig/fbconfig.c	Fri Sep 09 20:42:44 2011 -0700
+++ b/open-src/app/gfx-utils/sun-src/fbconfig/fbconfig.c	Sat Sep 10 23:06:14 2011 -0700
@@ -109,7 +109,7 @@
  *        svccfg -s svc:/application/x11/x11-server \
  *                        setprop options/server=/usr/openwin/bin/Xsun
  *        svccfg -s svc:/application/x11/x11-server \
- *                        setprop options/server=/usr/X11/bin/Xorg
+ *                        setprop options/server=/usr/bin/Xorg
  *
  *        svccfg -s svc:/application/x11/x11-server listprop 'options/server'
  */
@@ -144,8 +144,8 @@
 #define GFX_DEV_XORG	GFX_DEV_PFB | GFX_DEV_NFB | GFX_DEV_EFB | GFX_DEV_KFB | GFX_DEV_AST
 #endif
 
-char *xserver_str[]  = {"Xsun", "Xorg"};
-char *xserver_path[] = {"/usr/openwin/bin/Xsun", "/usr/X11/bin/Xorg"};
+const char *xserver_str[]  = {"Xsun", "Xorg"};
+const char *xserver_path[] = {"/usr/openwin/bin/Xsun", "/usr/bin/Xorg"};
 unsigned int xserver_device[] = { GFX_DEV_XSUN, GFX_DEV_XORG };
 
 static
@@ -1464,7 +1464,7 @@
 			}
 		}
 
-		system("svccfg -s svc:/application/x11/x11-server setprop options/server=/usr/X11/bin/Xorg");
+		system("svccfg -s svc:/application/x11/x11-server setprop options/server=/usr/bin/Xorg");
 
 		if (stat(efb_path, &stat_buf) == 0) {
 			system("rem_drv nfb 2>/dev/null&");