Putty and erlang sshd fix

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Putty and erlang sshd fix

Michał Ptaszek
I guess we should send this here as well...

/Peter



Peter Lund wrote:

> Testade med putty 0.59 och 0.60, men ssh_sshd servern krashade
> fortfarande.
> Servern krashar d? putty skickar en ensam tv?a <<2>> (SSH_MSG_IGNORE) men
> servern f?rv?ntar sig en str?ng efter IGNORE.
>
> Sj?lv la jag till ytterligare en patch f?r att f? servern att
> acceptera b?de en
> ensam IGNORE och en IGNORE med en str?ng. Med patchen neda fick jag
> ssh att funka.

Known 0.59 putty bug, putyy skickar IGNORE utan extra data.  Om vi ska
vara putty
bug-kompatibla s? ?r din patch n?stan ok. F?r att #ssh_msg_ignore{} ska
bli r?tt m?ste
dock patchen se ut som:

Index: ssh_bits.erl
===================================================================
--- ssh_bits.erl        (revision 14434)
+++ ssh_bits.erl        (working copy)
@@ -259,11 +259,16 @@
            <<_:Offset/binary, _:16, _:Pad, X:Bits/big-unsigned-integer,
             _/binary>> = Binary,
            decode(Binary, Offset+2+L, Ts, [X | Acc]);
-
        string ->
-           <<_:Offset/binary,?UINT32(L), X:L/binary,_/binary>> = Binary,
-           decode(Binary, Offset+4+L, Ts, [binary_to_list(X) | Acc]);
-
+           Size = size(Binary),
+           if Size < Offset + 4  ->
+                   %% empty string at end
+                   {Size, reverse(["" | Acc])};
+              true ->
+                   <<_:Offset/binary,?UINT32(L), X:L/binary,_/binary>> =
+                       Binary,
+                   decode(Binary, Offset+4+L, Ts, [binary_to_list(X) |
Acc])
+           end;
        binary ->
            <<_:Offset/binary,?UINT32(L), X:L/binary,_/binary>> = Binary,
            decode(Binary, Offset+4+L, Ts, [X | Acc]);



/klacke



Reply | Threaded
Open this post in threaded view
|

Putty and erlang sshd fix

Ingela Anderton Andin-2
Hi!

Thank you we will change ssh so that ssh_ignore will be correct.

Regards Ingela - OTP team

Peter Lund wrote:

> I guess we should send this here as well...
>
> /Peter
>
>
>
> Peter Lund wrote:
>
>  
>> Testade med putty 0.59 och 0.60, men ssh_sshd servern krashade
>> fortfarande.
>> Servern krashar d? putty skickar en ensam tv?a <<2>> (SSH_MSG_IGNORE) men
>> servern f?rv?ntar sig en str?ng efter IGNORE.
>>
>> Sj?lv la jag till ytterligare en patch f?r att f? servern att
>> acceptera b?de en
>> ensam IGNORE och en IGNORE med en str?ng. Med patchen neda fick jag
>> ssh att funka.
>>    
>
> Known 0.59 putty bug, putyy skickar IGNORE utan extra data.  Om vi ska
> vara putty
> bug-kompatibla s? ?r din patch n?stan ok. F?r att #ssh_msg_ignore{} ska
> bli r?tt m?ste
> dock patchen se ut som:
>
> Index: ssh_bits.erl
> ===================================================================
> --- ssh_bits.erl        (revision 14434)
> +++ ssh_bits.erl        (working copy)
> @@ -259,11 +259,16 @@
>             <<_:Offset/binary, _:16, _:Pad, X:Bits/big-unsigned-integer,
>              _/binary>> = Binary,
>             decode(Binary, Offset+2+L, Ts, [X | Acc]);
> -
>         string ->
> -           <<_:Offset/binary,?UINT32(L), X:L/binary,_/binary>> = Binary,
> -           decode(Binary, Offset+4+L, Ts, [binary_to_list(X) | Acc]);
> -
> +           Size = size(Binary),
> +           if Size < Offset + 4  ->
> +                   %% empty string at end
> +                   {Size, reverse(["" | Acc])};
> +              true ->
> +                   <<_:Offset/binary,?UINT32(L), X:L/binary,_/binary>> =
> +                       Binary,
> +                   decode(Binary, Offset+4+L, Ts, [binary_to_list(X) |
> Acc])
> +           end;
>         binary ->
>             <<_:Offset/binary,?UINT32(L), X:L/binary,_/binary>> = Binary,
>             decode(Binary, Offset+4+L, Ts, [X | Acc]);
>
>
>
> /klacke
>
> _______________________________________________
> erlang-patches mailing list
> erlang-patches
> http://www.erlang.org/mailman/listinfo/erlang-patches
>
>