I think there is a bug in rlm_exec.c.
The logic, if I am correct, is that input_pairs cannot be NULL, but since
the server
spawns the exec module and does wait for the child process to terminate if
wait = no,
therefore, the output_pairs MUST be NULL.
In rlm_exec.c, exec_instantiate() function, the following logic shows the
above statement:
...
/*
* No input pairs defined. Why are we executing a program?
*/
if (!inst->input) {
radlog(L_ERR, "rlm_exec: Must define input pairs for external
program.");
exec_detach(inst);
return -1;
}
/*
* Sanity check the config. If we're told to NOT wait,
* then the output pairs must not be defined.
*/
if (!inst->wait &&
(inst->output != NULL)) {
radlog(L_ERR, "rlm_exec: Cannot read output pairs if wait=no");
exec_detach(inst);
return -1;
}
...
But in CONFIG_PARSER, the default value of output_pairs is set to "reply",
as shown
below.
static CONF_PARSER module_config[] = {
{ "wait", PW_TYPE_BOOLEAN, offsetof(rlm_exec_t,wait), NULL, "yes" },
{ "program", PW_TYPE_STRING_PTR,
offsetof(rlm_exec_t,program), NULL, NULL },
{ "input_pairs", PW_TYPE_STRING_PTR,
offsetof(rlm_exec_t,input), NULL, "request" },
{ "output_pairs", PW_TYPE_STRING_PTR,
offsetof(rlm_exec_t,output), NULL, "reply" },
{ "packet_type", PW_TYPE_STRING_PTR,
offsetof(rlm_exec_t,packet_type), NULL, NULL },
{ NULL, -1, 0, NULL, NULL } /* end the list */
};
That means no matter what you do, you can never make output_pairs NULL, i.e.
if you comment it out, the default value "reply" takes place. Even if you
put "",
the parser still does not construct the inst->output to NULL.
which implies that the 'wait=no' condition can never be reached.
Am I missing something?
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Alex Chen
> Sent: Wednesday, September 24, 2003 4:30 PM
> To: FreeRADIUS Users (E-mail)
> Subject: The exec module
>
>
> I am trying to use the 'exec' module to do some house keeping work. I
> encounter a
> problem and would appreciate it if someone can help me.
>
> When I define an 'exec'module like the following, the server would not
> start.
> exec ext_perl {
> wait = no
> program = "${prefix}/bin/ext_perl"
> input_pairs = request
> #output_pairs = reply
> packet_type = Access-Accept
> }
>
> The error message I got was
> Module: Loaded exec
> exec: wait = no
> exec: program = "/usr/local/bin/ext_perl"
> exec: input_pairs = "request"
> exec: output_pairs = "reply"
> exec: packet_type = "Access-Accept"
> rlm_exec: Cannot read output pairs if wait=no
>
> It seems that even if I comment out the 'output_pairs', the
> server still
> uses "reply" as the
> value and thus fails to pass the logic check.
>
> What kind of setting should I use so that the server can just
> launch the
> exec and does not
> wait for it to return anything? Apparently comment out the
> 'output_pair' did
> not do the trick.
> I also tried to set output_pairs="" or output_pair=null, none worked.
>
>
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html