#include <dlfcn.h>
#include <stdio.h>

int main(int argc, char *argv[]) {
    if (argc < 2) {
        fprintf(stderr, "Usage: %s <libahfail_pam.so>\n", argv[0]);
        return 1;
    }
    void *lib = dlopen(argv[1], RTLD_NOW);
    if (!lib) { fprintf(stderr, "dlopen: %s\n", dlerror()); return 1; }
    if (!dlsym(lib, "pam_sm_authenticate")) {
        fprintf(stderr, "pam_sm_authenticate not found\n");
        dlclose(lib);
        return 1;
    }
    dlclose(lib);
    return 0;
}
