summaryrefslogtreecommitdiff
path: root/libpamc
diff options
context:
space:
mode:
authorThorsten Kukuk <kukuk@thkukuk.de>2005-05-20 14:58:58 +0000
committerThorsten Kukuk <kukuk@thkukuk.de>2005-05-20 14:58:58 +0000
commitfc3b13b0cc7905bbbf2820f9e5dd6479ed2ca14f (patch)
tree29832f5d590d4e0d32118391457f824d1c5bcbce /libpamc
parentb0f37d0d3bf7c08d15dae0b11c601ffed24de6b4 (diff)
Relevant BUGIDs: none
Purpose of commit: bugfix Commit summary: --------------- Redefining __u8 and __u32 is a bad idea (breaks PPC64), use u_int8_t and u_int32_t instead.
Diffstat (limited to 'libpamc')
-rw-r--r--libpamc/include/security/pam_client.h27
-rw-r--r--libpamc/pamc_converse.c8
2 files changed, 15 insertions, 20 deletions
diff --git a/libpamc/include/security/pam_client.h b/libpamc/include/security/pam_client.h
index 2afddd77..7fd195a5 100644
--- a/libpamc/include/security/pam_client.h
+++ b/libpamc/include/security/pam_client.h
@@ -16,19 +16,14 @@ extern "C" {
#include <unistd.h>
#include <string.h>
#include <stdio.h>
+#include <sys/types.h>
/* opaque agent handling structure */
typedef struct pamc_handle_s *pamc_handle_t;
/* binary prompt structure pointer */
-#ifndef __u32
-# define __u32 unsigned int
-#endif
-#ifndef __u8
-# define __u8 unsigned char
-#endif
-typedef struct { __u32 length; __u8 control; } *pamc_bp_t;
+typedef struct { u_int32_t length; u_int8_t control; } *pamc_bp_t;
/*
* functions provided by libpamc
@@ -91,10 +86,10 @@ char **pamc_list_agents(pamc_handle_t pch);
# define PAM_BP_FREE free
#endif /* PAM_BP_FREE */
-#define __PAM_BP_WOCTET(x,y) (*((y) + (__u8 *)(x)))
-#define __PAM_BP_ROCTET(x,y) (*((y) + (const __u8 *)(x)))
+#define __PAM_BP_WOCTET(x,y) (*((y) + (u_int8_t *)(x)))
+#define __PAM_BP_ROCTET(x,y) (*((y) + (const u_int8_t *)(x)))
-#define PAM_BP_MIN_SIZE (sizeof(__u32) + sizeof(__u8))
+#define PAM_BP_MIN_SIZE (sizeof(u_int32_t) + sizeof(u_int8_t))
#define PAM_BP_MAX_LENGTH 0x20000 /* an advisory limit */
#define PAM_BP_WCONTROL(x) (__PAM_BP_WOCTET(x,4))
#define PAM_BP_RCONTROL(x) (__PAM_BP_ROCTET(x,4))
@@ -103,8 +98,8 @@ char **pamc_list_agents(pamc_handle_t pch);
(__PAM_BP_ROCTET(x,2)<< 8)+ \
(__PAM_BP_ROCTET(x,3) ))
#define PAM_BP_LENGTH(x) (PAM_BP_SIZE(x) - PAM_BP_MIN_SIZE)
-#define PAM_BP_WDATA(x) (PAM_BP_MIN_SIZE + (__u8 *) (x))
-#define PAM_BP_RDATA(x) (PAM_BP_MIN_SIZE + (const __u8 *) (x))
+#define PAM_BP_WDATA(x) (PAM_BP_MIN_SIZE + (u_int8_t *) (x))
+#define PAM_BP_RDATA(x) (PAM_BP_MIN_SIZE + (const u_int8_t *) (x))
/* Note, this macro always '\0' terminates renewed packets */
@@ -112,13 +107,13 @@ char **pamc_list_agents(pamc_handle_t pch);
do { \
if (old_p) { \
if (*(old_p)) { \
- __u32 __size; \
+ u_int32_t __size; \
__size = PAM_BP_SIZE(*(old_p)); \
memset(*(old_p), 0, __size); \
PAM_BP_FREE(*(old_p)); \
} \
if (cntrl) { \
- __u32 __size; \
+ u_int32_t __size; \
\
__size = PAM_BP_MIN_SIZE + data_length; \
if ((*(old_p) = PAM_BP_CALLOC(1, 1+__size))) { \
@@ -141,7 +136,7 @@ do { \
#define PAM_BP_FILL(prmpt, offset, length, data) \
do { \
size_t bp_length; \
- __u8 *prompt = (__u8 *) (prmpt); \
+ u_int8_t *prompt = (u_int8_t *) (prmpt); \
bp_length = PAM_BP_LENGTH(prompt); \
if (bp_length < ((length)+(offset))) { \
PAM_BP_ASSERT("attempt to write over end of prompt"); \
@@ -152,7 +147,7 @@ do { \
#define PAM_BP_EXTRACT(prmpt, offset, length, data) \
do { \
size_t __bp_length; \
- const __u8 *__prompt = (const __u8 *) (prmpt); \
+ const u_int8_t *__prompt = (const u_int8_t *) (prmpt); \
__bp_length = PAM_BP_LENGTH(__prompt); \
if (((offset) < 0) || (__bp_length < ((length)+(offset))) \
|| ((length) < 0)) { \
diff --git a/libpamc/pamc_converse.c b/libpamc/pamc_converse.c
index 540a7d86..76685df6 100644
--- a/libpamc/pamc_converse.c
+++ b/libpamc/pamc_converse.c
@@ -34,8 +34,8 @@ static int __pamc_select_agent(pamc_handle_t pch, char *agent_id)
int pamc_converse(pamc_handle_t pch, pamc_bp_t *prompt_p)
{
- __u32 size, offset=0;
- __u8 control, raw[PAM_BP_MIN_SIZE];
+ u_int32_t size, offset=0;
+ u_int8_t control, raw[PAM_BP_MIN_SIZE];
D(("called"));
@@ -109,7 +109,7 @@ int pamc_converse(pamc_handle_t pch, pamc_bp_t *prompt_p)
/* pump all of the prompt into the agent */
do {
int rval = write(pch->current->writer,
- offset + (const __u8 *) (*prompt_p),
+ offset + (const u_int8_t *) (*prompt_p),
size - offset);
if (rval == -1) {
switch (errno) {
@@ -171,7 +171,7 @@ int pamc_converse(pamc_handle_t pch, pamc_bp_t *prompt_p)
value from the previous loop */
while (offset < size) {
- int rval = read(pch->current->reader, offset + (__u8 *) *prompt_p,
+ int rval = read(pch->current->reader, offset + (u_int8_t *) *prompt_p,
size-offset);
if (rval == -1) {