? .deps
? initdb
Index: initdb.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/initdb/initdb.c,v
retrieving revision 1.110
diff -c -r1.110 initdb.c
*** initdb.c	18 Feb 2006 16:15:23 -0000	1.110
--- initdb.c	22 Feb 2006 16:10:28 -0000
***************
*** 95,103 ****
  static bool debug = false;
  static bool noclean = false;
  static bool show_setting = false;
- #ifdef WIN32
- static bool restricted_exec = false;
- #endif
  
  
  /* internal vars */
--- 95,100 ----
***************
*** 2427,2437 ****
  		{"lc-messages", required_argument, NULL, 7},
  		{"no-locale", no_argument, NULL, 8},
  		{"auth", required_argument, NULL, 'A'},
! 		{"pwprompt", no_argument, NULL, 'W'},
  		{"pwfile", required_argument, NULL, 9},
- #ifdef WIN32
- 		{"restrictedexec", no_argument, NULL, 10},
- #endif
  		{"username", required_argument, NULL, 'U'},
  		{"help", no_argument, NULL, '?'},
  		{"version", no_argument, NULL, 'V'},
--- 2424,2431 ----
  		{"lc-messages", required_argument, NULL, 7},
  		{"no-locale", no_argument, NULL, 8},
  		{"auth", required_argument, NULL, 'A'},
! 		{"pwprompt", no_argument, NULL, 'W'},  
  		{"pwfile", required_argument, NULL, 9},
  		{"username", required_argument, NULL, 'U'},
  		{"help", no_argument, NULL, '?'},
  		{"version", no_argument, NULL, 'V'},
***************
*** 2450,2455 ****
--- 2444,2452 ----
  								 * environment */
  	char		bin_dir[MAXPGPATH];
  	char	   *pg_data_native;
+ #ifdef WIN32
+ 	char       *restrict_env;
+ #endif
  	static const char *subdirs[] = {
  		"global",
  		"pg_xlog",
***************
*** 2540,2550 ****
  			case 9:
  				pwfilename = xstrdup(optarg);
  				break;
- #ifdef WIN32
- 			case 10:
- 				restricted_exec = true;
- 				break;
- #endif
  			case 's':
  				show_setting = true;
  				break;
--- 2537,2542 ----
***************
*** 2556,2561 ****
--- 2548,2554 ----
  		}
  	}
  
+ 
  	/* Non-option argument specifies data directory */
  	if (optind < argc)
  	{
***************
*** 2644,2659 ****
       * Before we execute another program, make sure that we are running with a 
       * restricted token. If not, re-execute ourselves with one.
       */
!     if (!restricted_exec)
      {
          PROCESS_INFORMATION pi;
          char *cmdline;
          
          ZeroMemory(&pi, sizeof(pi));
  
!         cmdline = pg_malloc(strlen(GetCommandLine()) + 19);
!         strcpy(cmdline, GetCommandLine());
!         strcat(cmdline, " --restrictedexec");
          
          if (!CreateRestrictedProcess(cmdline, &pi))
          {
--- 2637,2654 ----
       * Before we execute another program, make sure that we are running with a 
       * restricted token. If not, re-execute ourselves with one.
       */
! 
! 	if ((restrict_env = getenv("PG_RESTRICT_EXEC")) == NULL 
! 		|| strcmp(restrict_env,"1") != 0)
      {
          PROCESS_INFORMATION pi;
          char *cmdline;
          
          ZeroMemory(&pi, sizeof(pi));
  
!         cmdline = x_strdup(GetCommandLine());
! 
! 		putenv("PG_RESTRICT_EXEC=1");
          
          if (!CreateRestrictedProcess(cmdline, &pi))
          {
