wwivbbs/wwiv

network2 sub add/drop response handling messes up digesting payload

Closed this issue · 13 comments

network2/subs.cpp handle_sub_add_drop_resp reads in a properly formed response packet, but messes up putting it in correct email format. also, the system sending the response was @63 (Aladdin's Lamp) sending to @60 (aliens' alcove!).

see:

 Sub: Personal E-Mail                     Msg#: [107 of 111]
From: Sub Type LAMPorry but you couldn't Date: This is /home/wwiv/wwivnet/srLAMP
.net
Subj: WWIV AreaFix (WWIVnet) Response for subtype 'LAMP
 Sys: aliens' alcove!                      Loc: Taguig City, Philippines        
   

Dear potential Subscriber, :)

I'm sorry but you couldn't subscribe to LAMP automatically.Please send me email
so that we can figure out what went wrong.

Mail {QSRIDAF?-+GEMZPVUOLCNY@} : 

looks like i'll have to set up virtualboxes with wwiv4.30 and net32 or something to see what the old software outputs with the various scenarios.

wwiv commented

What was wrong, sorry I can't tell from that email

From field should be the host sysop's name and userno.
Date should be the date.

These lines in the code smell funny. network2/subs.cpp lines 286-302

 LOG(INFO) << "Processed " << add_or_drop << " response from system @" << p.nh.fromsys << " to subtype: " << subname;

  auto code = *b++;
  auto code_string = SubAddDropResponseMessage(static_cast<uint8_t>(code));

  auto orig_title = get_message_field(p.text(), b, {'\0', '\r', '\n'}, 80);
  auto sender_date = get_message_field(p.text(), b, {'\0', '\r', '\n'}, 80);
  auto orig_date = get_message_field(p.text(), b, {'\0', '\r', '\n'}, 80);

  auto message_text = std::string(b, std::end(p.text()));
  net_header_rec nh = {};

  auto title = StrCat("WWIV AreaFix (", context.net.name, ") Response for subtype '", subname, "'");
  auto byname = StrCat("WWIV AreaFix (", context.net.name, ") @", p.nh.fromsys);
  auto body =
      StrCat("SubType '", subname, "', (", add_or_drop, ") Response: '", code_string, "'\r\n");
  body.append(message_text);

wwiv commented

That whole function looks like it may be wrong

Here's what it looks like in 5.3~

Screenshot from 2023-02-02 20-31-12

oh... i found a clue. i have the same message in my inbox but dated earlier. i'll narrow down the date of the change.
Screenshot from 2023-02-02 21-12-24

how does get_message_field() work? (sorry... haven't read the code, yet.)

Here's the netmail packet generated by network2 when it receives a major type 18 (sub_add_drop_response) packet. This appears malformed. This is the intermediate state before it is converted into email.

type-18-to-email.txt

Here's the netmail packet received by the system as input to network2.

type-18.txt

it appears that in network2/subs.cpp function handle_sub_add_drop_resp(), the subname doesn't get extracted properly from p.text(). the null char seems to be missing.

handle_sub_add_drop_resp() doesn't properly null-terminate the subname. i'm tempted to use char subname[8] to simplify, but i know that it's wrong.

Here's the netmail packet generated by network2 when it receives a major type 18 (sub_add_drop_response) packet. This appears malformed. This is the intermediate state before it is converted into email.

type-18-to-email.txt

Here's the netmail packet received by the system as input to network2.

type-18.txt

type-18.txt should be renamed local.net and placed in the network dir.
after running network2, system will generate a packet that looks like
type-18-to-email.txt.

receiving node is @60. sub name is LAMP.

wwiv commented

I just copied type-18.txt to local.net and then ran it under the debugger, it looked like it this on output to p0-2-0.net

U:\bbs>wwivutil net dump net\wwivnet\p0-2-0.net
Header for Packet Index Number: #0
==============================================================================
 destination: 1@0
        from: 65535@1
        type: (main_type_email/0)
    list_len: 0
       daten: Wed Feb 15 18:00:14 2023
      length: 204
==============================================================================
Raw Packet Text:
==============================================================================
WWIV AreaFix (wwivnet) Response for subtype 'WWIVSYS'[^@]WWIV AreaFix (wwivnet) @1
Wed Feb 15 18:00:14 2023
SubType 'WWIVSYS', (add) Response: 'You are already in the sub.'
You are already in the sub.



==============================================================================

What's wrong?

My bad! My system path was pointing to an old binary. 🤣