Next: , Previous: , Up: Top   [Contents]


3 Making the library work

LibSecRm has no magic in it, it won’t intercept calls to the mentioned functions just because it is compiled. Even installing the library in a system directory isn’t enough. The library needs to be loaded into memory. More strictly, it needs to be PRELOADED (loaded before other libraries). This is achieved easily, if you are using ld.so (or derivatives) to load libraries (like on GNU/Linux). Just add the following line:

export LD_PRELOAD=/usr/local/lib/libsecrm.so

to your startup scripts (like $HOME/.bashrc, $HOME/.bash_profile). You should change the path to the correct one. If you aren’t using bash, consult your shell manual for details on how to export an environment variable.

This will make the dynamic linker, ld.so, load LibSecRm before loading any other libraries, when starting programs. That is, after the line above gets executed, all programs from that moment start using LibSecRm.

You can alternatively put the full path to the library in the /etc/ld.so.preload. No syntax is required, just the path and filename, like this:

/usr/local/lib/libsecrm.so

To load LibSecRm for just one program, type like this (for bash):

LD_PRELOAD=/usr/local/lib/libsecrm.so some-program-name

Having the library loaded will NOT make your programs work faster, of course. Some programs may be unaffected, some may suffer from delays introduced by the library.

WARNING

Do NOT make the library suid. You wouldn’t want user ‘nobody’ (or any other non-root) to be able to delete system files, would you?