X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=kernel%2Furp.c;h=4a23bb87f50cc6590c66514328dd95bfd8233e07;hb=6cbe4e189c7fd43512081a6766ab0cb0bf1ed551;hp=5b73f461eb44287ed8b8abfb8bc9475c57f87e22;hpb=282ada9b1d5d1d336ea0b11c2c1c60a6d91f0adf;p=egate.git diff --git a/kernel/urp.c b/kernel/urp.c index 5b73f46..4a23bb8 100644 --- a/kernel/urp.c +++ b/kernel/urp.c @@ -45,7 +45,10 @@ * Europagate, 1995 * * $Log: urp.c,v $ - * Revision 1.35 1995/05/16 09:40:43 adam + * Revision 1.36 1995/05/17 10:51:33 adam + * Added a few more error checks to the show command. + * + * Revision 1.35 1995/05/16 09:40:43 adam * LICENSE. Setting of CCL token names (and/or/not/set) in read_kernel_res. * * Revision 1.34 1995/05/04 10:40:08 adam @@ -695,7 +698,19 @@ static int exec_show (struct ccl_token *list) li = li->next; } else + { + int len = li->len; + memcpy (tmp_str, li->name, len); + tmp_str[len] = '\0'; + if (atoi(tmp_str) <= 0) + { + fprintf (reply_fd, "%s\n", + gw_res_get (info.kernel_res, "gw.err.bad.show", + "Integer expected")); + return -3; + } li = li->next; + } } if (set_token) gw_log (GW_LOG_DEBUG, KERNEL_LOG, "Got set=%.*s", set_token->len, @@ -731,6 +746,15 @@ static int exec_show (struct ccl_token *list) memcpy (tmp_str, li->name, len); tmp_str [len] = '\0'; number = atoi (tmp_str) - offset + 1; + if (number <= 0) + { + fprintf (reply_fd, "%s\n", + gw_res_get (info.kernel_res, + "gw.err.pos.show", + "Starting position " + "greater than ending position")); + return -3; + } } else { @@ -743,7 +767,7 @@ static int exec_show (struct ccl_token *list) } li = li->next; } - else + else if (li->kind == CCL_TOK_TERM) { len = li->len; memcpy (tmp_str, li->name, len); @@ -1103,13 +1127,14 @@ void urp_end (void) mta = gw_res_get (info.kernel_res, "gw.reply.mta", "/usr/lib/sendmail"); sprintf (cmd, "%s %s < %s", mta, info.from_str, info.reply_fname); - +#if 1 mta_code = system (cmd); if (mta_code) gw_log (GW_LOG_FATAL, KERNEL_LOG, "Reply '%s' got exit code %d", cmd, mta_code); else unlink (info.reply_fname); +#endif gw_log (GW_LOG_ACCT, KERNEL_LOG, "User end %s", info.from_str); } }