diff options
author | onefang | 2020-03-18 23:41:08 +1000 |
---|---|---|
committer | onefang | 2020-03-18 23:41:08 +1000 |
commit | 2c1c17b16f731c75cbc120fa0ff9f1c3e688d4f4 (patch) | |
tree | d1543dfe2ecd7625b9bf87867f388f34926291a3 /src/sledjchisl/sledjchisl.c | |
parent | Some log message tweaks. (diff) | |
download | opensim-SC_OLD-2c1c17b16f731c75cbc120fa0ff9f1c3e688d4f4.zip opensim-SC_OLD-2c1c17b16f731c75cbc120fa0ff9f1c3e688d4f4.tar.gz opensim-SC_OLD-2c1c17b16f731c75cbc120fa0ff9f1c3e688d4f4.tar.bz2 opensim-SC_OLD-2c1c17b16f731c75cbc120fa0ff9f1c3e688d4f4.tar.xz |
Include all stuff in a session file.
Diffstat (limited to 'src/sledjchisl/sledjchisl.c')
-rw-r--r-- | src/sledjchisl/sledjchisl.c | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index 5d14eb1..06c6187 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c | |||
@@ -2811,37 +2811,49 @@ static void setToken_n_munchie(reqData *Rd, boolean linky) | |||
2811 | cookie *ck = setCookie(Rd, "toke_n_munchie", shs->toke_n_munchie); | 2811 | cookie *ck = setCookie(Rd, "toke_n_munchie", shs->toke_n_munchie); |
2812 | cookie *ckh = setCookie(Rd, "hashish", shs->hashish); | 2812 | cookie *ckh = setCookie(Rd, "hashish", shs->hashish); |
2813 | } | 2813 | } |
2814 | char *tnm = xmprintf( "toke_n_munchie = \n" | 2814 | char *tnm0 = xmprintf( "toke_n_munchie = \n" |
2815 | "{\n" | 2815 | "{\n" |
2816 | " ['IP']='%s',\n" | 2816 | " ['IP']='%s',\n" |
2817 | " ['name']='%s',\n" | ||
2818 | " ['level']='%s',\n" | ||
2819 | " ['passwordSalt']='%s',\n" | ||
2820 | " ['passwordHash']='%s',\n" | ||
2821 | " ['salt']='%s',\n" | 2817 | " ['salt']='%s',\n" |
2822 | " ['seshID']='%s',\n" | 2818 | " ['seshID']='%s',\n" |
2823 | " ['UUID']='%s',\n" | 2819 | " ['linky-hashishy']='%s',\n", |
2824 | " ['linky-hashish']='%s',\n" | ||
2825 | "}\n" | ||
2826 | "return toke_n_munchie\n", | ||
2827 | getStrH(Rd->headers, "REMOTE_ADDR"), | 2820 | getStrH(Rd->headers, "REMOTE_ADDR"), |
2828 | getStrH(Rd->stuff, "name"), | ||
2829 | getStrH(Rd->stuff, "level"), | ||
2830 | getStrH(Rd->stuff, "passwordSalt"), | ||
2831 | getStrH(Rd->stuff, "passwordHash"), | ||
2832 | shs->salt, | 2821 | shs->salt, |
2833 | shs->seshID, | 2822 | shs->seshID, |
2834 | getStrH(Rd->stuff, "UUID"), | ||
2835 | link | 2823 | link |
2836 | ); | 2824 | ); |
2825 | char *tnm1 = xmprintf("}\n" | ||
2826 | "return toke_n_munchie\n"); | ||
2837 | int fd = notstdio(xcreate_stdio(file, O_CREAT | O_WRONLY | O_TRUNC | O_CLOEXEC, S_IRUSR | S_IWUSR)); | 2827 | int fd = notstdio(xcreate_stdio(file, O_CREAT | O_WRONLY | O_TRUNC | O_CLOEXEC, S_IRUSR | S_IWUSR)); |
2838 | size_t l = strlen(tnm); | 2828 | size_t l = strlen(tnm0); |
2839 | 2829 | ||
2840 | if (s) | 2830 | if (s) |
2841 | I("Creating session %s.", file); | 2831 | I("Creating session %s.", file); |
2842 | else | 2832 | else |
2843 | C("Updating session %s.", file); // I don't think updates can occur now. | 2833 | C("Updating session %s.", file); // I don't think updates can occur now. |
2844 | if (l != writeall(fd, tnm, l)) | 2834 | if (l != writeall(fd, tnm0, l)) |
2835 | { | ||
2836 | perror_msg("Writing %s", file); | ||
2837 | freeSesh(Rd, linky, TRUE); | ||
2838 | } | ||
2839 | |||
2840 | qhashtbl_obj_t obj; | ||
2841 | |||
2842 | memset((void*)&obj, 0, sizeof(obj)); | ||
2843 | Rd->stuff->lock(Rd->stuff); | ||
2844 | while(Rd->stuff->getnext(Rd->stuff, &obj, false) == true) | ||
2845 | { | ||
2846 | t("stuff %s = %s", obj.name, (char *) obj.data); | ||
2847 | if (dprintf(fd, " ['%s'] = '%s',\n", obj.name, (char *) obj.data) < 0) | ||
2848 | { | ||
2849 | perror_msg("Writing %s", file); | ||
2850 | freeSesh(Rd, linky, TRUE); | ||
2851 | } | ||
2852 | } | ||
2853 | Rd->stuff->unlock(Rd->stuff); | ||
2854 | |||
2855 | l = strlen(tnm1); | ||
2856 | if (l != writeall(fd, tnm1, l)) | ||
2845 | { | 2857 | { |
2846 | perror_msg("Writing %s", file); | 2858 | perror_msg("Writing %s", file); |
2847 | freeSesh(Rd, linky, TRUE); | 2859 | freeSesh(Rd, linky, TRUE); |