Issue about permissions - hp2xx

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
luis.ffs
Posts: 1
Joined: 2014-05-02T04:54:11-07:00
Authentication code: 6789

Issue about permissions - hp2xx

Post by luis.ffs »

Hi guys,

I'm using Image Magick to convert HPGL format to EPS through hp2xx tool in my Web Service application.

So, I had installed IM in my Windows 2008 R2 server and setup my WS to invoke IM when it's needed.

I noticed that conversion was not succesful and started to investigate what was happening.

With a tracer sniffing my convert process on the server, I discovered that when IM calls hp2xx tool to make the conversion, it tries to create a temporary file on the root (e.g. C:\) of my server.

The problem: I guess isn't right to grant write/execution access to my IIS user on the root of my server.

So, I was taking a look at hp2xx posts on the internet and found that it uses a function called tmpfile() to create that temporary file.

Code: Select all

#if defined(DOS) && defined (GNU)
  if ((pg->td = fopen("hp2xx.$$$","w+b")) == NULL)
#elif defined(AMIGA)
  if ((pg->td = fopen("t:hp2xx.tmp","w+b")) == NULL)
#else
  [b]if ((pg->td = tmpfile()) == NULL)[/b]
#endif	/** !DOS && GNU	**/
  {
	PError("hp2xx -- opening temporary file");
	return ERROR;
  }
This function creates the temporary file on the root of server.

I got the source code of hp2xx tool and change that bold line in the code above to:

Code: Select all

if ((pg->td = fopen( tempnam("C:\tmp", "t"), "w+b")) == NULL)
Well, I made a compilation and now the temporary file is created under user temporary directory.

It is just a workaround to solve my problem for a while, but it's far away from a complete solution.

I wish to know if IM developers team known about this issue and if you have a way to recompile hp2xx with the proper modifications to embed in the next versions of IM.

I looked around for your version of hp2xx source code to recompile, but I can't found it.

Please, can you tell if is it possible to correct that problem for current or future versions?

I know that hp2xx tool it's an external tool, but I guess you have you have your own repository of code for that tool. Am I right?

Thanks in advanced.
Luís Felipe.
Post Reply