building PAM module for Opensolaris #76
Comments
Comment #1 originally posted by codermonkey@ymail.com on 2011-06-16T09:10:24.000Z: Try the attached patch; this patch is against revision 7223591fd2dd. Works for me, at least. Main issues fixed:
|
Comment #2 originally posted by codermonkey@ymail.com on 2011-06-16T09:21:49.000Z: Also, note that my patch does not result in 'demo.c' building correctly... but the pam module did work for me, and that's the key bit :) |
Comment #3 originally posted by kb7sqi on 2011-07-11T01:38:27.000Z: Alex had ask me to look into this when he first posted the problem. You fixed almost everthing, but here's a proper patch to be able to build everything & so it properly works on any Solaris box, either x86/sparc. Solaris don't like const void in pam_get_item: +#ifdef sun Also w/ your build_solaris.sh, it simply core dumps. To use the stock gcc to build, in the Makefile, you'll see this: .o.so: Notice the -mimpure-text instead of -g. I don't claim to be an expert, but it does build 100% & works correctly. Hope this helps. Steve |
Comment #4 originally posted by adumont on 2011-07-11T07:26:24.000Z: Thanks a lot Steve for your patch. It works perfectly! Great job :) |
Comment #5 originally posted by kexik@reversity.org on 2011-07-19T17:04:36.000Z: I had this problem on Gentoo too using GCC. Demo worked fine but PAM didn't logging "Invalid verification code" into auth.log. Recompiling with -shared -mimpure-text fixed it. You should update the Makefile so that it works for new users ;) |
Comment #6 originally posted by markus@google.com on 2011-07-19T20:36:10.000Z: "-mimpure-text" seems to be a SPARC specific option. A quick search didn't show any good explanation why it would be needed. I am happy to think of ways how to make the "Makefile" automatically set this option on SPARC, but would one of you guys care to explain what exactly is going on? I'd like to understand the code before adding it :-) |
Comment #7 originally posted by codermonkey@ymail.com on 2011-07-22T18:55:16.000Z: Thanks for improving upon the patch. Another slightly more elegant way of handling #ifndef sun I'm not sure that creating a completely separate Makefile is the right answer either...
This makes me think that the right answer is to make sure everything being built is actually PIC code, rather than kludging around it this way. |
Comment #8 originally posted by codermonkey@ymail.com on 2011-07-22T18:56:07.000Z: (PIC would be enabled with -fPIC) |
Comment #9 originally posted by markus@google.com on 2011-07-22T20:19:52.000Z: I just pushed http://code.google.com/p/google-authenticator/source/detail?r=fc188e0509dd5c19822017122f3a24470e1f9781 which should include all of the changes asked for in the ongoing discussion. Please test and let me know whether it works, or if additional changes are needed. |
Comment #10 originally posted by kb7sqi on 2011-07-22T20:51:36.000Z: Markus/CoderMonkey, thanks for updating this further. I'm pretty short on time right now. Markus, one problem I see w/ your changes is defining the '-DBYTE_ORDER=4321' in the Makefile. It'd work for fine for one, but not the other when going from x86/sparc. Later this evening I'll pull your changes & test on both x86/sparc solaris 10 & OpenSolaris. Thanks again! Steve |
Comment #11 originally posted by markus@google.com on 2011-07-22T20:55:27.000Z: To be honest, I don't even understand why Solaris wants us to explicitly specify the byte order on the command line. Why doesn't the compiler do this automatically, like on any other platform? |
Comment #12 originally posted by kb7sqi on 2011-07-23T22:47:09.000Z: Markus, I tested your update on my boxes & everything compiles fine. To resolve the BYTE_ORDER problem, I'd recommend the following fix: --- sha1.c.orig 2011-07-23 18:40:26.161157329 -0400 #ifndef BYTE_ORDER #ifndef TRUNC32 This is a quick/easy solution for most systems that don't define it properly. Thanks again on spending the time to get this merged in. Steve |
Comment #13 originally posted by markus@google.com on 2011-07-24T04:53:45.000Z: I just pushed an updated version. Please let me know, if this works better for you. |
Comment #14 originally posted by kb7sqi on 2011-07-24T19:23:43.000Z: Hi Markus, last fix. The defines for BIG_ENDIAN/LITTLE_ENDIAN, weren't quite right. This works perfectly & test on both x86/sparc on Solaris 10/OpenSolaris. --- sha1.c.orig 2011-07-24 14:04:25.000000000 -0400 #if !defined(BYTE_ORDER) Also for the record, -mimpure-text isn't need on Solaris 10. It's needed for OpenSolars/Solaris 11 Beta, but still compiles fine on Solaris 10 when using it. Thanks again. Steve |
Comment #15 originally posted by kb7sqi on 2011-07-24T20:17:27.000Z: Deleted my last post & decided to clean up the patches for demo.c/pam_google_authenticator_unittest.c per codermonkey's suggestion. I also fixed the sha1.c ENDIAN Macro's. Sorry, those weren't quite perfect. Last patch. Everything compiles clean on both Solaris 10/OpenSolaris. Thanks. Steve |
Comment #16 originally posted by markus@google.com on 2011-07-24T21:06:13.000Z: Please take another look. |
Comment #17 originally posted by kb7sqi on 2011-07-24T21:37:10.000Z: Confirmed to be working on both Sparc/x86, Solaris 10/OpenSolaris. Thanks! |
Original issue 76 created by adumont on 2011-06-07T12:22:12.000Z:
What steps will reproduce the problem?
I'm trying to build the PAM module for Opensolaris, but make is failling.
Not really an issue per-se, more a request for help, in case someone around here have any hint or knowledge about it. I think it can be useful, in order to enhance the project.
What is the expected output? What do you see instead?
I expect it build the module.
What version of the product are you using? On what operating system?
$ hg log | head
changeset: 61:7223591fd2dd
tag: tip
user: klyubin@google.com
date: Mon Apr 18 16:50:52 2011 +0100
summary: Extracted three user-visible hard-coded messages from the EnterKeyScreen to the .rrc file in preparation for i18n
$ uname -a
SunOS localhost 5.11 snv_111b i86pc i386 i86pc Solaris
$ gcc -v
Reading specs from /usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/specs
Configured with: /builds2/sfwnv-111a/usr/src/cmd/gcc/gcc-3.4.3/configure --prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++,f77,objc --enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-20050802)
Please provide any additional information below.
adumont$ export CFLAGS="-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -DBYTE_ORDER=LITTLE_ENDIAN"
adumont$ make clean
rm -f .o *.so core google-authenticator demo
pam_google_authenticator_unittest
adumont$ export CFLAGS="-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -DBYTE_ORDER=LITTLE_ENDIAN"
adumont$ make
cc --std=gnu99 -Wall -O2 -g -fPIC -c -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -DBYTE_ORDER=LITTLE_ENDIAN -o google-authenticator.o google-authenticator.c
cc --std=gnu99 -Wall -O2 -g -fPIC -c -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -DBYTE_ORDER=LITTLE_ENDIAN -o base32.o base32.c
base32.c: In function
base32_decode': base32.c:62: warning: visibility attribute not supported in this configuration; ignored base32.c: In function
base32_encode':base32.c:95: warning: visibility attribute not supported in this configuration; ignored
cc --std=gnu99 -Wall -O2 -g -fPIC -c -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -DBYTE_ORDER=LITTLE_ENDIAN -o hmac.o hmac.c
hmac.c: In function
hmac_sha1': hmac.c:77: warning: visibility attribute not supported in this configuration; ignored cc --std=gnu99 -Wall -O2 -g -fPIC -c -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -DBYTE_ORDER=LITTLE_ENDIAN -o sha1.o sha1.c sha1.c: In function
sha1_init':sha1.c:225: warning: visibility attribute not supported in this configuration; ignored
sha1.c: In function
sha1_update': sha1.c:264: warning: visibility attribute not supported in this configuration; ignored sha1.c: In function
sha1_final':sha1.c:321: warning: visibility attribute not supported in this configuration; ignored
cc -g -ldl
-o google-authenticator google-authenticator.o base32.o hmac.o sha1.o
cc --std=gnu99 -Wall -O2 -g -fPIC -c -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -DBYTE_ORDER=LITTLE_ENDIAN -o pam_google_authenticator.o pam_google_authenticator.c
In file included from pam_google_authenticator.c:41:
/usr/include/security/pam_modules.h:38: error: syntax error before '' token
/usr/include/security/pam_modules.h:45: error: syntax error before '' token
/usr/include/security/pam_modules.h:52: error: syntax error before '' token
/usr/include/security/pam_modules.h:59: error: syntax error before '' token
/usr/include/security/pam_modules.h:66: error: syntax error before '' token
/usr/include/security/pam_modules.h:80: error: syntax error before '' token
/usr/include/security/pam_modules.h:92: error: syntax error before '' token
/usr/include/security/pam_modules.h:95: error: syntax error before '' token
/usr/include/security/pam_modules.h:104: error: syntax error before '' token
pam_google_authenticator.c:65: error: syntax error before "pam_handle_t"
pam_google_authenticator.c: In function
log_message': pam_google_authenticator.c:68: error:
pamh' undeclared (first use in this function)pam_google_authenticator.c:68: error: (Each undeclared identifier is reported only once
pam_google_authenticator.c:68: error: for each function it appears in.)
pam_google_authenticator.c:69: warning: implicit declaration of function
pam_get_item' pam_google_authenticator.c:69: error:
PAM_SERVICE' undeclared (first use in this function)pam_google_authenticator.c:77: error:
format' undeclared (first use in this function) pam_google_authenticator.c:79: error:
LOG_AUTHPRIV' undeclared (first use in this function)pam_google_authenticator.c:80: error:
priority' undeclared (first use in this function) pam_google_authenticator.c: At top level: pam_google_authenticator.c:92: error: syntax error before '*' token pam_google_authenticator.c: In function
converse':pam_google_authenticator.c:96: error:
pamh' undeclared (first use in this function) pam_google_authenticator.c:96: error:
PAM_CONV' undeclared (first use in this function)pam_google_authenticator.c:97: error:
PAM_SUCCESS' undeclared (first use in this function) pam_google_authenticator.c:100: error: dereferencing pointer to incomplete type pam_google_authenticator.c:100: error:
nargs' undeclared (first use in this function)pam_google_authenticator.c:100: error:
message' undeclared (first use in this function) pam_google_authenticator.c:100: error:
response' undeclared (first use in this function)pam_google_authenticator.c:100: error: dereferencing pointer to incomplete type
pam_google_authenticator.c: At top level:
pam_google_authenticator.c:103: error: syntax error before '' token
pam_google_authenticator.c: In function
get_user_name': pam_google_authenticator.c:106: error:
pamh' undeclared (first use in this function)pam_google_authenticator.c:106: error:
PAM_USER' undeclared (first use in this function) pam_google_authenticator.c:106: error:
PAM_SUCCESS' undeclared (first use in this function)pam_google_authenticator.c: At top level:
pam_google_authenticator.c:115: error: syntax error before '' token
pam_google_authenticator.c: In function
get_secret_filename': pam_google_authenticator.c:119: error:
params' undeclared (first use in this function)pam_google_authenticator.c:134: error:
uid' undeclared (first use in this function) pam_google_authenticator.c:136: error:
username' undeclared (first use in this function)pam_google_authenticator.c:141: error:
pamh' undeclared (first use in this function) pam_google_authenticator.c: At top level: pam_google_authenticator.c:214: error: syntax error before '*' token pam_google_authenticator.c: In function
drop_privileges':pam_google_authenticator.c:217: error:
uid' undeclared (first use in this function) pam_google_authenticator.c:219: error:
pamh' undeclared (first use in this function)pam_google_authenticator.c:219: error:
username' undeclared (first use in this function) pam_google_authenticator.c: At top level: pam_google_authenticator.c:225: error: syntax error before '*' token pam_google_authenticator.c: In function
open_secret_file':pam_google_authenticator.c:229: error:
size' undeclared (first use in this function) pam_google_authenticator.c:230: error:
mtime' undeclared (first use in this function)pam_google_authenticator.c:231: error:
secret_filename' undeclared (first use in this function) pam_google_authenticator.c:235: error:
pamh' undeclared (first use in this function)pam_google_authenticator.c:246: error:
uid' undeclared (first use in this function) pam_google_authenticator.c:249: error:
username' undeclared (first use in this function)pam_google_authenticator.c: At top level:
pam_google_authenticator.c:265: error: syntax error before '' token
pam_google_authenticator.c: In function
read_file_contents': pam_google_authenticator.c:269: error:
filesize' undeclared (first use in this function)pam_google_authenticator.c:271: error:
fd' undeclared (first use in this function) pam_google_authenticator.c:274: error:
pamh' undeclared (first use in this function)pam_google_authenticator.c:274: error:
secret_filename' undeclared (first use in this function) pam_google_authenticator.c: At top level: pam_google_authenticator.c:302: error: syntax error before '_' token pam_google_authenticator.c: In function
write_file_contents':pam_google_authenticator.c:306: error:
secret_filename' undeclared (first use in this function) pam_google_authenticator.c:309: error:
pamh' undeclared (first use in this function)pam_google_authenticator.c:326: error:
old_size' undeclared (first use in this function) pam_google_authenticator.c:327: error:
old_mtime' undeclared (first use in this function)pam_google_authenticator.c:338: error:
buf' undeclared (first use in this function) pam_google_authenticator.c: At top level: pam_google_authenticator.c:352: error: syntax error before '_' token pam_google_authenticator.c: In function
get_shared_secret':pam_google_authenticator.c:356: error:
buf' undeclared (first use in this function) pam_google_authenticator.c:357: error:
secretLen' undeclared (first use in this function)pam_google_authenticator.c:366: error:
pamh' undeclared (first use in this function) pam_google_authenticator.c:368: error:
secret_filename' undeclared (first use in this function)pam_google_authenticator.c: At top level:
pam_google_authenticator.c:400: error: syntax error before '' token
pam_google_authenticator.c: In function
get_cfg_value': pam_google_authenticator.c:402: error:
key' undeclared (first use in this function)pam_google_authenticator.c:403: error:
buf' undeclared (first use in this function) pam_google_authenticator.c:412: error:
pamh' undeclared (first use in this function)pam_google_authenticator.c: At top level:
pam_google_authenticator.c:427: error: syntax error before '_' token
pam_google_authenticator.c: In function
set_cfg_value': pam_google_authenticator.c:429: error:
key' undeclared (first use in this function)pam_google_authenticator.c:434: error:
buf' undeclared (first use in this function) pam_google_authenticator.c:457: error:
val' undeclared (first use in this function)pam_google_authenticator.c:472: error:
pamh' undeclared (first use in this function) pam_google_authenticator.c: At top level: pam_google_authenticator.c:513: error: syntax error before '_' token pam_google_authenticator.c: In function
rate_limit':pam_google_authenticator.c:515: error:
pamh' undeclared (first use in this function) pam_google_authenticator.c:515: error:
buf' undeclared (first use in this function)pam_google_authenticator.c:538: error:
secret_filename' undeclared (first use in this function) pam_google_authenticator.c:618: error:
updated' undeclared (first use in this function)pam_google_authenticator.c: At top level:
pam_google_authenticator.c:630: error: syntax error before '' token
pam_google_authenticator.c: In function
request_verification_code': pam_google_authenticator.c:632: error: variable
msg' has initializer but incomplete typepam_google_authenticator.c:632: error: unknown field
msg_style' specified in initializer pam_google_authenticator.c:632: error:
PAM_PROMPT_ECHO_OFF' undeclared (first use in this function)pam_google_authenticator.c:632: warning: excess elements in struct initializer
pam_google_authenticator.c:632: warning: (near initialization for
msg') pam_google_authenticator.c:633: error: unknown field
msg' specified in initializerpam_google_authenticator.c:633: warning: excess elements in struct initializer
pam_google_authenticator.c:633: warning: (near initialization for
msg') pam_google_authenticator.c:632: error: storage size of 'msg' isn't known pam_google_authenticator.c:636: error:
pamh' undeclared (first use in this function)pam_google_authenticator.c:640: error:
PAM_SUCCESS' undeclared (first use in this function) pam_google_authenticator.c:640: error: invalid use of undefined type
struct pam_response'pam_google_authenticator.c:640: error: dereferencing pointer to incomplete type
pam_google_authenticator.c:641: error: invalid use of undefined type
struct pam_response' pam_google_authenticator.c:641: error: dereferencing pointer to incomplete type pam_google_authenticator.c:642: error: invalid use of undefined type
struct pam_response'pam_google_authenticator.c:642: error: dereferencing pointer to incomplete type
pam_google_authenticator.c:650: error: invalid use of undefined type
struct pam_response' pam_google_authenticator.c:650: error: dereferencing pointer to incomplete type pam_google_authenticator.c:651: error: invalid use of undefined type
struct pam_response'pam_google_authenticator.c:651: error: dereferencing pointer to incomplete type
pam_google_authenticator.c:651: error: invalid use of undefined type
struct pam_response' pam_google_authenticator.c:651: error: dereferencing pointer to incomplete type pam_google_authenticator.c:652: error: invalid use of undefined type
struct pam_response'pam_google_authenticator.c:652: error: dereferencing pointer to incomplete type
pam_google_authenticator.c:632: warning: unused variable
msg' pam_google_authenticator.c: At top level: pam_google_authenticator.c:664: error: syntax error before '_' token pam_google_authenticator.c: In function
check_scratch_codes':pam_google_authenticator.c:667: error:
buf' undeclared (first use in this function) pam_google_authenticator.c:698: error:
code' undeclared (first use in this function)pam_google_authenticator.c:704: error:
updated' undeclared (first use in this function) pam_google_authenticator.c: At top level: pam_google_authenticator.c:716: error: syntax error before '_' token pam_google_authenticator.c: In function
window_size':pam_google_authenticator.c:718: error:
pamh' undeclared (first use in this function) pam_google_authenticator.c:718: error:
buf' undeclared (first use in this function)pam_google_authenticator.c:738: error:
secret_filename' undeclared (first use in this function) pam_google_authenticator.c: At top level: pam_google_authenticator.c:750: error: syntax error before "pam_handle_t" pam_google_authenticator.c: In function
invalidate_timebased_code':pam_google_authenticator.c:753: error:
pamh' undeclared (first use in this function) pam_google_authenticator.c:753: error:
buf' undeclared (first use in this function)pam_google_authenticator.c:764: error:
secret_filename' undeclared (first use in this function) pam_google_authenticator.c:795: error:
tm' undeclared (first use in this function)pam_google_authenticator.c:834: error:
updated' undeclared (first use in this function) pam_google_authenticator.c: At top level: pam_google_authenticator.c:869: error: syntax error before '_' token pam_google_authenticator.c: In function
check_time_skew':pam_google_authenticator.c:874: error:
pamh' undeclared (first use in this function) pam_google_authenticator.c:874: error:
buf' undeclared (first use in this function)pam_google_authenticator.c:928: error:
tm' undeclared (first use in this function) pam_google_authenticator.c:928: error:
skew' undeclared (first use in this function)pam_google_authenticator.c:990: error:
updated' undeclared (first use in this function) pam_google_authenticator.c: At top level: pam_google_authenticator.c:999: error: syntax error before '_' token pam_google_authenticator.c: In function
check_timebased_code':pam_google_authenticator.c:1002: error:
buf' undeclared (first use in this function) pam_google_authenticator.c:1009: error:
code' undeclared (first use in this function)pam_google_authenticator.c:1016: error:
pamh' undeclared (first use in this function) pam_google_authenticator.c:1028: error:
secret_filename' undeclared (first use in this function)pam_google_authenticator.c:1033: error:
secret' undeclared (first use in this function) pam_google_authenticator.c:1033: error:
secretLen' undeclared (first use in this function)pam_google_authenticator.c:1036: error:
updated' undeclared (first use in this function) pam_google_authenticator.c:1040: error:
params' undeclared (first use in this function)pam_google_authenticator.c: At top level:
pam_google_authenticator.c:1065: error: syntax error before '' token
pam_google_authenticator.c: In function
parse_args': pam_google_authenticator.c:1067: error:
argc' undeclared (first use in this function)pam_google_authenticator.c:1068: error:
argv' undeclared (first use in this function) pam_google_authenticator.c:1069: error:
params' undeclared (first use in this function)pam_google_authenticator.c:1074: error:
pamh' undeclared (first use in this function) pam_google_authenticator.c: At top level: pam_google_authenticator.c:1081: error: syntax error before '_' token pam_google_authenticator.c: In function
google_authenticator':pam_google_authenticator.c:1083: error:
PAM_SESSION_ERR' undeclared (first use in this function) pam_google_authenticator.c:1100: error:
pamh' undeclared (first use in this function)pam_google_authenticator.c:1100: error:
argc' undeclared (first use in this function) pam_google_authenticator.c:1100: error:
argv' undeclared (first use in this function)pam_google_authenticator.c:1121: error:
PAM_SUCCESS' undeclared (first use in this function) pam_google_authenticator.c: At top level: pam_google_authenticator.c:1168: error: syntax error before "int" pam_google_authenticator.c:1168: error: syntax error before '_' token pam_google_authenticator.c: In function
pam_sm_authenticate':pam_google_authenticator.c:1170: error:
pamh' undeclared (first use in this function) pam_google_authenticator.c:1170: error:
flags' undeclared (first use in this function)pam_google_authenticator.c:1170: error:
argc' undeclared (first use in this function) pam_google_authenticator.c:1170: error:
argv' undeclared (first use in this function)pam_google_authenticator.c: At top level:
pam_google_authenticator.c:1173: error: syntax error before "int"
pam_google_authenticator.c:1173: error: syntax error before '' token
pam_google_authenticator.c: In function
pam_sm_setcred': pam_google_authenticator.c:1175: error:
PAM_SUCCESS' undeclared (first use in this function)pam_google_authenticator.c: At top level:
pam_google_authenticator.c:1178: error: syntax error before "int"
pam_google_authenticator.c:1178: error: syntax error before '' token
pam_google_authenticator.c: In function
pam_sm_open_session': pam_google_authenticator.c:1180: error:
pamh' undeclared (first use in this function)pam_google_authenticator.c:1180: error:
flags' undeclared (first use in this function) pam_google_authenticator.c:1180: error:
argc' undeclared (first use in this function)pam_google_authenticator.c:1180: error:
argv' undeclared (first use in this function) pam_google_authenticator.c: In function
log_message':pam_google_authenticator.c:77: error:`va_start' used in function with fixed args
make: *** [pam_google_authenticator.o] Error 1
adumont$
The text was updated successfully, but these errors were encountered: