Changeset 94 in openpam for trunk


Ignore:
Timestamp:
Mar 7, 2002, 8:22:38 PM (18 years ago)
Author:
Dag-Erling Smørgrav
Message:

Fix a number of bugs in the module cache:

  • Don't log dlopen() failures, since they're rarely interesting; instead, log a failure if no module was found at all.
  • When loading a versioned module, store its logical name in the module structure rather than its physical name, since it will be looked up by its logical name if it's needed again.
  • Initialize module->next->prev when adding a module to the cache.
  • Set modules to NULL when releasing the last module in the cache.

Sponsored by: DARPA, NAI Labs

Location:
trunk/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/openpam_dynamic.c

    r93 r94  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/openpam_dynamic.c#2 $
     34 * $P4: //depot/projects/openpam/lib/openpam_dynamic.c#3 $
    3535 */
    3636
     
    6565                goto buf_err;
    6666        if ((dlh = dlopen(vpath, RTLD_NOW)) == NULL) {
    67                 openpam_log(PAM_LOG_ERROR, "dlopen(): %s", dlerror());
    6867                *strrchr(vpath, '.') = '\0';
    6968                if ((dlh = dlopen(vpath, RTLD_NOW)) == NULL) {
    70                         openpam_log(PAM_LOG_ERROR, "dlopen(): %s", dlerror());
    7169                        free(module);
    7270                        return (NULL);
    7371                }
    7472        }
    75         module->path = vpath;
     73        free(vpath);
     74        if ((module->path = strdup(path)) == NULL)
     75                goto buf_err;
    7676        module->dlh = dlh;
    7777        for (i = 0; i < PAM_NUM_PRIMITIVES; ++i)
  • trunk/lib/openpam_load.c

    r93 r94  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/openpam_load.c#11 $
     34 * $P4: //depot/projects/openpam/lib/openpam_load.c#12 $
    3535 */
    3636
     
    8282        }
    8383#endif
    84         if (module == NULL)
     84        if (module == NULL) {
     85                openpam_log(PAM_LOG_ERROR, "no %s found", path);
    8586                return (NULL);
     87        }
     88        openpam_log(PAM_LOG_DEBUG, "adding %s to cache", module->path);
    8689        module->next = modules;
     90        if (module->next != NULL)
     91                module->next->prev = module;
    8792        module->prev = NULL;
    8893        modules = module;
     
    120125        if (module->next != NULL)
    121126                module->next->prev = module->prev;
     127        if (module == modules)
     128                modules = module->next;
     129        openpam_log(PAM_LOG_DEBUG, "releasing %s", module->path);
    122130        free(module->path);
    123131        free(module);
Note: See TracChangeset for help on using the changeset viewer.