X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit-ng%2Fadmin_functions.c;h=8b71a68fdef22f1b105620da9a3ec34383fa7ac7;hb=03d5df9a4e11ce16fbfeac4ad03f2825591fa4ae;hp=dbd3eca9576983e76021a6d9f1e9fc0c5bd7f34c;hpb=da6bb5e24252a0ff56d314a60081ae9ed31ab1a7;p=citadel.git diff --git a/webcit-ng/admin_functions.c b/webcit-ng/admin_functions.c index dbd3eca95..8b71a68fd 100644 --- a/webcit-ng/admin_functions.c +++ b/webcit-ng/admin_functions.c @@ -32,16 +32,16 @@ void try_login(struct http_transaction *h, struct ctdlsession *c) snprintf(buf, sizeof buf, "%s:%s", username, password); CtdlEncodeBase64(auth, buf, strlen(buf), 0); - syslog(LOG_DEBUG, "try_login(username='%s',password=(%d bytes))", username, (int)strlen(password)); + syslog(LOG_DEBUG, "try_login(username='%s',password=(%d bytes))", username, (int) strlen(password)); - ctdl_printf(c, "LOUT"); // log out, in case we were logged in - ctdl_readline(c, buf, sizeof(buf)); // ignore the result - memset(c->auth, 0, AUTH_MAX); // if this connection had auth, it doesn't now. - memset(c->whoami, 0, 64); // if this connection had auth, it doesn't now. + ctdl_printf(c, "LOUT"); // log out, in case we were logged in + ctdl_readline(c, buf, sizeof(buf)); // ignore the result + memset(c->auth, 0, AUTH_MAX); // if this connection had auth, it doesn't now. + memset(c->whoami, 0, 64); // if this connection had auth, it doesn't now. - login_success = login_to_citadel(c, auth, buf); // Now try logging in to Citadel + login_success = login_to_citadel(c, auth, buf); // Now try logging in to Citadel - h->response_code = 200; // 'buf' will contain the relevant response + h->response_code = 200; // 'buf' will contain the relevant response h->response_string = strdup("OK"); add_response_header(h, strdup("Content-type"), strdup("text/plain")); h->response_body = strdup(buf); @@ -60,13 +60,13 @@ void logout(struct http_transaction *h, struct ctdlsession *c) char password[256]; int login_success = 0; - ctdl_printf(c, "LOUT"); // log out - ctdl_readline(c, buf, sizeof(buf)); // ignore the result + ctdl_printf(c, "LOUT"); // log out + ctdl_readline(c, buf, sizeof(buf)); // ignore the result strcpy(c->auth, "x"); - //memset(c->auth, 0, AUTH_MAX); // if this connection had auth, it doesn't now. - memset(c->whoami, 0, 64); // if this connection had auth, it doesn't now. + //memset(c->auth, 0, AUTH_MAX); // if this connection had auth, it doesn't now. + memset(c->whoami, 0, 64); // if this connection had auth, it doesn't now. - http_redirect(h, "/ctdl/s/index.html"); // go back where we started :) + http_redirect(h, "/ctdl/s/index.html"); // go back where we started :) } @@ -88,20 +88,20 @@ void whoami(struct http_transaction *h, struct ctdlsession *c) */ void ctdl_a(struct http_transaction *h, struct ctdlsession *c) { - if (!strcasecmp(h->uri, "/ctdl/a/login")) { // log in + if (!strcasecmp(h->uri, "/ctdl/a/login")) { // log in try_login(h, c); - return; + return; } - if (!strcasecmp(h->uri, "/ctdl/a/logout")) { // log out + if (!strcasecmp(h->uri, "/ctdl/a/logout")) { // log out logout(h, c); - return; + return; } - if (!strcasecmp(h->uri, "/ctdl/a/whoami")) { // return display name of user + if (!strcasecmp(h->uri, "/ctdl/a/whoami")) { // return display name of user whoami(h, c); - return; + return; } - do_404(h); // unknown + do_404(h); // unknown }