What is the best way to keep track of different signatures of shared objects?




This is the general scenario. My application is a server that loads a
large number of similar (i.e. same signature) shared objects at
startup time, to be used on-demand later.

Version 1 was simple in the sense that all the loadable modules had
the same signature. For fast access, I save the addresses of the *.so
files in a C++ map. This is the relevant code:

typedef bool (*address)(const char *, const char *, char *);
typedef map<string, address> module_address;

module_address addressOf;

bool (*function)(const char *, const char *, char *);

handle = dlopen((mod_dir + "/" + filename).c_str(), RTLD_NOW);
*(void **)(&function) = dlsym(handle, fnc_name);

if (function) {
addressOf[unique_id] = function;
roster[unique_id] = true;
}

So far, so good. I have loaded all the shared object files, and I know
how to execute each because I have kept their addresses in a handy
map.

Here comes the troublesome code, when I actually execute the
functions:

address function;
function = addressOf[unique_id];

if (!function) {
throw UNSUPPORTED_ID;
}

bool success = function(arg1, arg2, buffer);

The mentioned scheme works fine as long as I keep the same signature,
but alas, now I need to load and execute some new functions which need
more arguments:

bool success = function(arg1, arg2, buffer, extra_arg);

-Ramon

.



Relevant Pages

  • Re: [Full-disclosure] Google Talk Denial of Service - BenjiBug
    ... its own signature so that Google Talk doesn't complain. ... >greater than the version currently running, Google Talk will download ... >the .exe and, after checking its authenticity, execute it to ...
    (Full-Disclosure)
  • Re: [work] RE: Active Directory Question
    ... The only way to make that work would be to have a signature for all ... programs users are allowed to execute, that way even if the user changes ... >Let's say I'm an Evil Guy trying to install a backdoor/privilege escalation ... Imaginary command prompt session follows (commmand prompt not really ...
    (Focus-Microsoft)
  • Re: [work] RE: Active Directory Question
    ... >programs users are allowed to execute, that way even if the user changes ... >that name of the the program he/she wants to execute the signature still ... issues) md5sum list / database that the user had no access to. ... it would need updating when setups were patched / altered etc ...
    (Focus-Microsoft)
  • Re: The a.u.e FAQ
    ... readership is not restricted to any field of knowledge. ... Not knowing which of thousands of interpretations the poster ... signature of the writer, standing for "Turdhead". ... What good is being an executive if you never get to execute anyone? ...
    (alt.usage.english)
  • Re: ASF custom file type
    ... which links to a source filter. ... signature) it loads my custom source filter, ... but when I use the AddSourceFilter method or loads the ... file extension or URL protocol or file signature), ...
    (microsoft.public.win32.programmer.directx.video)