Bug #4144

illumos pam_get_item missing const, causes build pain

Added by Alasdair Lumsden over 5 years ago.

Status:NewStart date:2013-09-18
Priority:LowDue date:
Assignee:-% Done:


Category:lib - userland libraries
Target version:-
Difficulty:Bite-size Tags:needs-triage


On Linux, pam_get_item and pam_set_item are defined as follows:

pam_get_item(const pam_handle_t *pamh, int item_type, const void **item);
pam_set_item(pam_handle_t *pamh, int item_type, const void *item);

Whereas on illumos they're defined as:

pam_get_item(const pam_handle_t *pamh, int item_type, void **item);
pam_set_item(pam_handle_t *pamh, int item_type, const void *item)

It would be better if they matched, as this difference causes pam modules authored on Linux to not build on illumos without minor hackery.

Unfortunately PAM_SET_ITEM(3PAM) shows it's a stable interface so I doubt there is anything that can be done about this? If not, feel free to close this bug.

Example build pain for SEO reasons:

gcc --std=gnu99 -Wall -O2 -g -fPIC -c  -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -fvisibility=hidden  -o demo.o demo.c
demo.c: In function 'pam_get_item':
demo.c:97: warning: initialization from incompatible pointer type
demo.c: At top level:
demo.c:106: error: conflicting types for 'pam_set_item'
/usr/include/security/pam_appl.h:175: note: previous declaration of 'pam_set_item' was here
gmake: *** [demo.o] Error 1

Also available in: Atom