iDeivid
iDeivid

Reputation: 3

Will this work? hex edited a file and changed inet_aton to inet_pton

I am trying to port a python script to an old Solaris 10 machine. I downloaded and installed all the required packages from sunfreeware. It crashed in the import line (import CGIHTTPServer) with this error message:

ImportError: ld.so.1: python: fatal: relocation error: file /usr/local/lib/python2.6/lib-dynload/_socket.so: symbol inet_aton: referenced symbol not found

I tried to recompile with libresolve, but I didn't want to do that, so I copied the file _socket.so to my linux machine and edited with ghex2. I replaced the inet_aton with inet_pton because i read that solaris uses inet_pton instead. I've also read in python documentation that both system calls are similar.

I copied back the file _socket.so to the original dir, backed up the old one and replaced with the patched one. It's running and looks OK so far.

Do you think the python socket module will break in the future?

Do inet_aton and inet_pton return structs compatible?

Upvotes: 0

Views: 336

Answers (2)

jlliagre
jlliagre

Reputation: 30843

Do you think the python socket module will break in the future?

Yes. inet-aton and inet_pton do not use the same number and type of arguments. Your code will likely break or at least dysfunction the first time this php function is called. If you (or a library you use) never call it, you are probably safe.

Upvotes: 0

user149341
user149341

Reputation:

No; inet_aton and inet_pton are not compatible. Just look at the prototypes:

int inet_aton(const char *, struct in_addr *);
int inet_pton(int, const char *, void *);

Totally different. Trying to swap one for the other will only result in pain and suffering (and a crash, most likely). If you've done this and it seems to be working, it's probably because the code which uses inet_aton isn't being called.

Upvotes: 0

Related Questions