List Archive

Thread

Thread Index

Message

From: Thomas Klausner <tk%giga.or.at@localhost>
To: Lisa Matias <lisa.matias%gmail.com@localhost>
Subject: Re: ZIP_CREATE flag for zip_fdopen issues
Date: Sun, 8 Jan 2017 15:24:34 +0100

Hi Lisa!


On Thu, Jan 05, 2017 at 06:37:42AM -0800, Lisa Matias wrote:
> The RAM disk option is not possible since for security, the CGI web
> application runs in chroot() set to an isolated directory with no other
> access to the web server file-system, so it cannot access /tmp.
> Furthermore, I do not have root/administer access on the web server this
> will be deployed on to set up any other RAM disks.

Ok.

> The example/in-memory.c is different than my intended usage, so I am still
> unclear on how to do this properly.

I think it fits your intended use case quite well. You create the file
in memory, you only have to add code to write the memory to the file
descriptor.


> Please consider this simple code example...

This is really hard because it obviously cannot compile.

> // #########################################
> static char file1 [] = "This is the contents of the first file!";
> static char file2 [] = "This is the contents of the second file!";
> static char file3 [] = "This is the contents of the third file!";
> 
> static unsigned char zipBuffer [65536];  // 64kB buffer for ZIP which is
> more than large enough
> zip_source_t *zipSource, *zipFile;
> zip_error_t zipError;
> zip_t *zip;
> 
> memset (zipBuffer, 0, sizeof (zipBuffer));
> *zip_error_init (&zipError);*
> if (!(*zipSource = zip_source_buffer_create (zipBuffer, sizeof (zipBuf), 0,
> &zipError)*))

In particular, sizeof(zipBuf) is not the size of zipBuffer.

If you want help, please provide the exact code. But I think debugging
of your code yourself should get you there...

Cheers,
 Thomas

Made by MHonArc.