#include #include # define RTLD_NEXT ((void *) -1l) extern char *__md5_crypt(const char *, const char *); char * crypt(const char *pw, const char *salt) { char *(*func)(const char *, const char *); if (strncmp(salt, "$1$", 3) == 0) { func = __md5_crypt; } else { func = dlsym(RTLD_NEXT, "crypt"); if (!func) func = __md5_crypt; } return func(pw, salt); }