1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

Update error handling to match gpg-error in CVS.

This commit is contained in:
Marcus Brinkmann 2003-06-04 21:37:56 +00:00
parent 39e6e163d4
commit a58ce94d8e
16 changed files with 119 additions and 124 deletions

View file

@ -607,7 +607,7 @@ gpgsm_finish_writer (Base64Context ctx)
struct writer_cb_parm_s *parm;
if (!ctx)
return gpg_error (GPG_ERR_INVALID_VALUE);
return gpg_error (GPG_ERR_INV_VALUE);
parm = &ctx->u.wparm;
if (parm->did_finish)
return 0; /* already done */

View file

@ -415,7 +415,7 @@ gpgsm_agent_pksign (const char *keygrip,
if (!gcry_sexp_canon_len (*r_buf, *r_buflen, NULL, NULL))
{
xfree (*r_buf); *r_buf = NULL;
return gpg_error (GPG_ERR_INVALID_VALUE);
return gpg_error (GPG_ERR_INV_VALUE);
}
return *r_buf? 0 : OUT_OF_CORE (errno);
@ -455,12 +455,12 @@ gpgsm_agent_pkdecrypt (const char *keygrip,
size_t ciphertextlen;
if (!keygrip || strlen(keygrip) != 40 || !ciphertext || !r_buf || !r_buflen)
return gpg_error (GPG_ERR_INVALID_VALUE);
return gpg_error (GPG_ERR_INV_VALUE);
*r_buf = NULL;
ciphertextlen = gcry_sexp_canon_len (ciphertext, 0, NULL, NULL);
if (!ciphertextlen)
return gpg_error (GPG_ERR_INVALID_VALUE);
return gpg_error (GPG_ERR_INV_VALUE);
rc = start_agent ();
if (rc)
@ -499,11 +499,11 @@ gpgsm_agent_pkdecrypt (const char *keygrip,
len--; /* remove the terminating 0 */
n = strtoul (buf, &endp, 10);
if (!n || *endp != ':')
return gpg_error (GPG_ERR_INVALID_SEXP);
return gpg_error (GPG_ERR_INV_SEXP);
endp++;
if (endp-buf+n > len)
return gpg_error (GPG_ERR_INVALID_SEXP); /* oops len does not
match internal len*/
return gpg_error (GPG_ERR_INV_SEXP); /* oops len does not
match internal len*/
memmove (buf, endp, n);
*r_buflen = n;
*r_buf = buf;
@ -552,7 +552,7 @@ gpgsm_agent_genkey (KsbaConstSexp keyparms, KsbaSexp *r_pubkey)
gk_parm.sexp = keyparms;
gk_parm.sexplen = gcry_sexp_canon_len (keyparms, 0, NULL, NULL);
if (!gk_parm.sexplen)
return gpg_error (GPG_ERR_INVALID_VALUE);
return gpg_error (GPG_ERR_INV_VALUE);
rc = assuan_transact (agent_ctx, "GENKEY",
membuf_data_cb, &data,
inq_genkey_parms, &gk_parm, NULL, NULL);
@ -567,7 +567,7 @@ gpgsm_agent_genkey (KsbaConstSexp keyparms, KsbaSexp *r_pubkey)
if (!gcry_sexp_canon_len (buf, len, NULL, NULL))
{
xfree (buf);
return gpg_error (GPG_ERR_INVALID_SEXP);
return gpg_error (GPG_ERR_INV_SEXP);
}
*r_pubkey = buf;
return 0;
@ -651,7 +651,7 @@ gpgsm_agent_havekey (const char *hexkeygrip)
return rc;
if (!hexkeygrip || strlen (hexkeygrip) != 40)
return gpg_error (GPG_ERR_INVALID_VALUE);
return gpg_error (GPG_ERR_INV_VALUE);
snprintf (line, DIM(line)-1, "HAVEKEY %s", hexkeygrip);
line[DIM(line)-1] = 0;
@ -768,7 +768,7 @@ gpgsm_agent_passwd (const char *hexkeygrip)
return rc;
if (!hexkeygrip || strlen (hexkeygrip) != 40)
return gpg_error (GPG_ERR_INVALID_VALUE);
return gpg_error (GPG_ERR_INV_VALUE);
snprintf (line, DIM(line)-1, "PASSWD %s", hexkeygrip);
line[DIM(line)-1] = 0;

View file

@ -186,7 +186,7 @@ check_cert_policy (KsbaCert cert)
{
fclose (fp);
xfree (policies);
return gpg_error (GPG_ERR_CONFIGURATION_ERROR);
return gpg_error (GPG_ERR_CONFIGURATION);
}
*p = 0; /* strip the rest of the line */
/* See whether we find ALLOWED (which is an OID) in POLICIES */

View file

@ -450,7 +450,7 @@ gpgsm_decrypt (CTRL ctrl, int in_fd, FILE *out_fp)
if (!npadding || npadding > dfparm.blklen)
{
log_error ("invalid padding with value %d\n", npadding);
rc = gpg_error (GPG_ERR_INVALID_DATA);
rc = gpg_error (GPG_ERR_INV_DATA);
goto leave;
}
rc = ksba_writer_write (writer,
@ -466,7 +466,7 @@ gpgsm_decrypt (CTRL ctrl, int in_fd, FILE *out_fp)
if (dfparm.lastblock[i] != npadding)
{
log_error ("inconsistent padding\n");
rc = gpg_error (GPG_ERR_INVALID_DATA);
rc = gpg_error (GPG_ERR_INV_DATA);
goto leave;
}
}

View file

@ -562,7 +562,7 @@ keydb_get_cert (KEYDB_HANDLE hd, KsbaCert *r_cert)
int rc = 0;
if (!hd)
return gpg_error (GPG_ERR_INVALID_VALUE);
return gpg_error (GPG_ERR_INV_VALUE);
if ( hd->found < 0 || hd->found >= hd->used)
return -1; /* nothing found */
@ -591,7 +591,7 @@ keydb_insert_cert (KEYDB_HANDLE hd, KsbaCert cert)
char digest[20];
if (!hd)
return gpg_error (GPG_ERR_INVALID_VALUE);
return gpg_error (GPG_ERR_INV_VALUE);
if (opt.dry_run)
return 0;
@ -633,7 +633,7 @@ keydb_update_cert (KEYDB_HANDLE hd, KsbaCert cert)
char digest[20];
if (!hd)
return gpg_error (GPG_ERR_INVALID_VALUE);
return gpg_error (GPG_ERR_INV_VALUE);
if ( hd->found < 0 || hd->found >= hd->used)
return -1; /* nothing found */
@ -671,7 +671,7 @@ keydb_delete (KEYDB_HANDLE hd)
int rc = -1;
if (!hd)
return gpg_error (GPG_ERR_INVALID_VALUE);
return gpg_error (GPG_ERR_INV_VALUE);
if ( hd->found < 0 || hd->found >= hd->used)
return -1; /* nothing found */
@ -710,7 +710,7 @@ keydb_locate_writable (KEYDB_HANDLE hd, const char *reserved)
int rc;
if (!hd)
return gpg_error (GPG_ERR_INVALID_VALUE);
return gpg_error (GPG_ERR_INV_VALUE);
rc = keydb_search_reset (hd); /* this does reset hd->current */
if (rc)
@ -770,7 +770,7 @@ keydb_search_reset (KEYDB_HANDLE hd)
int i, rc = 0;
if (!hd)
return gpg_error (GPG_ERR_INVALID_VALUE);
return gpg_error (GPG_ERR_INV_VALUE);
hd->current = 0;
hd->found = -1;
@ -800,7 +800,7 @@ keydb_search (KEYDB_HANDLE hd, KEYDB_SEARCH_DESC *desc, size_t ndesc)
int rc = -1;
if (!hd)
return gpg_error (GPG_ERR_INVALID_VALUE);
return gpg_error (GPG_ERR_INV_VALUE);
while (rc == -1 && hd->current >= 0 && hd->current < hd->used)
{
@ -891,12 +891,12 @@ keydb_search_issuer_sn (KEYDB_HANDLE hd,
desc.mode = KEYDB_SEARCH_MODE_ISSUER_SN;
s = serial;
if (*s !='(')
return gpg_error (GPG_ERR_INVALID_VALUE);
return gpg_error (GPG_ERR_INV_VALUE);
s++;
for (desc.snlen = 0; digitp (s); s++)
desc.snlen = 10*desc.snlen + atoi_1 (s);
if (*s !=':')
return gpg_error (GPG_ERR_INVALID_VALUE);
return gpg_error (GPG_ERR_INV_VALUE);
desc.sn = s+1;
desc.u.name = issuer;
rc = keydb_search (hd, &desc, 1);