diff options
| author | Thomas E. Dickey <dickey@invisible-island.net> | 2005-10-30 22:00:43 -0500 |
|---|---|---|
| committer | Thomas E. Dickey <dickey@invisible-island.net> | 2005-10-30 22:00:43 -0500 |
| commit | c64d302821eb22d2c3d1269715a0892ddb2bb342 (patch) | |
| tree | 4433aec5c6a84be601c15141bc7c3d0d7dbb8d2d /src | |
| parent | 1876fe93dd4a772ba8a6894f0ba0780b0171a5f2 (diff) | |
| download | lynx-snapshots-c64d302821eb22d2c3d1269715a0892ddb2bb342.tar.gz | |
snapshot of project "lynx", label v2-8-6dev_15
Diffstat (limited to 'src')
| -rw-r--r-- | src/LYCgi.c | 42 | ||||
| -rw-r--r-- | src/LYGetFile.c | 2 |
2 files changed, 39 insertions, 5 deletions
diff --git a/src/LYCgi.c b/src/LYCgi.c index 638543da..1969b227 100644 --- a/src/LYCgi.c +++ b/src/LYCgi.c @@ -149,6 +149,40 @@ static int LYLoadCGI(const char *arg, return -1; } #else +#ifdef LYNXCGI_LINKS +/* + * Wrapper for exec_ok(), confirming with user if the link text is not visible + * in the status line. + */ +static BOOL can_exec_cgi(const char *linktext, const char *linkargs) +{ + const char *format = gettext("Do you want to execute \"%s\"?"); + char *message = NULL; + char *command = NULL; + char *p; + BOOL result = TRUE; + + if (!exec_ok(HTLoadedDocumentURL(), linktext, CGI_PATH)) { + /* exec_ok gives out msg. */ + result = FALSE; + } else if (user_mode < ADVANCED_MODE) { + StrAllocCopy(command, linktext); + if (non_empty(linkargs)) { + HTSprintf(&command, " %s", linkargs); + } + HTUnEscape(command); + for (p = command; *p; ++p) + if (*p == '+') + *p = ' '; + HTSprintf0(&message, format, command); + result = HTConfirm(message); + FREE(message); + FREE(command); + } + return result; +} +#endif /* LYNXCGI_LINKS */ + static int LYLoadCGI(const char *arg, HTParentAnchor *anAnchor, HTFormat format_out, @@ -281,8 +315,7 @@ static int LYLoadCGI(const char *arg, strcmp(arg, HTLoadedDocumentURL()) && HText_AreDifferent(anAnchor, arg) && HTUnEscape(orig_pgm) && - !exec_ok(HTLoadedDocumentURL(), orig_pgm, - CGI_PATH)) { /* exec_ok gives out msg. */ + !can_exec_cgi(orig_pgm, "")) { /* * If we have extra path info and are not just reloading the current, * check the full file path (after unescaping) now to catch forbidden @@ -312,8 +345,7 @@ static int LYLoadCGI(const char *arg, !(reloading && anAnchor->document) && strcmp(arg, HTLoadedDocumentURL()) && HText_AreDifferent(anAnchor, arg) && - !exec_ok(HTLoadedDocumentURL(), pgm, - CGI_PATH)) { /* exec_ok gives out msg. */ + !can_exec_cgi(pgm, pgm_args)) { /* * If we are reloading a lynxcgi document that had already been loaded, * the various checks above should allow it even if exec_ok() would @@ -675,7 +707,7 @@ static int LYLoadCGI(const char *arg, PUTS(buf); HTSprintf0(&buf, - "href=\"http://kcgl1.eng.ohio-state.edu/www/doc/serverinfo.html\"\n"); + "href=\"http://www.ecr6.ohio-state.edu/www/doc/serverinfo.html\"\n"); PUTS(buf); HTSprintf0(&buf, ">%s</a>.\n", gettext("this link")); diff --git a/src/LYGetFile.c b/src/LYGetFile.c index 10e80f04..248ffa17 100644 --- a/src/LYGetFile.c +++ b/src/LYGetFile.c @@ -1474,6 +1474,8 @@ BOOLEAN exec_ok(const char *source, if (strstr(command, "//") == linktext) { command += 2; } + CTRACE((tfp, "comparing source\n\t'%s'\n\t'%s'\n", source, tp->src)); + CTRACE((tfp, "comparing command\n\t'%s'\n\t'%s'\n", command, tp->path)); if (STRNADDRCOMP(source, tp->src, strlen(tp->src)) == 0 && STRNADDRCOMP(command, tp->path, strlen(tp->path)) == 0) return TRUE; |