From 21eb7fec28703c4e0522374d37469b5b75bb1bbe Mon Sep 17 00:00:00 2001 From: onefang Date: Tue, 14 Sep 2021 12:34:28 +1000 Subject: More output logging tweaks. --- src/sledjchisl/sledjchisl.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index 3f420c6..c2ca044 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c @@ -1044,7 +1044,7 @@ int LuaToHash(reqData *Rd, char *file, char *var, qhashtbl_t *tnm, int ret, stru if (-1 == clock_gettime(CLOCK_REALTIME, &then)) perror_msg("Unable to get the time."); - I("Reading %s file %s", type, file); + V("Reading %s file %s", type, file); if (0 != stat(file, st)) // Don't delete this in future, the caller wants st filled. { D("No %s file.", file); @@ -5187,7 +5187,7 @@ static void freeSesh(reqData *Rd, boolean linky, boolean wipe) char *file = NULL; sesh *shs = &Rd->shs; -T("free sesh %s %s", linky ? "linky" : "session", wipe ? "wipe" : "delete"); +t("free sesh %s %s", linky ? "linky" : "session", wipe ? "wipe" : "delete"); if (linky) { shs = Rd->lnk; @@ -5197,9 +5197,9 @@ T("free sesh %s %s", linky ? "linky" : "session", wipe ? "wipe" : "delete"); file = xmprintf("%s/sessions/%s.lua", scCache, shs->leaf); if (wipe) - I("Wiping session %s.", file); + V("Wiping session %s.", file); else - I("Deleting session %s.", file); + V("Deleting session %s.", file); if ('\0' != shs->leaf[0]) { @@ -5296,7 +5296,7 @@ static void setToken_n_munchie(reqData *Rd, boolean linky) size_t l = strlen(tnm0); if (s) - I("Creating session %s.", file); + V("Creating session %s.", file); else C("Updating session %s.", file); // I don't think updates can occur now. t("Write shs %s", tnm0); @@ -5816,7 +5816,7 @@ static sesh *newSesh(reqData *Rd, boolean linky) uuid_t binuuid; sesh *ret = &Rd->shs; -T("new sesh %s %s %s", linky ? "linky" : "session", ret->UUID, ret->name); +t("new sesh %s %s %s", linky ? "linky" : "session", ret->UUID, ret->name); if (linky) { Rd->lnk = xzalloc(sizeof(sesh)); @@ -5971,7 +5971,7 @@ static int sessionValidate(reqData *Rd, inputForm *iF, inputValue *iV) // In this case the session stuff has to come from specific places. hashish = Rd->queries->getstr(Rd->queries, "hashish", true); -d("O hashish %s", hashish); +//d("O hashish %s", hashish); if (NULL != hashish) { char *t = xstrdup(hashish); @@ -6007,15 +6007,15 @@ d("O hashish %s", hashish); I("Validating SESSION hashish %s", hashish); } -d("O toke_n_munchie %s", toke_n_munchie); -d("O munchie %s", munchie); +//d("O toke_n_munchie %s", toke_n_munchie); +//d("O munchie %s", munchie); if (0 == ret) { struct stat st; struct timespec now; leaf = myHMACkey(getStrH(Rd->configs, "pepper"), hashish, TRUE); -d("leaf %s", leaf); +//d("leaf %s", leaf); if (linky) t0 = xmprintf("%s/sessions/%s.linky", scCache, leaf); else @@ -6048,12 +6048,12 @@ d("leaf %s", leaf); else { timeStamp = xmprintf("%ld.%ld", (long) st.st_mtim.tv_sec, st.st_mtim.tv_nsec); -d("timeStamp %s", timeStamp); +//d("timeStamp %s", timeStamp); seshion = xmprintf("%s%s", tnm->getstr(tnm, "seshID", false), timeStamp); -d("sesh %s", seshion); +//d("sesh %s", seshion); t0 = myHMAC(seshion, FALSE); munchie = xmprintf("%s%s", t0, timeStamp); -d("munchie %s", munchie); +//d("munchie %s", munchie); free(t0); free(timeStamp); t1 = getStrH(Rd->body, "munchie"); @@ -6071,7 +6071,7 @@ d("munchie %s", munchie); t1 = myHMAC(t0, FALSE); free(t0); -d("toke_n_munchie %s", t1); +//d("toke_n_munchie %s", t1); if (strcmp(t1, toke_n_munchie) != 0) { bitchSession(Rd, "Wrong toke_n_munchie for session.", "HMAC(UUID + munchie) != toke_n_munchie"); @@ -6086,10 +6086,10 @@ d("toke_n_munchie %s", t1); t1 = myHMAC(t0, FALSE); free(t0); toke_n_munchie = t1; -d("toke_n_munchie %s", t1); +//d("toke_n_munchie %s", t1); } t1 = myHMACkey(getStrH(tnm, "salt"), toke_n_munchie, FALSE); -d("hashish %s", t1); +//d("hashish %s", t1); if (strcmp(t1, hashish) != 0) { bitchSession(Rd, "Wrong hashish for session.", "HMAC(toke_n_munchie + salt) != hashish"); @@ -6101,7 +6101,6 @@ d("hashish %s", t1); // TODO - should carefully review all of this, especially the moving of session data to and fro. if (0 == ret) { -W("Validated session."); sesh *shs = &Rd->shs; qstrcpy(shs->leaf, sizeof(shs->leaf), leaf); @@ -6109,9 +6108,10 @@ W("Validated session."); shs->name = tnm->getstr(tnm, "name", true); if (NULL != shs->UUID) free(shs->UUID); shs->UUID = tnm->getstr(tnm, "UUID", true); +I("Validated session for %s.", shs->name); if (linky) { -W("Validated session linky."); +V("Validated session linky."); addStrL(Rd->messages, "Congratulations, you have validated your new account. Now you can log onto the web site."); addStrL(Rd->messages, "NOTE - you wont be able to log onto the grid until your new account has been approved."); Rd->lnk = xzalloc(sizeof(sesh)); @@ -9178,7 +9178,7 @@ t("QUERY"); } else { -T("ignoring QUERY"); +t("ignoring QUERY"); Rd->queries = qhashtbl(0, 0); free(Rd->RUri); Rd->RUri = xmprintf("%s%s", Rd->Script, Rd->Path); -- cgit v1.1