aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/sledjchisl/sledjchisl.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c
index 15f8d06..c4126b3 100644
--- a/src/sledjchisl/sledjchisl.c
+++ b/src/sledjchisl/sledjchisl.c
@@ -3289,13 +3289,14 @@ t("Write shs %s", tnm4);
3289 { 3289 {
3290// TODO - Later use libcurl. 3290// TODO - Later use libcurl.
3291 3291
3292 char *uuid = Rd->shs.UUID, *first = getStrH(Rd->stuff, "firstName"), *last = getStrH(Rd->stuff, "lastName"); 3292 char *uuid = Rd->shs.UUID, *first = getStrH(Rd->stuff, "firstName"), *last = getStrH(Rd->stuff, "lastName");
3293// TODO - should be from Rd.shs->linky-hashish 3293// TODO - should be from Rd.shs->linky-hashish
3294 char *t0 = Rd->lnk->hashish, *content, *command; 3294 char *t0 = xstrdup(Rd->lnk->hashish), *content, *command;
3295 3295
3296 if ('\0' != t0[0]) 3296 if ('\0' != t0[0])
3297 { 3297 {
3298 char *t1 = qurl_encode(t0, strlen(t0)); 3298 size_t sz = qhex_decode(t0);
3299 char *t1 = qB64_encode(t0, sz);
3299 3300
3300 content = xmprintf( 3301 content = xmprintf(
3301 "From: grid_no_reply@%s\n" 3302 "From: grid_no_reply@%s\n"
@@ -3343,6 +3344,7 @@ t("Write shs %s", tnm4);
3343 free(file); 3344 free(file);
3344 free(content); 3345 free(content);
3345 free(t1); 3346 free(t1);
3347 free(t0);
3346 } 3348 }
3347 } 3349 }
3348} 3350}
@@ -3555,11 +3557,11 @@ T("new sesh %s %s %s", linky ? "linky" : "session", ret->UUID, ret->name);
3555 hashish = myHMACkey(ret->salt, toke_n_munchie, FALSE); 3557 hashish = myHMACkey(ret->salt, toke_n_munchie, FALSE);
3556 free(toke_n_munchie); 3558 free(toke_n_munchie);
3557 qstrcpy(ret->hashish, sizeof(ret->hashish), hashish); 3559 qstrcpy(ret->hashish, sizeof(ret->hashish), hashish);
3558d("hashish %s", ret->hashish); 3560//d("hashish %s", ret->hashish);
3559 t0 = myHMACkey(getStrH(Rd->configs, "pepper"), hashish, TRUE); 3561 t0 = myHMACkey(getStrH(Rd->configs, "pepper"), hashish, TRUE);
3560 free(hashish); 3562 free(hashish);
3561 qstrcpy(ret->leaf, sizeof(ret->leaf), t0); 3563 qstrcpy(ret->leaf, sizeof(ret->leaf), t0);
3562d("leaf %s", ret->leaf); 3564//d("leaf %s", ret->leaf);
3563 free(t0); 3565 free(t0);
3564 ret->isLinky = linky; 3566 ret->isLinky = linky;
3565 setToken_n_munchie(Rd, linky); 3567 setToken_n_munchie(Rd, linky);
@@ -3651,16 +3653,23 @@ static int sessionValidate(reqData *Rd, inputForm *iF, inputValue *iV)
3651 char *toke_n_munchie = "", *munchie = "", *hashish = "", *leaf = "", *timeStamp = "", *seshion = "", *seshID = "", *t0, *t1; 3653 char *toke_n_munchie = "", *munchie = "", *hashish = "", *leaf = "", *timeStamp = "", *seshion = "", *seshID = "", *t0, *t1;
3652 3654
3653 // In this case the session stuff has to come from specific places. 3655 // In this case the session stuff has to come from specific places.
3654 hashish = getStrH(Rd->queries, "hashish"); 3656 hashish = Rd->queries->getstr(Rd->queries, "hashish", true);
3655//d("O hashish %s", hashish); 3657//d("O hashish %s", hashish);
3656 if ('\0' != hashish[0]) 3658 if (NULL != hashish)
3659 {
3660 char *t = xstrdup(hashish);
3661 size_t sz = qB64_decode(t);
3662
3663 free(hashish);
3664 hashish = qhex_encode(t, sz);
3657 linky = TRUE; 3665 linky = TRUE;
3666 }
3658 else 3667 else
3659 { 3668 {
3660 toke_n_munchie = getStrH(Rd->cookies, "toke_n_munchie"); 3669 toke_n_munchie = getStrH(Rd->cookies, "toke_n_munchie");
3661// munchie = getStrH(Rd->body, "munchie"); 3670// munchie = getStrH(Rd->body, "munchie");
3662 hashish = getStrH(Rd->cookies, "hashish"); 3671 hashish = Rd->cookies->getstr(Rd->cookies, "hashish", true);
3663 if (('\0' == toke_n_munchie[0]) || (('\0' == hashish[0]))) 3672 if (('\0' == toke_n_munchie[0]) || ((NULL == hashish)))
3664 { 3673 {
3665 if (strcmp("logout", Rd->doit) == 0) 3674 if (strcmp("logout", Rd->doit) == 0)
3666 { 3675 {
@@ -3842,6 +3851,7 @@ t("SessionValidate() Lua read %s = %s", n, (char *) obj.data);
3842 } 3851 }
3843 free(leaf); 3852 free(leaf);
3844 tnm->free(tnm); 3853 tnm->free(tnm);
3854 free(hashish);
3845 } 3855 }
3846 3856
3847 return ret; 3857 return ret;
@@ -5675,6 +5685,7 @@ static void cleanup(void)
5675 if (configs) configs->free(configs); 5685 if (configs) configs->free(configs);
5676} 5686}
5677 5687
5688
5678void sledjchisl_main(void) 5689void sledjchisl_main(void)
5679{ 5690{
5680 char *cmd = *toys.optargs; 5691 char *cmd = *toys.optargs;