openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/libpam/1.3.1-r0/Linux-PAM-1.3.1/libpam/pam_handlers.c
int _pam_free_handlers(pam_handle_t* pamh)
{
    struct loaded_module* mod;

    D(("called."));
    IF_NO_PAMH("_pam_free_handlers", pamh, PAM_SYSTEM_ERR);

    mod = pamh->handlers.module;

    /* Close all loaded modules */

    while (pamh->handlers.modules_used)
    {
        D(("_pam_free_handlers: dlclose(%s)", mod->name));
        free(mod->name);
        if (mod->type == PAM_MT_DYNAMIC_MOD)
        {
            _pam_dlclose(mod->dl_handle);
        }
        mod++;
        pamh->handlers.modules_used--;
    }

    /* Free all the handlers */

    _pam_free_handlers_aux(&(pamh->handlers.conf.authenticate));
    _pam_free_handlers_aux(&(pamh->handlers.conf.setcred));
    _pam_free_handlers_aux(&(pamh->handlers.conf.acct_mgmt));
    _pam_free_handlers_aux(&(pamh->handlers.conf.open_session));
    _pam_free_handlers_aux(&(pamh->handlers.conf.close_session));
    _pam_free_handlers_aux(&(pamh->handlers.conf.chauthtok));

    _pam_free_handlers_aux(&(pamh->handlers.other.authenticate));
    _pam_free_handlers_aux(&(pamh->handlers.other.setcred));
    _pam_free_handlers_aux(&(pamh->handlers.other.acct_mgmt));
    _pam_free_handlers_aux(&(pamh->handlers.other.open_session));
    _pam_free_handlers_aux(&(pamh->handlers.other.close_session));
    _pam_free_handlers_aux(&(pamh->handlers.other.chauthtok));

    /* no more loaded modules */

    _pam_drop(pamh->handlers.module);

    /* Indicate that handlers are not initialized for this pamh */

    pamh->handlers.handlers_loaded = 0;

    return PAM_SUCCESS;
}
/* Free various allocated structures and dlclose() the libs */
Free various allocated structures and dlclose() the libs
Free various allocated structures and dlclose () the libs
int _pam_free_handlers(pam_handle_t* pamh)
{
    struct loaded_module* mod;
    D(("called."));
    IF_NO_PAMH("_pam_free_handlers", pamh, PAM_SYSTEM_ERR);
    mod = pamh->handlers.module;
    while (pamh->handlers.modules_used)
    {
        D(("_pam_free_handlers: dlclose(%s)", mod->name));
        free(mod->name);
        if (mod->type == PAM_MT_DYNAMIC_MOD)
        {
            _pam_dlclose(mod->dl_handle);
        }
        mod++;
        pamh->handlers.modules_used--;
    }
    _pam_free_handlers_aux(&(pamh->handlers.conf.authenticate));
    _pam_free_handlers_aux(&(pamh->handlers.conf.setcred));
    _pam_free_handlers_aux(&(pamh->handlers.conf.acct_mgmt));
    _pam_free_handlers_aux(&(pamh->handlers.conf.open_session));
    _pam_free_handlers_aux(&(pamh->handlers.conf.close_session));
    _pam_free_handlers_aux(&(pamh->handlers.conf.chauthtok));
    _pam_free_handlers_aux(&(pamh->handlers.other.authenticate));
    _pam_free_handlers_aux(&(pamh->handlers.other.setcred));
    _pam_free_handlers_aux(&(pamh->handlers.other.acct_mgmt));
    _pam_free_handlers_aux(&(pamh->handlers.other.open_session));
    _pam_free_handlers_aux(&(pamh->handlers.other.close_session));
    _pam_free_handlers_aux(&(pamh->handlers.other.chauthtok));
    _pam_drop(pamh->handlers.module);
    pamh->handlers.handlers_loaded = 0;
    return PAM_SUCCESS;
}
int _pam_free_handlers ( pam_handle_t * pamh ) { struct loaded_module * mod ; D ( ( " " ) ) ; IF_NO_PAMH ( " " , pamh , PAM_SYSTEM_ERR ) ; mod = pamh -> handlers . module ; while ( pamh -> handlers . modules_used ) { D ( ( " " , mod -> name ) ) ; free ( mod -> name ) ; if ( mod -> type == PAM_MT_DYNAMIC_MOD ) { _pam_dlclose ( mod -> dl_handle ) ; } mod ++ ; pamh -> handlers . modules_used -- ; } _pam_free_handlers_aux ( & ( pamh -> handlers . conf . authenticate ) ) ; _pam_free_handlers_aux ( & ( pamh -> handlers . conf . setcred ) ) ; _pam_free_handlers_aux ( & ( pamh -> handlers . conf . acct_mgmt ) ) ; _pam_free_handlers_aux ( & ( pamh -> handlers . conf . open_session ) ) ; _pam_free_handlers_aux ( & ( pamh -> handlers . conf . close_session ) ) ; _pam_free_handlers_aux ( & ( pamh -> handlers . conf . chauthtok ) ) ; _pam_free_handlers_aux ( & ( pamh -> handlers . other . authenticate ) ) ; _pam_free_handlers_aux ( & ( pamh -> handlers . other . setcred ) ) ; _pam_free_handlers_aux ( & ( pamh -> handlers . other . acct_mgmt ) ) ; _pam_free_handlers_aux ( & ( pamh -> handlers . other . open_session ) ) ; _pam_free_handlers_aux ( & ( pamh -> handlers . other . close_session ) ) ; _pam_free_handlers_aux ( & ( pamh -> handlers . other . chauthtok ) ) ; _pam_drop ( pamh -> handlers . module ) ; pamh -> handlers . handlers_loaded = 0 ; return PAM_SUCCESS ; }
Free various allocated structures and dlclose() the libs
Free various allocated structures and dlclose () the libs
/* Close all loaded modules */ /* Free all the handlers */ /* no more loaded modules */ /* Indicate that handlers are not initialized for this pamh */