dcsimg
JNI iPlanet problem with IBM Access Manager API's
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Charles_Balasingh
Posted On:   Thursday, March 27, 2003 05:11 AM

I have a C program which has some IBM Access Manager API's. I am trying to call the same using JNI in iPlanet. When I run the program from command prompt it works fine. If do the same in iPlanet it core dumps and iPlanet shuts down. Am I missing something here. Thanks Charles The C code is as follows JNIEXPORT void JNICALL Java_r4migration_GMSPAMUpdate_updateAMPassword(JNIEnv * env, jobject thisObj, jstring adminName,jstring adminPw,jstring gsoResource,jstring userName,jstring newPassword) { unsigned long status=0; // to hold status of function calls ivadmin_context ctx=NULL; // to hold PD context ivadmin_response rsp=NUL   More>>

I have a C program which has some IBM Access Manager API's.
I am trying to call the same using JNI in iPlanet.
When I run the program from command prompt it works fine.
If do the same in iPlanet it core dumps and iPlanet shuts down.
Am I missing something here.


Thanks

Charles



The C code is as follows


			
JNIEXPORT void JNICALL Java_r4migration_GMSPAMUpdate_updateAMPassword(JNIEnv * env, jobject thisObj, jstring adminName,jstring adminPw,jstring gsoResource,jstring userName,jstring newPassword) {

unsigned long status=0; // to hold status of function calls
ivadmin_context ctx=NULL; // to hold PD context
ivadmin_response rsp=NULL; // to hold response value */

int rescount=0,i=0;

const char *strAdminName= (*env)->GetStringUTFChars(env, adminName, 0);
const char *strAdminPw = (*env)->GetStringUTFChars(env, adminPw, 0);
const char *strGsoResource = (*env)->GetStringUTFChars(env, gsoResource, 0);
const char *strUserName = (*env)->GetStringUTFChars(env, userName, 0);
const char *strNewPassword = (*env)->GetStringUTFChars(env, newPassword, 0);

printf("Received values %s - %s - %s - %s - %s
",strAdminName,strAdminPw,strGsoResource,strUserName,strNewPassword);

status=ivadmin_context_createdefault(strAdminName,strAdminPw, &ctx, &rsp);

printf("Admin context create status %d
",status);


if(status !=IVADMIN_TRUE)
{
rescount =ivadmin_response_getcount(rsp);
printf("Response count is : %d",rescount);
for (i=0; i
{
printf(" Error message %s
" ,ivadmin_response_getmessage(rsp, i));
}
}

status = ivadmin_ssocred_set(ctx,strGsoResource,IVADMIN_SSOCRED_SSOWEB,strUserName,strUserName,strNewPassword,&rsp);
//status = ivadmin_ssocred_set(ctx,"gmspresource",IVADMIN_SSOCRED_SSOWEB,"zzm44t","zzm44t","faizal12345",&rsp);

printf("
After update status - %d
",status);
if(status !=IVADMIN_TRUE)
{
printf("ivadminv true values %d
",status);

ivadmin_context_delete(ctx,&rsp);

printf("after contxt delete %d
",status);


if(rsp)
{
ivadmin_free(rsp);
rsp=NULL;
}
if(ctx)
{
ivadmin_free(ctx);
ctx=NULL;
}

//exit(1);
return;
}

if(rsp)
{
ivadmin_free(rsp);
rsp=NULL;
}

status =ivadmin_context_delete(ctx,&rsp);

printf("context delete status is %d
",status);

if (status !=IVADMIN_TRUE)
{
ivadmin_free(ctx);
//exit(1);
return;
}
if(rsp)
{
ivadmin_free(rsp);
rsp=NULL;
}

if(ctx)
{
ivadmin_free(ctx);
ctx=NULL;
}


printf("Mission complete
");
(*env)->ReleaseStringUTFChars(env, adminName, strAdminName);
(*env)->ReleaseStringUTFChars(env, adminPw, strAdminPw);
(*env)->ReleaseStringUTFChars(env, gsoResource, strGsoResource);
(*env)->ReleaseStringUTFChars(env, userName, strUserName);
(*env)->ReleaseStringUTFChars(env, newPassword, strNewPassword);

}
   <<Less
About | Sitemap | Contact