shuffle some code around -- no effect yet
[citadel.git] / citadel / modules / openid / serv_openid_rp.c
index 5171399efb14442933f44d4494430e90628cecf6..d8c43af129188f36d482cca0fb414257db44cd45 100644 (file)
@@ -739,7 +739,6 @@ int perform_openid2_discovery(StrBuf *YadisURL) {
        char errmsg[1024] = "";
        struct curl_slist *my_headers = NULL;
        StrBuf *x_xrds_location = NULL;
-       ctdl_openid *oiddata = (ctdl_openid *) CC->openid_data;
 
        if (YadisURL == NULL) return(0);
        syslog(LOG_DEBUG, "perform_openid2_discovery(%s)", ChrPtr(YadisURL));
@@ -807,10 +806,12 @@ int perform_openid2_discovery(StrBuf *YadisURL) {
         */
        if (return_value == 0) {
                syslog(LOG_DEBUG, "Attempting HTML discovery");
-               extract_link(oiddata->server, HKEY("openid2.provider"), ReplyBuf);
-               if (StrLength(oiddata->server) > 0) {
-                       syslog(LOG_DEBUG, "\033[31mHTML DISCO PROVIDER: %s\033[0m", ChrPtr(oiddata->server));
+               StrBuf *foo = NewStrBuf();
+               extract_link(foo, HKEY("openid2.provider"), ReplyBuf);
+               if (StrLength(foo) > 0) {
+                       syslog(LOG_DEBUG, "\033[31mHTML DISCO PROVIDER: %s\033[0m", ChrPtr(foo));
                }
+               FreeStrBuf(&foo);
        }
 
        if (ReplyBuf != NULL) {
@@ -824,6 +825,7 @@ int perform_openid2_discovery(StrBuf *YadisURL) {
  * Setup an OpenID authentication
  */
 void cmd_oids(char *argbuf) {
+       struct CitContext *CCC = CC;    /* CachedCitContext - performance boost */
        const char *Pos = NULL;
        StrBuf *ArgBuf = NULL;
        StrBuf *ReplyBuf = NULL;
@@ -831,8 +833,8 @@ void cmd_oids(char *argbuf) {
        StrBuf *trust_root = NULL;
        StrBuf *openid_delegate = NULL;
        StrBuf *RedirectUrl = NULL;
-       struct CitContext *CCC = CC;    /* CachedCitContext - performance boost */
        ctdl_openid *oiddata;
+       int discovery_succeeded = 0;
 
        Free_ctdl_openid ((ctdl_openid**)&CCC->openid_data);
 
@@ -867,15 +869,13 @@ void cmd_oids(char *argbuf) {
 
        /* Attempt section 7.3.2 (Yadis discovery) and section 7.3.3 (HTML discovery);
         */
-       int yadis_succeeded = perform_openid2_discovery(oiddata->claimed_id);
+       discovery_succeeded = perform_openid2_discovery(oiddata->claimed_id);
 
 
 
+       /************ OPENID 1.1 **********/
 
-#if 0
-       /* old openid 1.1 implementation ... not ready to break things yet */
-       if (    (yadis_succeeded == 0)
-               && (fetch_http(oiddata->claimed_id, &ReplyBuf) > 0)
+       if (    (fetch_http(oiddata->claimed_id, &ReplyBuf) > 0)
                && (StrLength(ReplyBuf) > 0)
        ) {
                openid_delegate = NewStrBuf();
@@ -927,7 +927,6 @@ void cmd_oids(char *argbuf) {
 
                return;
        }
-#endif /* 0 */
 
        FreeStrBuf(&ArgBuf);
        FreeStrBuf(&ReplyBuf);