summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>1999-10-09 06:34:15 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>1999-10-09 06:34:15 +0000
commit78a3820d7c72ca33ca89b44c87a2c5fb3d028e1e (patch)
tree6c306314a72696e38603264ecf0ecf6431d1443c /lib
parentacd5d55e740e3de51e4e63a4cf80566349e13a99 (diff)
Better handling of errors in kn_query, update manpage accordingly.
Diffstat (limited to 'lib')
-rw-r--r--lib/libkeynote/Makefile.in2
-rw-r--r--lib/libkeynote/environment.c15
-rw-r--r--lib/libkeynote/keynote.310
3 files changed, 17 insertions, 10 deletions
diff --git a/lib/libkeynote/Makefile.in b/lib/libkeynote/Makefile.in
index 2cffc0d22f9..0180ecba8df 100644
--- a/lib/libkeynote/Makefile.in
+++ b/lib/libkeynote/Makefile.in
@@ -17,7 +17,7 @@
# MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
# PURPOSE.
-VERSION = 2.0
+VERSION = 2.1
DISTFILE = keynote-${VERSION}.tar.gz
KNSUBDIR = KeyNote-${VERSION}
diff --git a/lib/libkeynote/environment.c b/lib/libkeynote/environment.c
index 3b9ed53942d..a82e6baed8b 100644
--- a/lib/libkeynote/environment.c
+++ b/lib/libkeynote/environment.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: environment.c,v 1.5 1999/10/06 20:27:46 angelos Exp $ */
-/*
+/* $OpenBSD: environment.c,v 1.6 1999/10/09 06:34:14 angelos Exp $ */
+/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
* This code was written by Angelos D. Keromytis in Philadelphia, PA, USA,
@@ -793,8 +793,8 @@ kn_query(struct environment *env, char **retvalues, int numval,
/* Action set */
for (en = env; en != (struct environment *) NULL; en = en->env_next)
- if (kn_add_action(sessid, en->env_name, en->env_value, en->env_flags) ==
- -1)
+ if (kn_add_action(sessid, en->env_name, en->env_value,
+ en->env_flags) == -1)
{
serrno = keynote_errno;
kn_close(sessid);
@@ -804,8 +804,8 @@ kn_query(struct environment *env, char **retvalues, int numval,
/* Locally trusted assertions */
for (i = 0; i < numtrusted; i++)
- if (kn_add_assertion(sessid, trusted[i], trustedlen[i],
- ASSERT_FLAG_LOCAL) == -1)
+ if ((kn_add_assertion(sessid, trusted[i], trustedlen[i],
+ ASSERT_FLAG_LOCAL) == -1) && (keynote_errno == ERROR_MEMORY))
{
serrno = keynote_errno;
kn_close(sessid);
@@ -815,7 +815,8 @@ kn_query(struct environment *env, char **retvalues, int numval,
/* Untrusted assertions */
for (i = 0; i < numuntrusted; i++)
- if (kn_add_assertion(sessid, untrusted[i], untrustedlen[i], 0) == -1)
+ if ((kn_add_assertion(sessid, untrusted[i], untrustedlen[i], 0) == -1)
+ && (keynote_errno == ERROR_MEMORY))
{
serrno = keynote_errno;
kn_close(sessid);
diff --git a/lib/libkeynote/keynote.3 b/lib/libkeynote/keynote.3
index 04ba4dd7267..820b5ecde67 100644
--- a/lib/libkeynote/keynote.3
+++ b/lib/libkeynote/keynote.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: keynote.3,v 1.11 1999/10/06 19:26:14 angelos Exp $
+.\" $OpenBSD: keynote.3,v 1.12 1999/10/09 06:34:14 angelos Exp $
.\"
.\" The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
.\"
@@ -547,7 +547,13 @@ indicating the returned value to the query. On failure, it returns \-1
and sets
.Va keynote_errno
to the same values as
-.Xr kn_do_query 3 .
+.Xr kn_do_query 3 ,
+or to
+.Er ERROR_MEMORY
+if a trusted or untrusted assertion could not be added to the session due
+to lack of memory resources. Syntax errors in assertions will not be reported
+by
+.Fn kn_query .
.Pp
.Fn kn_encode_base64
converts the data of length