Updated mbtelind

This commit is contained in:
Michiel Broek 2003-11-26 21:36:00 +00:00
parent 1a46ff9be6
commit 88d139c314

View File

@ -84,7 +84,7 @@ void die(int onsig)
} }
t_end = time(NULL); t_end = time(NULL);
Syslog(' ', "MBTELNETD finished in %s", t_elapsed(t_start, t_end)); Syslog(' ', "MBTELIND finished in %s", t_elapsed(t_start, t_end));
if (envptr) if (envptr)
free(envptr); free(envptr);
ExitClient(onsig); ExitClient(onsig);
@ -122,11 +122,11 @@ int main(int ac, char **av)
InitConfig(); InitConfig();
t_start = time(NULL); t_start = time(NULL);
InitClient(pw->pw_name, (char *)"mbtelnetd", CFG.location, CFG.logfile, InitClient(pw->pw_name, (char *)"mbtelind", CFG.location, CFG.logfile,
CFG.util_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog); CFG.util_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);
Syslog(' ', " "); Syslog(' ', " ");
Syslog(' ', "MBTELNETDv%s", VERSION); Syslog(' ', "MBTELIND v%s", VERSION);
/* /*
* Catch all signals we can, and ignore the rest. * Catch all signals we can, and ignore the rest.
@ -188,7 +188,7 @@ int main(int ac, char **av)
telnet_init(); telnet_init();
tmp = calloc(81, sizeof(char )); tmp = calloc(81, sizeof(char ));
sprintf(tmp, "mbtelnetd v%s\r\n", VERSION); sprintf(tmp, "mbtelind v%s\r\n", VERSION);
telnet_write(tmp, strlen(tmp)); telnet_write(tmp, strlen(tmp));
free(tmp); free(tmp);
@ -248,10 +248,6 @@ bad: ;
static int tellen;
static int buflen = 0;
/* --- This is an artwork of serge terekhov, 2:5000/13@fidonet :) --- */ /* --- This is an artwork of serge terekhov, 2:5000/13@fidonet :) --- */
void telnet_answer(int tag, int opt) void telnet_answer(int tag, int opt)
@ -273,7 +269,7 @@ void telnet_answer(int tag, int opt)
r = (char *)"DONT"; r = (char *)"DONT";
break; break;
} }
Syslog('s', "TELNET send %s %d", r, opt); Syslog('s', "Telnet: send %s %d", r, opt);
buf[0] = IAC; buf[0] = IAC;
buf[1] = tag; buf[1] = tag;
@ -332,28 +328,27 @@ int telnet_read(char *buf, int len)
--n; --n;
switch (m = (unsigned char)*q++) { switch (m = (unsigned char)*q++) {
case WILL: m = (unsigned char)*q++; --n; case WILL: m = (unsigned char)*q++; --n;
Syslog('s', "TELNET: recv WILL %d", m); Syslog('s', "Telnet: recv WILL %d", m);
if (m != TOPT_BIN && m != TOPT_SUPP && m != TOPT_ECHO) if (m != TOPT_BIN && m != TOPT_SUPP && m != TOPT_ECHO)
telnet_answer(DONT, m); telnet_answer(DONT, m);
break; break;
case WONT: m = *q++; case WONT: m = *q++;
--n; --n;
Syslog('s', "TELNET: recv WONT %d", m); Syslog('s', "Telnet: recv WONT %d", m);
break; break;
case DO: m = (unsigned char)*q++; case DO: m = (unsigned char)*q++;
--n; --n;
Syslog('s', "TELNET: recv DO %d", m); Syslog('s', "Telnet: recv DO %d", m);
if (m != TOPT_BIN && m != TOPT_SUPP && m != TOPT_ECHO) if (m != TOPT_BIN && m != TOPT_SUPP && m != TOPT_ECHO)
telnet_answer(WONT, m); telnet_answer(WONT, m);
break; break;
case DONT: m = (unsigned char)*q++; case DONT: m = (unsigned char)*q++;
--n; --n;
Syslog('s', "TELNET: recv DONT %d", m); Syslog('s', "Telnet: recv DONT %d", m);
break; break;
case IAC: Syslog('s', "TELNET: recv 2nd IAC %d", m); case IAC: *p++ = IAC;
*p++ = IAC;
break; break;
default: Syslog('s', "TELNET: recv IAC %d", m); default: Syslog('s', "Telnet: recv IAC %d, not good", m);
break; break;
} }
} }