[CentOS] CentOS 5.9 and google-authenticator

Thu Jun 27 21:30:08 UTC 2013
Stephen Harris <lists at spuddy.org>

I'm playing with google-authenticator libpam

  https://code.google.com/p/google-authenticator/

It appears to be failing the "make test" on CentOS 5.9 32bit.

  ./pam_google_authenticator_unittest
  Testing base32 encoding
  Testing base32 decoding
  Testing HMAC_SHA1
  Loading PAM module

  Running tests, querying for verification code
  Testing failed login attempt
  Testing required number of digits
  Testing a blank response
  Test handling of missing state files
  Testing successful login
  Testing WINDOW_SIZE option
  Testing DISALLOW_REUSE option
  Testing RATE_LIMIT option
  Testing TIME_SKEW
  pam_google_authenticator_unittest: pam_google_authenticator_unittest.c:137: verify_prompts_shown: Assertion `num_prompts_shown == expected_prompts_shown' failed.
  Invalid verification code
  make: *** [test] Error 1

Playing with the code...

    // Test TIME_SKEW option
    puts("Testing TIME_SKEW");
    for (int i = 0; i < 4; ++i) {
      set_time((12000 + i)*30);
      char buf[7];
      response = buf;
      sprintf(response, "%06d",
              compute_code(binary_secret, binary_secret_len, 11000 + i));
      assert(pam_sm_open_session(NULL, 0, targc, targv) ==
             (i >= 2 ? PAM_SUCCESS : PAM_SESSION_ERR));
      verify_prompts_shown(expected_good_prompts_shown);
    }

Up to here works fine...

    set_time(12010 * 30);
    char buf[7];
    response = buf;
    sprintf(response, "%06d", compute_code(binary_secret,
                                           binary_secret_len, 11010));
    assert(pam_sm_open_session(NULL, 0, 1,
                               (const char *[]){ "noskewadj", 0 }) ==
           PAM_SESSION_ERR);
    verify_prompts_shown(0);

This is where it fails.

The same code works correctly without error on CentOS 6.4 64bit.

Has anyone else managed to pass the tests on 5.9 32bit?

-- 

rgds
Stephen