Centralize macros used for hiding GCC-specific attributes.
Use attributes for publicly exported functions. Submitted by: "Dmitry V. Levin" <ldv@altlinux.org> git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@318 185d5e19-27fe-0310-9dcf-9bff6b9f3609
This commit is contained in:
parent
842343cb04
commit
4243d0384f
5 changed files with 98 additions and 36 deletions
3
MANIFEST
3
MANIFEST
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# $P4: //depot/projects/openpam/MANIFEST#21 $
|
# $P4: //depot/projects/openpam/MANIFEST#22 $
|
||||||
#
|
#
|
||||||
CREDITS
|
CREDITS
|
||||||
HISTORY
|
HISTORY
|
||||||
|
@ -90,6 +90,7 @@ include/security/Makefile.in
|
||||||
include/security/openpam.h
|
include/security/openpam.h
|
||||||
include/security/openpam_version.h
|
include/security/openpam_version.h
|
||||||
include/security/pam_appl.h
|
include/security/pam_appl.h
|
||||||
|
include/security/pam_attributes.h
|
||||||
include/security/pam_constants.h
|
include/security/pam_constants.h
|
||||||
include/security/pam_modules.h
|
include/security/pam_modules.h
|
||||||
include/security/pam_types.h
|
include/security/pam_types.h
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $P4: //depot/projects/openpam/include/security/Makefile.am#3 $
|
# $P4: //depot/projects/openpam/include/security/Makefile.am#4 $
|
||||||
|
|
||||||
openpamdir = $(includedir)/security
|
openpamdir = $(includedir)/security
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ openpam_HEADERS = \
|
||||||
openpam.h \
|
openpam.h \
|
||||||
openpam_version.h \
|
openpam_version.h \
|
||||||
pam_appl.h \
|
pam_appl.h \
|
||||||
|
pam_attributes.h \
|
||||||
pam_constants.h \
|
pam_constants.h \
|
||||||
pam_modules.h \
|
pam_modules.h \
|
||||||
pam_types.h
|
pam_types.h
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $P4: //depot/projects/openpam/include/security/openpam.h#28 $
|
* $P4: //depot/projects/openpam/include/security/openpam.h#29 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SECURITY_OPENPAM_H_INCLUDED
|
#ifndef _SECURITY_OPENPAM_H_INCLUDED
|
||||||
|
@ -42,6 +42,8 @@
|
||||||
*/
|
*/
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#include <security/pam_attributes.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -53,7 +55,8 @@ struct passwd;
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
openpam_borrow_cred(pam_handle_t *_pamh,
|
openpam_borrow_cred(pam_handle_t *_pamh,
|
||||||
const struct passwd *_pwd);
|
const struct passwd *_pwd)
|
||||||
|
OPENPAM_NONNULL((1,2));
|
||||||
|
|
||||||
void
|
void
|
||||||
openpam_free_data(pam_handle_t *_pamh,
|
openpam_free_data(pam_handle_t *_pamh,
|
||||||
|
@ -68,7 +71,8 @@ openpam_get_option(pam_handle_t *_pamh,
|
||||||
const char *_option);
|
const char *_option);
|
||||||
|
|
||||||
int
|
int
|
||||||
openpam_restore_cred(pam_handle_t *_pamh);
|
openpam_restore_cred(pam_handle_t *_pamh)
|
||||||
|
OPENPAM_NONNULL((1));
|
||||||
|
|
||||||
int
|
int
|
||||||
openpam_set_option(pam_handle_t *_pamh,
|
openpam_set_option(pam_handle_t *_pamh,
|
||||||
|
@ -78,48 +82,62 @@ openpam_set_option(pam_handle_t *_pamh,
|
||||||
int
|
int
|
||||||
pam_error(pam_handle_t *_pamh,
|
pam_error(pam_handle_t *_pamh,
|
||||||
const char *_fmt,
|
const char *_fmt,
|
||||||
...);
|
...)
|
||||||
|
OPENPAM_FORMAT ((__printf__, 2, 3))
|
||||||
|
OPENPAM_NONNULL((1,2));
|
||||||
|
|
||||||
int
|
int
|
||||||
pam_get_authtok(pam_handle_t *_pamh,
|
pam_get_authtok(pam_handle_t *_pamh,
|
||||||
int _item,
|
int _item,
|
||||||
const char **_authtok,
|
const char **_authtok,
|
||||||
const char *_prompt);
|
const char *_prompt)
|
||||||
|
OPENPAM_NONNULL((1,3));
|
||||||
|
|
||||||
int
|
int
|
||||||
pam_info(pam_handle_t *_pamh,
|
pam_info(pam_handle_t *_pamh,
|
||||||
const char *_fmt,
|
const char *_fmt,
|
||||||
...);
|
...)
|
||||||
|
OPENPAM_FORMAT ((__printf__, 2, 3))
|
||||||
|
OPENPAM_NONNULL((1,2));
|
||||||
|
|
||||||
int
|
int
|
||||||
pam_prompt(pam_handle_t *_pamh,
|
pam_prompt(pam_handle_t *_pamh,
|
||||||
int _style,
|
int _style,
|
||||||
char **_resp,
|
char **_resp,
|
||||||
const char *_fmt,
|
const char *_fmt,
|
||||||
...);
|
...)
|
||||||
|
OPENPAM_FORMAT ((__printf__, 4, 5))
|
||||||
|
OPENPAM_NONNULL((1,4));
|
||||||
|
|
||||||
int
|
int
|
||||||
pam_setenv(pam_handle_t *_pamh,
|
pam_setenv(pam_handle_t *_pamh,
|
||||||
const char *_name,
|
const char *_name,
|
||||||
const char *_value,
|
const char *_value,
|
||||||
int _overwrite);
|
int _overwrite)
|
||||||
|
OPENPAM_NONNULL((1,2,3));
|
||||||
|
|
||||||
int
|
int
|
||||||
pam_vinfo(pam_handle_t *_pamh,
|
pam_vinfo(pam_handle_t *_pamh,
|
||||||
const char *_fmt,
|
const char *_fmt,
|
||||||
va_list _ap);
|
va_list _ap)
|
||||||
|
OPENPAM_FORMAT ((__printf__, 2, 0))
|
||||||
|
OPENPAM_NONNULL((1,2));
|
||||||
|
|
||||||
int
|
int
|
||||||
pam_verror(pam_handle_t *_pamh,
|
pam_verror(pam_handle_t *_pamh,
|
||||||
const char *_fmt,
|
const char *_fmt,
|
||||||
va_list _ap);
|
va_list _ap)
|
||||||
|
OPENPAM_FORMAT ((__printf__, 2, 0))
|
||||||
|
OPENPAM_NONNULL((1,2));
|
||||||
|
|
||||||
int
|
int
|
||||||
pam_vprompt(pam_handle_t *_pamh,
|
pam_vprompt(pam_handle_t *_pamh,
|
||||||
int _style,
|
int _style,
|
||||||
char **_resp,
|
char **_resp,
|
||||||
const char *_fmt,
|
const char *_fmt,
|
||||||
va_list _ap);
|
va_list _ap)
|
||||||
|
OPENPAM_FORMAT ((__printf__, 4, 0))
|
||||||
|
OPENPAM_NONNULL((1,4));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read cooked lines.
|
* Read cooked lines.
|
||||||
|
@ -130,7 +148,8 @@ pam_vprompt(pam_handle_t *_pamh,
|
||||||
char *
|
char *
|
||||||
openpam_readline(FILE *_f,
|
openpam_readline(FILE *_f,
|
||||||
int *_lineno,
|
int *_lineno,
|
||||||
size_t *_lenp);
|
size_t *_lenp)
|
||||||
|
OPENPAM_NONNULL((1));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -151,10 +170,8 @@ _openpam_log(int _level,
|
||||||
const char *_func,
|
const char *_func,
|
||||||
const char *_fmt,
|
const char *_fmt,
|
||||||
...)
|
...)
|
||||||
#if defined(__GNUC__)
|
OPENPAM_FORMAT ((__printf__, 3, 4))
|
||||||
__attribute__((__format__(__printf__, 3, 4)))
|
OPENPAM_NONNULL((3));
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||||
#define openpam_log(lvl, ...) \
|
#define openpam_log(lvl, ...) \
|
||||||
|
@ -172,7 +189,9 @@ _openpam_log(int _level,
|
||||||
void
|
void
|
||||||
openpam_log(int _level,
|
openpam_log(int _level,
|
||||||
const char *_format,
|
const char *_format,
|
||||||
...);
|
...)
|
||||||
|
OPENPAM_FORMAT ((__printf__, 2, 3))
|
||||||
|
OPENPAM_NONNULL((2));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $P4: //depot/projects/openpam/include/security/pam_appl.h#14 $
|
* $P4: //depot/projects/openpam/include/security/pam_appl.h#15 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _PAM_APPL_H_INCLUDED
|
#ifndef _PAM_APPL_H_INCLUDED
|
||||||
|
@ -39,6 +39,7 @@
|
||||||
|
|
||||||
#include <security/pam_types.h>
|
#include <security/pam_types.h>
|
||||||
#include <security/pam_constants.h>
|
#include <security/pam_constants.h>
|
||||||
|
#include <security/pam_attributes.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -50,53 +51,65 @@ extern "C" {
|
||||||
|
|
||||||
int
|
int
|
||||||
pam_acct_mgmt(pam_handle_t *_pamh,
|
pam_acct_mgmt(pam_handle_t *_pamh,
|
||||||
int _flags);
|
int _flags)
|
||||||
|
OPENPAM_NONNULL((1));
|
||||||
|
|
||||||
int
|
int
|
||||||
pam_authenticate(pam_handle_t *_pamh,
|
pam_authenticate(pam_handle_t *_pamh,
|
||||||
int _flags);
|
int _flags)
|
||||||
|
OPENPAM_NONNULL((1));
|
||||||
|
|
||||||
int
|
int
|
||||||
pam_chauthtok(pam_handle_t *_pamh,
|
pam_chauthtok(pam_handle_t *_pamh,
|
||||||
int _flags);
|
int _flags)
|
||||||
|
OPENPAM_NONNULL((1));
|
||||||
|
|
||||||
int
|
int
|
||||||
pam_close_session(pam_handle_t *_pamh,
|
pam_close_session(pam_handle_t *_pamh,
|
||||||
int _flags);
|
int _flags)
|
||||||
|
OPENPAM_NONNULL((1));
|
||||||
|
|
||||||
int
|
int
|
||||||
pam_end(pam_handle_t *_pamh,
|
pam_end(pam_handle_t *_pamh,
|
||||||
int _status);
|
int _status)
|
||||||
|
OPENPAM_NONNULL((1));
|
||||||
|
|
||||||
int
|
int
|
||||||
pam_get_data(pam_handle_t *_pamh,
|
pam_get_data(pam_handle_t *_pamh,
|
||||||
const char *_module_data_name,
|
const char *_module_data_name,
|
||||||
void **_data);
|
void **_data)
|
||||||
|
OPENPAM_NONNULL((1,2,3));
|
||||||
|
|
||||||
int
|
int
|
||||||
pam_get_item(pam_handle_t *_pamh,
|
pam_get_item(pam_handle_t *_pamh,
|
||||||
int _item_type,
|
int _item_type,
|
||||||
const void **_item);
|
const void **_item)
|
||||||
|
OPENPAM_NONNULL((1,3));
|
||||||
|
|
||||||
int
|
int
|
||||||
pam_get_user(pam_handle_t *_pamh,
|
pam_get_user(pam_handle_t *_pamh,
|
||||||
const char **_user,
|
const char **_user,
|
||||||
const char *_prompt);
|
const char *_prompt)
|
||||||
|
OPENPAM_NONNULL((1,2));
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
pam_getenv(pam_handle_t *_pamh,
|
pam_getenv(pam_handle_t *_pamh,
|
||||||
const char *_name);
|
const char *_name)
|
||||||
|
OPENPAM_NONNULL((1,2));
|
||||||
|
|
||||||
char **
|
char **
|
||||||
pam_getenvlist(pam_handle_t *_pamh);
|
pam_getenvlist(pam_handle_t *_pamh)
|
||||||
|
OPENPAM_NONNULL((1));
|
||||||
|
|
||||||
int
|
int
|
||||||
pam_open_session(pam_handle_t *_pamh,
|
pam_open_session(pam_handle_t *_pamh,
|
||||||
int _flags);
|
int _flags)
|
||||||
|
OPENPAM_NONNULL((1));
|
||||||
|
|
||||||
int
|
int
|
||||||
pam_putenv(pam_handle_t *_pamh,
|
pam_putenv(pam_handle_t *_pamh,
|
||||||
const char *_namevalue);
|
const char *_namevalue)
|
||||||
|
OPENPAM_NONNULL((1,2));
|
||||||
|
|
||||||
int
|
int
|
||||||
pam_set_data(pam_handle_t *_pamh,
|
pam_set_data(pam_handle_t *_pamh,
|
||||||
|
@ -104,22 +117,26 @@ pam_set_data(pam_handle_t *_pamh,
|
||||||
void *_data,
|
void *_data,
|
||||||
void (*_cleanup)(pam_handle_t *_pamh,
|
void (*_cleanup)(pam_handle_t *_pamh,
|
||||||
void *_data,
|
void *_data,
|
||||||
int _pam_end_status));
|
int _pam_end_status))
|
||||||
|
OPENPAM_NONNULL((1,2));
|
||||||
|
|
||||||
int
|
int
|
||||||
pam_set_item(pam_handle_t *_pamh,
|
pam_set_item(pam_handle_t *_pamh,
|
||||||
int _item_type,
|
int _item_type,
|
||||||
const void *_item);
|
const void *_item)
|
||||||
|
OPENPAM_NONNULL((1));
|
||||||
|
|
||||||
int
|
int
|
||||||
pam_setcred(pam_handle_t *_pamh,
|
pam_setcred(pam_handle_t *_pamh,
|
||||||
int _flags);
|
int _flags)
|
||||||
|
OPENPAM_NONNULL((1));
|
||||||
|
|
||||||
int
|
int
|
||||||
pam_start(const char *_service,
|
pam_start(const char *_service,
|
||||||
const char *_user,
|
const char *_user,
|
||||||
const struct pam_conv *_pam_conv,
|
const struct pam_conv *_pam_conv,
|
||||||
pam_handle_t **_pamh);
|
pam_handle_t **_pamh)
|
||||||
|
OPENPAM_NONNULL((4));
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
pam_strerror(pam_handle_t *_pamh,
|
pam_strerror(pam_handle_t *_pamh,
|
||||||
|
|
24
include/security/pam_attributes.h
Normal file
24
include/security/pam_attributes.h
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
#ifndef _PAM_ATTRIBUTES_H_INCLUDED
|
||||||
|
#define _PAM_ATTRIBUTES_H_INCLUDED
|
||||||
|
|
||||||
|
/* GCC attributes */
|
||||||
|
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && !defined(__STRICT_ANSI__)
|
||||||
|
# define OPENPAM_GNUC_PREREQ(maj, min) \
|
||||||
|
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
|
||||||
|
#else
|
||||||
|
# define OPENPAM_GNUC_PREREQ(maj, min) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if OPENPAM_GNUC_PREREQ(2,5)
|
||||||
|
# define OPENPAM_FORMAT(params) __attribute__((__format__ params))
|
||||||
|
#else
|
||||||
|
# define OPENPAM_FORMAT(params)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if OPENPAM_GNUC_PREREQ(3,3)
|
||||||
|
# define OPENPAM_NONNULL(params) __attribute__((__nonnull__ params))
|
||||||
|
#else
|
||||||
|
# define OPENPAM_NONNULL(params)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _PAM_ATTRIBUTES_H_INCLUDED */
|
Loading…
Reference in a new issue