Example #1
0
static char *dl_name_converter(DSO *dso, const char *filename)
	{
	char *translated;
	int len, rsize, transform;

	len = strlen(filename);
	rsize = len + 1;
	transform = (strstr(filename, "/") == NULL);
		{
		/* We will convert this to "%s.s?" or "lib%s.s?" */
		rsize += strlen(extension);/* The length of ".s?" */
		if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
			rsize += 3; /* The length of "lib" */
		}
	translated = OPENSSL_malloc(rsize);
	if(translated == NULL)
		{
		DSOerr(DSO_F_DL_NAME_CONVERTER,
				DSO_R_NAME_TRANSLATION_FAILED); 
		return(NULL);   
		}
	if(transform)
		{
		if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
			sprintf(translated, "lib%s%s", filename, extension);
		else
			sprintf(translated, "%s%s", filename, extension);
		}
	else
		sprintf(translated, "%s", filename);
	return(translated);
	}
Example #2
0
static char *dlfcn_name_converter(DSO *dso, const char *filename)
	{
	char *translated;
	int len, rsize, transform;

	len = TINYCLR_SSL_STRLEN(filename);
	rsize = len + 1;
	transform = (strstr(filename, "/") == NULL);
	if(transform)
		{
		/* We will convert this to "%s.so" or "lib%s.so" etc */
		rsize += DSO_extlen;	/* The length of ".so" */
		if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
			rsize += 3; /* The length of "lib" */
		}
	translated = OPENSSL_malloc(rsize);
	if(translated == NULL)
		{
		DSOerr(DSO_F_DLFCN_NAME_CONVERTER,
				DSO_R_NAME_TRANSLATION_FAILED);
		return(NULL);
		}
	if(transform)
		{
		if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
			TINYCLR_SSL_SPRINTF(translated, "lib%s" DSO_ext, filename);
		else
			TINYCLR_SSL_SPRINTF(translated, "%s" DSO_ext, filename);
		}
	else
		TINYCLR_SSL_SPRINTF(translated, "%s", filename);
	return(translated);
	}
Example #3
0
static char *dlfcn_name_converter(DSO *dso, const char *filename)
	{
	char *translated;
	int len, rsize, transform;

	len = strlen(filename);
	rsize = len + 1;
	transform = (strstr(filename, "/") == NULL);
	if(transform)
		{
#ifndef SYMBIAN		
		/* We will convert this to "%s.so" or "lib%s.so" */
		rsize += 3;	/* The length of ".so" */
		if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
			rsize += 3; /* The length of "lib" */
#else
	/* We will convert this to "%s.dll" or "lib%s.dll" */
		rsize += 4;	/* The length of ".dll" */
		if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
			rsize += 3; /* The length of "lib" */
#endif			
		}
	translated = OPENSSL_malloc(rsize);
	if(translated == NULL)
		{
		DSOerr(DSO_F_DLFCN_NAME_CONVERTER,
				DSO_R_NAME_TRANSLATION_FAILED);
		return(NULL);
		}
	if(transform)
		{
#ifndef SYMBIAN		
		if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
			sprintf(translated, "lib%s.so", filename);
		else
			sprintf(translated, "%s.so", filename);
#else
		if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
			sprintf(translated, "lib%s.dll", filename);
		else
			sprintf(translated, "%s.dll", filename);

#endif		
		
		}
	else
		sprintf(translated, "%s", filename);
	return(translated);
	}
Example #4
0
static char *
dlfcn_name_converter(DSO *dso, const char *filename)
{
	char *translated;
	int ret;

	if (strchr(filename, '/') == NULL) {
		/* Bare name, so convert to "%s.so" or "lib%s.so" */
		if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
			ret = asprintf(&translated, "lib%s" DSO_ext, filename);
		else
			ret = asprintf(&translated, "%s" DSO_ext, filename);
		if (ret == -1)
			translated = NULL;
	} else {
		/* Full path, so just duplicate it */
		translated = strdup(filename);
	}

	if (translated == NULL)
		DSOerr(DSO_F_DLFCN_NAME_CONVERTER,
		    DSO_R_NAME_TRANSLATION_FAILED);
	return (translated);
}