Changeset 32 in openpam for trunk/include


Ignore:
Timestamp:
Feb 4, 2002, 11:22:40 PM (17 years ago)
Author:
Dag-Erling Smørgrav
Message:

Add support for static linking. Also rename a handful of constants
to reduce the chance of every running into a naming conflict.

Sponsored by: DARPA, NAI Labs

Location:
trunk/include/security
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/security/openpam.h

    r23 r32  
    5656        ...);
    5757
    58 #ifdef __GNUC__
     58#if defined(__STDC__) && (__STDC_VERSION__ > 199901L)
     59#define openpam_log(lvl, fmt, ...) \
     60        _openpam_log((lvl), __func__, fmt, __VA_ARGS__)
     61#elif defined(__GNUC__)
    5962#define openpam_log(lvl, fmt...) \
    6063        _openpam_log((lvl), __func__, ##fmt)
    6164#else
    62 #define openpam_log(lvl, fmt, ...) \
    63         _openpam_log((lvl), __func__, fmt, __VA_ARGS__)
     65extern openpam_log(int _level, const char *_format, ...);
    6466#endif
    6567
     
    6769 * Generic conversation function
    6870 */
     71struct pam_message;
     72struct pam_response;
    6973int openpam_ttyconv(int _n,
    7074        const struct pam_message **_msg,
     
    7276        void *_data);
    7377
     78/*
     79 * PAM primitives
     80 */
     81enum {
     82        PAM_SM_AUTHENTICATE,
     83        PAM_SM_SETCRED,
     84        PAM_SM_ACCT_MGMT,
     85        PAM_SM_OPEN_SESSION,
     86        PAM_SM_CLOSE_SESSION,
     87        PAM_SM_CHAUTHTOK,
     88        /* keep this last */
     89        PAM_NUM_PRIMITIVES
     90};
     91
     92/*
     93 * Dummy service module function
     94 */
     95#define PAM_SM_DUMMY(type)                                              \
     96PAM_EXTERN int                                                          \
     97pam_sm_##type(pam_handle_t *pamh, int flags,                            \
     98    int argc, const char *argv[])                                       \
     99{                                                                       \
     100        return (PAM_IGNORE);                                            \
     101}
     102
     103/*
     104 * PAM service module functions match this typedef
     105 */
     106struct pam_handle;
     107typedef int (*pam_func_t)(struct pam_handle *, int, int, const char **);
     108
     109/*
     110 * A struct that describes a module.
     111 */
     112typedef struct pam_module pam_module_t;
     113struct pam_module {
     114        const char      *path;
     115        pam_func_t       func[PAM_NUM_PRIMITIVES];
     116        void            *dlh;
     117        int              refcount;
     118        pam_module_t    *prev;
     119        pam_module_t    *next;
     120};
     121
     122/*
     123 * Infrastructure for static modules using GCC linker sets.
     124 * You are not expected to understand this.
     125 */
     126#if defined(__GNUC__) && !defined(__PIC__)
     127#if defined(__FreeBSD__)
     128#define PAM_SOEXT ".so"
     129#else
     130#error Static linking is not supported on your platform
    74131#endif
     132/* gcc, static linking */
     133#include <sys/cdefs.h>
     134#include <linker_set.h>
     135#define OPENPAM_STATIC_MODULES
     136#define PAM_EXTERN static
     137#define PAM_MODULE_ENTRY(name)                                          \
     138static struct pam_module _pam_module = { name PAM_SOEXT, {              \
     139    pam_sm_authenticate, pam_sm_setcred, pam_sm_acct_mgmt,              \
     140    pam_sm_open_session, pam_sm_close_session, pam_sm_chauthtok },      \
     141    NULL, 0, NULL, NULL };                                              \
     142DATA_SET(_openpam_modules, _pam_module)
     143#else
     144/* normal case */
     145#define PAM_EXTERN
     146#define PAM_MODULE_ENTRY(name)
     147#endif
     148
     149#endif
  • trunk/include/security/pam_modules.h

    r16 r32  
    4040#include <security/pam_types.h>
    4141#include <security/pam_constants.h>
     42#include <security/openpam.h>
    4243
    4344/*
     
    4546 */
    4647
    47 int
     48PAM_EXTERN int
    4849pam_sm_acct_mgmt(pam_handle_t *_pamh,
    4950        int _flags,
     
    5152        const char **_argv);
    5253
    53 int
     54PAM_EXTERN int
    5455pam_sm_authenticate(pam_handle_t *_pamh,
    5556        int _flags,
     
    5758        const char **_argv);
    5859
    59 int
     60PAM_EXTERN int
    6061pam_sm_chauthtok(pam_handle_t *_pamh,
    6162        int _flags,
     
    6364        const char **_argv);
    6465
    65 int
     66PAM_EXTERN int
    6667pam_sm_close_session(pam_handle_t *_pamh,
    6768        int _flags,
     
    6970        const char **_argv);
    7071
    71 int
     72PAM_EXTERN int
    7273pam_sm_open_session(pam_handle_t *_pamh,
    7374        int _flags,
     
    7576        const char **_argv);
    7677
    77 int
     78PAM_EXTERN int
    7879pam_sm_setcred(pam_handle_t *_pamh,
    7980        int _flags,
     
    8586 */
    8687#if 0
    87 int
     88PAM_EXTERN int
    8889pam_sm_authenticate_secondary(pam_handle_t *_pamh,
    8990        char *_target_username,
     
    9697        const char **_argv);
    9798
    98 int
     99PAM_EXTERN int
    99100pam_sm_get_mapped_authtok(pam_handle_t *_pamh,
    100101        char *_target_module_username,
     
    106107        char *_argv);
    107108
    108 int
     109PAM_EXTERN int
    109110pam_sm_get_mapped_username(pam_handle_t *_pamh,
    110111        char *_src_username,
     
    117118        const char **_argv);
    118119
    119 int
     120PAM_EXTERN int
    120121pam_sm_set_mapped_authtok(pam_handle_t *_pamh,
    121122        char *_target_module_username,
     
    127128        const char *_argv);
    128129
    129 int
     130PAM_EXTERN int
    130131pam_sm_set_mapped_username(pam_handle_t *_pamh,
    131132        char *_target_module_username,
Note: See TracChangeset for help on using the changeset viewer.