PostgreSQL Source Code git master
Loading...
Searching...
No Matches
restricted_token.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void get_restricted_token (void)
 

Function Documentation

◆ get_restricted_token()

void get_restricted_token ( void  )

Definition at line 129 of file restricted_token.c.

130{
131#ifdef WIN32
133
134 /*
135 * Before we execute another program, make sure that we are running with a
136 * restricted token. If not, re-execute ourselves with one.
137 */
138
139 if ((restrict_env = getenv("PG_RESTRICT_EXEC")) == NULL
140 || strcmp(restrict_env, "1") != 0)
141 {
143 char *cmdline;
144
145 ZeroMemory(&pi, sizeof(pi));
146
148
149 setenv("PG_RESTRICT_EXEC", "1", 1);
150
152 {
153 pg_log_error("could not re-execute with restricted token: error code %lu", GetLastError());
154 }
155 else
156 {
157 /*
158 * Successfully re-executed. Now wait for child process to capture
159 * the exit code.
160 */
161 DWORD x;
162
164 CloseHandle(pi.hThread);
166
167 if (!GetExitCodeProcess(pi.hProcess, &x))
168 pg_fatal("could not get exit code from subprocess: error code %lu", GetLastError());
169 exit(x);
170 }
172 }
173#endif
174}
char * pg_strdup(const char *in)
Definition fe_memutils.c:85
void pg_free(void *ptr)
int x
Definition isn.c:75
#define pg_log_error(...)
Definition logging.h:106
#define pg_fatal(...)
static int fb(int x)
#define setenv(x, y, z)
Definition win32_port.h:542

References fb(), pg_fatal, pg_free(), pg_log_error, pg_strdup(), setenv, and x.

Referenced by main(), main(), and regression_main().