Back to index

webcit  8.12-dfsg
Functions
openid.c File Reference
#include "webcit.h"
#include "webserver.h"

Go to the source code of this file.

Functions

void display_openids (void)
void openid_attach (void)
void openid_detach (void)
void InitModule_OPENID (void)

Function Documentation

void display_openids ( void  )

Definition at line 19 of file openid.c.

{
       wcsession *WCC = WC;
       char buf[1024];
       int bg = 0;

       output_headers(1, 1, 1, 0, 0, 0);

       do_template("box_begin_1");
       StrBufAppendBufPlain(WCC->WBuf, _("Manage Account/OpenID Associations"), -1, 0);
       do_template("box_begin_2");

       if (WCC->serv_info->serv_supports_openid) {

              wc_printf("<table class=\"altern\">");
       
              serv_puts("OIDL");
              serv_getln(buf, sizeof buf);
              if (buf[0] == '1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
                     bg = 1 - bg;
                     wc_printf("<tr class=\"%s\">", (bg ? "even" : "odd"));
                     wc_printf("<td><img src=\"static/webcit_icons/openid-small.gif\"></td><td>");
                     escputs(buf);
                     wc_printf("</td><td>");
                     wc_printf("<a href=\"openid_detach?id_to_detach=");
                     urlescputs(buf);
                     wc_printf("\" onClick=\"return confirm('%s');\">",
                            _("Do you really want to delete this OpenID?"));
                     wc_printf("%s</a>", _("(delete)"));
                     wc_printf("</td></tr>\n");
              }
       
              wc_printf("</table><br>\n");
       
               wc_printf("<form method=\"POST\" action=\"openid_attach\">\n");
              wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WCC->nonce);
              wc_printf(_("Add an OpenID: "));
               wc_printf("<input type=\"text\" name=\"openid_url\" class=\"openid_urlarea\" size=\"40\">\n");
               wc_printf("<input type=\"submit\" name=\"attach_button\" value=\"%s\">"
                     "</form></center>\n", _("Attach"));
       }

       else {
              wc_printf(_("%s does not permit authentication via OpenID."), ChrPtr(WCC->serv_info->serv_humannode));
       }

       do_template("box_end");
       wDumpContent(2);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void InitModule_OPENID ( void  )

Definition at line 123 of file openid.c.

{
       WebcitAddUrlHandler(HKEY("display_openids"), "", 0, display_openids, 0);
       WebcitAddUrlHandler(HKEY("openid_attach"), "", 0, openid_attach, 0);
       WebcitAddUrlHandler(HKEY("openid_detach"), "", 0, openid_detach, 0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void openid_attach ( void  )

Definition at line 73 of file openid.c.

                         {
       char buf[4096];

       if (havebstr("attach_button")) {

              syslog(LOG_DEBUG, "Attempting to attach %s\n", bstr("openid_url"));

              snprintf(buf, sizeof buf,
                     "OIDS %s|%s/finalize_openid_login?attach_existing=1|%s",
                     bstr("openid_url"),
                     ChrPtr(site_prefix),
                     ChrPtr(site_prefix)
              );

              serv_puts(buf);
              serv_getln(buf, sizeof buf);
              if (buf[0] == '2') {
                     syslog(LOG_DEBUG, "OpenID server contacted; redirecting to %s\n", &buf[4]);
                     http_redirect(&buf[4]);
                     return;
              }
              else {
                     syslog(LOG_DEBUG, "OpenID attach failed: %s\n", &buf[4]);
              }
       }

       /* If we get to this point then something failed. */
       display_openids();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void openid_detach ( void  )

Definition at line 107 of file openid.c.

                         {
       StrBuf *Line;

       if (havebstr("id_to_detach")) {
              serv_printf("OIDD %s", bstr("id_to_detach"));
              Line = NewStrBuf();
              StrBuf_ServGetln(Line);
              GetServerStatusMsg(Line, NULL, 1, 2);
              FreeStrBuf(&Line);
       }

       display_openids();
}

Here is the call graph for this function:

Here is the caller graph for this function: