Problems while "extending" restful_authentication

I’m trying to make restful authentication work with ruby pam so that I
can authenticate against my unix box. (I made a post earlier today about
this but I have made some progress since).

I downloaded ruby-pam from rubyforge and compiled the extension which
resulted in a file called pam.so.

Ruby-pam comes with a couple of test files which help you to try the
extension. When I run them they work correctly and without errors.

Under “#{RAILS_ROOT}/lib” I created a file called pam_pam.rb which is
based on the test code from ruby-pam (that works by itself without a
problem). I also copied pam.so to this same directory.

In the SessionController I “include PamPam” and make a call to the
function that does the authentication.

Even though i’m using almost the exact same code as in the tests (which
works) I’m getting an error about an undefined function (“pam_end”).

How come I get this error under rails but not while running the test
script by itself ? Am I not setting up the library correctly ?

You can find the code (from the lib and the controller) in pastie:

http://pastie.caboo.se/18661

I suspect my problem is in a misplacement of libraries or the incorrect
include’ing of files since the test script of ruby-pam works just fine.

Any help is greatly appreciated.
any help is appreciated.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs