rafket / pam_duress

A pam module written in C for duress codes in linux authentication
GNU General Public License v2.0
146 stars 11 forks source link

Address compiler-warnings #4

Closed UnitedMarsupials-zz closed 7 years ago

UnitedMarsupials-zz commented 7 years ago

Add const-attribute to the input parameters of various functions.

Declare the internal functions as static, remove unused variables. No functional changes, but these steps allow pam_duress.c to compile on FreeBSD with clang and WARNS=5 level of compiler-warnings.

rafket commented 7 years ago

gcc does not recognize the attribute __unused Also, pam_ext.h is needed for pam_get_authtok

UnitedMarsupials-zz commented 7 years ago

gcc does not recognize the attribute __unused

Indeed, it is a FreeBSD short-cut for __attribute__((unused)). Try:

#ifndef __unused
# ifdef __GNUC__
#  define __unused __attribute__((__unused__))
# else
#  define __unused
# endif
#endif

Also, pam_ext.h is needed for pam_get_authtok

Khmm, FreeBSD uses OpenPAM, which declares the function in <security/openpam.h> -- there is no pam_ext.h here. It may need another compatibility-ifdef... I'll research it.

UnitedMarsupials-zz commented 7 years ago

The current version of my fork should compile cleanly for both of us...

rafket commented 7 years ago

Works great! Thank you very much for your contribution! But please follow my indentation style (4 spaces in place of tabs).

UnitedMarsupials-zz commented 7 years ago

But please follow my indentation style (4 spaces in place of tabs).

I thought, I do (painful though it is)...