Skip to content

Commit

Permalink
Make sure that we only set the "have TYPE" flag when the TYPE command…
Browse files Browse the repository at this point in the history
… succeeds.
  • Loading branch information
Castaglia committed Apr 11, 2016
1 parent a15ed1e commit a78920b
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions modules/mod_xfer.c
Expand Up @@ -2618,18 +2618,6 @@ MODRET xfer_type(cmd_rec *cmd) {
return PR_ERROR(cmd);
}

/* Note that the client may NOT be authenticated at this point in time.
* If that is the case, set a flag so that the POST_CMD PASS handler does
* not overwrite the TYPE command's setting.
*
* Alternatively, we COULD bar/reject any TYPE commands before authentication.
* However, I think that doing so would interfere with many existing clients
* which assume that they can send TYPE before authenticating.
*/
if (session.auth_mech == NULL) {
have_type = TRUE;
}

type = pstrdup(cmd->tmp_pool, cmd->argv[1]);
type[0] = toupper(type[0]);

Expand Down Expand Up @@ -2658,6 +2646,18 @@ MODRET xfer_type(cmd_rec *cmd) {
return PR_ERROR(cmd);
}

/* Note that the client may NOT be authenticated at this point in time.
* If that is the case, set a flag so that the POST_CMD PASS handler does
* not overwrite the TYPE command's setting.
*
* Alternatively, we COULD bar/reject any TYPE commands before authentication.
* However, I think that doing so would interfere with many existing clients
* which assume that they can send TYPE before authenticating.
*/
if (session.auth_mech == NULL) {
have_type = TRUE;
}

pr_response_add(R_200, _("Type set to %s"), (char *) cmd->argv[1]);
return PR_HANDLED(cmd);
}
Expand Down

0 comments on commit a78920b

Please sign in to comment.