Package: pam
Version: 0.76-23
Severity: normal
Tags: patch

When building 'pam' on ppc64/unstable, I get the following error:

gcc -Wall -Wwrite-strings       -Wpointer-arith -Wcast-qual -Wcast-align        
-Wstrict-prototypes -Wmissing-prototypes        -Wnested-externs -Winline 
-Wshadow -Dlinux -g -D_GNU_SOURCE -D_REENTRANT -fPIC -O2 -I./include 
-I/pam-0.76/Linux-PAM/libpam/include -I/pam-0.76/Linux-PAM 
-I/pam-0.76/Linux-PAM/libpamc/include   -DPAM_DYNAMIC    -c pamc_client.c -o 
dynamic/pamc_client.o
In file included from /usr/include/asm/types.h:8,
                 from /usr/include/asm-ppc64/elf.h:4,
                 from /usr/include/asm/elf.h:8,
                 from /usr/include/asm-ppc64/sigcontext.h:12,
                 from /usr/include/asm/sigcontext.h:8,
                 from /usr/include/bits/sigcontext.h:28,
                 from /usr/include/signal.h:333,
                 from /usr/include/sys/wait.h:30,
                 from libpamc.h:18,
                 from pamc_client.c:9:
/usr/include/asm-ppc64/types.h:27: error: duplicate 'unsigned'
/usr/include/asm-ppc64/types.h:27: error: two or more data types in declaration 
specifiers
/usr/include/asm-ppc64/types.h:33: error: duplicate 'unsigned'
/usr/include/asm-ppc64/types.h:33: error: two or more data types in declaration 
specifiers
make[2]: *** [dynamic/pamc_client.o] Error 1
make[2]: Leaving directory `/pam-0.76/Linux-PAM/libpamc'

This is caused by the definition of '__u32' in 
Linux-PAM/libpamc/include/security/pam_client.h.

Please use the standard types 'uint32_t' and 'uint8_t' from the
C99 standard include file <inttypes.h> instead of '__u32' and '__u8' 
which are used by the linux kernel headers internally.

With the attached patch 'pam' can be compiled on ppc64.

Regards
Andreas Jochens

diff -urN ../tmp-orig/pam-0.76/Linux-PAM/libpamc/include/security/pam_client.h 
./Linux-PAM/libpamc/include/security/pam_client.h
--- ../tmp-orig/pam-0.76/Linux-PAM/libpamc/include/security/pam_client.h        
2005-09-16 13:24:15.000000000 +0200
+++ ./Linux-PAM/libpamc/include/security/pam_client.h   2005-09-16 
13:17:47.000000000 +0200
@@ -16,6 +16,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdio.h>
+#include <inttypes.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -25,14 +26,7 @@
 
 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 { uint32_t length; uint8_t control; } *pamc_bp_t;
 
 /*
  * functions provided by libpamc
@@ -95,10 +89,10 @@
 # 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) + (uint8_t *)(x)))
+#define __PAM_BP_ROCTET(x,y)  (*((y) + (const uint8_t *)(x)))
 
-#define PAM_BP_MIN_SIZE       (sizeof(__u32) + sizeof(__u8))
+#define PAM_BP_MIN_SIZE       (sizeof(uint32_t) + sizeof(uint8_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))
@@ -107,8 +101,8 @@
                               (__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 + (uint8_t *) (x))
+#define PAM_BP_RDATA(x)       (PAM_BP_MIN_SIZE + (const uint8_t *) (x))
 
 /* Note, this macro always '\0' terminates renewed packets */
 
@@ -116,13 +110,13 @@
 do {                                                                       \
     if (old_p) {                                                           \
        if (*(old_p)) {                                                    \
-           __u32 __size;                                                  \
+           uint32_t __size;                                               \
             __size = PAM_BP_SIZE(*(old_p));                                \
            memset(*(old_p), 0, __size);                                   \
            PAM_BP_FREE(*(old_p));                                         \
        }                                                                  \
        if (cntrl) {                                                       \
-           __u32 __size;                                                  \
+           uint32_t __size;                                               \
                                                                            \
            __size = PAM_BP_MIN_SIZE + data_length;                        \
            if ((*(old_p) = PAM_BP_CALLOC(1, 1+__size))) {                 \
@@ -145,7 +139,7 @@
 #define PAM_BP_FILL(prmpt, offset, length, data)                           \
 do {                                                                       \
     size_t bp_length;                                                      \
-    __u8 *prompt = (__u8 *) (prmpt);                                       \
+    uint8_t *prompt = (uint8_t *) (prmpt);                                     
  \
     bp_length = PAM_BP_LENGTH(prompt);                                     \
     if (bp_length < ((length)+(offset))) {                                 \
        PAM_BP_ASSERT("attempt to write over end of prompt");              \
@@ -156,7 +150,7 @@
 #define PAM_BP_EXTRACT(prmpt, offset, length, data)                        \
 do {                                                                       \
     size_t __bp_length;                                                    \
-    const __u8 *__prompt = (const __u8 *) (prmpt);                         \
+    const uint8_t *__prompt = (const uint8_t *) (prmpt);                       
  \
     __bp_length = PAM_BP_LENGTH(__prompt);                                 \
     if (((offset) < 0) || (__bp_length < ((length)+(offset)))              \
        || ((length) < 0)) {                                               \
diff -urN ../tmp-orig/pam-0.76/Linux-PAM/libpamc/pamc_converse.c 
./Linux-PAM/libpamc/pamc_converse.c
--- ../tmp-orig/pam-0.76/Linux-PAM/libpamc/pamc_converse.c      2005-09-16 
13:24:15.000000000 +0200
+++ ./Linux-PAM/libpamc/pamc_converse.c 2005-09-16 13:19:03.000000000 +0200
@@ -34,8 +34,8 @@
 
 int pamc_converse(pamc_handle_t pch, pamc_bp_t *prompt_p)
 {
-    __u32 size, offset=0;
-    __u8 control, raw[PAM_BP_MIN_SIZE];
+    uint32_t size, offset=0;
+    uint8_t control, raw[PAM_BP_MIN_SIZE];
 
     D(("called"));
 
@@ -109,7 +109,7 @@
     /* pump all of the prompt into the agent */
     do {
        int rval = write(pch->current->writer,
-                        offset + (const __u8 *) (*prompt_p),
+                        offset + (const uint8_t *) (*prompt_p),
                         size - offset);
        if (rval == -1) {
            switch (errno) {
@@ -171,7 +171,7 @@
        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 + (uint8_t *) *prompt_p,
                        size-offset);
 
        if (rval == -1) {


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to