diff options
author | onefang | 2020-05-21 10:49:15 +1000 |
---|---|---|
committer | onefang | 2020-05-21 10:49:15 +1000 |
commit | 8ee79a1ab2ce374ce0b784866460cfe50c277f11 (patch) | |
tree | d5add4b7387b0538525530e649a3c69f6b6e4d80 | |
parent | Leaks -= (diff) | |
download | opensim-SC-8ee79a1ab2ce374ce0b784866460cfe50c277f11.zip opensim-SC-8ee79a1ab2ce374ce0b784866460cfe50c277f11.tar.gz opensim-SC-8ee79a1ab2ce374ce0b784866460cfe50c277f11.tar.bz2 opensim-SC-8ee79a1ab2ce374ce0b784866460cfe50c277f11.tar.xz |
Clear out some no longer needed stuff.
-rw-r--r-- | src/sledjchisl/sledjchisl.c | 93 |
1 files changed, 2 insertions, 91 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index 59e00ae..537b435 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c | |||
@@ -57,7 +57,6 @@ extern char **environ; | |||
57 | #include <my_global.h> | 57 | #include <my_global.h> |
58 | #include <mysql.h> | 58 | #include <mysql.h> |
59 | 59 | ||
60 | // TODO - audit all the alloc()s and free()s involved in qLibc stuff. | ||
61 | #include <qlibc.h> | 60 | #include <qlibc.h> |
62 | #include <extensions/qconfig.h> | 61 | #include <extensions/qconfig.h> |
63 | 62 | ||
@@ -313,25 +312,6 @@ qhashtbl_t *HTMLfileCache = NULL; | |||
313 | 312 | ||
314 | typedef struct _reqData reqData; | 313 | typedef struct _reqData reqData; |
315 | 314 | ||
316 | /* | ||
317 | typedef int (*fieldValidFunc) (reqData *Rd, qhashtbl_t *data, char *name); | ||
318 | typedef struct _validFunc validFunc; | ||
319 | struct _validFunc | ||
320 | { | ||
321 | char *name, *title; | ||
322 | fieldValidFunc func; | ||
323 | }; | ||
324 | |||
325 | qlisttbl_t *fieldValidFuncs = NULL; | ||
326 | static void newValidFunc(char *name, char *title, fieldValidFunc func) | ||
327 | { | ||
328 | validFunc *vf = xmalloc(sizeof(validFunc)); | ||
329 | vf->name = name; vf->title = title; vf->func = func; | ||
330 | fieldValidFuncs->put(fieldValidFuncs, vf->name, vf, sizeof(validFunc)); | ||
331 | free(vf); | ||
332 | } | ||
333 | */ | ||
334 | |||
335 | typedef void *(*pageFunction) (char *file, reqData *Rd, HTMLfile *thisFile); | 315 | typedef void *(*pageFunction) (char *file, reqData *Rd, HTMLfile *thisFile); |
336 | typedef struct _dynPage dynPage; | 316 | typedef struct _dynPage dynPage; |
337 | struct _dynPage | 317 | struct _dynPage |
@@ -348,23 +328,6 @@ static void newDynPage(char *name, pageFunction func) | |||
348 | free(dp); | 328 | free(dp); |
349 | } | 329 | } |
350 | 330 | ||
351 | /* | ||
352 | typedef void *(*pageBuildFunction) (reqData *Rd, char *message); | ||
353 | typedef struct _buildPage buildPage; | ||
354 | struct _buildPage | ||
355 | { | ||
356 | char *name; | ||
357 | pageBuildFunction func, eFunc; | ||
358 | }; | ||
359 | qhashtbl_t *buildPages; | ||
360 | static void newBuildPage(char *name, pageBuildFunction func, pageBuildFunction eFunc) | ||
361 | { | ||
362 | buildPage *bp = xmalloc(sizeof(buildPage)); | ||
363 | bp->name = name; bp->func = func; bp->eFunc = eFunc; | ||
364 | buildPages->put(buildPages, bp->name, bp, sizeof(buildPage)); | ||
365 | free(bp); | ||
366 | } | ||
367 | */ | ||
368 | 331 | ||
369 | #define HMACSIZE EVP_MAX_MD_SIZE * 2 | 332 | #define HMACSIZE EVP_MAX_MD_SIZE * 2 |
370 | #define HMACSIZE64 88 | 333 | #define HMACSIZE64 88 |
@@ -416,7 +379,6 @@ struct _reqData | |||
416 | gridStats *stats; | 379 | gridStats *stats; |
417 | qlist_t *errors, *messages; | 380 | qlist_t *errors, *messages; |
418 | qgrow_t *reply; | 381 | qgrow_t *reply; |
419 | // pageBuildFunction func; | ||
420 | struct timespec then; | 382 | struct timespec then; |
421 | boolean fromDb; | 383 | boolean fromDb; |
422 | }; | 384 | }; |
@@ -1976,7 +1938,7 @@ my_ulonglong dbCount(MYSQL *db, char *table, char *where) | |||
1976 | perror_msg("Unable to get the time."); | 1938 | perror_msg("Unable to get the time."); |
1977 | double n = (now.tv_sec * 1000000000.0) + now.tv_nsec; | 1939 | double n = (now.tv_sec * 1000000000.0) + now.tv_nsec; |
1978 | double t = (then.tv_sec * 1000000000.0) + then.tv_nsec; | 1940 | double t = (then.tv_sec * 1000000000.0) + then.tv_nsec; |
1979 | T("dbCount(%s) took %lf seconds", sql, (n - t) / 1000000000.0); | 1941 | // T("dbCount(%s) took %lf seconds", sql, (n - t) / 1000000000.0); |
1980 | free(sql); | 1942 | free(sql); |
1981 | return ret; | 1943 | return ret; |
1982 | } | 1944 | } |
@@ -2025,7 +1987,7 @@ my_ulonglong dbCountJoin(MYSQL *db, char *table, char *select, char *join, char | |||
2025 | perror_msg("Unable to get the time."); | 1987 | perror_msg("Unable to get the time."); |
2026 | double n = (now.tv_sec * 1000000000.0) + now.tv_nsec; | 1988 | double n = (now.tv_sec * 1000000000.0) + now.tv_nsec; |
2027 | double t = (then.tv_sec * 1000000000.0) + then.tv_nsec; | 1989 | double t = (then.tv_sec * 1000000000.0) + then.tv_nsec; |
2028 | T("dbCointJoin(%s) took %lf seconds", sql, (n - t) / 1000000000.0); | 1990 | // T("dbCointJoin(%s) took %lf seconds", sql, (n - t) / 1000000000.0); |
2029 | free(sql); | 1991 | free(sql); |
2030 | return ret; | 1992 | return ret; |
2031 | } | 1993 | } |
@@ -4491,8 +4453,6 @@ static int nameValidate(reqData *Rd, inputForm *iF, inputValue *iV) | |||
4491 | unsigned char *name; // We have to be unsigned coz of isalnum(). | 4453 | unsigned char *name; // We have to be unsigned coz of isalnum(). |
4492 | char *where = NULL; | 4454 | char *where = NULL; |
4493 | 4455 | ||
4494 | //d("nameValidate %s", iV->field->name); | ||
4495 | |||
4496 | name = xstrdup(iV->value); | 4456 | name = xstrdup(iV->value); |
4497 | 4457 | ||
4498 | if ((NULL == name) || ('\0' == name[0])) | 4458 | if ((NULL == name) || ('\0' == name[0])) |
@@ -4926,8 +4886,6 @@ static void accountWebHeaders(reqData *Rd, inputForm *oF) //, char *name) | |||
4926 | free(nm); | 4886 | free(nm); |
4927 | } | 4887 | } |
4928 | free(linky); | 4888 | free(linky); |
4929 | // if (NULL != name) | ||
4930 | // Rd->reply->addstrf(Rd->reply, "<h2><!--#echo var=\"grid\" --> account for %s</h2>\n", name); | ||
4931 | if (0 != Rd->errors->size(Rd->messages)) | 4889 | if (0 != Rd->errors->size(Rd->messages)) |
4932 | HTMLlist(Rd->reply, "messages -", Rd->messages); | 4890 | HTMLlist(Rd->reply, "messages -", Rd->messages); |
4933 | if (NULL != oF->help) | 4891 | if (NULL != oF->help) |
@@ -4977,8 +4935,6 @@ static void accountWebFooter(reqData *Rd, inputForm *oF) | |||
4977 | 4935 | ||
4978 | static void accountAddWeb(reqData *Rd, inputForm *oF, inputValue *oV) | 4936 | static void accountAddWeb(reqData *Rd, inputForm *oF, inputValue *oV) |
4979 | { | 4937 | { |
4980 | // char *name = getStrH(Rd->database, "Lua.name"); | ||
4981 | |||
4982 | accountWebHeaders(Rd, oF); | 4938 | accountWebHeaders(Rd, oF); |
4983 | accountWebFields(Rd, oF, oV); | 4939 | accountWebFields(Rd, oF, oV); |
4984 | accountWebSubs(Rd, oF); | 4940 | accountWebSubs(Rd, oF); |
@@ -5017,8 +4973,6 @@ static void accountViewWeb(reqData *Rd, inputForm *oF, inputValue *oV) | |||
5017 | Rd->reply->addstrf(Rd->reply, "<p><font size='5'><span style='font-size: x-large'><b>Email :</b></span></font> %s</p>", email); | 4973 | Rd->reply->addstrf(Rd->reply, "<p><font size='5'><span style='font-size: x-large'><b>Email :</b></span></font> %s</p>", email); |
5018 | Rd->reply->addstrf(Rd->reply, "<p><font size='5'><span style='font-size: x-large'><b>UUID :</b></span></font> %s</p>", getStrH(Rd->database, "UserAccounts.PrincipalID")); | 4974 | Rd->reply->addstrf(Rd->reply, "<p><font size='5'><span style='font-size: x-large'><b>UUID :</b></span></font> %s</p>", getStrH(Rd->database, "UserAccounts.PrincipalID")); |
5019 | Rd->reply->addstrf(Rd->reply, "<p><font size='5'><span style='font-size: x-large'><b>Voucher :</b></span></font> %s</p>", voucher); | 4975 | Rd->reply->addstrf(Rd->reply, "<p><font size='5'><span style='font-size: x-large'><b>Voucher :</b></span></font> %s</p>", voucher); |
5020 | // Rd->reply->addstrf(Rd->reply, "<p><font size='5'><span style='font-size: x-large'><b>About :</b></span></font> </p>" | ||
5021 | // "<textarea readonly >%s</textarea>", qurl_decode(getStrH(Rd->database, "Lua.aboutMe"))); | ||
5022 | HTMLtextArea(Rd->reply, "aboutMe", "About", 7, 50, 4, 16384, "", "off", "true", "soft", about, FALSE, TRUE); | 4976 | HTMLtextArea(Rd->reply, "aboutMe", "About", 7, 50, 4, 16384, "", "off", "true", "soft", about, FALSE, TRUE); |
5023 | accountWebSubs(Rd, oF); | 4977 | accountWebSubs(Rd, oF); |
5024 | accountWebFooter(Rd, oF); | 4978 | accountWebFooter(Rd, oF); |
@@ -5849,11 +5803,6 @@ static int collectFields(reqData *Rd, inputForm *iF, inputValue *iV, int t) | |||
5849 | case 1 : vl = Rd->body-> getstr(Rd->body, obj.name, false); break; | 5803 | case 1 : vl = Rd->body-> getstr(Rd->body, obj.name, false); break; |
5850 | case 2 : vl = Rd->queries->getstr(Rd->queries, obj.name, false); break; | 5804 | case 2 : vl = Rd->queries->getstr(Rd->queries, obj.name, false); break; |
5851 | case 3 : vl = Rd->queries->getstr(Rd->stuff, obj.name, false); break; | 5805 | case 3 : vl = Rd->queries->getstr(Rd->stuff, obj.name, false); break; |
5852 | // Rd->stuff comes from the database reads and calculated stuff, which we do later with this new architecture. The old version validated Rd->stuff as well. | ||
5853 | // It was doing that so we can pick up any UUID, validate it, and read in relevant records. | ||
5854 | // For newbies their UUID was generated during the validation of name. | ||
5855 | // Should still validate that it's long enough and in the correct format, coz that's coming from RD->body sometimes. | ||
5856 | // The rest can happen in the submit functions now. | ||
5857 | default: break; | 5806 | default: break; |
5858 | } | 5807 | } |
5859 | if ((NULL != iV[i].value) && (NULL != vl)) | 5808 | if ((NULL != iV[i].value) && (NULL != vl)) |
@@ -5876,40 +5825,6 @@ static int collectFields(reqData *Rd, inputForm *iF, inputValue *iV, int t) | |||
5876 | return i; | 5825 | return i; |
5877 | } | 5826 | } |
5878 | 5827 | ||
5879 | /* | ||
5880 | void listPage(reqData *Rd, char *message) | ||
5881 | { | ||
5882 | // TODO - should check if the user is a god before allowing this. | ||
5883 | char *name = getStrH(Rd->stuff, "name"), *linky = checkLinky(Rd); | ||
5884 | char *toke_n_munchie = getCookie(Rd->Rcookies, "toke_n_munchie"); | ||
5885 | |||
5886 | HTMLheader(Rd->reply, "<!--#echo var=\"grid\" --> account manager"); | ||
5887 | if (DEBUG) HTMLdebug(Rd->reply); | ||
5888 | Rd->reply->addstrf(Rd->reply, "<h1><!--#echo var=\"grid\" --> account manager</h1>\n"); | ||
5889 | Rd->reply->addstrf(Rd->reply, "<h1><!--#echo var=\"grid\" --> member accounts</h1>\n"); | ||
5890 | Rd->reply->addstr(Rd->reply, linky); | ||
5891 | free(linky); | ||
5892 | if (0 != Rd->errors->size(Rd->messages)) | ||
5893 | HTMLlist(Rd->reply, "messages -", Rd->messages); | ||
5894 | HTMLtable(Rd->reply, Rd->db, | ||
5895 | dbSelect(Rd->db, "UserAccounts", | ||
5896 | "CONCAT(FirstName,' ',LastName) as Name,UserTitle as Title,UserLevel as Level,UserFlags as Flags,PrincipalID as UUID", | ||
5897 | NULL, NULL, "Name"), | ||
5898 | "member accounts", NULL, NULL); | ||
5899 | HTMLform(Rd->reply, "", Rd->shs.munchie); | ||
5900 | HTMLhidden(Rd->reply, "form", "accountExplore"); | ||
5901 | HTMLhidden(Rd->reply, "name", name); | ||
5902 | HTMLhidden(Rd->reply, "UUID", Rd->shs.UUID); | ||
5903 | Rd->reply->addstrf(Rd->reply, "<input type='submit' disabled style='display: none' aria-hidden='true' />\n"); // Stop Enter key on text fields triggering the first submit button. | ||
5904 | HTMLbutton(Rd->reply, "me", "me"); | ||
5905 | HTMLbutton(Rd->reply, "logout", "logout"); | ||
5906 | if (0 != Rd->errors->size(Rd->errors)) | ||
5907 | HTMLlist(Rd->reply, "errors -", Rd->errors); | ||
5908 | Rd->reply->addstrf(Rd->reply, "<p>%s</p>\n", message); | ||
5909 | HTMLfooter(Rd->reply); | ||
5910 | } | ||
5911 | */ | ||
5912 | |||
5913 | 5828 | ||
5914 | void sessionStateEngine(reqData *Rd, char *type) | 5829 | void sessionStateEngine(reqData *Rd, char *type) |
5915 | { | 5830 | { |
@@ -6371,7 +6286,6 @@ static void cleanup(void) | |||
6371 | { | 6286 | { |
6372 | inputForm *f = (inputForm *) obj.data; | 6287 | inputForm *f = (inputForm *) obj.data; |
6373 | 6288 | ||
6374 | //d("%s = %s", obj.name, (char *) obj.data); | ||
6375 | f->subs->free(f->subs); | 6289 | f->subs->free(f->subs); |
6376 | qlisttbl_obj_t fobj; | 6290 | qlisttbl_obj_t fobj; |
6377 | 6291 | ||
@@ -6392,8 +6306,6 @@ static void cleanup(void) | |||
6392 | accountPages = NULL; | 6306 | accountPages = NULL; |
6393 | } | 6307 | } |
6394 | 6308 | ||
6395 | // if (fieldValidFuncs) fieldValidFuncs->free(fieldValidFuncs); | ||
6396 | // if (buildPages) buildPages->free(buildPages); | ||
6397 | if (dynPages) dynPages->free(dynPages); | 6309 | if (dynPages) dynPages->free(dynPages); |
6398 | dynPages = NULL; | 6310 | dynPages = NULL; |
6399 | if (HTMLfileCache) | 6311 | if (HTMLfileCache) |
@@ -7010,7 +6922,6 @@ t("BODY"); | |||
7010 | E("Failed to open %s, it's not a virtual file either", toybuf); | 6922 | E("Failed to open %s, it's not a virtual file either", toybuf); |
7011 | goto sendReply; | 6923 | goto sendReply; |
7012 | } | 6924 | } |
7013 | // I("Dynamic page %s found.", dp->name); | ||
7014 | dp->func(toybuf, Rd, thisFile); | 6925 | dp->func(toybuf, Rd, thisFile); |
7015 | char *finl = Rd->reply->tostring(Rd->reply); // This mallocs new storage and returns it to us. | 6926 | char *finl = Rd->reply->tostring(Rd->reply); // This mallocs new storage and returns it to us. |
7016 | // TODO - maybe cache this? | 6927 | // TODO - maybe cache this? |