/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 2003-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* pax zip format
*/
#include <paxlib.h>
#include <codex.h>
#include <dt.h>
#include <swap.h>
#include <tm.h>
#include <vmalloc.h>
typedef struct Ar_s
{
unsigned int index;
unsigned long checksum;
} Ar_t;
typedef struct Mem_s
{
unsigned long checksum;
} Mem_t;
static int
{
return -1;
return 0;
}
static int
zip_getprologue(Pax_t* pax, Paxformat_t* fp, register Paxarchive_t* ap, Paxfile_t* f, unsigned char* buf, size_t size)
{
unsigned long magic;
unsigned char* hdr;
int n;
int ext;
int com;
if (size < ZIP_LOC_HEADER || (magic = (unsigned long)swapget(0, buf, 4)) != ZIP_LOC_MAGIC && magic != ZIP_CEN_MAGIC)
return 0;
return paxnospace(pax);
{
return paxnospace(pax);
}
{
{
return paxnospace(pax);
}
{
return -1;
}
{
{
return paxnospace(pax);
}
{
(*pax->errorf)(NiL, pax, 2, "%s: invalid %s format verification header name [size=%I*u]", ap->name, fp->name, sizeof(n), n);
return -1;
}
n--;
{
(*pax->errorf)(NiL, pax, 2, "%s: %s: invalid %s format verification header extended data [size=%I*u]", ap->name, mem->name, fp->name, sizeof(ext), ext);
return -1;
}
{
(*pax->errorf)(NiL, pax, 2, "%s: %s: invalid %s format verification header comment data [size=%I*u]", ap->name, mem->name, fp->name, sizeof(com), com);
return -1;
}
}
{
return -1;
}
}
return 1;
}
static int
{
unsigned char* hdr;
long n;
int i;
int m;
{
{
case ZIP_LOC_MAGIC:
num += n + m;
break;
{
if (n)
n--;
}
else
f->name[n] = 0;
f->linktype = PAX_NOLINK;
f->linkpath = 0;
{
}
else
{
}
i = 0;
i += sfsprintf(ar->method, sizeof(ar->method), "crypt-zip+SIZE=%I*u|", sizeof(f->st->st_size), f->st->st_size);
else
i += sfsprintf(ar->method + i, sizeof(ar->method) - i, "zip-%u+SIZE=%I*u", m, sizeof(f->uncompressed), f->uncompressed);
if (error_info.trace)
return 1;
case ZIP_EXT_MAGIC:
{
(*pax->errorf)(NiL, pax, 2, "%s: invalid %s format verification header", ap->name, ap->format->name);
return 0;
}
break;
default:
return 0;
}
}
return 0;
}
static int
{
ssize_t n;
int r;
int pop;
return 1;
r = -1;
if (fd < 0)
r = 1;
{
else
{
for (;;)
{
{
break;
}
else if (n == 0)
{
r = 1;
break;
}
break;
}
}
}
{
(*pax->errorf)(NiL, pax, 2, "%s: %s: cannot seek past %s format data", ap->name, f->name, ap->format->name);
r = -1;
}
return r;
}
{
"zip",
0,
"zip 2.1 / PKZIP 2.04g archive.",
0,
0,
0,
};