4 * This is an implementation of OpenID 1.1 Relying Party support, in stateless mode.
16 #include <sys/types.h>
18 #if TIME_WITH_SYS_TIME
19 # include <sys/time.h>
23 # include <sys/time.h>
32 #include <curl/curl.h>
33 #include "ctdl_module.h"
35 #include "citserver.h"
39 char claimed_id[1024];
49 /**************************************************************************/
51 /* Functions in this section handle Citadel internal OpenID mapping stuff */
53 /**************************************************************************/
57 * The structure of an openid record *key* is:
59 * |--------------claimed_id-------------|
60 * (actual length of claimed id)
63 * The structure of an openid record *value* is:
65 * |-----user_number----|------------claimed_id---------------|
66 * (sizeof long) (actual length of claimed id)
73 * Attach an OpenID to a Citadel account
75 int attach_openid(struct ctdluser *who, char *claimed_id)
77 struct cdbdata *cdboi;
83 if (!claimed_id) return(1);
84 if (IsEmptyStr(claimed_id)) return(1);
86 /* Check to see if this OpenID is already in the database */
88 cdboi = cdb_fetch(CDB_OPENID, claimed_id, strlen(claimed_id));
90 memcpy(&fetched_usernum, cdboi->ptr, sizeof(long));
93 if (fetched_usernum == who->usernum) {
94 CtdlLogPrintf(CTDL_INFO, "%s already associated; no action is taken\n", claimed_id);
98 CtdlLogPrintf(CTDL_INFO, "%s already belongs to another user\n", claimed_id);
103 /* Not already in the database, so attach it now */
105 data_len = sizeof(long) + strlen(claimed_id) + 1;
106 data = malloc(data_len);
108 memcpy(data, &who->usernum, sizeof(long));
109 memcpy(&data[sizeof(long)], claimed_id, strlen(claimed_id) + 1);
111 cdb_store(CDB_OPENID, claimed_id, strlen(claimed_id), data, data_len);
114 CtdlLogPrintf(CTDL_INFO, "%s has been attached to %s (%ld)\n",
115 claimed_id, who->fullname, who->usernum);
122 * When a user is being deleted, we have to delete any OpenID associations
124 void openid_purge(struct ctdluser *usbuf) {
125 struct cdbdata *cdboi;
126 HashList *keys = NULL;
128 char *deleteme = NULL;
133 keys = NewHash(1, NULL);
137 cdb_rewind(CDB_OPENID);
138 while (cdboi = cdb_next_item(CDB_OPENID), cdboi != NULL) {
139 if (cdboi->len > sizeof(long)) {
140 if (((long)*(cdboi->ptr)) == usbuf->usernum) {
141 deleteme = strdup(cdboi->ptr + sizeof(long)),
142 Put(keys, deleteme, strlen(deleteme), deleteme, generic_free_handler);
148 /* Go through the hash list, deleting keys we stored in it */
150 HashPos = GetNewHashPos();
151 while (GetNextHashPos(keys, HashPos, &len, &Key, &Value)!=0)
153 CtdlLogPrintf(CTDL_DEBUG, "Deleting associated OpenID <%s>\n", Value);
154 cdb_delete(CDB_OPENID, Value, strlen(Value));
155 /* note: don't free(Value) -- deleting the hash list will handle this for us */
157 DeleteHashPos(&HashPos);
164 * List the OpenIDs associated with the currently logged in account
166 void cmd_oidl(char *argbuf) {
167 struct cdbdata *cdboi;
169 if (CtdlAccessCheck(ac_logged_in)) return;
170 cdb_rewind(CDB_OPENID);
171 cprintf("%d Associated OpenIDs:\n", LISTING_FOLLOWS);
173 while (cdboi = cdb_next_item(CDB_OPENID), cdboi != NULL) {
174 if (cdboi->len > sizeof(long)) {
175 if (((long)*(cdboi->ptr)) == CC->user.usernum) {
176 cprintf("%s\n", cdboi->ptr + sizeof(long));
186 * Attempt to register (populate the vCard) the currently-logged-in user
187 * using the data from Simple Registration Extension, if present.
189 void populate_vcard_from_sreg(HashList *sreg_keys) {
192 int pop = 0; /* number of fields populated */
194 char *postcode = NULL;
195 char *country = NULL;
197 if (!sreg_keys) return;
201 if (GetHash(sreg_keys, "identity", 8, (void *) &data)) {
202 vcard_add_prop(v, "url;type=openid", data);
206 if (GetHash(sreg_keys, "sreg.email", 10, (void *) &data)) {
207 vcard_add_prop(v, "email;internet", data);
211 if (GetHash(sreg_keys, "sreg.nickname", 13, (void *) &data)) {
212 vcard_add_prop(v, "nickname", data);
216 if (GetHash(sreg_keys, "sreg.fullname", 13, (void *) &data)) {
218 vcard_add_prop(v, "fn", data);
219 vcard_fn_to_n(n, data, sizeof n);
220 vcard_add_prop(v, "n", n);
224 if (!GetHash(sreg_keys, "sreg.postcode", 13, (void *) &postcode)) {
228 if (!GetHash(sreg_keys, "sreg.country", 12, (void *) &country)) {
232 if (postcode || country) {
234 snprintf(adr, sizeof adr, ";;;;;%s;%s",
235 (postcode ? postcode : ""),
236 (country ? country : "")
238 vcard_add_prop(v, "adr", adr);
242 if (GetHash(sreg_keys, "sreg.dob", 8, (void *) &data)) {
243 vcard_add_prop(v, "bday", data);
247 if (GetHash(sreg_keys, "sreg.gender", 11, (void *) &data)) {
248 vcard_add_prop(v, "x-funambol-gender", data);
252 /* Only save the vCard if there is some useful data in it */
258 CtdlMakeTempFileName(temp, sizeof temp);
259 ser = vcard_serialize(v);
261 fp = fopen(temp, "w");
263 fwrite(ser, strlen(ser), 1, fp);
265 CtdlWriteObject(USERCONFIGROOM, "text/x-vcard", temp, &CC->user, 0, 0, 0);
276 * Create a new user account, manually specifying the name, after successfully
277 * verifying an OpenID (which will of course be attached to the account)
279 void cmd_oidc(char *argbuf) {
280 struct ctdl_openid *oiddata = (struct ctdl_openid *) CC->openid_data;
282 if (!oiddata->verified) {
283 cprintf("%d You have not verified an OpenID yet.\n", ERROR);
287 /* We can make the semantics of OIDC exactly the same as NEWU, simply
288 * by _calling_ cmd_newu() and letting it run. Very clever!
292 /* Now, if this logged us in, we have to attach the OpenID */
294 attach_openid(&CC->user, oiddata->claimed_id);
295 if (oiddata->sreg_keys != NULL) {
296 populate_vcard_from_sreg(oiddata->sreg_keys);
306 * Detach an OpenID from the currently logged in account
308 void cmd_oidd(char *argbuf) {
309 struct cdbdata *cdboi;
310 char id_to_detach[1024];
311 int this_is_mine = 0;
313 if (CtdlAccessCheck(ac_logged_in)) return;
314 extract_token(id_to_detach, argbuf, 0, '|', sizeof id_to_detach);
315 if (IsEmptyStr(id_to_detach)) {
316 cprintf("%d An empty OpenID URL is not allowed.\n", ERROR + ILLEGAL_VALUE);
319 cdb_rewind(CDB_OPENID);
320 while (cdboi = cdb_next_item(CDB_OPENID), cdboi != NULL) {
321 if (cdboi->len > sizeof(long)) {
322 if (((long)*(cdboi->ptr)) == CC->user.usernum) {
330 cprintf("%d That OpenID was not found or not associated with your account.\n",
331 ERROR + ILLEGAL_VALUE);
335 cdb_delete(CDB_OPENID, id_to_detach, strlen(id_to_detach));
336 cprintf("%d %s detached from your account.\n", CIT_OK, id_to_detach);
342 * Attempt to auto-create a new Citadel account using the nickname from Simple Registration Extension
344 int openid_create_user_via_sreg(char *claimed_id, HashList *sreg_keys)
346 char *desired_name = NULL;
347 char new_password[32];
349 if (config.c_auth_mode != AUTHMODE_NATIVE) return(1);
350 if (config.c_disable_newu) return(2);
351 if (CC->logged_in) return(3);
352 if (!GetHash(sreg_keys, "sreg.nickname", 13, (void *) &desired_name)) return(4);
354 CtdlLogPrintf(CTDL_DEBUG, "The desired account name is <%s>\n", desired_name);
356 if (!getuser(&CC->user, desired_name)) {
357 CtdlLogPrintf(CTDL_DEBUG, "<%s> is already taken by another user.\n", desired_name);
358 memset(&CC->user, 0, sizeof(struct ctdluser));
362 /* The desired account name is available. Create the account and log it in! */
363 if (create_user(desired_name, 1)) return(6);
365 snprintf(new_password, sizeof new_password, "%08lx%08lx", random(), random());
366 CtdlSetPassword(new_password);
367 attach_openid(&CC->user, claimed_id);
368 populate_vcard_from_sreg(sreg_keys);
374 * If a user account exists which is associated with the Claimed ID, log it in and return zero.
375 * Otherwise it returns nonzero.
377 int login_via_openid(char *claimed_id)
379 struct cdbdata *cdboi;
382 cdboi = cdb_fetch(CDB_OPENID, claimed_id, strlen(claimed_id));
387 memcpy(&usernum, cdboi->ptr, sizeof(long));
390 if (!getuserbynumber(&CC->user, usernum)) {
391 /* Now become the user we just created */
392 safestrncpy(CC->curr_user, CC->user.fullname, sizeof CC->curr_user);
397 memset(&CC->user, 0, sizeof(struct ctdluser));
405 /**************************************************************************/
407 /* Functions in this section handle OpenID protocol */
409 /**************************************************************************/
413 * Locate a <link> tag and, given its 'rel=' parameter, return its 'href' parameter
415 void extract_link(char *target_buf, int target_size, char *rel, char *source_buf)
417 char *ptr = source_buf;
419 if (!target_buf) return;
421 if (!source_buf) return;
425 while (ptr = bmstrcasestr(ptr, "<link"), ptr != NULL) {
427 char work_buffer[2048];
428 char *link_tag_start = NULL;
429 char *link_tag_end = NULL;
434 link_tag_start = ptr;
435 link_tag_end = strchr(ptr, '>');
439 if ((link_tag_end) && (link_tag_end > link_tag_start)) {
441 len = link_tag_end - link_tag_start;
442 if (len > sizeof work_buffer) len = sizeof work_buffer;
443 memcpy(work_buffer, link_tag_start, len);
445 char *rel_start = NULL;
446 char *rel_end = NULL;
447 rel_start = bmstrcasestr(work_buffer, "rel=");
449 rel_start = strchr(rel_start, '\"');
452 rel_end = strchr(rel_start, '\"');
453 if ((rel_end) && (rel_end > rel_start)) {
454 safestrncpy(rel_tag, rel_start, rel_end - rel_start + 1);
459 char *href_start = NULL;
460 char *href_end = NULL;
461 href_start = bmstrcasestr(work_buffer, "href=");
463 href_start = strchr(href_start, '\"');
466 href_end = strchr(href_start, '\"');
467 if ((href_end) && (href_end > href_start)) {
468 safestrncpy(href_tag, href_start, href_end - href_start + 1);
473 if (!strcasecmp(rel, rel_tag)) {
474 safestrncpy(target_buf, href_tag, target_size);
490 int total_bytes_received;
495 size_t fh_callback(void *ptr, size_t size, size_t nmemb, void *stream)
497 struct fh_data *fh = (struct fh_data *) stream;
498 int got_bytes = (size * nmemb);
500 if (fh->total_bytes_received + got_bytes > fh->maxbytes) {
501 got_bytes = fh->maxbytes - fh->total_bytes_received;
504 memcpy(&fh->buf[fh->total_bytes_received], ptr, got_bytes);
505 fh->total_bytes_received += got_bytes;
508 return (size * nmemb); /* always succeed; libcurl doesn't need to know if we truncated it */
514 * Begin an HTTP fetch (returns number of bytes actually fetched, or -1 for error) using libcurl.
516 * If 'normalize_len' is nonzero, the caller is specifying the buffer size of 'url', and is
517 * requesting that the effective (normalized) URL be copied back to it.
519 int fetch_http(char *url, char *target_buf, int maxbytes, int normalize_len)
523 char errmsg[1024] = "";
524 struct fh_data fh = {
529 char *effective_url = NULL;
531 if (!url) return(-1);
532 if (!target_buf) return(-1);
533 memset(target_buf, 0, maxbytes);
535 curl = curl_easy_init();
537 CtdlLogPrintf(CTDL_ALERT, "Unable to initialize libcurl.\n");
541 curl_easy_setopt(curl, CURLOPT_URL, url);
542 curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
543 curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
544 curl_easy_setopt(curl, CURLOPT_WRITEDATA, &fh);
545 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fh_callback);
546 curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errmsg);
547 curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
548 curl_easy_setopt(curl, CURLOPT_USERAGENT, CITADEL);
549 if (!IsEmptyStr(config.c_ip_addr)) {
550 curl_easy_setopt(curl, CURLOPT_INTERFACE, config.c_ip_addr);
552 res = curl_easy_perform(curl);
554 CtdlLogPrintf(CTDL_DEBUG, "fetch_http() libcurl error %d: %s\n", res, errmsg);
556 if (normalize_len > 0) {
557 curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &effective_url);
558 safestrncpy(url, effective_url, normalize_len);
560 curl_easy_cleanup(curl);
561 return fh.total_bytes_received;
566 * Setup an OpenID authentication
568 void cmd_oids(char *argbuf) {
569 char return_to[1024];
570 char trust_root[1024];
573 struct CitContext *CCC = CC; /* CachedCitContext - performance boost */
574 struct ctdl_openid *oiddata;
576 oiddata = (struct ctdl_openid *) CCC->openid_data;
578 if (oiddata != NULL) {
579 if (oiddata->sreg_keys != NULL) {
580 DeleteHash(&oiddata->sreg_keys);
581 oiddata->sreg_keys = NULL;
583 free(CCC->openid_data);
585 oiddata = malloc(sizeof(struct ctdl_openid));
586 if (oiddata == NULL) {
587 cprintf("%d malloc failed\n", ERROR + INTERNAL_ERROR);
590 memset(oiddata, 0, sizeof(struct ctdl_openid));
591 CCC->openid_data = (void *) oiddata;
593 extract_token(oiddata->claimed_id, argbuf, 0, '|', sizeof oiddata->claimed_id);
594 extract_token(return_to, argbuf, 1, '|', sizeof return_to);
595 extract_token(trust_root, argbuf, 2, '|', sizeof trust_root);
596 oiddata->verified = 0;
598 i = fetch_http(oiddata->claimed_id, buf, sizeof buf - 1, sizeof oiddata->claimed_id);
599 CtdlLogPrintf(CTDL_DEBUG, "Normalized URL and Claimed ID is: %s\n", oiddata->claimed_id);
600 buf[sizeof buf - 1] = 0;
602 char openid_delegate[1024];
604 extract_link(oiddata->server, sizeof oiddata->server, "openid.server", buf);
605 extract_link(openid_delegate, sizeof openid_delegate, "openid.delegate", buf);
607 if (IsEmptyStr(oiddata->server)) {
608 cprintf("%d There is no OpenID identity provider at this URL.\n", ERROR);
612 /* Empty delegate is legal; we just use the openid_url instead */
613 if (IsEmptyStr(openid_delegate)) {
614 safestrncpy(openid_delegate, oiddata->claimed_id, sizeof openid_delegate);
617 /* Assemble a URL to which the user-agent will be redirected. */
618 char redirect_string[4096];
619 char escaped_identity[512];
620 char escaped_return_to[2048];
621 char escaped_trust_root[1024];
622 char escaped_sreg_optional[256];
624 urlesc(escaped_identity, sizeof escaped_identity, openid_delegate);
625 urlesc(escaped_return_to, sizeof escaped_return_to, return_to);
626 urlesc(escaped_trust_root, sizeof escaped_trust_root, trust_root);
627 urlesc(escaped_sreg_optional, sizeof escaped_sreg_optional,
628 "nickname,email,fullname,postcode,country,dob,gender");
630 snprintf(redirect_string, sizeof redirect_string,
632 "?openid.mode=checkid_setup"
633 "&openid.identity=%s"
634 "&openid.return_to=%s"
635 "&openid.trust_root=%s"
636 "&openid.sreg.optional=%s"
642 escaped_sreg_optional
644 cprintf("%d %s\n", CIT_OK, redirect_string);
648 cprintf("%d Unable to fetch OpenID URL\n", ERROR);
656 * Finalize an OpenID authentication
658 void cmd_oidf(char *argbuf) {
662 HashList *keys = NULL;
663 struct ctdl_openid *oiddata = (struct ctdl_openid *) CC->openid_data;
665 keys = NewHash(1, NULL);
667 cprintf("%d NewHash() failed\n", ERROR + INTERNAL_ERROR);
671 cprintf("%d Transmit OpenID data now\n", START_CHAT_MODE);
673 while (client_getln(buf, sizeof buf), strcmp(buf, "000")) {
674 extract_token(thiskey, buf, 0, '|', sizeof thiskey);
675 extract_token(thisdata, buf, 1, '|', sizeof thisdata);
676 CtdlLogPrintf(CTDL_DEBUG, "%s: [%d] %s\n", thiskey, strlen(thisdata), thisdata);
677 Put(keys, thiskey, strlen(thiskey), strdup(thisdata), generic_free_handler);
681 /* Now that we have all of the parameters, we have to validate the signature against the server */
682 CtdlLogPrintf(CTDL_DEBUG, "About to validate the signature...\n");
686 struct curl_httppost *formpost = NULL;
687 struct curl_httppost *lastptr = NULL;
688 char errmsg[1024] = "";
689 char *o_assoc_handle = NULL;
691 char *o_signed = NULL;
692 int num_signed_values;
695 char k_o_keyname[128];
696 char *k_value = NULL;
699 struct fh_data fh = {
705 curl_formadd(&formpost, &lastptr,
706 CURLFORM_COPYNAME, "openid.mode",
707 CURLFORM_COPYCONTENTS, "check_authentication",
709 CtdlLogPrintf(CTDL_DEBUG, "%25s : %s\n", "openid.mode", "check_authentication");
711 if (GetHash(keys, "assoc_handle", 12, (void *) &o_assoc_handle)) {
712 curl_formadd(&formpost, &lastptr,
713 CURLFORM_COPYNAME, "openid.assoc_handle",
714 CURLFORM_COPYCONTENTS, o_assoc_handle,
716 CtdlLogPrintf(CTDL_DEBUG, "%25s : %s\n", "openid.assoc_handle", o_assoc_handle);
719 if (GetHash(keys, "sig", 3, (void *) &o_sig)) {
720 curl_formadd(&formpost, &lastptr,
721 CURLFORM_COPYNAME, "openid.sig",
722 CURLFORM_COPYCONTENTS, o_sig,
724 CtdlLogPrintf(CTDL_DEBUG, "%25s : %s\n", "openid.sig", o_sig);
727 if (GetHash(keys, "signed", 6, (void *) &o_signed)) {
728 curl_formadd(&formpost, &lastptr,
729 CURLFORM_COPYNAME, "openid.signed",
730 CURLFORM_COPYCONTENTS, o_signed,
732 CtdlLogPrintf(CTDL_DEBUG, "%25s : %s\n", "openid.signed", o_signed);
734 num_signed_values = num_tokens(o_signed, ',');
735 for (i=0; i<num_signed_values; ++i) {
736 extract_token(k_keyname, o_signed, i, ',', sizeof k_keyname);
737 if (strcasecmp(k_keyname, "mode")) { // work around phpMyID bug
738 if (GetHash(keys, k_keyname, strlen(k_keyname), (void *) &k_value)) {
739 snprintf(k_o_keyname, sizeof k_o_keyname, "openid.%s", k_keyname);
740 curl_formadd(&formpost, &lastptr,
741 CURLFORM_COPYNAME, k_o_keyname,
742 CURLFORM_COPYCONTENTS, k_value,
744 CtdlLogPrintf(CTDL_DEBUG, "%25s : %s\n", k_o_keyname, k_value);
747 CtdlLogPrintf(CTDL_INFO, "OpenID: signed field '%s' is missing\n",
754 curl = curl_easy_init();
755 curl_easy_setopt(curl, CURLOPT_URL, oiddata->server);
756 curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
757 curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
758 curl_easy_setopt(curl, CURLOPT_WRITEDATA, &fh);
759 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fh_callback);
760 curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
761 curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errmsg);
762 curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
763 curl_easy_setopt(curl, CURLOPT_USERAGENT, CITADEL);
764 if (!IsEmptyStr(config.c_ip_addr)) {
765 curl_easy_setopt(curl, CURLOPT_INTERFACE, config.c_ip_addr);
768 res = curl_easy_perform(curl);
770 CtdlLogPrintf(CTDL_DEBUG, "cmd_oidf() libcurl error %d: %s\n", res, errmsg);
772 curl_easy_cleanup(curl);
773 curl_formfree(formpost);
775 valbuf[fh.total_bytes_received] = 0;
777 if (bmstrcasestr(valbuf, "is_valid:true")) {
778 oiddata->verified = 1;
781 CtdlLogPrintf(CTDL_DEBUG, "Authentication %s.\n", (oiddata->verified ? "succeeded" : "failed") );
783 /* Respond to the client */
785 if (oiddata->verified) {
787 /* If we were already logged in, attach the OpenID to the user's account */
789 if (attach_openid(&CC->user, oiddata->claimed_id) == 0) {
797 /* Otherwise, a user is attempting to log in using the verified OpenID */
800 * Existing user who has claimed this OpenID?
802 * Note: if you think that sending the password back over the wire is insecure,
803 * check your assumptions. If someone has successfully asserted an OpenID that
804 * is associated with the account, they already have password equivalency and can
805 * login, so they could just as easily change the password, etc.
807 if (login_via_openid(oiddata->claimed_id) == 0) {
808 cprintf("authenticate\n%s\n%s\n", CC->user.fullname, CC->user.password);
809 logged_in_response();
813 * If this system does not allow self-service new user registration, the
814 * remaining modes do not apply, so fail here and now.
816 else if (config.c_disable_newu) {
821 * New user whose OpenID is verified and Simple Registration Extension is in use?
823 else if (openid_create_user_via_sreg(oiddata->claimed_id, keys) == 0) {
824 cprintf("authenticate\n%s\n%s\n", CC->user.fullname, CC->user.password);
825 logged_in_response();
829 * OpenID is verified, but the desired username either was not specified or
830 * conflicts with an existing user. Manual account creation is required.
833 char *desired_name = NULL;
834 cprintf("verify_only\n");
835 cprintf("%s\n", oiddata->claimed_id);
836 if (GetHash(keys, "sreg.nickname", 13, (void *) &desired_name)) {
837 cprintf("%s\n", desired_name);
850 if (oiddata->sreg_keys != NULL) {
851 DeleteHash(&oiddata->sreg_keys);
852 oiddata->sreg_keys = NULL;
854 oiddata->sreg_keys = keys;
859 /**************************************************************************/
861 /* Functions in this section handle module initialization and shutdown */
863 /**************************************************************************/
867 * This cleanup function blows away the temporary memory used by this module.
869 void openid_cleanup_function(void) {
870 struct ctdl_openid *oiddata = (struct ctdl_openid *) CC->openid_data;
872 if (oiddata != NULL) {
873 CtdlLogPrintf(CTDL_DEBUG, "Clearing OpenID session state\n");
874 if (oiddata->sreg_keys != NULL) {
875 DeleteHash(&oiddata->sreg_keys);
876 oiddata->sreg_keys = NULL;
883 CTDL_MODULE_INIT(openid_rp)
886 curl_global_init(CURL_GLOBAL_ALL);
888 /* Only enable the OpenID command set when native mode authentication is in use. */
889 if (config.c_auth_mode == AUTHMODE_NATIVE) {
890 CtdlRegisterProtoHook(cmd_oids, "OIDS", "Setup OpenID authentication");
891 CtdlRegisterProtoHook(cmd_oidf, "OIDF", "Finalize OpenID authentication");
892 CtdlRegisterProtoHook(cmd_oidl, "OIDL", "List OpenIDs associated with an account");
893 CtdlRegisterProtoHook(cmd_oidd, "OIDD", "Detach an OpenID from an account");
894 CtdlRegisterProtoHook(cmd_oidc, "OIDC", "Create new user after validating OpenID");
896 CtdlRegisterSessionHook(openid_cleanup_function, EVT_LOGOUT);
897 CtdlRegisterUserHook(openid_purge, EVT_PURGEUSER);
900 /* return our Subversion id for the Log */