Subject: Re: Character conversion for sftp

Re: Character conversion for sftp

From: Fritz Elfert <fritz_at_fritz-elfert.de>
Date: Tue, 30 Mar 2010 18:01:09 +0200

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi guys,

Apologies for my intrusion here (im lurking on libbs2-devel for some
time now) ...

Peter Stuge schrieb:
> Hi Nagasekhar,
>
> NAGASEKHAR BHUVANAGIRI wrote:
>> The conversion is for control responses and not for data. The
>> reponse received by banner_receive method in (libssh2's session.c)
>> is garbled and gived PACKET_FAIL error.

To me, this looks more like an EBCDIC vs. ASCII problem rather than a
problem with libssh2 code itself. What rings a bell here, is this:

>> This issue is specific to
>> z/OS.

On z/OS, source code is treated as EBCDIC by default, so if you compile
something like

const char *str = "foo";

the resulting string constant is *not* 0x66 0x6f 0x6f and if you
transfer that over the wire to some ASCII-based system it *looks* like
garbage.

IMHO, the easiest way of porting to z/OS is to treat the whole source
code as ASCII and then use special ioctls (provided by IBM's libc) to
enable auto-conversion back to EBCDIC for stdin, stdout and stderr (if
those are connected to a terminal).

My last z/OS porting work is almost a year ago, so I would have too look
 up the exact cc options and those ioctls. There is extensive
documentation on that topic available at:

http://www-03.ibm.com/systems/z/os/zos/features/unix/bpxa1p03.html

Cheers
 -Fritz

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFLsiBFboM4mAMyprARAhLOAKCctO3GEOYZE20vRRuAFLaqNXeUsACePELa
KFbi5rFFlt3fArLzVyy1NRI=
=Vftm
-----END PGP SIGNATURE-----
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-03-30