summaryrefslogtreecommitdiffstats
path: root/libexec/comsat
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1997-09-15 00:27:49 +0000
committerache <ache@FreeBSD.org>1997-09-15 00:27:49 +0000
commitc823c67692a1df5afe723631c9daa9aaaff908c8 (patch)
tree9d2df24cf810cdfd7d4370ee794c8bde195ab416 /libexec/comsat
parentc1fa713ef319002bf238bb8080bfbaa2e85ebcf9 (diff)
downloadFreeBSD-src-c823c67692a1df5afe723631c9daa9aaaff908c8.zip
FreeBSD-src-c823c67692a1df5afe723631c9daa9aaaff908c8.tar.gz
disable upper controls and enable all other
8bit codes due to lack of locale knowledge in daemon
Diffstat (limited to 'libexec/comsat')
-rw-r--r--libexec/comsat/comsat.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/libexec/comsat/comsat.c b/libexec/comsat/comsat.c
index c3b876a..f37796c 100644
--- a/libexec/comsat/comsat.c
+++ b/libexec/comsat/comsat.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: comsat.c,v 1.8 1997/02/22 14:21:23 peter Exp $
*/
#ifndef lint
@@ -251,11 +251,11 @@ jkfprintf(tp, user, file, offset)
char file[];
off_t offset;
{
- register char *cp, ch;
+ register unsigned char *cp, ch;
register FILE *fi;
register int linecnt, charcnt, inheader;
register struct passwd *p;
- char line[BUFSIZ];
+ unsigned char line[BUFSIZ];
/* Set effective uid to user in case mail drop is on nfs */
if ((p = getpwnam(user)) != NULL)
@@ -291,15 +291,19 @@ jkfprintf(tp, user, file, offset)
}
/* strip weird stuff so can't trojan horse stupid terminals */
for (cp = line; (ch = *cp) && ch != '\n'; ++cp, --charcnt) {
- if (!isprint(ch)) {
- if (ch & 0x80)
+ /* disable upper controls and enable all other
+ 8bit codes due to lack of locale knowledge
+ */
+ if (((ch & 0x80) && ch < 0xA0) ||
+ (!(ch & 0x80) && !isprint(ch) &&
+ !isspace(ch) && ch != '\007')
+ ) {
+ if (ch & 0x80) {
+ ch &= ~0x80;
(void)fputs("M-", tp);
- ch &= 0177;
- if (!isprint(ch)) {
- if (ch == 0177)
- ch = '?';
- else
- ch |= 0x40;
+ }
+ if (iscntrl(ch)) {
+ ch ^= 0x40;
(void)fputc('^', tp);
}
}
OpenPOWER on IntegriCloud