MFP4: avoid side effects in macro arguments (#24823)

This commit is contained in:
Dag-Erling Smørgrav 2003-02-08 20:18:25 +00:00
parent b511bdf31c
commit 60f020541d
8 changed files with 32 additions and 24 deletions

View File

@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $P4: //depot/projects/openpam/lib/pam_acct_mgmt.c#10 $
* $P4: //depot/projects/openpam/lib/pam_acct_mgmt.c#11 $
*/
#include <sys/param.h>
@ -51,11 +51,11 @@ int
pam_acct_mgmt(pam_handle_t *pamh,
int flags)
{
int pam_err;
int r;
ENTER();
pam_err = openpam_dispatch(pamh, PAM_SM_ACCT_MGMT, flags);
RETURNC(pam_err);
r = openpam_dispatch(pamh, PAM_SM_ACCT_MGMT, flags);
RETURNC(r);
}
/*

View File

@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $P4: //depot/projects/openpam/lib/pam_authenticate.c#12 $
* $P4: //depot/projects/openpam/lib/pam_authenticate.c#13 $
*/
#include <sys/param.h>
@ -51,14 +51,14 @@ int
pam_authenticate(pam_handle_t *pamh,
int flags)
{
int pam_err;
int r;
ENTER();
if (flags & ~(PAM_SILENT|PAM_DISALLOW_NULL_AUTHTOK))
RETURNC(PAM_SYMBOL_ERR);
pam_err = openpam_dispatch(pamh, PAM_SM_AUTHENTICATE, flags);
r = openpam_dispatch(pamh, PAM_SM_AUTHENTICATE, flags);
pam_set_item(pamh, PAM_AUTHTOK, NULL);
RETURNC(pam_err);
RETURNC(r);
}
/*

View File

@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $P4: //depot/projects/openpam/lib/pam_chauthtok.c#13 $
* $P4: //depot/projects/openpam/lib/pam_chauthtok.c#14 $
*/
#include <sys/param.h>
@ -51,19 +51,19 @@ int
pam_chauthtok(pam_handle_t *pamh,
int flags)
{
int pam_err;
int r;
ENTER();
if (flags & ~(PAM_SILENT|PAM_CHANGE_EXPIRED_AUTHTOK))
RETURNC(PAM_SYMBOL_ERR);
pam_err = openpam_dispatch(pamh, PAM_SM_CHAUTHTOK,
r = openpam_dispatch(pamh, PAM_SM_CHAUTHTOK,
flags | PAM_PRELIM_CHECK);
if (pam_err == PAM_SUCCESS)
pam_err = openpam_dispatch(pamh, PAM_SM_CHAUTHTOK,
if (r == PAM_SUCCESS)
r = openpam_dispatch(pamh, PAM_SM_CHAUTHTOK,
flags | PAM_UPDATE_AUTHTOK);
pam_set_item(pamh, PAM_OLDAUTHTOK, NULL);
pam_set_item(pamh, PAM_AUTHTOK, NULL);
RETURNC(pam_err);
RETURNC(r);
}
/*

View File

@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $P4: //depot/projects/openpam/lib/pam_close_session.c#10 $
* $P4: //depot/projects/openpam/lib/pam_close_session.c#11 $
*/
#include <sys/param.h>
@ -51,11 +51,13 @@ int
pam_close_session(pam_handle_t *pamh,
int flags)
{
int r;
ENTER();
if (flags & ~(PAM_SILENT))
RETURNC(PAM_SYMBOL_ERR);
RETURNC(openpam_dispatch(pamh, PAM_SM_CLOSE_SESSION, flags));
r = openpam_dispatch(pamh, PAM_SM_CLOSE_SESSION, flags);
RETURNC(r);
}
/*

View File

@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $P4: //depot/projects/openpam/lib/pam_get_authtok.c#20 $
* $P4: //depot/projects/openpam/lib/pam_get_authtok.c#21 $
*/
#include <sys/param.h>
@ -124,7 +124,8 @@ pam_get_authtok(pam_handle_t *pamh,
free(resp);
if (r != PAM_SUCCESS)
RETURNC(r);
RETURNC(pam_get_item(pamh, item, (const void **)authtok));
r = pam_get_item(pamh, item, (const void **)authtok);
RETURNC(r);
}
/*

View File

@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $P4: //depot/projects/openpam/lib/pam_get_user.c#13 $
* $P4: //depot/projects/openpam/lib/pam_get_user.c#14 $
*/
#include <sys/param.h>
@ -78,7 +78,8 @@ pam_get_user(pam_handle_t *pamh,
free(resp);
if (r != PAM_SUCCESS)
RETURNC(r);
RETURNC(pam_get_item(pamh, PAM_USER, (const void **)user));
r = pam_get_item(pamh, PAM_USER, (const void **)user);
RETURNC(r);
}
/*

View File

@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $P4: //depot/projects/openpam/lib/pam_open_session.c#10 $
* $P4: //depot/projects/openpam/lib/pam_open_session.c#11 $
*/
#include <sys/param.h>
@ -51,11 +51,13 @@ int
pam_open_session(pam_handle_t *pamh,
int flags)
{
int r;
ENTER();
if (flags & ~(PAM_SILENT))
RETURNC(PAM_SYMBOL_ERR);
RETURNC(openpam_dispatch(pamh, PAM_SM_OPEN_SESSION, flags));
r = openpam_dispatch(pamh, PAM_SM_OPEN_SESSION, flags);
RETURNC(r);
}
/*

View File

@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $P4: //depot/projects/openpam/lib/pam_setcred.c#11 $
* $P4: //depot/projects/openpam/lib/pam_setcred.c#12 $
*/
#include <sys/param.h>
@ -51,13 +51,15 @@ int
pam_setcred(pam_handle_t *pamh,
int flags)
{
int r;
ENTER();
if (flags & ~(PAM_SILENT|PAM_ESTABLISH_CRED|PAM_DELETE_CRED|
PAM_REINITIALIZE_CRED|PAM_REFRESH_CRED))
RETURNC(PAM_SYMBOL_ERR);
/* XXX enforce exclusivity */
RETURNC(openpam_dispatch(pamh, PAM_SM_SETCRED, flags));
r = openpam_dispatch(pamh, PAM_SM_SETCRED, flags);
RETURNC(r);
}
/*