I have installed module.
Than copy and past controller URL and token.
Than add this lines:
\/services\/xmlrpc$
\/addphoto.*$

to Target URLs (or somthing like this).
Cache and sessions tables was cleared.
I can login controler but not on other sites.
Any page (even update.php) redirects to:
http://example.com/singlesignon/associate?origin=http%3A%2F%2Fexample2.c...
and I see only white screen.

PS. This is upgrade from Shared SingOn so SSO before this was working.
Thanks

CommentFileSizeAuthor
#6 sso-log-a2715e.txt3.36 KBvladsavitsky

Comments

meba’s picture

It's just improperly set up. Can you please try to follow README.txt exactly and then report when do you have problems?

vladsavitsky’s picture

I have reinstalled sso according to readme.txt and got the same errors.
Reading apache's error_log gives me answer -some functions placed in session.singlesignon.inc is not defined in:
singlesignon_controller.module
singlesignon_client.module

Solution
Add to singlesignon_controller.module:


/**
 * Helper function for retrieving the session domain from a URL.
 */
function singlesignon_get_domain($url = NULL) {
  global $base_url;
  if (!isset($url)) {
    $url = $base_url;
  }
  $parsed = parse_url($url);
  return preg_replace('/^www\./', '', $parsed['host']) . ($parsed['scheme'] == 'https' ? ':ssl' : '');
}

/**
 * Helper function for claiming a session using a nonce.
 */
function singlesignon_claim_session($nonce) {
  global $user;

  // Look up session by nonce.
  $sid = db_result(db_query("SELECT sid FROM {sessions} WHERE nonce = '%s'", $nonce));

  if ($sid) {
    // Wipe nonce from the DB.
    db_query("UPDATE {sessions} SET nonce = '' WHERE sid = '%s'", $sid);

    // Adopt the new session and give it a permanent SID.
    sess_destroy_sid(session_id());
    session_id($sid);
    sess_regenerate();

    // Don't overwrite the information in the adopted session.
    session_save_session(FALSE);

    return TRUE;
  }
  return FALSE;
}

/**
 * Helper function for deleting associated client sessions.
 */
function singlesignon_destroy_client_sessions($sid) {
  db_query("DELETE FROM {sessions} WHERE global_sid = '%s'", $sid);
}

/**
 * Helper function for deleting an associated controller session (and all its client sessions).
 */
function singlesignon_destroy_controller_session($sid) {
  $global_sid = db_result(db_query("SELECT global_sid FROM {sessions} WHERE sid = '%s'", $sid));
  if ($global_sid) {
    sess_destroy_sid($global_sid);
  }
}

/**
 * Helper function to track uid changes in page requests.
 */
function sess_old_uid($uid = NULL) {
  static $_uid = 0;
  if (!is_null($uid)) {
    $_uid = $uid;
  }
  return $_uid;
}

Add to singlesignon_client.module:


/**
 * Helper function for retrieving the session domain from a URL.
 */
function singlesignon_get_domain($url = NULL) {
  global $base_url;
  if (!isset($url)) {
    $url = $base_url;
  }
  $parsed = parse_url($url);
  return preg_replace('/^www\./', '', $parsed['host']) . ($parsed['scheme'] == 'https' ? ':ssl' : '');
}

/**
 * Helper function for claiming a session using a nonce.
 */
function singlesignon_claim_session($nonce) {
  global $user;

  // Look up session by nonce.
  $sid = db_result(db_query("SELECT sid FROM {sessions} WHERE nonce = '%s'", $nonce));

  if ($sid) {
    // Wipe nonce from the DB.
    db_query("UPDATE {sessions} SET nonce = '' WHERE sid = '%s'", $sid);

    // Adopt the new session and give it a permanent SID.
    sess_destroy_sid(session_id());
    session_id($sid);
    sess_regenerate();

    // Don't overwrite the information in the adopted session.
    session_save_session(FALSE);

    return TRUE;
  }
  return FALSE;
}

/**
 * Helper function for deleting associated client sessions.
 */
function singlesignon_destroy_client_sessions($sid) {
  db_query("DELETE FROM {sessions} WHERE global_sid = '%s'", $sid);
}

/**
 * Helper function for deleting an associated controller session (and all its client sessions).
 */
function singlesignon_destroy_controller_session($sid) {
  $global_sid = db_result(db_query("SELECT global_sid FROM {sessions} WHERE sid = '%s'", $sid));
  if ($global_sid) {
    sess_destroy_sid($global_sid);
  }
}

/**
 * Helper function to track uid changes in page requests.
 */
function sess_old_uid($uid = NULL) {
  static $_uid = 0;
  if (!is_null($uid)) {
    $_uid = $uid;
  }
  return $_uid;
}

Why duplicate? Including session.singlesignon.inc will bring new error with duplicated functions so this is faster solution.

And I have got error "Underfined index" at line 40 singlesignon_client.module.
Solution
Replace:

  if ($_GET['singlesignon_message']) {

with:

  if (isset($_GET['singlesignon_message'])) {

After all this SSO is not working!
I'll spend 1 hour to get it working. If it will not work for me - I'll use Shared SingOn.

And why I need a separated domain for contoller?! This is silly because I need to add to my 4-domain-multisite with 650 tables one more site just for SSO?! Why?!

vladsavitsky’s picture

PS. I don't use Domain Access.
Used simple multisiting with different table prefixes and all tables in one database.

vladsavitsky’s picture

HEAD from CVS is not working too.

vladsavitsky’s picture

Ok. I did not read README carefully.
I haven't add to settings.php code which adds your fixed session.inc file.
But this only replace all code I have write above.

But path 'singlesignon/claim' is not really exists and I have got error "Access denied. You may need to login below or register to access this page."

In hook_menu implementation in client-module I didn't found this url. So there is no callback for it.
How to fix it?

vladsavitsky’s picture

StatusFileSize
new3.36 KB

This is a debug log for one page request at client-site. See attach.

vladsavitsky’s picture

Status: Active » Fixed

Problem was solved.
At database table users was removed record for user with uid=0 so sessions for anonymous user was not craeted at all!
So I create this user manualy:

INSERT INTO `users` (`uid`, `name`, `pass`, `mail`, `mode`, `sort`, `threshold`, `theme`, `signature`, `signature_format`, `created`, `access`, `login`, `status`, `timezone`, `language`, `picture`, `init`, `data`) VALUES
(0, '', '', '', 0, 0, 0, '', '', 0, 0, 0, 0, 0, NULL, '', '', '', NULL);

I'm not one who changes site so I don't even know who did this!
Now all work fine.
Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.