Subject: bin/13667: More telnetd nits
To: None <gnats-bugs@gnats.netbsd.org>
From: None <ginsbach@cray.com>
List: netbsd-bugs
Date: 08/09/2001 09:31:05
>Number:         13667
>Category:       bin
>Synopsis:       Spelling errors, \n in syslog msgs, missing casts in telnetd src
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 09 07:28:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Brian Ginsbach
>Release:        NetBSD-current
>Organization:
Cray Inc.
>Environment:
	n.a.
>Description:
	The telnetd sources contain spelling errors in comments, a stray
	';', and some syslog messages with '\n' (newlines).  Some compilers
	also complain about the types passed to the new output_data and
	output_datalen functions.  There is also a misplaced #endif in
	the newest version of ext.h.

	Changes:
	- authenc.c	add cast 
	- ext.h		add extern to declaration of terminaltype;
			move #endif so that inclusion of libtelnet/auth.h
			and libtelnet/encrypt.h do not depend upon
			DEFAULT_IM being undefined.
	- state.c	remove newline from syslog message
			add casts
			spelling error: preceeded -> preceded
	- sys_term.c	spelling error: DECODE_BUAD -> DECODE_BAUD
			remove newlines from syslog messages
	- telnetd.c	spelling error: wierdness -> weirdness
			remove stray ';'
			add casts
	(Spelling errors pointed out by FreeBSD source.)
>How-To-Repeat:
	By inspection.
>Fix:

Index: authenc.c
===================================================================
RCS file: /cvsroot/basesrc/libexec/telnetd/authenc.c,v
retrieving revision 1.8
diff -u -r1.8 authenc.c
--- authenc.c	2001/07/19 04:57:49	1.8
+++ authenc.c	2001/08/08 21:20:19
@@ -52,7 +52,7 @@
 	int len;
 {
 	if (nfrontp + len < netobuf + BUFSIZ) {
-		output_datalen(str, len);
+		output_datalen((const char *)str, len);
 		return(len);
 	}
 	return(0);
Index: ext.h
===================================================================
RCS file: /cvsroot/basesrc/libexec/telnetd/ext.h,v
retrieving revision 1.13
diff -u -r1.13 ext.h
--- ext.h	2001/07/19 04:57:49	1.13
+++ ext.h	2001/08/08 21:20:19
@@ -71,7 +71,7 @@
 
 extern slcfun	slctab[NSLC + 1];	/* slc mapping table */
 
-char	*terminaltype;
+extern char	*terminaltype;
 
 /*
  * I/O data buffers, pointers, and counters.
@@ -238,6 +238,7 @@
 #   endif
 #  endif
 # endif
+#endif
 
 #if	defined(AUTHENTICATION)
 #include <libtelnet/auth.h>
@@ -245,5 +246,4 @@
 
 #if defined(ENCRYPTION)
 #include <libtelnet/encrypt.h>
-#endif
 #endif
Index: state.c
===================================================================
RCS file: /cvsroot/basesrc/libexec/telnetd/state.c,v
retrieving revision 1.18
diff -u -r1.18 state.c
--- state.c	2001/07/27 22:21:46	1.18
+++ state.c	2001/08/08 21:20:20
@@ -362,7 +362,7 @@
 			continue;
 
 		default:
-			syslog(LOG_ERR, "telnetd: panic state=%d\n", state);
+			syslog(LOG_ERR, "panic state=%d", state);
 			printf("telnetd: panic state=%d\n", state);
 			exit(1);
 		}
@@ -461,7 +461,7 @@
 			set_his_want_state_will(option);
 		do_dont_resp[option]++;
 	}
-	(void) output_data(doopt, option);
+	(void) output_data((const char *)doopt, option);
 
 	DIAG(TD_OPTIONS, printoption("td: send do", option));
 }
@@ -683,7 +683,7 @@
 		set_his_want_state_wont(option);
 		do_dont_resp[option]++;
 	}
-	(void) output_data(dont, option);
+	(void) output_data((const char *)dont, option);
 
 	DIAG(TD_OPTIONS, printoption("td: send dont", option));
 }
@@ -833,7 +831,7 @@
 		set_my_want_state_will(option);
 		will_wont_resp[option]++;
 	}
-	(void) output_data(will, option);
+	(void) output_data((const char *)will, option);
 
 	DIAG(TD_OPTIONS, printoption("td: send will", option));
 }
@@ -992,7 +990,7 @@
 		set_my_want_state_wont(option);
 		will_wont_resp[option]++;
 	}
-	(void) output_data(wont, option);
+	(void) output_data((const char *)wont, option);
 
 	DIAG(TD_OPTIONS, printoption("td: send wont", option));
 }
@@ -1243,7 +1241,7 @@
 	if (SB_EOF())
 	    break;		/* another garbage check */
 
-	if (request == LM_SLC) {  /* SLC is not preceeded by WILL or WONT */
+	if (request == LM_SLC) {  /* SLC is not preceded by WILL or WONT */
 		/*
 		 * Process suboption buffer of slc's
 		 */
Index: sys_term.c
===================================================================
RCS file: /cvsroot/basesrc/libexec/telnetd/sys_term.c,v
retrieving revision 1.23
diff -u -r1.23 sys_term.c
--- sys_term.c	2001/07/19 04:57:50	1.23
+++ sys_term.c	2001/08/08 21:20:20
@@ -1023,7 +1023,7 @@
 #endif
 	{ -1,     0 }
 };
-#endif	/* DECODE_BUAD */
+#endif	/* DECODE_BAUD */
 
 	void
 tty_tspeed(val)
@@ -1037,9 +1037,9 @@
 	if (tp->speed == -1)	/* back up to last valid value */
 		--tp;
 	cfsetospeed(&termbuf, tp->value);
-#else	/* DECODE_BUAD */
+#else	/* DECODE_BAUD */
 	cfsetospeed(&termbuf, val);
-#endif	/* DECODE_BUAD */
+#endif	/* DECODE_BAUD */
 }
 
 	void
@@ -1837,7 +1841,7 @@
 	sleep(1);
         execv(loginprog, argv);
 
-        syslog(LOG_ERR, "%s: %m\n", loginprog);
+        syslog(LOG_ERR, "%s: %m", loginprog);
         fatalperror(net, loginprog);
 	/*NOTREACHED*/
 }
@@ -1864,7 +1868,7 @@
 	if (cpp == &argv[(long)argv[-1]]) {
 		--argv;
 		*argv = (char *)((long)(*argv) + 10);
-		argv = (char **)realloc(argv, sizeof(*argv)*((long)(*argv) + 2));
+		argv = (char **)realloc(argv, sizeof(*argv) * ((long)(*argv) + 2));
 		if (argv == NULL) {
 			fatal(net, "not enough memory");
 			/*NOTREACHED*/
@@ -2257,12 +2261,12 @@
 {
 	switch(fork()) {
 	case -1:
-		syslog(LOG_WARNING, "TMPDIR cleanup(%s): fork() failed: %m\n",
+		syslog(LOG_WARNING, "TMPDIR cleanup(%s): fork() failed: %m",
 		    tpath);
 		break;
 	case 0:
-		execl(CLEANTMPCMD, CLEANTMPCMD, user, tpath, 0);
-		syslog(LOG_ERR, "TMPDIR cleanup(%s): execl(%s) failed: %m\n",
+		execl(CLEANTMPCMD, CLEANTMPCMD, user, tpath, (char *)0);
+		syslog(LOG_ERR, "TMPDIR cleanup(%s): execl(%s) failed: %m",
 		    tpath, CLEANTMPCMD);
 		exit(1);
 	default:
Index: telnetd.c
===================================================================
RCS file: /cvsroot/basesrc/libexec/telnetd/telnetd.c,v
retrieving revision 1.26
diff -u -r1.26 telnetd.c
--- telnetd.c	2001/07/19 04:57:50	1.26
+++ telnetd.c	2001/08/08 21:20:20
@@ -147,7 +147,7 @@
 
 /*
  * Because of the way ptyibuf is used with streams messages, we need
- * ptyibuf+1 to be on a full-word boundary.  The following wierdness
+ * ptyibuf+1 to be on a full-word boundary.  The following weirdness
  * is simply to make that happen.
  */
 long	ptyibufbuf[BUFSIZ/sizeof(long)+1];
@@ -507,7 +507,7 @@
 
 	    s = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
 	    if (s < 0) {
-		perror("telnetd: socket");;
+		perror("telnetd: socket");
 		exit(1);
 	    }
 	    (void) setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
@@ -731,7 +731,7 @@
 	static unsigned char sb[] =
 			{ IAC, SB, TELOPT_TSPEED, TELQUAL_SEND, IAC, SE };
 
-	output_datalen(sb, sizeof sb);
+	output_datalen((const char *)sb, sizeof sb);
 	DIAG(TD_OPTIONS, printsub('>', sb + 2, sizeof sb - 2););
     }
 #ifdef	ENCRYPTION
@@ -747,26 +747,26 @@
 	static unsigned char sb[] =
 			{ IAC, SB, TELOPT_XDISPLOC, TELQUAL_SEND, IAC, SE };
 
-	output_datalen(sb, sizeof sb);
+	output_datalen((const char *)sb, sizeof sb);
 	DIAG(TD_OPTIONS, printsub('>', sb + 2, sizeof sb - 2););
     }
     if (his_state_is_will(TELOPT_NEW_ENVIRON)) {
 	static unsigned char sb[] =
 			{ IAC, SB, TELOPT_NEW_ENVIRON, TELQUAL_SEND, IAC, SE };
 
-	output_datalen(sb, sizeof sb);
+	output_datalen((const char *)sb, sizeof sb);
 	DIAG(TD_OPTIONS, printsub('>', sb + 2, sizeof sb - 2););
     }
     else if (his_state_is_will(TELOPT_OLD_ENVIRON)) {
 	static unsigned char sb[] =
 			{ IAC, SB, TELOPT_OLD_ENVIRON, TELQUAL_SEND, IAC, SE };
 
-	output_datalen(sb, sizeof sb);
+	output_datalen((const char *)sb, sizeof sb);
 	DIAG(TD_OPTIONS, printsub('>', sb + 2, sizeof sb - 2););
     }
     if (his_state_is_will(TELOPT_TTYPE)) {
 
-	output_datalen(ttytype_sbbuf, sizeof ttytype_sbbuf);
+	output_datalen((const char *)ttytype_sbbuf, sizeof ttytype_sbbuf);
 	DIAG(TD_OPTIONS, printsub('>', ttytype_sbbuf + 2,
 					sizeof ttytype_sbbuf - 2););
     }
@@ -845,7 +845,7 @@
     if (his_state_is_wont(TELOPT_TTYPE))
 	return;
     settimer(baseline);
-    output_datalen(ttytype_sbbuf, sizeof ttytype_sbbuf);
+    output_datalen((const char *)ttytype_sbbuf, sizeof ttytype_sbbuf);
     DIAG(TD_OPTIONS, printsub('>', ttytype_sbbuf + 2,
 					sizeof ttytype_sbbuf - 2););
     while (sequenceIs(ttypesubopt, baseline))
>Release-Note:
>Audit-Trail:
>Unformatted: