From 1c69f80f047ad4688a68c3229ebaf1c5f0c732d2 Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Fri, 23 Feb 2024 21:15:46 +0000 Subject: [PATCH] -Fixed bug #150: ping reply length -Fixed bug where some commands were terminated with \n\r instead of \r\n git-svn-id: svn://kolibrios.org@9979 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/network/ircc/ircc.asm | 2 +- programs/network/ircc/serverparser.inc | 20 ++++++++------------ programs/network/ircc/socket.inc | 18 +++++++++++------- programs/network/ircc/userparser.inc | 4 ++-- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/programs/network/ircc/ircc.asm b/programs/network/ircc/ircc.asm index 330177187d..373ff02447 100644 --- a/programs/network/ircc/ircc.asm +++ b/programs/network/ircc/ircc.asm @@ -13,7 +13,7 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -version equ '0.35' +version equ '0.35b' ; connection status STATUS_DISCONNECTED = 0 diff --git a/programs/network/ircc/serverparser.inc b/programs/network/ircc/serverparser.inc index 52b9e58901..926e105f49 100644 --- a/programs/network/ircc/serverparser.inc +++ b/programs/network/ircc/serverparser.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2021. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2024. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; Written by hidnplayr@kolibrios.org ;; @@ -14,6 +14,7 @@ server_parser: mov esi, servercommand + mov ebx, ecx cmp byte [esi], ':' jne .parse @@ -27,7 +28,7 @@ server_parser: .parse: mov eax, [esi] - or eax, 0x20202020 + or eax, 0x20202020 ; convert to lowercase mov edi, server_commands mov ecx, server_commands.number @@ -42,6 +43,7 @@ server_parser: ret .got_cmd: + mov ecx, ebx jmp dword[edi] @@ -232,18 +234,12 @@ cmd_ping: ; Just change PING to PONG mov dword[esi], 'PONG' -; Find the end of the command - lea edi, [esi + 5] - xor al, al - repne scasb +; Append \r\n + mov word[esi+ecx], 0x0a0d -; Now send it back +; And send the response to the server mov edx, esi - mov esi, edi - mov word [esi], 0x0d0a - inc esi - inc esi - sub esi, edx + lea esi, [ecx+2] mcall send, [socketnum], , , 0 ret diff --git a/programs/network/ircc/socket.inc b/programs/network/ircc/socket.inc index 312e2393c5..79af9217df 100644 --- a/programs/network/ircc/socket.inc +++ b/programs/network/ircc/socket.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2018. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2024. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; Written by hidnplayr@kolibrios.org ;; @@ -226,26 +226,30 @@ socket_receive: .nextcommand: mov edi, servercommand .byteloop: + test ecx, ecx + jz .nextpacket lodsb + dec ecx cmp al, 10 je .got_command cmp al, 13 je .got_command stosb - dec ecx - jnz .byteloop - ;;; FIXME - jmp .nextpacket + jmp .byteloop ; we have a command, call the serverparser .got_command: + cmp edi, servercommand + 4 + jb .nextcommand + mov byte[edi], 0 ; mark the end of the command push esi ecx + mov ecx, edi + sub ecx, servercommand ; put length in ecx call server_parser pop ecx esi - test ecx, ecx - jnz .nextcommand + jmp .nextcommand .done: popa diff --git a/programs/network/ircc/userparser.inc b/programs/network/ircc/userparser.inc index 094a19c643..712aed8d26 100644 --- a/programs/network/ircc/userparser.inc +++ b/programs/network/ircc/userparser.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2018. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2024. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; Written by hidnplayr@kolibrios.org ;; @@ -659,7 +659,7 @@ cmd_usr_send: mov esi, [user_command.size] mov eax, [user_command.size] add eax, user_command+1 - mov word[eax], 0x0d0a + mov word[eax], 0x0a0d inc esi mcall send, [socketnum], user_command+1, , 0