99 *
1010 *
1111 * IDENTIFICATION
12- * $PostgreSQL: pgsql/src/port/exec.c,v 1.59 2008/03/31 01:31:43 tgl Exp $
12+ * $PostgreSQL: pgsql/src/port/exec.c,v 1.60 2008/04/16 22:16:00 adunstan Exp $
1313 *
1414 *-------------------------------------------------------------------------
1515 */
@@ -695,7 +695,6 @@ AddUserToDacl(HANDLE hProcess)
695695DWORD dwNewAclSize ;
696696DWORD dwSize = 0 ;
697697DWORD dwTokenInfoLength = 0 ;
698- DWORD dwResult = 0 ;
699698HANDLE hToken = NULL ;
700699PACL pacl = NULL ;
701700PSID psidUser = NULL ;
@@ -707,7 +706,7 @@ AddUserToDacl(HANDLE hProcess)
707706/* Get the token for the process */
708707if (!OpenProcessToken (hProcess ,TOKEN_QUERY |TOKEN_ADJUST_DEFAULT ,& hToken ))
709708{
710- log_error ("could not open process token: %ui " ,GetLastError ());
709+ log_error ("could not open process token: %lu " ,GetLastError ());
711710gotocleanup ;
712711}
713712
@@ -719,19 +718,19 @@ AddUserToDacl(HANDLE hProcess)
719718ptdd = (TOKEN_DEFAULT_DACL * )LocalAlloc (LPTR ,dwSize );
720719if (ptdd == NULL )
721720{
722- log_error ("could not allocate %i bytes of memory" ,dwSize );
721+ log_error ("could not allocate %lu bytes of memory" ,dwSize );
723722gotocleanup ;
724723}
725724
726725if (!GetTokenInformation (hToken ,tic , (LPVOID )ptdd ,dwSize ,& dwSize ))
727726{
728- log_error ("could not get token information: %ui " ,GetLastError ());
727+ log_error ("could not get token information: %lu " ,GetLastError ());
729728gotocleanup ;
730729}
731730}
732731else
733732{
734- log_error ("could not get token information buffer size: %ui " ,GetLastError ());
733+ log_error ("could not get token information buffer size: %lu " ,GetLastError ());
735734gotocleanup ;
736735}
737736}
@@ -741,14 +740,14 @@ AddUserToDacl(HANDLE hProcess)
741740 (DWORD )sizeof (ACL_SIZE_INFORMATION ),
742741AclSizeInformation ))
743742{
744- log_error ("could not get ACL information: %ui " ,GetLastError ());
743+ log_error ("could not get ACL information: %lu " ,GetLastError ());
745744gotocleanup ;
746745}
747746
748747/* Get the SID for the current user. We need to add this to the ACL. */
749748if (!GetUserSid (& psidUser ,hToken ))
750749{
751- log_error ("could not get user SID: %ui " ,GetLastError ());
750+ log_error ("could not get user SID: %lu " ,GetLastError ());
752751gotocleanup ;
753752}
754753
@@ -759,13 +758,13 @@ AddUserToDacl(HANDLE hProcess)
759758pacl = (PACL )LocalAlloc (LPTR ,dwNewAclSize );
760759if (pacl == NULL )
761760{
762- log_error ("could not allocate %i bytes of memory" ,dwNewAclSize );
761+ log_error ("could not allocate %lu bytes of memory" ,dwNewAclSize );
763762gotocleanup ;
764763}
765764
766765if (!InitializeAcl (pacl ,dwNewAclSize ,ACL_REVISION ))
767766{
768- log_error ("could not initialize ACL: %ui " ,GetLastError ());
767+ log_error ("could not initialize ACL: %lu " ,GetLastError ());
769768gotocleanup ;
770769}
771770
@@ -774,21 +773,21 @@ AddUserToDacl(HANDLE hProcess)
774773{
775774if (!GetAce (ptdd -> DefaultDacl ,i , (LPVOID * )& pace ))
776775{
777- log_error ("could not get ACE: %ui " ,GetLastError ());
776+ log_error ("could not get ACE: %lu " ,GetLastError ());
778777gotocleanup ;
779778}
780779
781780if (!AddAce (pacl ,ACL_REVISION ,MAXDWORD ,pace , ((PACE_HEADER )pace )-> AceSize ))
782781{
783- log_error ("could not add ACE: %ui " ,GetLastError ());
782+ log_error ("could not add ACE: %lu " ,GetLastError ());
784783gotocleanup ;
785784}
786785}
787786
788787/* Add the new ACE for the current user */
789788if (!AddAccessAllowedAce (pacl ,ACL_REVISION ,GENERIC_ALL ,psidUser ))
790789{
791- log_error ("could not add access allowed ACE: %ui " ,GetLastError ());
790+ log_error ("could not add access allowed ACE: %lu " ,GetLastError ());
792791gotocleanup ;
793792}
794793
@@ -797,7 +796,7 @@ AddUserToDacl(HANDLE hProcess)
797796
798797if (!SetTokenInformation (hToken ,tic , (LPVOID )& tddNew ,dwNewAclSize ))
799798{
800- log_error ("could not set token information: %ui " ,GetLastError ());
799+ log_error ("could not set token information: %lu " ,GetLastError ());
801800gotocleanup ;
802801}
803802
@@ -828,8 +827,6 @@ static BOOL
828827GetUserSid (PSID * ppSidUser ,HANDLE hToken )
829828{
830829DWORD dwLength ;
831- DWORD cbName = 250 ;
832- DWORD cbDomainName = 250 ;
833830PTOKEN_USER pTokenUser = NULL ;
834831
835832
@@ -845,13 +842,13 @@ GetUserSid(PSID * ppSidUser, HANDLE hToken)
845842
846843if (pTokenUser == NULL )
847844{
848- log_error ("could not allocate %ui bytes of memory" ,dwLength );
845+ log_error ("could not allocate %lu bytes of memory" ,dwLength );
849846return FALSE;
850847}
851848}
852849else
853850{
854- log_error ("could not get token information buffer size: %ui " ,GetLastError ());
851+ log_error ("could not get token information buffer size: %lu " ,GetLastError ());
855852return FALSE;
856853}
857854}
@@ -865,7 +862,7 @@ GetUserSid(PSID * ppSidUser, HANDLE hToken)
865862HeapFree (GetProcessHeap (),0 ,pTokenUser );
866863pTokenUser = NULL ;
867864
868- log_error ("could not get token information: %ui " ,GetLastError ());
865+ log_error ("could not get token information: %lu " ,GetLastError ());
869866return FALSE;
870867}
871868