*/
static char *unset = "; expires=28-May-1971 18:10:00 GMT";
-/**
+/**
* \brief remove escaped strings from i.e. the url string (like %20 for blanks)
* \param buf the buffer to examine
*/
* \param nbsp If nonzero, spaces are converted to non-breaking spaces.
* \param nolinebreaks if set, linebreaks are removed from the string.
*/
-void stresc(char *target, char *strbuf, int nbsp, int nolinebreaks)
+long stresc(char *target, long tSize, char *strbuf, int nbsp, int nolinebreaks)
{
- char *aptr, *bptr;
+ char *aptr, *bptr, *eptr;
*target = '\0';
aptr = strbuf;
bptr = target;
+ eptr = target + tSize - 6; // our biggest unit to put in...
- while (!IsEmptyStr(aptr) ){
+ while ((bptr < eptr) && !IsEmptyStr(aptr) ){
if (*aptr == '<') {
memcpy(bptr, "<", 4);
bptr += 4;
bptr += 6;
}
else if ((*aptr == '\n') && (nolinebreaks)) {
- strcat(bptr, ""); /* nothing */
+ *bptr='\0'; /* nothing */
}
else if ((*aptr == '\r') && (nolinebreaks)) {
- strcat(bptr, ""); /* nothing */
+ *bptr='\0'; /* nothing */
}
else{
*bptr = *aptr;
aptr ++;
}
*bptr = '\0';
+ if ((bptr = eptr - 1 ) && !IsEmptyStr(aptr) )
+ return -1;
+ return (bptr - target);
}
/**
void escputs1(char *strbuf, int nbsp, int nolinebreaks)
{
char *buf;
+ long Siz;
if (strbuf == NULL) return;
- buf = malloc( (3 * strlen(strbuf)) + SIZ );
- stresc(buf, strbuf, nbsp, nolinebreaks);
+ Siz = (3 * strlen(strbuf)) + SIZ ;
+ buf = malloc(Siz);
+ stresc(buf, Siz, strbuf, nbsp, nolinebreaks);
wprintf("%s", buf);
free(buf);
}
outbuf = malloc( buflen);
outbuf2 = malloc( buflen);
msgesc(outbuf, strbuf);
- stresc(outbuf2, outbuf, 0, 0);
+ stresc(outbuf2, buflen, outbuf, 0, 0);
wprintf("%s", outbuf2);
free(outbuf);
free(outbuf2);
url_do_template();
} else if (!strcasecmp(action, "display_aide_menu")) {
display_aide_menu();
+ } else if (!strcasecmp(action, "server_shutdown")) {
+ display_shutdown();
} else if (!strcasecmp(action, "display_main_menu")) {
display_main_menu();
} else if (!strcasecmp(action, "who")) {
begin_ajax_response();
calendar_section();
end_ajax_response();
+ } else if (!strcasecmp(action, "mini_calendar")) {
+ begin_ajax_response();
+ ajax_mini_calendar();
+ end_ajax_response();
} else if (!strcasecmp(action, "iconbar_ajax_menu")) {
begin_ajax_response();
do_iconbar();
display_sieve();
} else if (!strcasecmp(action, "save_sieve")) {
save_sieve();
+ } else if (!strcasecmp(action, "display_pushemail")) {
+ display_pushemail();
+ } else if (!strcasecmp(action, "save_pushemail")) {
+ save_pushemail();
} else if (!strcasecmp(action, "display_add_remove_scripts")) {
display_add_remove_scripts(NULL);
} else if (!strcasecmp(action, "create_script")) {