From 3d11c249697074e185c0d084fc2c1d3dc2a82457 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sat, 18 May 2002 14:35:35 +0000 Subject: [PATCH] Fixes for mbcico history data --- ChangeLog | 2 ++ mbcico/answer.c | 4 ++-- mbcico/binkp.c | 9 +++------ mbcico/call.c | 6 ++++-- mbcico/dial.c | 1 - mbcico/emsidat.c | 7 +++---- mbcico/ftsc.c | 5 +++-- mbcico/yoohoo.c | 7 +++---- 8 files changed, 20 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9c72caa4..3043199b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4845,6 +4845,8 @@ v0.33.20 10-Feb-2002 Splitted no TCP settings in no IBN, no IFC and no ITN. Removed settings for Non-hold mail and Pickup Primary. Removed nonsense error message when stopped on a signal. + Fixed some small problems with the history data log. Added tty + information when it is available. mbout: The status display has now 9 digits for the outbound size. diff --git a/mbcico/answer.c b/mbcico/answer.c index 32186447..7ed0e455 100644 --- a/mbcico/answer.c +++ b/mbcico/answer.c @@ -78,6 +78,7 @@ int answer(char *stype) q = strrchr(ttyname(0), '/'); if (q) p = q + 1; + strncpy(history.tty, p, 6); if (load_port(p)) Syslog('d', "Port %s, modem %s", ttyinfo.tty, modem.modem); else @@ -141,7 +142,7 @@ int answer(char *stype) history.rcvd_bytes = rcvdbytes; history.inbound = TRUE; - p = calloc(128, sizeof(char)); + p = calloc(PATH_MAX, sizeof(char)); sprintf(p, "%s/var/mailer.hist", getenv("MBSE_ROOT")); if ((fp = fopen(p, "a")) == NULL) WriteError("$Can't open %s", p); @@ -151,7 +152,6 @@ int answer(char *stype) } free(p); if (Loaded) { - Syslog('s', "Updateing noderecord %s", aka2str(nodes.Aka[0])); nodes.LastDate = time(NULL); UpdateNode(); } diff --git a/mbcico/binkp.c b/mbcico/binkp.c index 99cc05b5..b4990854 100644 --- a/mbcico/binkp.c +++ b/mbcico/binkp.c @@ -339,16 +339,13 @@ void b_nul(char *msg) { if (strncmp(msg, "SYS ", 4) == 0) { Syslog('+', "System : %s", msg+4); - msg[40] = '\0'; - sprintf(history.system_name, "%s", msg+4); + strncpy(history.system_name, msg+4, 35); } else if (strncmp(msg, "ZYZ ", 4) == 0) { Syslog('+', "Sysop : %s", msg+4); - msg[40] = '\0'; - sprintf(history.sysop, "%s", msg+4); + strncpy(history.sysop, msg+4, 35); } else if (strncmp(msg, "LOC ", 4) == 0) { Syslog('+', "Location: %s", msg+4); - msg[40] = '\0'; - sprintf(history.location, "%s", msg+4); + strncpy(history.location, msg+4, 35); } else if (strncmp(msg, "NDL ", 4) == 0) Syslog('+', "Flags : %s", msg+4); else if (strncmp(msg, "TIME ", 5) == 0) diff --git a/mbcico/call.c b/mbcico/call.c index a18592df..c8ed27dc 100644 --- a/mbcico/call.c +++ b/mbcico/call.c @@ -75,6 +75,7 @@ int portopen(faddr *addr) if (forcedline) { Syslog('d', "portopen forcedline %s", forcedline); p = forcedline; + strncpy(history.tty, p, 6); if (load_port(p)) { if ((rc = openport(p, ttyinfo.portspeed))) { @@ -133,8 +134,9 @@ int call(faddr *addr) /* * Fill default history info in case we get a FTS0001 session */ - sprintf(history.system_name, "%s", nlent->name); - sprintf(history.location, "%s", nlent->location); + strncpy(history.system_name, nlent->name, 35); + strncpy(history.location, nlent->location, 35); + strncpy(history.sysop, nlent->sysop, 35); history.aka.zone = addr->zone; history.aka.net = addr->net; history.aka.node = addr->node; diff --git a/mbcico/dial.c b/mbcico/dial.c index 8ddf2291..9a6c95cd 100644 --- a/mbcico/dial.c +++ b/mbcico/dial.c @@ -139,7 +139,6 @@ int hangup() free(tmp); memset(&history, 0, sizeof(history)); if (Loaded) { - Syslog('s', "Updateing noderecord %s", aka2str(nodes.Aka[0])); nodes.LastDate = time(NULL); UpdateNode(); } diff --git a/mbcico/emsidat.c b/mbcico/emsidat.c index 77f573c9..ba635874 100644 --- a/mbcico/emsidat.c +++ b/mbcico/emsidat.c @@ -441,12 +441,11 @@ int scanemsidat(char *buf) if (strcasecmp(p,"IDENT") == 0) { p=sel_brace(NULL); Syslog('+', "system : %s",(p=sel_bracket(p))); - sprintf(history.system_name, "%s", p); - history.system_name[36] = '\0'; + strncpy(history.system_name, p, 35); Syslog('+', "location: %s",(p=sel_bracket(NULL))); - sprintf(history.location, "%s", p); + strncpy(history.location, p, 35); Syslog('+', "operator: %s",(p=sel_bracket(NULL))); - sprintf(history.sysop, "%s", p); + strncpy(history.sysop, p, 35); if (remote && remote->addr) remote->addr->name=xstrcpy(p); Syslog('+', "phone : %s",sel_bracket(NULL)); diff --git a/mbcico/ftsc.c b/mbcico/ftsc.c index 4cbdbfc3..0ae8c2a7 100644 --- a/mbcico/ftsc.c +++ b/mbcico/ftsc.c @@ -436,8 +436,9 @@ SM_STATE(scan_packet) if (inbound) free(inbound); inbound = xstrcpy(CFG.inbound); - sprintf(history.system_name, "%s", nlent->name); - sprintf(history.location, "%s", nlent->location); + strncpy(history.system_name, nlent->name, 35); + strncpy(history.location, nlent->location, 35); + strncpy(history.sysop, nlent->sysop, 35); } else { sprintf(history.system_name, "Unknown"); sprintf(history.location, "Somewhere"); diff --git a/mbcico/yoohoo.c b/mbcico/yoohoo.c index fd07b7bd..69f84a57 100644 --- a/mbcico/yoohoo.c +++ b/mbcico/yoohoo.c @@ -162,7 +162,7 @@ int rx_yoohoo(void) if (inbound) free(inbound); inbound = xstrcpy(CFG.inbound); - sprintf(history.location, "%s", nlent->location); + strncpy(history.location, nlent->location, 35); } if (nlent) rdoptions(Loaded); @@ -594,10 +594,9 @@ int checkhello(void) else Syslog('+', " uses: %s [%04X] version %d.%d", prodnm, hello2.product, majver, minver); Syslog('+', " system: %s",(char*)hello2.my_name); - sprintf(history.system_name, "%s", hello2.my_name); - history.system_name[36] = '\0'; + strncpy(history.system_name, hello2.my_name, 35); Syslog('+', " sysop: %s",(char*)hello2.sysop); - sprintf(history.sysop, "%s", hello2.sysop); + strncpy(history.sysop, hello2.sysop, 35); sprintf(history.location, "Somewhere"); free(prodnm);