Style cleanup; correct some namespace violations (breaking source

compatibility in the process, but only for OpenPAM-specific features)


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@401 185d5e19-27fe-0310-9dcf-9bff6b9f3609
This commit is contained in:
Dag-Erling Smørgrav 2007-11-28 12:25:53 +00:00
parent e484c931ae
commit e725df8bb1
7 changed files with 83 additions and 63 deletions

View File

@ -34,8 +34,8 @@
* $Id$ * $Id$
*/ */
#ifndef _SECURITY_OPENPAM_H_INCLUDED #ifndef SECURITY_OPENPAM_H_INCLUDED
#define _SECURITY_OPENPAM_H_INCLUDED #define SECURITY_OPENPAM_H_INCLUDED
/* /*
* Annoying but necessary header pollution * Annoying but necessary header pollution
@ -236,6 +236,11 @@ PAM_EXTERN int \
pam_sm_##type(pam_handle_t *pamh, int flags, \ pam_sm_##type(pam_handle_t *pamh, int flags, \
int argc, const char *argv[]) \ int argc, const char *argv[]) \
{ \ { \
\
(void)pamh; \
(void)flags; \
(void)argc; \
(void)argv; \
return (PAM_IGNORE); \ return (PAM_IGNORE); \
} }
@ -263,39 +268,43 @@ struct pam_module {
*/ */
#if defined(PAM_SM_AUTH) || defined(PAM_SM_ACCOUNT) || \ #if defined(PAM_SM_AUTH) || defined(PAM_SM_ACCOUNT) || \
defined(PAM_SM_SESSION) || defined(PAM_SM_PASSWORD) defined(PAM_SM_SESSION) || defined(PAM_SM_PASSWORD)
#define LINUX_PAM_MODULE # define LINUX_PAM_MODULE
#endif #endif
#if defined(LINUX_PAM_MODULE) && !defined(PAM_SM_AUTH) #if defined(LINUX_PAM_MODULE) && !defined(PAM_SM_AUTH)
#define _PAM_SM_AUTHENTICATE 0 # define _PAM_SM_AUTHENTICATE 0
#define _PAM_SM_SETCRED 0 # define _PAM_SM_SETCRED 0
#else #else
#undef PAM_SM_AUTH # undef PAM_SM_AUTH
#define PAM_SM_AUTH # define PAM_SM_AUTH
#define _PAM_SM_AUTHENTICATE pam_sm_authenticate # define _PAM_SM_AUTHENTICATE pam_sm_authenticate
#define _PAM_SM_SETCRED pam_sm_setcred # define _PAM_SM_SETCRED pam_sm_setcred
#endif #endif
#if defined(LINUX_PAM_MODULE) && !defined(PAM_SM_ACCOUNT) #if defined(LINUX_PAM_MODULE) && !defined(PAM_SM_ACCOUNT)
#define _PAM_SM_ACCT_MGMT 0 # define _PAM_SM_ACCT_MGMT 0
#else #else
#undef PAM_SM_ACCOUNT # undef PAM_SM_ACCOUNT
#define PAM_SM_ACCOUNT # define PAM_SM_ACCOUNT
#define _PAM_SM_ACCT_MGMT pam_sm_acct_mgmt # define _PAM_SM_ACCT_MGMT pam_sm_acct_mgmt
#endif #endif
#if defined(LINUX_PAM_MODULE) && !defined(PAM_SM_SESSION) #if defined(LINUX_PAM_MODULE) && !defined(PAM_SM_SESSION)
#define _PAM_SM_OPEN_SESSION 0 # define _PAM_SM_OPEN_SESSION 0
#define _PAM_SM_CLOSE_SESSION 0 # define _PAM_SM_CLOSE_SESSION 0
#else #else
#undef PAM_SM_SESSION # undef PAM_SM_SESSION
#define PAM_SM_SESSION # define PAM_SM_SESSION
#define _PAM_SM_OPEN_SESSION pam_sm_open_session # define _PAM_SM_OPEN_SESSION pam_sm_open_session
#define _PAM_SM_CLOSE_SESSION pam_sm_close_session # define _PAM_SM_CLOSE_SESSION pam_sm_close_session
#endif #endif
#if defined(LINUX_PAM_MODULE) && !defined(PAM_SM_PASSWORD) #if defined(LINUX_PAM_MODULE) && !defined(PAM_SM_PASSWORD)
#define _PAM_SM_CHAUTHTOK 0 # define _PAM_SM_CHAUTHTOK 0
#else #else
#undef PAM_SM_PASSWORD # undef PAM_SM_PASSWORD
#define PAM_SM_PASSWORD # define PAM_SM_PASSWORD
#define _PAM_SM_CHAUTHTOK pam_sm_chauthtok # define _PAM_SM_CHAUTHTOK pam_sm_chauthtok
#endif #endif
/* /*
@ -303,33 +312,40 @@ struct pam_module {
* You are not expected to understand this. * You are not expected to understand this.
*/ */
#if defined(__FreeBSD__) #if defined(__FreeBSD__)
#define PAM_SOEXT ".so" # define PAM_SOEXT ".so"
#else #else
#ifndef NO_STATIC_MODULES # undef NO_STATIC_MODULES
#define NO_STATIC_MODULES # define NO_STATIC_MODULES
#endif
#endif #endif
#if defined(__GNUC__) && !defined(__PIC__) && !defined(NO_STATIC_MODULES) #if defined(__GNUC__) && !defined(__PIC__) && !defined(NO_STATIC_MODULES)
/* gcc, static linking */ /* gcc, static linking */
#include <sys/cdefs.h> # include <sys/cdefs.h>
#include <linker_set.h> # include <linker_set.h>
#define OPENPAM_STATIC_MODULES # define OPENPAM_STATIC_MODULES
#define PAM_EXTERN static # define PAM_EXTERN static
#define PAM_MODULE_ENTRY(name) \ # define PAM_MODULE_ENTRY(name) \
static char _pam_name[] = name PAM_SOEXT; \ static char _pam_name[] = name PAM_SOEXT; \
static struct pam_module _pam_module = { _pam_name, { \ static struct pam_module _pam_module = { \
_PAM_SM_AUTHENTICATE, _PAM_SM_SETCRED, _PAM_SM_ACCT_MGMT, \ .path = _pam_name, \
_PAM_SM_OPEN_SESSION, _PAM_SM_CLOSE_SESSION, _PAM_SM_CHAUTHTOK }, \ .func = { \
NULL, 0, NULL, NULL }; \ [PAM_SM_AUTHENTICATE] = _PAM_SM_AUTHENTICATE, \
DATA_SET(_openpam_static_modules, _pam_module) [PAM_SM_SETCRED] = _PAM_SM_SETCRED, \
[PAM_SM_ACCT_MGMT] = _PAM_SM_ACCT_MGMT, \
[PAM_SM_OPEN_SESSION] = _PAM_SM_OPEN_SESSION, \
[PAM_SM_CLOSE_SESSION] = _PAM_SM_CLOSE_SESSION, \
[PAM_SM_CHAUTHTOK] = _PAM_SM_CHAUTHTOK \
}, \
}; \
DATA_SET(_openpam_static_modules, _pam_module)
#else #else
/* normal case */ /* normal case */
#define PAM_EXTERN # define PAM_EXTERN
#define PAM_MODULE_ENTRY(name) # define PAM_MODULE_ENTRY(name)
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif /* !SECURITY_OPENPAM_H_INCLUDED */

View File

@ -34,11 +34,11 @@
* $Id$ * $Id$
*/ */
#ifndef _OPENPAM_VERSION_H_INCLUDED #ifndef SECURITY_OPENPAM_VERSION_H_INCLUDED
#define _OPENPAM_VERSION_H_INCLUDED #define SECURITY_OPENPAM_VERSION_H_INCLUDED
#define _OPENPAM #define OPENPAM
#define _OPENPAM_VERSION 20050616 #define OPENPAM_VERSION 20071218
#define _OPENPAM_RELEASE "Figwort" #define OPENPAM_RELEASE "Hydrangea"
#endif #endif /* !SECURITY_OPENPAM_VERSION_H_INCLUDED */

View File

@ -34,8 +34,8 @@
* $Id$ * $Id$
*/ */
#ifndef _PAM_APPL_H_INCLUDED #ifndef SECURITY_PAM_APPL_H_INCLUDED
#define _PAM_APPL_H_INCLUDED #define SECURITY_PAM_APPL_H_INCLUDED
#include <security/pam_types.h> #include <security/pam_types.h>
#include <security/pam_constants.h> #include <security/pam_constants.h>
@ -194,4 +194,4 @@ pam_set_mapped_username(pam_handle_t *_pamh,
} }
#endif #endif
#endif #endif /* !SECURITY_PAM_APPL_H_INCLUDED */

View File

@ -1,5 +1,9 @@
#ifndef _PAM_ATTRIBUTES_H_INCLUDED /*
#define _PAM_ATTRIBUTES_H_INCLUDED * $Id$
*/
#ifndef SECURITY_PAM_ATTRIBUTES_H_INCLUDED
#define SECURITY_PAM_ATTRIBUTES_H_INCLUDED
/* GCC attributes */ /* GCC attributes */
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && !defined(__STRICT_ANSI__) #if defined(__GNUC__) && defined(__GNUC_MINOR__) && !defined(__STRICT_ANSI__)
@ -21,4 +25,4 @@
# define OPENPAM_NONNULL(params) # define OPENPAM_NONNULL(params)
#endif #endif
#endif /* _PAM_ATTRIBUTES_H_INCLUDED */ #endif /* !SECURITY_PAM_ATTRIBUTES_H_INCLUDED */

View File

@ -34,8 +34,8 @@
* $Id$ * $Id$
*/ */
#ifndef _PAM_CONSTANTS_H_INCLUDED #ifndef SECURITY_PAM_CONSTANTS_H_INCLUDED
#define _PAM_CONSTANTS_H_INCLUDED #define SECURITY_PAM_CONSTANTS_H_INCLUDED
#include <security/openpam_version.h> #include <security/openpam_version.h>
@ -132,4 +132,4 @@ enum {
} }
#endif #endif
#endif #endif /* !SECURITY_PAM_CONSTANTS_H_INCLUDED */

View File

@ -34,8 +34,8 @@
* $Id$ * $Id$
*/ */
#ifndef _PAM_MODULES_H_INCLUDED #ifndef SECURITY_PAM_MODULES_H_INCLUDED
#define _PAM_MODULES_H_INCLUDED #define SECURITY_PAM_MODULES_H_INCLUDED
#include <security/pam_types.h> #include <security/pam_types.h>
#include <security/pam_constants.h> #include <security/pam_constants.h>
@ -157,4 +157,4 @@ pam_sm_set_mapped_username(pam_handle_t *_pamh,
} }
#endif #endif
#endif #endif /* !SECURITY_PAM_MODULES_H_INCLUDED */

View File

@ -34,8 +34,8 @@
* $Id$ * $Id$
*/ */
#ifndef _PAM_TYPES_H_INCLUDED #ifndef SECURITY_PAM_TYPES_H_INCLUDED
#define _PAM_TYPES_H_INCLUDED #define SECURITY_PAM_TYPES_H_INCLUDED
#include <stddef.h> #include <stddef.h>
@ -77,11 +77,11 @@ typedef struct pam_handle pam_handle_t;
typedef struct pam_repository { typedef struct pam_repository {
char *type; char *type;
void *scope; void *scope;
size_t scope_len; size_t scope_len;
} pam_repository_t; } pam_repository_t;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif /* !SECURITY_PAM_TYPES_H_INCLUDED */