2001-05-07 09:03:40 +04:00
/* pam_winbind header file
( Solaris needs some macros from Linux for common PAM code )
Shirish Kalele 2000
*/
# ifdef HAVE_FEATURES_H
# include <features.h>
# endif
# include <stdlib.h>
# include <unistd.h>
# include <string.h>
# include <syslog.h>
# include <stdarg.h>
# include <sys/types.h>
# include <sys/stat.h>
# include <fcntl.h>
# include <errno.h>
# include <config.h>
# define MODULE_NAME "pam_winbind"
# define PAM_SM_AUTH
# define PAM_SM_ACCOUNT
# define PAM_SM_PASSWORD
2003-09-02 04:09:31 +04:00
# if defined(SUNOS5) || defined(SUNOS4) || defined(HPUX) || defined(FREEBSD)
2001-05-07 09:03:40 +04:00
/* Solaris always uses dynamic pam modules */
# define PAM_EXTERN extern
# include <security/pam_appl.h>
2003-09-04 07:28:40 +04:00
# ifndef PAM_AUTHTOK_RECOVER_ERR
2001-05-07 09:03:40 +04:00
# define PAM_AUTHTOK_RECOVER_ERR PAM_AUTHTOK_RECOVERY_ERR
# endif
2003-09-04 07:28:40 +04:00
# endif
2001-05-23 01:47:11 +04:00
# ifdef HAVE_SECURITY_PAM_MODULES_H
2001-05-07 09:03:40 +04:00
# include <security/pam_modules.h>
2001-05-23 01:47:11 +04:00
# endif
2001-05-07 09:03:40 +04:00
# ifdef HAVE_SECURITY__PAM_MACROS_H
# include <security/_pam_macros.h>
# else
/* Define required macros from (Linux PAM 0.68) security/_pam_macros.h */
# define _pam_drop_reply( /* struct pam_response * */ reply, /* int */ replies) \
do { \
int reply_i ; \
\
for ( reply_i = 0 ; reply_i < replies ; + + reply_i ) { \
if ( reply [ reply_i ] . resp ) { \
_pam_overwrite ( reply [ reply_i ] . resp ) ; \
free ( reply [ reply_i ] . resp ) ; \
} \
} \
if ( reply ) \
free ( reply ) ; \
} while ( 0 )
# define _pam_overwrite(x) \
do { \
register char * __xx__ ; \
if ( ( __xx__ = ( x ) ) ) \
while ( * __xx__ ) \
* __xx__ + + = ' \0 ' ; \
} while ( 0 )
/*
* Don ' t just free it , forget it too .
*/
2001-09-17 08:52:45 +04:00
# define _pam_drop(X) SAFE_FREE(X)
2001-05-07 09:03:40 +04:00
# define x_strdup(s) ( (s) ? strdup(s):NULL )
# endif
2002-02-05 12:40:36 +03:00
# define WINBIND_DEBUG_ARG (1<<0)
# define WINBIND_USE_AUTHTOK_ARG (1<<1)
# define WINBIND_UNKNOWN_OK_ARG (1<<2)
# define WINBIND_TRY_FIRST_PASS_ARG (1<<3)
# define WINBIND_USE_FIRST_PASS_ARG (1<<4)
# define WINBIND__OLD_PASSWORD (1<<5)
2004-08-18 20:25:41 +04:00
# define WINBIND_REQUIRED_MEMBERSHIP (1<<6)
2002-02-05 12:40:36 +03:00
2006-01-13 14:11:23 +03:00
# define PAM_WINBIND_NEW_AUTHTOK_REQD "PAM_WINBIND_NEW_AUTHTOK_REQD"
2002-02-05 12:40:36 +03:00
/*
* here is the string to inform the user that the new passwords they
* typed were not the same .
*/
# define MISTYPED_PASS "Sorry, passwords do not match"
# define on(x, y) (x & y)
# define off(x, y) (!(x & y))
2001-05-07 09:03:40 +04:00
2002-09-25 19:19:00 +04:00
# include "winbind_client.h"