Sample code to allow checkout based on license file and trusted storage model

Sample code to allow checkout based on license file and trusted storage model

Seen below is a sample of  modified lsvendor.c that contains a server side checkout filter. It uses a flag that will detect if the license that is being checked out is from the Server Trusted Storage or a License file and will deny/allow accordingly.

 

int TS_License_out()
{
		
	char* feature;
	CONFIG * conf;


	ls_get_attr(LS_ATTR_FEATURE, &feature);
	ls_log_asc_printf("outfilter check out for lic file\n");

	conf = lc_get_config(lm_job, feature);
	printf("license type is %d\n", conf->nTSFeatFlag); //Check if license is TS or Lic file


	if (conf->nTSFeatFlag > 0) {
		ls_log_asc_printf("Allow Checkout"); // Allow if > 0(TS)
	return (1);
	}

	else {
		ls_log_asc_printf("Deny Checkout"); // Deny if 0 (Lic File)
		lc_set_errno(lm_job, -53);
		return(0);
	}

}
Labels (2)
Was this article helpful? Yes No
No ratings
Comments

Why not simply have a FNP library version when building to vendor daemon that  simply doesn't support certificate at all? 

Yes that can be definitely one of the ways, but in this approach suggested above we are allowing the user to have an option to allow or deny checkout through certificate/TS depending on the requirement which might vary each time. 

Version history
Revision #:
1 of 1
Last update:
‎Oct 22, 2020 03:24 AM
Updated by:
 
Contributors