From 041c06b9a7871bee25c315b207c6f7093d81e505 Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Wed, 14 Jun 1995 22:27:37 +0000 Subject: [PATCH] Fixed ACL routines to work on systems with unsigned char. Also fixed minor ordering problem in error checks. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6063 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kadmin/v5server/ChangeLog | 12 ++++++++++++ src/kadmin/v5server/srv_acl.c | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/kadmin/v5server/ChangeLog b/src/kadmin/v5server/ChangeLog index 2dbae7792..c2cb92393 100644 --- a/src/kadmin/v5server/ChangeLog +++ b/src/kadmin/v5server/ChangeLog @@ -1,3 +1,15 @@ +Wed Jun 14 17:19:09 1995 Sam Hartman + + * srv_acl.c (acl_get_line): Check to make sure we haven't exceeded + the buffer size before overwriting the newline we may have just + read. If the newline is clobbered, there is no way of + distinguishing between a line that uses the full buffer from a + line longer than the full buffer. Also, cast EOF to a char, so + that it works on unsigned char systems. This means you can't + distinguish reading 0xff at the beginning of a line from EOF, but + the only other option is to introduce an intermediate variable. + + Tue Jun 13 11:36:52 1995 Sam Hartman * srv_net.c: Include sys/select.h if it is found. diff --git a/src/kadmin/v5server/srv_acl.c b/src/kadmin/v5server/srv_acl.c index 4b1cf4d61..fae8e5a9a 100644 --- a/src/kadmin/v5server/srv_acl.c +++ b/src/kadmin/v5server/srv_acl.c @@ -96,14 +96,14 @@ acl_get_line(fp, lnp) (!feof(fp)) && ((acl_buf[i] = fgetc(fp)) != '\n')); i++); - acl_buf[i] = '\0'; /* Check if we exceeded our buffer size */ if ((i == BUFSIZ) && (!feof(fp)) && (acl_buf[i] != '\n')) { fprintf(stderr, acl_line2long_msg, acl_acl_file, *lnp); while (fgetc(fp) != '\n'); } - if (acl_buf[0] == EOF) /* ptooey */ + acl_buf[i] = '\0'; + if (acl_buf[0] == (char) EOF) /* ptooey */ acl_buf[0] = '\0'; else (*lnp)++; -- 2.26.2