bool env_inherit;
fr_time_delta_t timeout;
bool timeout_is_set;
+ bool xlat_read_binary;
} rlm_exec_t;
static const conf_parser_t module_config[] = {
{ FR_CONF_OFFSET("shell_escape", rlm_exec_t, shell_escape), .dflt = "yes" },
{ FR_CONF_OFFSET("env_inherit", rlm_exec_t, env_inherit), .dflt = "no" },
{ FR_CONF_OFFSET_IS_SET("timeout", FR_TYPE_TIME_DELTA, 0, rlm_exec_t, timeout) },
+ { FR_CONF_OFFSET("xlat_read_binary", rlm_exec_t, xlat_read_binary) },
CONF_PARSER_TERMINATOR
};
xlat_ctx_t const *xctx,
request_t *request, UNUSED fr_value_box_list_t *in)
{
+ rlm_exec_t const *inst = talloc_get_type_abort_const(xctx->mctx->mi->data, rlm_exec_t);
fr_exec_state_t *exec = talloc_get_type_abort(xctx->rctx, fr_exec_state_t);
fr_value_box_t *vb;
MEM(vb = fr_value_box_alloc_null(ctx));
- /*
- * Remove any trailing line endings and trim buffer
- */
- fr_sbuff_trim(&exec->stdout_buff, sbuff_char_line_endings);
- fr_sbuff_trim_talloc(&exec->stdout_buff, SIZE_MAX);
+ if (!inst->xlat_read_binary) {
+ /*
+ * Remove any trailing line endings and trim buffer
+ */
+ fr_sbuff_trim(&exec->stdout_buff, sbuff_char_line_endings);
+ fr_sbuff_trim_talloc(&exec->stdout_buff, SIZE_MAX);
+ }
/*
* Use the buffer for the output vb
*/
- fr_value_box_strdup_shallow(vb, NULL, fr_sbuff_buff(&exec->stdout_buff), true);
+ fr_value_box_bstrndup_shallow(vb, NULL, fr_sbuff_buff(&exec->stdout_buff), fr_sbuff_used(&exec->stdout_buff), true);
fr_dcursor_append(out, vb);