Sample Install Program

if (error_ptr->error == CSSM_GUID_BEEN_INSTALLED) printf(“The add-in/GUID has been installed arleady.\n”);

else {

printf(“Failed at CSSM_ModuleInstall, error = %d\n”, error_ptr->error); printf(“Check <cdsa/cssmerr.h> for the error.\n”);

}

exit(1);

}

/* copy library to /usr/lib/cdsa */ memset(cpcmd, 0, PATH_LEN);

(void) sprintf(&cpcmd[0], “cp %s %s”, DL_LIB, TARGET_NAME); if (system(cpcmd) != 0) {

printf(“Failed to copy library image to /usr/lib/cdsa\n”); uninstall_addin(1);

exit (1);

}

if (chmod (TARGET_NAME, S_IRUSRS_IXUSRS_IRGRPS_IXGRPS_IROTHS_IXOTH) != 0)

{

printf(“Failed to change library mode.\n”); uninstall_addin(1);

exit (1);

}

printf(“The add-in module has been installed successfully.\n”);

exit( 0 );

}

CSSM_RETURN uninstall_addin(cleanup)

80

Appendix A