/* * Combine two user structs. ONLY to be called from within a scheme * module. The scheme module is responsible for ensuring that the * two users _can_ be merged without invalidating all the request * scheme data. the scheme is also responsible for merging any user * related scheme data itself. */ void authenticateAuthUserMerge(auth_user_t * from, auth_user_t * to) { dlink_node *link, *tmplink; auth_user_request_t *auth_user_request; /* * XXX combine two authuser structs. Incomplete: it should merge * in hash references too and ask the module to merge in scheme * data */ debug(29, 5) ("authenticateAuthUserMerge auth_user '%p' into auth_user '%p'.\n", from, to); link = from->requests.head; while (link) { auth_user_request = link->data; tmplink = link; link = link->next; dlinkDelete(tmplink, &from->requests); dlinkAddTail(auth_user_request, tmplink, &to->requests); auth_user_request->auth_user = to; } to->references += from->references; from->references = 0; authenticateFreeProxyAuthUser(from); }
void authenticateAuthUserUnlock(auth_user_t * auth_user) { debug(29, 9) ("authenticateAuthUserUnlock auth_user '%p'.\n", auth_user); assert(auth_user != NULL); if (auth_user->references > 0) { auth_user->references--; } else { fatalf("Attempt to lower Auth User %p refcount below 0!\n", auth_user); } debug(29, 9) ("authenticateAuthUserUnlock auth_user '%p' now at '%ld'.\n", auth_user, (long int) auth_user->references); if (auth_user->references == 0) authenticateFreeProxyAuthUser(auth_user); }