aboutsummaryrefslogtreecommitdiff
path: root/libexec/comsat
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>1997-09-15 00:27:49 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>1997-09-15 00:27:49 +0000
commit4541df7be4bcc28009d4872ec56b58e9265d2cf3 (patch)
tree70ee54d45d6b417e3cc2a4c983796da0490bf3a1 /libexec/comsat
parent07484d1f24bc1d323bb71b7e2a967ec02cd6f2cf (diff)
downloadsrc-4541df7be4bcc28009d4872ec56b58e9265d2cf3.tar.gz
src-4541df7be4bcc28009d4872ec56b58e9265d2cf3.zip
disable upper controls and enable all other
8bit codes due to lack of locale knowledge in daemon
Notes
Notes: svn path=/head/; revision=29432
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 c3b876a77765..f37796c29bd4 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);
}
}