[so] Interceptare functii glibc - Linux

Bogdan Luca so@cursuri.cs.pub.ro
Sat, 20 Nov 2004 14:17:41 +0200


Citez din enuntul temei: "Interceptarea functiilor /write se va face 
prin crearea unei biblioteci care sa defineasca aceste functii. 
Functiile originale se vor afla cu ajutorul functiilor 
dlopen("libc.so.6") si dlsym("read"/"write").".

Cred ca e mai simplu sa folosim dlsym(RTLD_NEXT, "read"/"write"), dupa 
cum zice pagina de manual a dlsym: "There are two special 
pseudo-handles, RTLD_DEFAULT and RTLD_NEXT.  The former will find the 
first occurrence of the desired symbol using the default library search 
order. The latter will find the next occurrence of  a  function  in the 
  search  order  after  the  current library.  This allows one to 
provide a wrapper around a function in another shared library.".

E vreo problema daca folosim metoda asta?

Bogdan Luca
345CA