Changeset 87 in openpam
- Timestamp:
- Mar 5, 2002, 2:20:26 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/security/openpam.h
r86 r87 32 32 * SUCH DAMAGE. 33 33 * 34 * $P4: //depot/projects/openpam/include/security/openpam.h#1 0$34 * $P4: //depot/projects/openpam/include/security/openpam.h#11 $ 35 35 */ 36 36 … … 178 178 typedef struct pam_module pam_module_t; 179 179 struct pam_module { 180 c onst char*path;180 char *path; 181 181 pam_func_t func[PAM_NUM_PRIMITIVES]; 182 182 void *dlh; … … 202 202 #define PAM_EXTERN static 203 203 #define PAM_MODULE_ENTRY(name) \ 204 static struct pam_module _pam_module = { name PAM_SOEXT, { \ 204 static char _pam_name[] = name PAM_SOEXT; \ 205 static struct pam_module _pam_module = { _pam_name, { \ 205 206 pam_sm_authenticate, pam_sm_setcred, pam_sm_acct_mgmt, \ 206 207 pam_sm_open_session, pam_sm_close_session, pam_sm_chauthtok }, \ -
trunk/lib/Makefile
r86 r87 32 32 # SUCH DAMAGE. 33 33 # 34 # $P4: //depot/projects/openpam/lib/Makefile#1 0$34 # $P4: //depot/projects/openpam/lib/Makefile#11 $ 35 35 # 36 36 … … 42 42 NO_WERROR = yes 43 43 CFLAGS += -I${.CURDIR}/../include 44 CFLAGS += -DLIB_MAJ=${SHLIB_MAJOR} 44 45 45 46 SRCS = 46 47 SRCS += openpam_dispatch.c 48 SRCS += openpam_dynamic.c 47 49 SRCS += openpam_findenv.c 48 50 SRCS += openpam_get_option.c -
trunk/lib/openpam_impl.h
r86 r87 32 32 * SUCH DAMAGE. 33 33 * 34 * $P4: //depot/projects/openpam/lib/openpam_impl.h# 9$34 * $P4: //depot/projects/openpam/lib/openpam_impl.h#10 $ 35 35 */ 36 36 … … 105 105 pam_module_t *openpam_static(const char *); 106 106 #endif 107 pam_module_t *openpam_dynamic(const char *); 107 108 108 109 #endif -
trunk/lib/openpam_load.c
r86 r87 32 32 * SUCH DAMAGE. 33 33 * 34 * $P4: //depot/projects/openpam/lib/openpam_load.c# 9$34 * $P4: //depot/projects/openpam/lib/openpam_load.c#10 $ 35 35 */ 36 36 … … 55 55 56 56 /* 57 * Lo ad a dynamic module, or locate a static one. Keep a list of58 * previouslyfound modules to speed up the process.57 * Locate a matching dynamic or static module. Keep a list of previously 58 * found modules to speed up the process. 59 59 */ 60 60 … … 63 63 { 64 64 pam_module_t *module; 65 void *dlh;66 int i;67 65 68 66 /* check cache first */ … … 72 70 73 71 /* nope; try to load */ 74 if ((dlh = dlopen(path, RTLD_NOW)) == NULL) { 75 openpam_log(PAM_LOG_ERROR, "dlopen(): %s", dlerror()); 76 } else { 77 if ((module = calloc(1, sizeof *module)) == NULL) 78 goto buf_err; 79 if ((module->path = strdup(path)) == NULL) 80 goto buf_err; 81 module->dlh = dlh; 82 for (i = 0; i < PAM_NUM_PRIMITIVES; ++i) 83 module->func[i] = dlsym(dlh, _pam_sm_func_name[i]); 84 } 72 module = openpam_dynamic(path); 85 73 openpam_log(PAM_LOG_DEBUG, "%s dynamic %s", 86 74 (module == NULL) ? "no" : "using", path); … … 102 90 ++module->refcount; 103 91 return (module); 104 buf_err:105 openpam_log(PAM_LOG_ERROR, "malloc(): %m");106 dlclose(dlh);107 free(module);108 return (NULL);109 92 } 110 93 … … 137 120 if (module->next != NULL) 138 121 module->next->prev = module->prev; 122 free(module->path); 139 123 free(module); 140 124 }
Note: See TracChangeset
for help on using the changeset viewer.