CyberNinjas / pam_aad

Azure Active Directory PAM Module
GNU General Public License v3.0
54 stars 19 forks source link

Create unit tests suite from commented out sections #9

Closed Jnchi closed 5 years ago

Jnchi commented 5 years ago

Postman

Resources:

See also:

Jnchi commented 5 years ago

Newman is a command-line collection runner for Postman

Jnchi commented 5 years ago

https://github.com/CyberNinjas/pam_aad/tree/feature-testing

Jnchi commented 5 years ago
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, const char* argv[])
{
    if ( argc != 2 )
    {
    printf("Usage: ./dlopentest <path_to_pam_module>\n");
    exit(1);
    }

    void *libhandle = dlopen(argv[1], RTLD_NOW);
    if ( libhandle == NULL )
    {        
        printf("%s",dlerror());
        exit(1);
    }
    void* sym = dlsym(libhandle,"pam_sm_authenticate");
    if ( sym == NULL )
    {
        printf("%s",dlerror());
        exit(1);  
    } 
    sym = dlsym(libhandle,"pam_sm_setcred");  
    if ( sym == NULL )  
    {                           
        printf("%s",dlerror());             
        exit(1);    
    }
    dlclose(libhandle);
}

Source: https://github.com/CyberNinjas/pam_aad/blob/6b547f4aac02821b6a4840098c71fcd83af389f4/dev/dlopentest.c