-/* $Id: telnetd.c,v 1.5 2003/03/19 09:12:39 mjn3 Exp $
+/* $Id: telnetd.c,v 1.9 2003/12/19 11:30:13 andersen Exp $
*
* Simple telnet server
* Bjorn Wesen, Axis Communications AB (bjornw@axis.com)
#define BUFSIZE 4000
-static const char *loginpath =
+static const char *loginpath
#ifdef CONFIG_LOGIN
-"/bin/login";
+ = "/bin/login";
#else
-"/bin/sh";
+;
#endif
static const char *issuefile = "/etc/issue.net";
FIXME - if we mean to send 0xFF to the terminal then it will be escaped,
what is the escape character? We aren't handling that situation here.
+ CR-LF ->'s CR mapping is also done here, for convenience
+
*/
static char *
remove_iacs(struct tsession *ts, int *pnum_totty) {
while (ptr < end) {
if (*ptr != IAC) {
+ int c = *ptr;
*totty++ = *ptr++;
+ /* We now map \r\n ==> \r for pragmatic reasons.
+ * Many client implementations send \r\n when
+ * the user hits the CarriageReturn key.
+ */
+ if (c == '\r' && (*ptr == '\n' || *ptr == 0) && ptr < end)
+ ptr++;
}
else {
if ((ptr+2) < end) {
#else /* CONFIG_EATURE_TELNETD_INETD */
"f:l:p:";
#endif /* CONFIG_FEATURE_TELNETD_INETD */
+ int maxlen, w, r;
+
+#ifndef CONFIG_LOGIN
+ loginpath = DEFAULT_SHELL;
+#endif
for (;;) {
c = getopt( argc, argv, options);
ts = sessions;
while (ts) { /* For all sessions... */
#endif /* CONFIG_FEATURE_TELNETD_INETD */
- int maxlen, w, r;
#ifndef CONFIG_FEATURE_TELNETD_INETD
struct tsession *next = ts->next; /* in case we free ts. */
#endif /* CONFIG_FEATURE_TELNETD_INETD */