summaryrefslogtreecommitdiff
path: root/src/plugins/auth-pam/pamdl.c
diff options
context:
space:
mode:
authorAlberto Gonzalez Iniesta <agi@inittab.org>2016-12-27 18:25:47 +0100
committerAlberto Gonzalez Iniesta <agi@inittab.org>2016-12-27 18:25:47 +0100
commit79f3537f69e125f19f59c36aa090120a63186a54 (patch)
tree2089a3b7dac990841dbc2e4d9b2f535b82dbb0af /src/plugins/auth-pam/pamdl.c
parentf2137fedb30cb87448eb03b2f288920df6187571 (diff)
parent3a2bbdb05ca6a6996e424c9fb225cb0d53804125 (diff)
Merge tag 'upstream/2.4.0'
Upstream version 2.4.0
Diffstat (limited to 'src/plugins/auth-pam/pamdl.c')
-rw-r--r--src/plugins/auth-pam/pamdl.c113
1 files changed, 64 insertions, 49 deletions
diff --git a/src/plugins/auth-pam/pamdl.c b/src/plugins/auth-pam/pamdl.c
index 26e9821..02ea71a 100644
--- a/src/plugins/auth-pam/pamdl.c
+++ b/src/plugins/auth-pam/pamdl.c
@@ -21,125 +21,136 @@ static void *libpam_h = NULL;
#define RESOLVE_PAM_FUNCTION(x, y, z, err) \
{ \
- union { const void *tpointer; y (*fn) z ; } fptr; \
- fptr.tpointer = dlsym(libpam_h, #x); real_##x = fptr.fn; \
- if (real_##x == NULL) { \
- fprintf (stderr, "PAMDL: unable to resolve '%s': %s\n", #x, dlerror()); \
- return err; \
- } \
+ union { const void *tpointer; y(*fn) z; } fptr; \
+ fptr.tpointer = dlsym(libpam_h, #x); real_ ## x = fptr.fn; \
+ if (real_ ## x == NULL) { \
+ fprintf(stderr, "PAMDL: unable to resolve '%s': %s\n", #x, dlerror()); \
+ return err; \
+ } \
}
int
-dlopen_pam (const char *so)
+dlopen_pam(const char *so)
{
- if (libpam_h == NULL)
+ if (libpam_h == NULL)
{
- libpam_h = dlopen(so, RTLD_GLOBAL|RTLD_NOW);
+ libpam_h = dlopen(so, RTLD_GLOBAL|RTLD_NOW);
}
- return libpam_h != NULL;
+ return libpam_h != NULL;
}
void
-dlclose_pam (void)
+dlclose_pam(void)
{
- if (libpam_h != NULL)
+ if (libpam_h != NULL)
{
- dlclose(libpam_h);
- libpam_h = NULL;
+ dlclose(libpam_h);
+ libpam_h = NULL;
}
}
-int pam_start(const char *service_name, const char *user,
- const struct pam_conv *pam_conversation,
- pam_handle_t **pamh)
+int
+pam_start(const char *service_name, const char *user,
+ const struct pam_conv *pam_conversation,
+ pam_handle_t **pamh)
{
int (*real_pam_start)(const char *, const char *,
- const struct pam_conv *,
- pam_handle_t **);
+ const struct pam_conv *,
+ pam_handle_t **);
RESOLVE_PAM_FUNCTION(pam_start, int, (const char *, const char *,
- const struct pam_conv *,
- pam_handle_t **), PAM_ABORT);
+ const struct pam_conv *,
+ pam_handle_t **), PAM_ABORT);
return real_pam_start(service_name, user, pam_conversation, pamh);
}
-int pam_end(pam_handle_t *pamh, int pam_status)
+int
+pam_end(pam_handle_t *pamh, int pam_status)
{
int (*real_pam_end)(pam_handle_t *, int);
RESOLVE_PAM_FUNCTION(pam_end, int, (pam_handle_t *, int), PAM_ABORT);
return real_pam_end(pamh, pam_status);
}
-int pam_set_item(pam_handle_t *pamh, int item_type, const void *item)
+int
+pam_set_item(pam_handle_t *pamh, int item_type, const void *item)
{
int (*real_pam_set_item)(pam_handle_t *, int, const void *);
RESOLVE_PAM_FUNCTION(pam_set_item, int,
- (pam_handle_t *, int, const void *), PAM_ABORT);
+ (pam_handle_t *, int, const void *), PAM_ABORT);
return real_pam_set_item(pamh, item_type, item);
}
-int pam_get_item(const pam_handle_t *pamh, int item_type, const void **item)
+int
+pam_get_item(const pam_handle_t *pamh, int item_type, const void **item)
{
int (*real_pam_get_item)(const pam_handle_t *, int, const void **);
RESOLVE_PAM_FUNCTION(pam_get_item, int,
- (const pam_handle_t *, int, const void **),
- PAM_ABORT);
+ (const pam_handle_t *, int, const void **),
+ PAM_ABORT);
return real_pam_get_item(pamh, item_type, item);
}
-int pam_fail_delay(pam_handle_t *pamh, unsigned int musec_delay)
+int
+pam_fail_delay(pam_handle_t *pamh, unsigned int musec_delay)
{
int (*real_pam_fail_delay)(pam_handle_t *, unsigned int);
RESOLVE_PAM_FUNCTION(pam_fail_delay, int, (pam_handle_t *, unsigned int),
- PAM_ABORT);
+ PAM_ABORT);
return real_pam_fail_delay(pamh, musec_delay);
}
-typedef const char * const_char_pointer;
+typedef const char *const_char_pointer;
-const_char_pointer pam_strerror(pam_handle_t *pamh, int errnum)
+const_char_pointer
+pam_strerror(pam_handle_t *pamh, int errnum)
{
const_char_pointer (*real_pam_strerror)(pam_handle_t *, int);
RESOLVE_PAM_FUNCTION(pam_strerror, const_char_pointer,
- (pam_handle_t *, int), NULL);
+ (pam_handle_t *, int), NULL);
return real_pam_strerror(pamh, errnum);
}
-int pam_putenv(pam_handle_t *pamh, const char *name_value)
+int
+pam_putenv(pam_handle_t *pamh, const char *name_value)
{
int (*real_pam_putenv)(pam_handle_t *, const char *);
RESOLVE_PAM_FUNCTION(pam_putenv, int, (pam_handle_t *, const char *),
- PAM_ABORT);
+ PAM_ABORT);
return real_pam_putenv(pamh, name_value);
}
-const_char_pointer pam_getenv(pam_handle_t *pamh, const char *name)
+const_char_pointer
+pam_getenv(pam_handle_t *pamh, const char *name)
{
const_char_pointer (*real_pam_getenv)(pam_handle_t *, const char *);
RESOLVE_PAM_FUNCTION(pam_getenv, const_char_pointer,
- (pam_handle_t *, const char *), NULL);
+ (pam_handle_t *, const char *), NULL);
return real_pam_getenv(pamh, name);
}
-typedef char ** char_ppointer;
-char_ppointer pam_getenvlist(pam_handle_t *pamh)
+typedef char **char_ppointer;
+char_ppointer
+pam_getenvlist(pam_handle_t *pamh)
{
char_ppointer (*real_pam_getenvlist)(pam_handle_t *);
RESOLVE_PAM_FUNCTION(pam_getenvlist, char_ppointer, (pam_handle_t *),
- NULL);
+ NULL);
return real_pam_getenvlist(pamh);
}
/* Authentication management */
-int pam_authenticate(pam_handle_t *pamh, int flags)
+int
+pam_authenticate(pam_handle_t *pamh, int flags)
{
int (*real_pam_authenticate)(pam_handle_t *, int);
RESOLVE_PAM_FUNCTION(pam_authenticate, int, (pam_handle_t *, int),
- PAM_ABORT);
+ PAM_ABORT);
return real_pam_authenticate(pamh, flags);
}
-int pam_setcred(pam_handle_t *pamh, int flags)
+int
+pam_setcred(pam_handle_t *pamh, int flags)
{
int (*real_pam_setcred)(pam_handle_t *, int);
RESOLVE_PAM_FUNCTION(pam_setcred, int, (pam_handle_t *, int), PAM_ABORT);
@@ -148,7 +159,8 @@ int pam_setcred(pam_handle_t *pamh, int flags)
/* Account Management API's */
-int pam_acct_mgmt(pam_handle_t *pamh, int flags)
+int
+pam_acct_mgmt(pam_handle_t *pamh, int flags)
{
int (*real_pam_acct_mgmt)(pam_handle_t *, int);
RESOLVE_PAM_FUNCTION(pam_acct_mgmt, int, (pam_handle_t *, int), PAM_ABORT);
@@ -157,28 +169,31 @@ int pam_acct_mgmt(pam_handle_t *pamh, int flags)
/* Session Management API's */
-int pam_open_session(pam_handle_t *pamh, int flags)
+int
+pam_open_session(pam_handle_t *pamh, int flags)
{
int (*real_pam_open_session)(pam_handle_t *, int);
RESOLVE_PAM_FUNCTION(pam_open_session, int, (pam_handle_t *, int),
- PAM_ABORT);
+ PAM_ABORT);
return real_pam_open_session(pamh, flags);
}
-int pam_close_session(pam_handle_t *pamh, int flags)
+int
+pam_close_session(pam_handle_t *pamh, int flags)
{
int (*real_pam_close_session)(pam_handle_t *, int);
RESOLVE_PAM_FUNCTION(pam_close_session, int, (pam_handle_t *, int),
- PAM_ABORT);
+ PAM_ABORT);
return real_pam_close_session(pamh, flags);
}
/* Password Management API's */
-int pam_chauthtok(pam_handle_t *pamh, int flags)
+int
+pam_chauthtok(pam_handle_t *pamh, int flags)
{
int (*real_pam_chauthtok)(pam_handle_t *, int);
RESOLVE_PAM_FUNCTION(pam_chauthtok, int, (pam_handle_t *, int), PAM_ABORT);
return real_pam_chauthtok(pamh, flags);
}
-#endif
+#endif /* ifdef USE_PAM_DLOPEN */