[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CVS shishi/lib
From: |
shishi-commit |
Subject: |
CVS shishi/lib |
Date: |
Fri, 10 Sep 2004 11:58:31 +0200 |
Update of /home/cvs/shishi/lib
In directory dopio:/tmp/cvs-serv20229/lib
Modified Files:
aprep.c apreq.c asn1.c authenticator.c encapreppart.c
enckdcreppart.c encticketpart.c gztime.c kdc.c kdcrep.c
kdcreq.c krberror.c principal.c priv.c safe.c shishi.h.in
ticket.c tkt.c
Log Message:
Cleanup ASN.1.
--- /home/cvs/shishi/lib/aprep.c 2004/09/10 09:04:16 1.38
+++ /home/cvs/shishi/lib/aprep.c 2004/09/10 09:58:30 1.39
@@ -397,7 +397,7 @@
if (etype != shishi_key_type (key))
return SHISHI_APREP_BAD_KEYTYPE;
- res = shishi_asn1_read2 (handle, aprep, "enc-part.cipher",
+ res = shishi_asn1_read (handle, aprep, "enc-part.cipher",
&cipher, &cipherlen);
if (res != SHISHI_OK)
return res;
--- /home/cvs/shishi/lib/apreq.c 2004/09/10 09:04:16 1.46
+++ /home/cvs/shishi/lib/apreq.c 2004/09/10 09:58:30 1.47
@@ -417,7 +417,7 @@
char *buf;
size_t buflen, i, n;
- res = shishi_asn1_read2 (handle, ticket, "tkt-vno", &buf, &buflen);
+ res = shishi_asn1_read (handle, ticket, "tkt-vno", &buf, &buflen);
if (res != SHISHI_OK)
return res;
@@ -426,7 +426,7 @@
if (res != SHISHI_OK)
return res;
- res = shishi_asn1_read2 (handle, ticket, "realm", &buf, &buflen);
+ res = shishi_asn1_read (handle, ticket, "realm", &buf, &buflen);
if (res != SHISHI_OK)
return res;
@@ -435,7 +435,7 @@
if (res != SHISHI_OK)
return res;
- res = shishi_asn1_read2 (handle, ticket, "sname.name-type", &buf, &buflen);
+ res = shishi_asn1_read (handle, ticket, "sname.name-type", &buf, &buflen);
if (res != SHISHI_OK)
return res;
@@ -458,7 +458,7 @@
return res;
asprintf (&format, "sname.name-string.?%d", i);
- res = shishi_asn1_read2 (handle, ticket, format, &buf, &buflen);
+ res = shishi_asn1_read (handle, ticket, format, &buf, &buflen);
free (format);
if (res != SHISHI_OK)
return res;
@@ -471,7 +471,7 @@
return res;
}
- res = shishi_asn1_read2 (handle, ticket, "enc-part.etype", &buf, &buflen);
+ res = shishi_asn1_read (handle, ticket, "enc-part.etype", &buf, &buflen);
if (res != SHISHI_OK)
return res;
@@ -481,7 +481,7 @@
if (res != SHISHI_OK)
return res;
- res = shishi_asn1_read2 (handle, ticket, "enc-part.kvno", &buf, &buflen);
+ res = shishi_asn1_read (handle, ticket, "enc-part.kvno", &buf, &buflen);
if (res != SHISHI_OK && res != SHISHI_ASN1_NO_ELEMENT)
return res;
@@ -496,7 +496,7 @@
if (res != SHISHI_OK)
return res;
- res = shishi_asn1_read2 (handle, ticket, "enc-part.cipher", &buf, &buflen);
+ res = shishi_asn1_read (handle, ticket, "enc-part.cipher", &buf, &buflen);
if (res != SHISHI_OK)
return res;
@@ -689,7 +689,7 @@
if (!*ticket)
return SHISHI_ASN1_ERROR;
- res = shishi_asn1_read2 (handle, apreq, "ticket.tkt-vno", &buf, &buflen);
+ res = shishi_asn1_read (handle, apreq, "ticket.tkt-vno", &buf, &buflen);
if (res != SHISHI_OK)
goto error;
@@ -698,7 +698,7 @@
if (res != SHISHI_OK)
goto error;
- res = shishi_asn1_read2 (handle, apreq, "ticket.realm", &buf, &buflen);
+ res = shishi_asn1_read (handle, apreq, "ticket.realm", &buf, &buflen);
if (res != SHISHI_OK)
goto error;
@@ -707,7 +707,7 @@
if (res != SHISHI_OK)
goto error;
- res = shishi_asn1_read2 (handle, apreq, "ticket.sname.name-type",
+ res = shishi_asn1_read (handle, apreq, "ticket.sname.name-type",
&buf, &buflen);
if (res != SHISHI_OK)
goto error;
@@ -730,7 +730,7 @@
goto error;
asprintf (&format, "ticket.sname.name-string.?%d", i);
- res = shishi_asn1_read2 (handle, apreq, format, &buf, &buflen);
+ res = shishi_asn1_read (handle, apreq, format, &buf, &buflen);
free (format);
if (res != SHISHI_OK)
goto error;
@@ -743,7 +743,7 @@
goto error;
}
- res = shishi_asn1_read2 (handle, apreq, "ticket.enc-part.etype",
+ res = shishi_asn1_read (handle, apreq, "ticket.enc-part.etype",
&buf, &buflen);
if (res != SHISHI_OK)
goto error;
@@ -753,7 +753,7 @@
if (res != SHISHI_OK)
goto error;
- res = shishi_asn1_read2 (handle, apreq, "ticket.enc-part.kvno",
+ res = shishi_asn1_read (handle, apreq, "ticket.enc-part.kvno",
&buf, &buflen);
if (res != SHISHI_OK && res != SHISHI_ASN1_NO_ELEMENT)
goto error;
@@ -768,7 +768,7 @@
if (res != SHISHI_OK)
goto error;
- res = shishi_asn1_read2 (handle, apreq, "ticket.enc-part.cipher",
+ res = shishi_asn1_read (handle, apreq, "ticket.enc-part.cipher",
&buf, &buflen);
if (res != SHISHI_OK)
goto error;
@@ -806,7 +806,7 @@
if (etype != shishi_key_type (key))
return SHISHI_APREQ_BAD_KEYTYPE;
- res = shishi_asn1_read2 (handle, apreq, "authenticator.cipher",
+ res = shishi_asn1_read (handle, apreq, "authenticator.cipher",
&cipher, &cipherlen);
if (res != SHISHI_OK)
return res;
--- /home/cvs/shishi/lib/asn1.c 2004/09/10 09:04:16 1.67
+++ /home/cvs/shishi/lib/asn1.c 2004/09/10 09:58:30 1.68
@@ -91,10 +91,29 @@
return 0;
}
-/* XXX obsolete, see shishi_asn1_read2 */
+/**
+ * shishi_asn1_read_inline:
+ * @handle: shishi handle as allocated by shishi_init().
+ * @node: ASN.1 variable to read field from.
+ * @field: name of field in @node to read.
+ * @data: pre-allocated output buffer that will hold ASN.1 field data.
+ * @datalen: on input, maximum size of output buffer,
+ * on output, actual size of output buffer.
+ *
+ * Extract data stored in a ASN.1 field into a fixed size buffer
+ * allocated by caller.
+ *
+ * Note that since it is difficult to predict the length of the field,
+ * it is often better to use shishi_asn1_read() instead.
+ *
+ * Return value: Returns SHISHI_OK if successful,
+ * SHISHI_ASN1_NO_ELEMENT if the element do not exist,
+ * SHISHI_ASN1_NO_VALUE if the field has no value, ot
+ * SHISHI_ASN1_ERROR otherwise.
+ **/
int
-shishi_asn1_read (Shishi * handle, Shishi_asn1 node,
- const char *field, char *data, size_t * datalen)
+shishi_asn1_read_inline (Shishi * handle, Shishi_asn1 node,
+ const char *field, char *data, size_t * datalen)
{
int rc;
@@ -113,9 +132,23 @@
return SHISHI_OK;
}
-/* XXX rename and document */
+/**
+ * shishi_asn1_read:
+ * @handle: shishi handle as allocated by shishi_init().
+ * @node: ASN.1 variable to read field from.
+ * @field: name of field in @node to read.
+ * @data: newly allocated output buffer that will hold ASN.1 field data.
+ * @datalen: actual size of output buffer.
+ *
+ * Extract data stored in a ASN.1 field into a newly allocated buffer.
+ *
+ * Return value: Returns SHISHI_OK if successful,
+ * SHISHI_ASN1_NO_ELEMENT if the element do not exist,
+ * SHISHI_ASN1_NO_VALUE if the field has no value, ot
+ * SHISHI_ASN1_ERROR otherwise.
+ **/
int
-shishi_asn1_read2 (Shishi * handle,
+shishi_asn1_read (Shishi * handle,
Shishi_asn1 node, const char *field,
char **data, size_t * datalen)
{
@@ -142,7 +175,7 @@
if (len > 0)
{
- rc = shishi_asn1_read (handle, node, field, *data, &dlen);
+ rc = shishi_asn1_read_inline (handle, node, field, *data, &dlen);
if (rc != SHISHI_OK)
return rc;
}
@@ -156,6 +189,42 @@
return SHISHI_OK;
}
+/**
+ * shishi_asn1_read_optional:
+ * @handle: shishi handle as allocated by shishi_init().
+ * @node: ASN.1 variable to read field from.
+ * @field: name of field in @node to read.
+ * @data: newly allocated output buffer that will hold ASN.1 field data.
+ * @datalen: actual size of output buffer.
+ *
+ * Extract data stored in a ASN.1 field into a newly allocated buffer.
+ * If the field does not exist (i.e., SHISHI_ASN1_NO_ELEMENT), this
+ * function set datalen to 0 and succeeds. Can be useful to read
+ * ASN.1 fields which are marked OPTIONAL in the grammar, if you want
+ * to avoid special error handling in your code.
+ *
+ * Return value: Returns SHISHI_OK if successful,
+ * SHISHI_ASN1_NO_VALUE if the field has no value, ot
+ * SHISHI_ASN1_ERROR otherwise.
+ **/
+int
+shishi_asn1_read_optional (Shishi * handle,
+ Shishi_asn1 node, const char *field,
+ char **data, size_t * datalen)
+{
+ int rc;
+
+ rc = shishi_asn1_read (handle, node, field, data, datalen);
+ if (rc != SHISHI_OK && rc != SHISHI_ASN1_NO_ELEMENT)
+ return rc;
+
+ if (rc == SHISHI_ASN1_NO_ELEMENT)
+ if (datalen)
+ *datalen = 0;
+
+ return SHISHI_OK;
+}
+
int
shishi_asn1_read_int32 (Shishi * handle, Shishi_asn1 node,
const char *field, int32_t * i)
@@ -166,14 +235,14 @@
memset (buf, 0, sizeof (buf));
buflen = sizeof (buf);
- rc = shishi_asn1_read (handle, node, field, buf, &buflen);
+ rc = shishi_asn1_read_inline (handle, node, field, buf, &buflen);
if (rc != SHISHI_OK)
return rc;
if (buflen < 4)
{
memset (buf, 0, sizeof (buf));
- rc = shishi_asn1_read (handle, node, field, &buf[4 - buflen], &buflen);
+ rc = shishi_asn1_read_inline (handle, node, field, &buf[4 - buflen],
&buflen);
if (rc != SHISHI_OK)
return rc;
}
@@ -205,7 +274,7 @@
size_t i;
int res;
- res = shishi_asn1_read2 (handle, node, field, &buf, &buflen);
+ res = shishi_asn1_read (handle, node, field, &buf, &buflen);
if (res != SHISHI_OK)
return res;
@@ -227,46 +296,6 @@
return SHISHI_OK;
}
-/* XXX obsolete, see shishi_asn1_read2_optional */
-int
-shishi_asn1_read_optional (Shishi * handle,
- Shishi_asn1 node, const char *field,
- char *data, size_t * datalen)
-{
- int rc;
-
- rc = asn1_read_value (node, field, (unsigned char *) data, (int *) datalen);
- if (rc != ASN1_SUCCESS && rc != ASN1_ELEMENT_NOT_FOUND)
- {
- shishi_error_set (handle, libtasn1_strerror (rc));
- return SHISHI_ASN1_ERROR;
- }
-
- if (rc == ASN1_ELEMENT_NOT_FOUND)
- *datalen = 0;
-
- return SHISHI_OK;
-}
-
-/* XXX rename and document */
-int
-shishi_asn1_read2_optional (Shishi * handle,
- Shishi_asn1 node, const char *field,
- char **data, size_t * datalen)
-{
- int rc;
-
- rc = shishi_asn1_read2 (handle, node, field, data, datalen);
- if (rc != SHISHI_OK && rc != SHISHI_ASN1_NO_ELEMENT)
- return rc;
-
- if (rc == SHISHI_ASN1_NO_ELEMENT)
- if (datalen)
- *datalen = 0;
-
- return SHISHI_OK;
-}
-
int
shishi_asn1_write (Shishi * handle, Shishi_asn1 node,
const char *field, const char *data, size_t datalen)
--- /home/cvs/shishi/lib/authenticator.c 2004/09/10 09:32:29 1.66
+++ /home/cvs/shishi/lib/authenticator.c 2004/09/10 09:58:30 1.67
@@ -602,7 +602,7 @@
if (res != SHISHI_OK)
return res;
- res = shishi_asn1_read2 (handle, authenticator, "cksum.checksum",
+ res = shishi_asn1_read (handle, authenticator, "cksum.checksum",
cksum, cksumlen);
if (res != SHISHI_OK)
return res;
@@ -829,7 +829,7 @@
return res;
asprintf (&format, "authorization-data.?%d.ad-data", i);
- res = shishi_asn1_read2 (handle, authenticator, format, addata, addatalen);
+ res = shishi_asn1_read (handle, authenticator, format, addata, addatalen);
free (format);
if (res != SHISHI_OK)
return res;
@@ -885,7 +885,7 @@
if (res != SHISHI_OK)
return res;
- res = shishi_asn1_read2 (handle, authenticator, "subkey.keyvalue",
+ res = shishi_asn1_read (handle, authenticator, "subkey.keyvalue",
&subkeyvalue, &subkeylen);
if (res != SHISHI_OK)
return res;
--- /home/cvs/shishi/lib/encapreppart.c 2004/09/10 09:32:29 1.37
+++ /home/cvs/shishi/lib/encapreppart.c 2004/09/10 09:58:30 1.38
@@ -283,7 +283,7 @@
if (res != SHISHI_OK)
return res;
- res = shishi_asn1_read2 (handle, encapreppart, "subkey.keyvalue",
+ res = shishi_asn1_read (handle, encapreppart, "subkey.keyvalue",
&buf, &buflen);
if (res != SHISHI_OK)
return res;
@@ -481,7 +481,7 @@
size_t buflen;
int res;
- res = shishi_asn1_read2 (handle, authenticator, "cusec", &buf, &buflen);
+ res = shishi_asn1_read (handle, authenticator, "cusec", &buf, &buflen);
if (res != SHISHI_OK)
return res;
@@ -490,7 +490,7 @@
if (res != SHISHI_OK)
return res;
- res = shishi_asn1_read2 (handle, authenticator, "ctime", &buf, &buflen);
+ res = shishi_asn1_read (handle, authenticator, "ctime", &buf, &buflen);
if (res != SHISHI_OK)
return res;
--- /home/cvs/shishi/lib/enckdcreppart.c 2004/09/10 09:32:29 1.32
+++ /home/cvs/shishi/lib/enckdcreppart.c 2004/09/10 09:58:30 1.33
@@ -94,7 +94,7 @@
if (res != SHISHI_OK)
return res;
- res = shishi_asn1_read2 (handle, enckdcreppart, "key.keyvalue",
+ res = shishi_asn1_read (handle, enckdcreppart, "key.keyvalue",
&buf, &buflen);
if (res != SHISHI_OK)
return res;
@@ -356,7 +356,7 @@
size_t buflen;
int res;
- res = shishi_asn1_read2 (handle, encticketpart, "flags", &buf, &buflen);
+ res = shishi_asn1_read (handle, encticketpart, "flags", &buf, &buflen);
if (res != SHISHI_OK)
return SHISHI_ASN1_ERROR;
@@ -365,7 +365,7 @@
if (res != SHISHI_OK)
return SHISHI_ASN1_ERROR;
- res = shishi_asn1_read2 (handle, encticketpart, "authtime", &buf, &buflen);
+ res = shishi_asn1_read (handle, encticketpart, "authtime", &buf, &buflen);
if (res != SHISHI_OK)
return SHISHI_ASN1_ERROR;
@@ -374,7 +374,7 @@
if (res != SHISHI_OK)
return SHISHI_ASN1_ERROR;
- res = shishi_asn1_read2 (handle, encticketpart, "starttime", &buf, &buflen);
+ res = shishi_asn1_read (handle, encticketpart, "starttime", &buf, &buflen);
if (res != SHISHI_OK && res != SHISHI_ASN1_NO_ELEMENT)
return SHISHI_ASN1_ERROR;
@@ -389,7 +389,7 @@
if (res != SHISHI_OK)
return SHISHI_ASN1_ERROR;
- res = shishi_asn1_read2 (handle, encticketpart, "endtime", &buf, &buflen);
+ res = shishi_asn1_read (handle, encticketpart, "endtime", &buf, &buflen);
if (res != SHISHI_OK)
return SHISHI_ASN1_ERROR;
@@ -399,7 +399,7 @@
return SHISHI_ASN1_ERROR;
res =
- shishi_asn1_read2 (handle, encticketpart, "renew-till", &buf, &buflen);
+ shishi_asn1_read (handle, encticketpart, "renew-till", &buf, &buflen);
if (res != SHISHI_OK && res != SHISHI_ASN1_NO_ELEMENT)
return SHISHI_ASN1_ERROR;
--- /home/cvs/shishi/lib/encticketpart.c 2004/09/10 09:32:30 1.30
+++ /home/cvs/shishi/lib/encticketpart.c 2004/09/10 09:58:30 1.31
@@ -114,7 +114,7 @@
if (res != SHISHI_OK)
return res;
- res = shishi_asn1_read2 (handle, encticketpart, "key.keyvalue",
+ res = shishi_asn1_read (handle, encticketpart, "key.keyvalue",
&buf, &buflen);
if (res != SHISHI_OK)
return res;
@@ -187,7 +187,7 @@
Shishi_asn1 encticketpart,
char **crealm, size_t * crealmlen)
{
- return shishi_asn1_read2 (handle, encticketpart, "crealm",
+ return shishi_asn1_read (handle, encticketpart, "crealm",
crealm, crealmlen);
}
@@ -346,7 +346,7 @@
Shishi_asn1 encticketpart,
char *authtime, size_t * authtimelen)
{
- return shishi_asn1_read (handle, encticketpart, "authtime",
+ return shishi_asn1_read_inline (handle, encticketpart, "authtime",
authtime, authtimelen);
}
--- /home/cvs/shishi/lib/gztime.c 2004/09/10 09:32:30 1.14
+++ /home/cvs/shishi/lib/gztime.c 2004/09/10 09:58:30 1.15
@@ -116,7 +116,7 @@
len = SHISHI_GENERALIZEDTIME_LENGTH + 1;
*t = xmalloc (len);
- res = shishi_asn1_read (handle, node, field, *t, &len);
+ res = shishi_asn1_read_inline (handle, node, field, *t, &len);
if (res != SHISHI_OK)
return res;
--- /home/cvs/shishi/lib/kdc.c 2004/09/10 09:04:16 1.60
+++ /home/cvs/shishi/lib/kdc.c 2004/09/10 09:58:30 1.61
@@ -65,7 +65,7 @@
if (patype == SHISHI_PA_PW_SALT)
{
asprintf (&format, "padata.?%d.padata-value", i);
- res = shishi_asn1_read2 (handle, asrep, format, salt, saltlen);
+ res = shishi_asn1_read (handle, asrep, format, salt, saltlen);
free (format);
if (res != SHISHI_OK)
return res;
@@ -89,7 +89,7 @@
size_t tmplen;
asprintf (&format, "req-body.cname.name-string.?%d", i);
- res = shishi_asn1_read2 (handle, asreq, format, &tmp, &tmplen);
+ res = shishi_asn1_read (handle, asreq, format, &tmp, &tmplen);
free (format);
if (res != SHISHI_OK)
return res;
@@ -126,7 +126,7 @@
return res;
}
- res = shishi_asn1_read2 (handle, kdcreq, "req-body.realm",
+ res = shishi_asn1_read (handle, kdcreq, "req-body.realm",
&realm, &realmlen);
if (res != SHISHI_OK)
{
@@ -209,7 +209,7 @@
size_t buflen;
int res;
- res = shishi_asn1_read2 (handle, encticketpart, "crealm", &buf, &buflen);
+ res = shishi_asn1_read (handle, encticketpart, "crealm", &buf, &buflen);
if (res != SHISHI_OK)
return res;
@@ -241,7 +241,7 @@
size_t reqrealmlen, reprealmlen;
int res;
- res = shishi_asn1_read2 (handle, asreq, "req-body.realm",
+ res = shishi_asn1_read (handle, asreq, "req-body.realm",
&reqrealm, &reqrealmlen);
if (res != SHISHI_OK)
{
@@ -250,7 +250,7 @@
return res;
}
- res = shishi_asn1_read2 (handle, asrep, "crealm", &reprealm, &reprealmlen);
+ res = shishi_asn1_read (handle, asrep, "crealm", &reprealm, &reprealmlen);
if (res != SHISHI_OK)
{
shishi_error_printf (handle, "Could not read reply realm: %s\n",
@@ -297,7 +297,7 @@
size_t buflen, i, n;
int res;
- res = shishi_asn1_read2 (handle, encticketpart,
+ res = shishi_asn1_read (handle, encticketpart,
"cname.name-type", &buf, &buflen);
if (res != SHISHI_OK)
return res;
@@ -323,7 +323,7 @@
return res;
asprintf (&format, "cname.name-string.?%d", i);
- res = shishi_asn1_read2 (handle, encticketpart, format, &buf, &buflen);
+ res = shishi_asn1_read (handle, encticketpart, format, &buf, &buflen);
free (format);
if (res != SHISHI_OK)
return res;
@@ -378,14 +378,14 @@
for (i = 1; i <= j; i++)
{
asprintf (&format, "req-body.cname.name-string.?%d", i);
- res = shishi_asn1_read2 (handle, asreq, format,
+ res = shishi_asn1_read (handle, asreq, format,
&reqcname, &reqcnamelen);
free (format);
if (res != SHISHI_OK)
return res;
asprintf (&format, "cname.name-string.?%d", i);
- res = shishi_asn1_read2 (handle, asrep, format,
+ res = shishi_asn1_read (handle, asrep, format,
&repcname, &repcnamelen);
free (format);
if (res != SHISHI_OK)
@@ -513,7 +513,7 @@
size_t reqnoncelen, repnoncelen;
int res;
- res = shishi_asn1_read2 (handle, kdcreq, "req-body.nonce",
+ res = shishi_asn1_read (handle, kdcreq, "req-body.nonce",
&reqnonce, &reqnoncelen);
if (res != SHISHI_OK)
{
@@ -522,7 +522,7 @@
return res;
}
- res = shishi_asn1_read2 (handle, enckdcreppart, "nonce",
+ res = shishi_asn1_read (handle, enckdcreppart, "nonce",
&repnonce, &repnoncelen);
if (res != SHISHI_OK)
{
--- /home/cvs/shishi/lib/kdcrep.c 2004/09/10 09:04:16 1.43
+++ /home/cvs/shishi/lib/kdcrep.c 2004/09/10 09:58:30 1.44
@@ -392,7 +392,7 @@
if (!*ticket)
return SHISHI_ASN1_ERROR;
- res = shishi_asn1_read2 (handle, kdcrep, "ticket.tkt-vno", &buf, &buflen);
+ res = shishi_asn1_read (handle, kdcrep, "ticket.tkt-vno", &buf, &buflen);
if (res != SHISHI_OK)
goto error;
@@ -401,7 +401,7 @@
if (res != SHISHI_OK)
goto error;
- res = shishi_asn1_read2 (handle, kdcrep, "ticket.realm", &buf, &buflen);
+ res = shishi_asn1_read (handle, kdcrep, "ticket.realm", &buf, &buflen);
if (res != SHISHI_OK)
goto error;
@@ -410,7 +410,7 @@
if (res != SHISHI_OK)
goto error;
- res = shishi_asn1_read2 (handle, kdcrep, "ticket.sname.name-type",
+ res = shishi_asn1_read (handle, kdcrep, "ticket.sname.name-type",
&buf, &buflen);
if (res != SHISHI_OK)
goto error;
@@ -433,7 +433,7 @@
goto error;
asprintf (&format, "ticket.sname.name-string.?%d", i);
- res = shishi_asn1_read2 (handle, kdcrep, format, &buf, &buflen);
+ res = shishi_asn1_read (handle, kdcrep, format, &buf, &buflen);
free (format);
if (res != SHISHI_OK)
goto error;
@@ -446,7 +446,7 @@
goto error;
}
- res = shishi_asn1_read2 (handle, kdcrep, "ticket.enc-part.etype",
+ res = shishi_asn1_read (handle, kdcrep, "ticket.enc-part.etype",
&buf, &buflen);
if (res != SHISHI_OK)
goto error;
@@ -456,7 +456,7 @@
if (res != SHISHI_OK)
goto error;
- res = shishi_asn1_read2 (handle, kdcrep, "ticket.enc-part.kvno",
+ res = shishi_asn1_read (handle, kdcrep, "ticket.enc-part.kvno",
&buf, &buflen);
if (res != SHISHI_OK && res != SHISHI_ASN1_NO_ELEMENT)
goto error;
@@ -471,7 +471,7 @@
if (res != SHISHI_OK)
goto error;
- res = shishi_asn1_read2 (handle, kdcrep, "ticket.enc-part.cipher",
+ res = shishi_asn1_read (handle, kdcrep, "ticket.enc-part.cipher",
&buf, &buflen);
if (res != SHISHI_OK)
goto error;
@@ -508,7 +508,7 @@
size_t buflen;
size_t i, n;
- res = shishi_asn1_read2 (handle, ticket, "tkt-vno", &buf, &buflen);
+ res = shishi_asn1_read (handle, ticket, "tkt-vno", &buf, &buflen);
if (res != SHISHI_OK)
return res;
@@ -517,7 +517,7 @@
if (res != SHISHI_OK)
return res;
- res = shishi_asn1_read2 (handle, ticket, "realm", &buf, &buflen);
+ res = shishi_asn1_read (handle, ticket, "realm", &buf, &buflen);
if (res != SHISHI_OK)
return res;
@@ -526,7 +526,7 @@
if (res != SHISHI_OK)
return res;
- res = shishi_asn1_read2 (handle, ticket, "sname.name-type", &buf, &buflen);
+ res = shishi_asn1_read (handle, ticket, "sname.name-type", &buf, &buflen);
if (res != SHISHI_OK)
return res;
@@ -549,7 +549,7 @@
return res;
asprintf (&format, "sname.name-string.?%d", i);
- res = shishi_asn1_read2 (handle, ticket, format, &buf, &buflen);
+ res = shishi_asn1_read (handle, ticket, format, &buf, &buflen);
free (format);
if (res != SHISHI_OK)
return res;
@@ -562,7 +562,7 @@
return res;
}
- res = shishi_asn1_read2 (handle, ticket, "enc-part.etype", &buf, &buflen);
+ res = shishi_asn1_read (handle, ticket, "enc-part.etype", &buf, &buflen);
if (res != SHISHI_OK)
return res;
@@ -572,7 +572,7 @@
if (res != SHISHI_OK)
return res;
- res = shishi_asn1_read2 (handle, ticket, "enc-part.kvno", &buf, &buflen);
+ res = shishi_asn1_read (handle, ticket, "enc-part.kvno", &buf, &buflen);
if (res != SHISHI_OK)
res = shishi_asn1_write (handle, kdcrep, "ticket.enc-part.kvno", NULL, 0);
else
@@ -584,7 +584,7 @@
if (res != SHISHI_OK)
return res;
- res = shishi_asn1_read2 (handle, ticket, "enc-part.cipher", &buf, &buflen);
+ res = shishi_asn1_read (handle, ticket, "enc-part.cipher", &buf, &buflen);
if (res != SHISHI_OK)
return res;
@@ -720,7 +720,7 @@
if (etype != shishi_key_type (key))
return SHISHI_KDCREP_BAD_KEYTYPE;
- res = shishi_asn1_read2 (handle, kdcrep, "enc-part.cipher",
+ res = shishi_asn1_read (handle, kdcrep, "enc-part.cipher",
&cipher, &cipherlen);
if (res != SHISHI_OK)
return res;
--- /home/cvs/shishi/lib/kdcreq.c 2004/09/10 09:32:30 1.67
+++ /home/cvs/shishi/lib/kdcreq.c 2004/09/10 09:58:30 1.68
@@ -455,16 +455,16 @@
shishi_kdcreq_realm (Shishi * handle, Shishi_asn1 kdcreq,
char **realm, size_t * realmlen)
{
- return shishi_asn1_read2_optional (handle, kdcreq, "req-body.realm",
+ return shishi_asn1_read_optional (handle, kdcreq, "req-body.realm",
realm, realmlen);
}
int
shishi_kdcreq_realm_get (Shishi * handle, Shishi_asn1 kdcreq,
- char *realm, size_t * realmlen)
+ char **realm, size_t * realmlen)
{
return shishi_asn1_read_optional (handle, kdcreq, "req-body.realm",
- realm, realmlen);
+ realm, realmlen);
}
/**
@@ -612,7 +612,7 @@
shishi_kdcreq_till (Shishi * handle, Shishi_asn1 kdcreq,
char **till, size_t * tilllen)
{
- return shishi_asn1_read2 (handle, kdcreq, "req-body.till",
+ return shishi_asn1_read (handle, kdcreq, "req-body.till",
till, tilllen);
}
@@ -1166,7 +1166,7 @@
if (patype == (int32_t) padatatype)
{
asprintf (&format, "padata.?%d.padata-value", i);
- res = shishi_asn1_read2 (handle, kdcreq, format, out, outlen);
+ res = shishi_asn1_read (handle, kdcreq, format, out, outlen);
free (format);
if (res != SHISHI_OK)
return res;
--- /home/cvs/shishi/lib/krberror.c 2004/09/10 09:32:30 1.34
+++ /home/cvs/shishi/lib/krberror.c 2004/09/10 09:58:30 1.35
@@ -421,7 +421,7 @@
shishi_krberror_crealm (Shishi * handle,
Shishi_asn1 krberror, char **realm, size_t * realmlen)
{
- return shishi_asn1_read2 (handle, krberror, "crealm", realm, realmlen);
+ return shishi_asn1_read (handle, krberror, "crealm", realm, realmlen);
}
/**
@@ -579,7 +579,7 @@
shishi_krberror_realm (Shishi * handle,
Shishi_asn1 krberror, char **realm, size_t * realmlen)
{
- return shishi_asn1_read2 (handle, krberror, "realm", realm, realmlen);
+ return shishi_asn1_read (handle, krberror, "realm", realm, realmlen);
}
/**
@@ -1002,7 +1002,7 @@
shishi_krberror_etext (Shishi * handle, Shishi_asn1 krberror,
char **etext, size_t * etextlen)
{
- return shishi_asn1_read2 (handle, krberror, "e-text", etext, etextlen);
+ return shishi_asn1_read (handle, krberror, "e-text", etext, etextlen);
}
/**
@@ -1064,7 +1064,7 @@
shishi_krberror_edata (Shishi * handle, Shishi_asn1 krberror,
char **edata, size_t * edatalen)
{
- return shishi_asn1_read2 (handle, krberror, "e-data", edata, edatalen);
+ return shishi_asn1_read (handle, krberror, "e-data", edata, edatalen);
}
/**
--- /home/cvs/shishi/lib/principal.c 2004/04/21 16:28:53 1.30
+++ /home/cvs/shishi/lib/principal.c 2004/09/10 09:58:30 1.31
@@ -230,7 +230,7 @@
size_t safetmplen;
asprintf (&format, "%s.name-string.?%d", namefield, i);
- res = shishi_asn1_read2 (handle, namenode, format, &tmp, &tmplen);
+ res = shishi_asn1_read (handle, namenode, format, &tmp, &tmplen);
free (format);
if (res != SHISHI_OK)
return res;
@@ -293,7 +293,7 @@
{
len = *outlen - totlen;
asprintf (&format, "%s.name-string.?%d", namefield, i);
- res = shishi_asn1_read (handle, namenode, format, &out[totlen], &len);
+ res = shishi_asn1_read_inline (handle, namenode, format, &out[totlen],
&len);
free (format);
if (res != SHISHI_OK)
return res;
@@ -364,7 +364,7 @@
totlen += strlen ("@");
len = *outlen - totlen;
- res = shishi_asn1_read (handle, realmnode, realmfield,
+ res = shishi_asn1_read_inline (handle, realmnode, realmfield,
&out[totlen], &len);
if (res == SHISHI_ASN1_NO_ELEMENT)
totlen--;
--- /home/cvs/shishi/lib/priv.c 2004/09/10 09:04:16 1.6
+++ /home/cvs/shishi/lib/priv.c 2004/09/10 09:58:30 1.7
@@ -546,7 +546,7 @@
{
int res;
- res = shishi_asn1_read2 (handle, encprivpart, "user-data",
+ res = shishi_asn1_read (handle, encprivpart, "user-data",
userdata, userdatalen);
if (res != SHISHI_OK)
return res;
@@ -658,7 +658,7 @@
if (etype != shishi_key_type (key))
return SHISHI_PRIV_BAD_KEYTYPE;
- res = shishi_asn1_read2 (priv->handle, priv->priv, "enc-part.cipher",
+ res = shishi_asn1_read (priv->handle, priv->priv, "enc-part.cipher",
&cipher, &cipherlen);
if (res != SHISHI_OK)
return res;
--- /home/cvs/shishi/lib/safe.c 2004/09/10 09:04:16 1.28
+++ /home/cvs/shishi/lib/safe.c 2004/09/10 09:58:30 1.29
@@ -407,7 +407,7 @@
if (res != SHISHI_OK)
return res;
- res = shishi_asn1_read2 (handle, safe, "cksum.checksum", cksum, cksumlen);
+ res = shishi_asn1_read (handle, safe, "cksum.checksum", cksum, cksumlen);
if (res != SHISHI_OK)
return res;
@@ -467,7 +467,7 @@
{
int res;
- res = shishi_asn1_read2 (handle, safe, "safe-body.user-data",
+ res = shishi_asn1_read (handle, safe, "safe-body.user-data",
userdata, userdatalen);
if (res != SHISHI_OK)
return res;
--- /home/cvs/shishi/lib/shishi.h.in 2004/09/10 09:33:28 1.238
+++ /home/cvs/shishi/lib/shishi.h.in 2004/09/10 09:58:30 1.239
@@ -1080,7 +1080,7 @@
extern int shishi_kdcreq_realm (Shishi * handle, Shishi_asn1 kdcreq,
char **realm, size_t * realmlen);
extern int shishi_kdcreq_realm_get (Shishi * handle, Shishi_asn1 kdcreq,
- char *realm, size_t * realmlen);
+ char **realm, size_t * realmlen);
extern int shishi_kdcreq_set_realm (Shishi * handle, Shishi_asn1 kdcreq,
const char *realm);
extern int shishi_kdcreq_set_server (Shishi * handle, Shishi_asn1 req,
@@ -1550,10 +1550,11 @@
const char *field);
extern int shishi_asn1_read (Shishi * handle, Shishi_asn1 node,
- const char *field, char *data, size_t * datalen);
-extern int shishi_asn1_read2 (Shishi * handle, Shishi_asn1 node,
- const char *field,
- char **data, size_t * datalen);
+ const char *field,
+ char **data, size_t * datalen);
+extern int shishi_asn1_read_inline (Shishi * handle, Shishi_asn1 node,
+ const char *field,
+ char *data, size_t * datalen);
extern int shishi_asn1_read_integer (Shishi * handle, Shishi_asn1 node,
const char *field, int *i);
extern int shishi_asn1_read_int32 (Shishi * handle, Shishi_asn1 node,
@@ -1564,10 +1565,7 @@
const char *field, uint32_t * flags);
extern int shishi_asn1_read_optional (Shishi * handle,
Shishi_asn1 node, const char *field,
- char *data, size_t * datalen);
-extern int shishi_asn1_read2_optional (Shishi * handle,
- Shishi_asn1 node, const char *field,
- char **data, size_t * datalen);
+ char **data, size_t * datalen);
extern int shishi_asn1_write (Shishi * handle, Shishi_asn1 node,
const char *field,
--- /home/cvs/shishi/lib/ticket.c 2004/09/10 09:04:16 1.54
+++ /home/cvs/shishi/lib/ticket.c 2004/09/10 09:58:30 1.55
@@ -71,7 +71,7 @@
shishi_ticket_realm_get (Shishi * handle,
Shishi_asn1 ticket, char **realm, size_t * realmlen)
{
- return shishi_asn1_read2 (handle, ticket, "realm", realm, realmlen);
+ return shishi_asn1_read (handle, ticket, "realm", realm, realmlen);
}
/**
@@ -278,7 +278,7 @@
if (etype != shishi_key_type (key))
return SHISHI_TICKET_BAD_KEYTYPE;
- res = shishi_asn1_read2 (handle, ticket, "enc-part.cipher",
+ res = shishi_asn1_read (handle, ticket, "enc-part.cipher",
&cipher, &cipherlen);
if (res != SHISHI_OK)
return res;
--- /home/cvs/shishi/lib/tkt.c 2004/09/10 09:32:30 1.42
+++ /home/cvs/shishi/lib/tkt.c 2004/09/10 09:58:30 1.43
@@ -1058,7 +1058,7 @@
if (lrtype == tmplrtype)
{
asprintf (&format, "last-req.?%d.lr-value", i);
- res = shishi_asn1_read2 (tkt->handle, tkt->enckdcreppart,
+ res = shishi_asn1_read (tkt->handle, tkt->enckdcreppart,
format, lrtime, lrtimelen);
free (format);
if (res != SHISHI_OK)
@@ -1106,7 +1106,7 @@
int
shishi_tkt_authtime (Shishi_tkt * tkt, char **authtime, size_t * authtimelen)
{
- return shishi_asn1_read2 (tkt->handle, tkt->enckdcreppart, "authtime",
+ return shishi_asn1_read (tkt->handle, tkt->enckdcreppart, "authtime",
authtime, authtimelen);
}
@@ -1145,7 +1145,7 @@
char **starttime,
size_t * starttimelen)
{
- return shishi_asn1_read2_optional (tkt->handle, tkt->enckdcreppart,
+ return shishi_asn1_read_optional (tkt->handle, tkt->enckdcreppart,
"starttime", starttime, starttimelen);
}
@@ -1182,7 +1182,7 @@
int
shishi_tkt_endtime (Shishi_tkt * tkt, char **endtime, size_t * endtimelen)
{
- return shishi_asn1_read2 (tkt->handle, tkt->enckdcreppart, "endtime",
+ return shishi_asn1_read (tkt->handle, tkt->enckdcreppart, "endtime",
endtime, endtimelen);
}
@@ -1220,7 +1220,7 @@
char **renewtill,
size_t * renewtilllen)
{
- return shishi_asn1_read2_optional (tkt->handle, tkt->enckdcreppart,
+ return shishi_asn1_read_optional (tkt->handle, tkt->enckdcreppart,
"renew-till", renewtill, renewtilllen);
}
- CVS shishi/lib, (continued)
- CVS shishi/lib, shishi-commit, 2004/09/02
- CVS shishi/lib, shishi-commit, 2004/09/06
- CVS shishi/lib, shishi-commit, 2004/09/08
- CVS shishi/lib, shishi-commit, 2004/09/08
- CVS shishi/lib, shishi-commit, 2004/09/10
- CVS shishi/lib, shishi-commit, 2004/09/10
- CVS shishi/lib, shishi-commit, 2004/09/10
- CVS shishi/lib, shishi-commit, 2004/09/10
- CVS shishi/lib, shishi-commit, 2004/09/10
- CVS shishi/lib, shishi-commit, 2004/09/10
- CVS shishi/lib,
shishi-commit <=
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17
- CVS shishi/lib, shishi-commit, 2004/09/17