Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
cc28a275
Commit
cc28a275
authored
Aug 28, 2004
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use dynamic buffer for token buffer in win32 admin check
Magnus Hagander
parent
1c72d0de
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
4 deletions
+27
-4
src/backend/port/win32/security.c
src/backend/port/win32/security.c
+27
-4
No files found.
src/backend/port/win32/security.c
View file @
cc28a275
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/port/win32/security.c,v 1.
1 2004/06/24 21:02:42 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/port/win32/security.c,v 1.
2 2004/08/28 21:00:35 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -25,8 +25,8 @@ int
pgwin32_is_admin
(
void
)
{
HANDLE
AccessToken
;
UCHAR
InfoBuffer
[
1024
]
;
PTOKEN_GROUPS
Groups
=
(
PTOKEN_GROUPS
)
InfoBuffer
;
char
*
InfoBuffer
=
NULL
;
PTOKEN_GROUPS
Groups
;
DWORD
InfoBufferSize
;
PSID
AdministratorsSid
;
PSID
PowerUsersSid
;
...
...
@@ -41,8 +41,30 @@ pgwin32_is_admin(void)
exit
(
1
);
}
if
(
GetTokenInformation
(
AccessToken
,
TokenGroups
,
NULL
,
0
,
&
InfoBufferSize
))
{
write_stderr
(
"failed to get token information - got zero size!
\n
"
);
exit
(
1
);
}
if
(
GetLastError
()
!=
ERROR_INSUFFICIENT_BUFFER
)
{
write_stderr
(
"failed to get token information: %d
\n
"
,
(
int
)
GetLastError
());
exit
(
1
);
}
InfoBuffer
=
malloc
(
InfoBufferSize
);
if
(
!
InfoBuffer
)
{
write_stderr
(
"failed to allocate %i bytes for token information!
\n
"
,
(
int
)
InfoBufferSize
);
exit
(
1
);
}
Groups
=
(
PTOKEN_GROUPS
)
InfoBuffer
;
if
(
!
GetTokenInformation
(
AccessToken
,
TokenGroups
,
InfoBuffer
,
1024
,
&
InfoBufferSize
))
InfoBufferSize
,
&
InfoBufferSize
))
{
write_stderr
(
"failed to get token information: %d
\n
"
,
(
int
)
GetLastError
());
...
...
@@ -81,6 +103,7 @@ pgwin32_is_admin(void)
}
}
free
(
InfoBuffer
);
FreeSid
(
AdministratorsSid
);
FreeSid
(
PowerUsersSid
);
return
success
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment