-struct associate_handle *prepare_openid_associate_request(
- char *claimed_id, char *openid_server, char *openid_delegate)
-{
- CURL *curl;
- CURLcode res;
- struct curl_httppost *formpost=NULL;
- struct curl_httppost *lastptr=NULL;
- char associate_response[ASSOCIATE_RESPONSE_SIZE];
- struct associate_handle *h = NULL;
-
- memset(associate_response, 0, ASSOCIATE_RESPONSE_SIZE);
-
- curl_formadd(&formpost,
- &lastptr,
- CURLFORM_COPYNAME, "openid.mode",
- CURLFORM_COPYCONTENTS, "associate",
- CURLFORM_END
- );
-
- curl_formadd(&formpost,
- &lastptr,
- CURLFORM_COPYNAME, "openid.session_type",
- CURLFORM_COPYCONTENTS, "",
- CURLFORM_END
- );
-
- curl = curl_easy_init();
- if (curl) {
- curl_easy_setopt(curl, CURLOPT_URL, openid_server);
- curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
- curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, associate_response);
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, associate_callback);
- curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
-
- curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
- res = curl_easy_perform(curl);
- h = process_associate_response(claimed_id, associate_response);
- curl_easy_cleanup(curl);
+int parse_xrds_document(StrBuf *ReplyBuf) {
+ struct xrds xrds;
+
+ memset(&xrds, 0, sizeof (struct xrds));
+ XML_Parser xp = XML_ParserCreate(NULL);
+ if (xp) {
+ XML_SetUserData(xp, &xrds);
+ XML_SetElementHandler(xp, xrds_xml_start, xrds_xml_end);
+ XML_SetCharacterDataHandler(xp, xrds_xml_chardata);
+ XML_Parse(xp, ChrPtr(ReplyBuf), StrLength(ReplyBuf), 0);
+ XML_Parse(xp, "", 0, 1);
+ XML_ParserFree(xp);
+ }
+ else {
+ syslog(LOG_ALERT, "Cannot create XML parser");