Package: libpam0g-dev
Version: 0.79-3
Severity: serious
Tags: patch
Justification: Breaks compilation of software using PAM headers

Hi,

security/pam_client.h redefines types used internally by glibc and
libstdc++, causing complete breakage in programs which include other
headers which use these types:

#ifndef __u32
# define __u32  unsigned int
#endif
#ifndef __u8
# define __u8  unsigned char
#endif

This is a minimal test case:

#include <security/pam_misc.h>
#include <tr1/tuple>

int
main ()
{
  return 0;
}

Compile with
  g++ -c broken.cc

There is no reason why the header can't use the standard C types for
the binary prompt, and the patch which follows converts it to use
the standard sized integer types uint8_t and uint32_t from <stdint.h>.
This patch should ideally also be applied upstream, since this is not
a Debian-specific issue.

If you won't have time to look at this in the next few days, would you
have any objection to my uploading an NMU for this (with your approval
of the patch, of course).


Many thanks,
Roger


--- pam_client.h        2005-12-22 19:09:15.487730144 +0000
+++ pam_client.h.new    2005-12-22 19:09:12.976499878 +0000
@@ -16,6 +16,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdio.h>
+#include <stdint.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -26,13 +27,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 +90,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 +102,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 +111,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 +140,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 +151,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)) {                                               \


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (990, 'unstable')
Architecture: powerpc (ppc)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.14.4
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)

Versions of packages libpam0g-dev depends on:
ii  libc6-dev [libc-dev]          2.3.5-9    GNU C Library: Development Librari
ii  libpam0g                      0.79-3     Pluggable Authentication Modules l

libpam0g-dev recommends no packages.

-- no debconf information


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

Reply via email to