Skip to content

Commit

Permalink
Merge pull request #339 from LocutusOfBorg/fix-338
Browse files Browse the repository at this point in the history
Fixed issue #338, by adding more descriptive warning messages
  • Loading branch information
LocutusOfBorg committed Sep 20, 2013
2 parents f8841aa + 699d3ec commit a884011
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
22 changes: 16 additions & 6 deletions plug-ins/sslstrip/sslstrip.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,10 @@ static int http_insert_redirect(u_int16 dport)
char **param = NULL;

if (GBL_CONF->redir_command_on == NULL)
{
USER_MSG("SSLStrip: cannot setup the redirect, did you uncomment the redir_command_on command on your etter.conf file?");
return -EFATAL;

}
snprintf(asc_dport, 16, "%u", dport);

command = strdup(GBL_CONF->redir_command_on);
Expand All @@ -486,7 +488,9 @@ static int http_insert_redirect(u_int16 dport)
switch(fork()) {
case 0:
execvp(param[0], param);
break;
WARN_MSG("Cannot setup http redirect (command: %s), please edit your etter.conf file and put a valid value in redir_command_on field\n", param[0]);
safe_free_http_redirect(param, &param_length, command, orig_command);
_exit(EINVALID);
case -1:
safe_free_http_redirect(param, &param_length, command, orig_command);
return -EINVALID;
Expand All @@ -512,8 +516,12 @@ static int http_remove_redirect(u_int16 dport)
char *command, *orig_command, *p;
char **param = NULL;


if (GBL_CONF->redir_command_off == NULL)
return -EFATAL;
{
USER_MSG("SSLStrip: cannot remove the redirect, did you uncomment the redir_command_off command on your etter.conf file?");
return -EFATAL;
}

snprintf(asc_dport, 16, "%u", dport);

Expand All @@ -539,9 +547,11 @@ static int http_remove_redirect(u_int16 dport)
param_length= i + 1; //because there is a SAFE_REALLOC after the for.

switch(fork()) {
case 0:
execvp(param[0], param);
break;
case 0:
execvp(param[0], param);
WARN_MSG("Cannot remove http redirect (command: %s), please edit your etter.conf file and put a valid value in redir_command_on field\n", param[0]);
safe_free_http_redirect(param, &param_length, command, orig_command);
_exit(EINVALID);
case -1:
safe_free_http_redirect(param, &param_length, command, orig_command);
return -EINVALID;
Expand Down
11 changes: 9 additions & 2 deletions src/ec_sslwrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,10 @@ static int sslw_insert_redirect(u_int16 sport, u_int16 dport)

/* the script is not defined */
if (GBL_CONF->redir_command_on == NULL)
{
USER_MSG("SSLStrip: cannot setup the redirect, did you uncomment the redir_command_on command on your etter.conf file?");
return -EFATAL;

}
snprintf(asc_sport, 16, "%u", sport);
snprintf(asc_dport, 16, "%u", dport);

Expand Down Expand Up @@ -427,6 +429,7 @@ static int sslw_insert_redirect(u_int16 sport, u_int16 dport)
switch (fork()) {
case 0:
execvp(param[0], param);
WARN_MSG("Cannot setup http redirect (command: %s), please edit your etter.conf file and put a valid value in redir_command_on field\n", param[0]);
safe_free_mem(param, &param_length, command);
_exit(EINVALID);
case -1:
Expand Down Expand Up @@ -456,8 +459,11 @@ static int sslw_remove_redirect(u_int16 sport, u_int16 dport)

/* the script is not defined */
if (GBL_CONF->redir_command_off == NULL)
{
USER_MSG("SSLStrip: cannot remove the redirect, did you uncomment the redir_command_off command on your etter.conf file?");
return -EFATAL;

}

snprintf(asc_sport, 16, "%u", sport);
snprintf(asc_dport, 16, "%u", dport);

Expand Down Expand Up @@ -491,6 +497,7 @@ static int sslw_remove_redirect(u_int16 sport, u_int16 dport)
switch (fork()) {
case 0:
execvp(param[0], param);
WARN_MSG("Cannot remove http redirect (command: %s), please edit your etter.conf file and put a valid value in redir_command_on field\n", param[0]);
safe_free_mem(param, &param_length, command);
_exit(EINVALID);
case -1:
Expand Down

0 comments on commit a884011

Please sign in to comment.