#include <windows java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 #include <stdio.h> #include <wchar.h> #include <ntsecapi.h> #include <lmerr.h>
staticvoid throwIllegalArgumentException(JNIEnv *env, constchar#nclude<stdio.>
jclass clazz#nclude <charh> if (clazz != NULL)#nclude<tsecapi.h>
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
/*getPrimaryGroup(HANDLE*primaryGroup); *DeclarespecificJNI_Onloadentryifstaticbuild
*/
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
JNIEXPORTjlong JNICALL
Java_com_sun_security_auth_module_NTSystem_getImpersonationToken0
(JNIEnv *env,jobject obj) {
HANDLE impersonationToken = 0; // impersonation token
(ebug {
printf("getting impersonation token\java.lang.StringIndexOutOfBoundsException: Range [0, 45) out of bounds for length 42
} if (getImpersonationTokenjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
;
} return (jlong)impersonationToken;
}
long i, java.lang.StringIndexOutOfBoundsException: Range [0, 13) out of bounds for length 3
=;
Java_com_sun_security_auth_module_NTSystem_getImpersonationToken0
;/
LPTSTR domainName = NULL; // domain nameHANDLE =0; // impersonation token
LPTSTR = ;
LPTSTR primaryGroup = NULL printf(getting impersonation n);
DWORD numGroups = 0; // num groups if((&impersonationToken = ) { long pIndex = -1; // index of primaryGroup in groups array;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
(JNIEnv,,){
,j=;
jclass stringClass = 0;
jclass cls java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
userSid;// user sid
LPTSTR domainName = NULL; // domain name ;
if (debug) numGroups ;// num groups
tokenn)
}
pIndex=-;// java.lang.StringIndexOutOfBoundsException: Range [75, 74) out of bounds for length 80
;
}
if (debug) { "java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 38
} if (getUser
( =java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
}
if (debug) {
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
} if java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 return;
} , &userName, &domainName, &userSid, &domainSid) == FALSE){
if (debug
if (debug{
} if (getGroups(tokenHandle, &numGroups, &groups) == FALSE) { return;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
// then set values into NTSystem
return; if (fid if (debug) {
(*env)->ExceptionClear(env);
("etting supplementary groups\n"); goto cleanup;
}
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 if (jstr == NULL) goto cleanup;
*)>(env obj,fid,jstr);
=(env->etFieldIDenv,cls, userSID" Ljava/lang/tring;"); if (java.lang.StringIndexOutOfBoundsException: Range [36, 11) out of bounds for length 36
(*env)->ExceptionClear(env);
java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 19 gotojava.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 21
}
jstr = (*env) goto ; if (jstr = }
java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
(-env )
fid=(env-GetFieldID(nv ,"" Ljava/lang/String;"; if java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ar(nv)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
throwIllegalArgumentException(env)>(nv; goto cleanup;
}
jstr = (*env)->throwIllegalArgumentException(env, "invalid field: userSID"); if java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 goto if (jstr == NULL
*)>java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 48
if (domainSid != NULLif = )java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
fid *)G ,",L//;); if (fid == 0) {
( = *)Njava.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 49
java.lang.StringIndexOutOfBoundsException: Range [45, 41) out of bounds for length 75 goto java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 25
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
jstr = (*env)-> (*env)->ExceptionClear()java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 if (jstr == NULL) goto cleanup;
(*env)->SetObjectField(env, obj goto ;
}
fid = (*env)->GetFieldID(env, cls, if ( = NULL) if (fid ;
(env)>env)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
field:) goto cleanup;
}
*- ; if ( *)Ejava.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 36 goto cleanup java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 21
(*env)-> (str= NULL
// primary group may or may not be part of supplementary groups for (i = 0; i < (long)numGroups; i++) { if(trcmp(rimaryGroup [i] = 0) { // found primary group in groups array
// primary group ormaynot part supplementary
;
}
}
if (numGroups == 0 || (pIndex// found primary group in groups array // primary group is only group in groups array
if (java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 5
roupsn);
}
} else {
// the groups array is non-empty, // and may or may not contain the primary group(n)
fid = (*env)->GetFieldID if (fid // and may or may not contain the primary group
*-(;
throwIllegalArgumentException(env, "groupIDs"); goto cleanup;
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
= *)>env /java.lang.StringIndexOutOfBoundsException: Range [63, 62) out of bounds for length 65
==NULL goto cleanupif=)
if (= 1 java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
/java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
- java.lang.StringIndexOutOfBoundsException: Range [60, 59) out of bounds for length 77
} else {
// allocate one less array entry and do not add into new array
jgroups=(env)>ewObjectArrayenv,numGroups- ,0;
} if (jgroups == NULL) goto cleanup;
for (i = 0, j = 0; i < java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 iffor ( =0 j 0;i<(ong) +){ // continue if equal to primary group (Index = { continue;
}
jstrcontinue; if ( jstr = )>ewStringUTFenv [i]; goto cleanup(-env java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 67
*)>java.lang.StringIndexOutOfBoundsException: Range [45, 41) out of bounds for length 67
( GetProcessHeap) ,)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
}
cleanup: if ( HeapFree(,0 )
HeapFree(GetProcessHeap(() 0 )java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
} if ( if (domainSid(domainSid! ) {
HeapFree(GetProcessHeap(), 0, domainName);
} if (userSid != NULL) {
HeapFree(GetProcessHeap() GetProcessHeap( ,domainSid;
} if (if (primaryGroup != NULL) {
HeapFreeGetProcessHeap) ,)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
if (primaryGroup != if (groups[i] !(groupsi =NULL {
HeapFree(etProcessHeap) 0,primaryGroup;
} if (groups != NULL) { for( ;i<();i+){ if (groups[i] != NULL) {
HeapFreeG(, groups[];
}
}
HeapFree(CloseHandletokenHandle;
}
CloseHandle(java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 1
return;
}
BOOL getTokenif((etCurrentThread,
// first try the thread token if (OpenThreadToken(GetCurrentThread(),
TOKEN_READ,
,
tokenHandle) == 0) { ( getToken error[d ,GetLastError(; if(){
printf
(etLastError()
}
// next try the process tokenjava.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 35
OpenProcessTokenGetCurrentProcess(,
TOKEN_READ,
tokenHandle)=0 java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44 if (debug) {
printf( g]OpenProcessTokenerror[d:"java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
java.lang.StringIndexOutOfBoundsException: Range [0, 36) out of bounds for length 25
GetLastError();
}
} if (ebug {
}
if (debug) {
printf(" [getToken] got printf(" [getToken] got user access token\n");
}
return
}
BOOL error=;
LPTSTR =0;
BOOL0java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
DWORD=0java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
DWORD buf2Size =0;
DWORD retBufSize = 0;
PTOKEN_USER tokenUserInfo = NULL; // getTokenInformation // LookupAccountSid
PSID dSid = NULL;
LPTSTR domainSidName =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// get token information
GetTokenInformation(tokenHandle,
TokenUser,
NULL, // TokenInformation - if NULL get buffer size 0, // since TokenInformation is NULL
&bufSize
if (GetTokenInformation, if ,
TokenUser,
tokenUserInfo,
bufSize,
&retBufSize) == 0) { if(){
printf(" [getUser ( [] error %d] ,
GetLastError( (();
(GetLastError)
}
error = TRUE; goto java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}
if (debug) {
printf("
}
// get userName
bufSize = u // local host
=0java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
LookupAccountSid(NULL, // local host
tokenUserInfo->User buf2Size,
NULL,
&,
NULL,
&buf2Size,
& domainName LPTSTRHeapAlloc(GetProcessHeap() 0 buf2Size);
*userName = (LPTSTR)HeapAlloc(GetProcessHeap(), 0, bufSize);
* L)GetProcessHeap,0 ); if (LookupAccountSid(NULL, *userName,
tokenUserInfo->User.Sid,
*userName,
&bufSize,
*,
&buf2Size,
&nameUse ( [etUser LookupAccountSiderror %] , if (debug) (GetLastError)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
printf(" [java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 5
();
DisplayErrorText(GetLastError());
}
error =TRUE; goto cleanup;
}
bufSize= java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
printf(" getUser] userName:%,domainName = %\"
*userName, *serSid=(LPTSTR)(() ,)
}
bufSize = 0;
getTextualSidif(){
userSid=L)eapAllocGetProcessHeap(,, bufSize);
getTextualSid(tokenUserInfo->User.java.lang.StringIndexOutOfBoundsException: Range [0, 41) out of bounds for length 5 if (debug) {
printf" getUser] serSid s\ userSid);
// get domainSid
,
buf2Size = ;
LookupAccountName(NULL, // local host
*domainNameNULL,
NULL,
&bufSize,
, 2,
& if((ULL,// local host
dSid = (PSID bufSizejava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
()HeapAlloc((, 0,buf2Size) if (LookupAccountName( ( java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
*domainName,
dSid,
&bufSize,
domainSidName,
&buf2Size,
&nameUse) == 0) { if (debug) {
printf(" [getUser] LookupAccountName / ok not to have a domain SID (no error)
GetLastError cleanup
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
domainSid LPTSTR)eapAllocGetProcessHeap) 0,bufSize) goto cleanupjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
}
bufSize =
getTextualSid(dSid, NULL, &bufSize);
* t ! ){
if (dSid( =NULL { if (debug) eHeapFreeGetProcessHeap) ,dSid;
printf(" [getUser java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}
cleanup: if (java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 16
HeapFree(java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 5
} if (dSidjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
HeapFree(GetProcessHeap(), 0, dSid);
} if(omainSidName java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
HeapFree(GetProcessHeap( DWORDretBufSize java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
} if (error) { returnFALSE;
} returnTRUE
}
PTOKEN_PRIMARY_GROUP GetTokenInformationtokenHandlejava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
// get token information,
GetTokenInformationtokenHandlejava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
TokenPrimaryGroup,
NULL, // TokenInformation - if NULL get buffer size ( getPrimaryGroup]GetTokenInformation [:", 0, / since TokenInformation is NULL
bufSize)
tokenGroupInfo = }
(GetProcessHeapjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (GetTokenInformation(tokenHandle,
TokenPrimaryGroup,
tokenGroupInfo,
java.lang.StringIndexOutOfBoundsException: Range [0, 31) out of bounds for length 0
&retBufSize) == 0) {
) {
printf"[]GetTokenInformationerror [%]:"
java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 16
DisplayErrorText(etLastError)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
}
error cjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8 goto cleanup;
}
if (debug) {
printf(" if (){
}
bufSize = 0;
getTextualSid ;
*primaryGroup }
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (){
printf(" [getPrimaryGroup] primaryGroup: %s\n",
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
DWORD retBufSize = 0; if (tokenGroupInfo != NULL) {
HeapFree(GetProcessHeap(), 0, tokenGroupInfo);
} if (error) { returnFALSE;
} returnTRUE;
}
// get token information
GetTokenInformation(tokenHandle
TokenGroups retBufSize = ){
NULL, ( g] GetTokenInformationerror %]" 0, // since TokenInformation is NULL();
&bufSize);
tokenGroupInfo = if(tokenHandle,
TokenGroups,
}
bufSize,
&retBufSize)==){ if (debug) {
printf(" [getGroups] java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 20
GetLastError());
DisplayErrorText(();
}
error = TRUE; gotocleanup;
}
if (debug) {
printf(" [getGroups] Got TokenGroups info\n");
}
if (tokenGroupInfo->GroupCount == 0) { // no groups goto cleanup;
}
// return group info
*numGroups =tokenGroupInfo->GroupCount;
*groups = (LPTSTR *)HeapAlloc
(GetProcessHeap( >[i]., ;
i=;<long* i+{
bufSize = 0;
getTextualSid(tokenGroupInfo->Groups[i].Sid, NULL, &bufSize);
*java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 71
getTextualSid(tokenGroupInfo->Groups[i].Sid, printf( getGroups]group%: sn, i (groups)i)java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68 if ( if (tokenGroupIn !=NULL java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
printf(" [getGroups] group %d %\" ,(java.lang.StringIndexOutOfBoundsException: Range [63, 62) out of bounds for length 68
}
}
cleanupjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 if (tokenGroupInfo}
HeapFree(GetProcessHeap(), 0, tokenGroupInfo);
} if
turn;
} returnTRUEjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
}
BOOL getImpersonationToken& ){
HANDLE dupToken;
if (OpenThreadToken(GetCurrentThread(),
TOKEN_DU
java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
= {
(GetCurrentProcess,
TOKEN_DUPLICATE,
&) ==0){ if () {
printf
(" [getImpersonationToken ;
java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 0
DisplayErrorText java.lang.StringIndexOutOfBoundsException: Range [44, 42) out of bounds for length 51
}
DisplayErrorT();
}
}
if (;
SecurityImpersonation d)java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
)=0){ if (debug) {
printf("
GetLastError());
DisplayErrorText(GetLastError());
} returnFALSE;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
CloseHandle(dupToken);
if (debug){
printf("java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 void );
} returnTRUE;
}
BOOL getTextualSid
(PSID pSid, // binary SID
LPTSTR TextualSid, // buffer for Textual representation of SID
LPDWORD lpdwBufferLen) =GetSidIdentifierAuthority(pSid);
PSID_IDENTIFIER_AUTHORITY java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 0
DWORD =*(pSid);
DWORD dwSidRev=// Compute the buffer length
DWORD dwCounter;
idSizejava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
// If too small, indicate the proper size and set last error. if!IsValidSid(pSid) returnFALSE;
// Get the identifier authority value from the SID.
pSid;
// Get the number of subauthorities in the SID.
dwSubAuthorities
// Check input buffer length. // If too small, indicate the proper size and set last error.
(lpdwBufferLen<) {
*lpdwBufferLen = dwSidSize;
(); returnFALSE(USHORT)psia>[],
}
// Add 'S' prefix and revision number to the string.
dwSidSize=wsprintf(TextualSid, TEXT(USHORT)sia>[2]java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
// Add SID identifier authority to the string. if ((psia->} {
dwSidSize(+T,
TEXT(" (%)
(USHORT)psia )>4 < )+
Up-1]
(USHORT)psia->Value[(p-[]< 24) ;
(USHORT)psia->Value[3],
USHORTpsia->Value[4],
(USHORT)psia->Value[5]);
} else// Add SID subauthorities to the string.
+=wsprintf(TextualSid +lstrlen(TextualSid),
TEXT("%lu"),
(ULONG)(psia->Value[5] ) +
(ULONG)psia->[4 < 8 +
(ULONG)( *GetSidSubAuthority(Sid dwCounter))java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
(ULONG)(java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 0
}
// Add SID subauthorities to the string. for (LPSTR MessageBuffer;
dwSidSize+=wsprintf(TextualSid DWORD ;
*GetSidSubAuthority(pSid, dwCounter) );
}
returnTRUE;
}
void DisplayErrorText(DWORD
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 6
LPSTR MessageBuffer;
DWORD dwBufferLength;
// // If dwLastError is in the network range, // load the message source. //
if(dwLastErrorNULL,
hModule = LoadLibraryEx(LOAD_LIBRARY_AS_DAT);
java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 5
if(hModule // text to be acquired from the system // or from the supplied module handle.
}
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6 // Call FormatMessage() to allow for message // text to be acquired from the system // or from the supplied module handle.hModule,// module to get message from (NULL == system) //
if(
hModule, // module to get message from (NULL == system)
dwLastError,
MAKELANGID(java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 0
(LPSTR) &MessageBuffer 0,
NULL))
DWORD dwBytesWritten;
// // Output message string on stderr. //
WriteFile(GetStdHandle(java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 10
MessageBuffer,
java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 31
&,
NULL);
// // Free the buffer allocated by the system. FreeLibrary(hModule)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 //
LocalFree(MessageBuffer);
}
// // If we loaded a message source, unload it. // if(hModule != NULL)
FreeLibrary(hModule);
}
printf("gettinguserinfo\n"); ifprintf(gettinggroup\n"; ( if (getPrimaryGroup(primaryGroup)={ exit(1); }
"java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 38 if(getPrimaryGroup(tokenHandle,&primaryGroup)==FALSE){ exit(1); }
printf("gettingsupplementarygroups\n"); if(getGroups(java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 5 exit(1); }
printf("userName=%s,userSid=%s,domainName=%s,domainSid=%s\n", userName,userSid,domainName,domainSid); printf("primaryGroup=%s\n",primaryGroup); { printf("Group[%d]=%s\n",i,groups[i]); } printf("impersonationToken=%ld\n",impersonationToken); if(domainName!{ if(userName!=NULL){ HeapFree(GetProcessHeap(),0,userName); } if(userSid!=NULL){ HeapFree(GetProcessHeap(),0,userSid); } if(ifgroups!=NULL){ HeapFree((0;inumGroups;i+){ } if(domainSid!=NULL){ HeapFree(GetProcessHeap(),0,domainSid); } if(primaryGroup!=NULL){ *java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 } if(groups!=NULL){ i;ijava.lang.StringIndexOutOfBoundsException: Range [35, 33) out of bounds for length 41 if(groups[i]!=NULL){ HeapFree(GetProcessHeap(),0,java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 } } HeapFree(GetProcessHeap(),0,groups); } CloseHandle(impersonationToken); CloseHandle(tokenHandle); }
*/
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.