Updated from canonical source location in GnuPG.
This commit is contained in:
parent
a22eef99a2
commit
dc8410cbcf
1
assuan/README.1st
Normal file
1
assuan/README.1st
Normal file
@ -0,0 +1 @@
|
|||||||
|
Please don't modify it here but in the copy which comes with GnuPG.
|
@ -78,7 +78,7 @@ readline (int fd, char *buf, size_t buflen, int *r_nread, int *eof)
|
|||||||
for (; n && *p != '\n'; n--, p++)
|
for (; n && *p != '\n'; n--, p++)
|
||||||
;
|
;
|
||||||
if (n)
|
if (n)
|
||||||
break;
|
break; /* at least one full line available - that's enough for now */
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -95,7 +95,26 @@ _assuan_read_line (ASSUAN_CONTEXT ctx)
|
|||||||
if (ctx->inbound.eof)
|
if (ctx->inbound.eof)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
rc = readline (ctx->inbound.fd, line, LINELENGTH, &nread, &ctx->inbound.eof);
|
if (ctx->inbound.attic.linelen)
|
||||||
|
{
|
||||||
|
memcpy (line, ctx->inbound.attic.line, ctx->inbound.attic.linelen);
|
||||||
|
nread = ctx->inbound.attic.linelen;
|
||||||
|
ctx->inbound.attic.linelen = 0;
|
||||||
|
for (n=0; n < nread && line[n] != '\n'; n++)
|
||||||
|
;
|
||||||
|
if (n < nread)
|
||||||
|
rc = 0; /* found another line in the attic */
|
||||||
|
else
|
||||||
|
{ /* read the rest */
|
||||||
|
n = nread;
|
||||||
|
assert (n < LINELENGTH);
|
||||||
|
rc = readline (ctx->inbound.fd, line + n, LINELENGTH - n,
|
||||||
|
&nread, &ctx->inbound.eof);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rc = readline (ctx->inbound.fd, line, LINELENGTH,
|
||||||
|
&nread, &ctx->inbound.eof);
|
||||||
if (rc)
|
if (rc)
|
||||||
return ASSUAN_Read_Error;
|
return ASSUAN_Read_Error;
|
||||||
if (!nread)
|
if (!nread)
|
||||||
@ -104,15 +123,18 @@ _assuan_read_line (ASSUAN_CONTEXT ctx)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (n=nread-1; n>=0 ; n--)
|
for (n=0; n < nread; n++)
|
||||||
{
|
{
|
||||||
if (line[n] == '\n')
|
if (line[n] == '\n')
|
||||||
{
|
{
|
||||||
if (n != nread-1)
|
if (n+1 < nread)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "DBG-assuan: %d bytes left over after read\n",
|
n++;
|
||||||
nread-1 - n);
|
/* we have to copy the rest because the handlers are
|
||||||
/* fixme: store them for the next read */
|
allowed to modify the passed buffer */
|
||||||
|
memcpy (ctx->inbound.attic.line, line+n, nread-n);
|
||||||
|
ctx->inbound.attic.linelen = nread-n;
|
||||||
|
n--;
|
||||||
}
|
}
|
||||||
if (n && line[n-1] == '\r')
|
if (n && line[n-1] == '\r')
|
||||||
n--;
|
n--;
|
||||||
|
@ -45,6 +45,10 @@ struct assuan_context_s {
|
|||||||
int linelen; /* w/o CR, LF - might not be the same as
|
int linelen; /* w/o CR, LF - might not be the same as
|
||||||
strlen(line) due to embedded nuls. However a nul
|
strlen(line) due to embedded nuls. However a nul
|
||||||
is always written at this pos */
|
is always written at this pos */
|
||||||
|
struct {
|
||||||
|
char line[LINELENGTH];
|
||||||
|
int linelen ;
|
||||||
|
} attic;
|
||||||
} inbound;
|
} inbound;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
@ -52,6 +52,7 @@ typedef enum {
|
|||||||
ASSUAN_Line_Not_Terminated = 108,
|
ASSUAN_Line_Not_Terminated = 108,
|
||||||
ASSUAN_No_Input = 109,
|
ASSUAN_No_Input = 109,
|
||||||
ASSUAN_No_Output = 110,
|
ASSUAN_No_Output = 110,
|
||||||
|
ASSUAN_Canceled = 111,
|
||||||
|
|
||||||
ASSUAN_Cert_Revoked = 301,
|
ASSUAN_Cert_Revoked = 301,
|
||||||
ASSUAN_No_CRL_For_Cert = 302,
|
ASSUAN_No_CRL_For_Cert = 302,
|
||||||
|
Loading…
Reference in New Issue
Block a user