Mailing List Archive

Setting UserDir to "disabled" doesn't work?
In mod_userdir.c, in the function set_user_dir(), is the negated
string comparison correct?

char *set_user_dir (cmd_parms *cmd, void *dummy, char *arg)
{
void *server_conf = cmd->server->module_config;

if (!strcasecmp (arg, "disabled")) arg = NULL;

set_module_config (server_conf, &userdir_module, pstrdup (cmd->pool, arg));
return NULL;
}

It would seem that if the UserDir argument was set to "disabled",
a NULL pointer would be passed to set_module_config (to disable tilde
expansion of home directories in URL's).
--
Brian Tao <taob@io.org>
System Administrator, Internex Online Inc.
"Though this be madness, yet there is method in't"
Re: Setting UserDir to "disabled" doesn't work? [ In reply to ]
It would seem that if the UserDir argument was set to "disabled",
a NULL pointer would be passed to set_module_config (to disable tilde
expansion of home directories in URL's).

Correct. Reversing the sense of the comparison would cause all arguments
*other* than "disabled" to cause a NULL pointer to be passed. As to the
idiom:

if (!strcasecmp (arg, "disabled")) arg = NULL;

strcasecmp, like strcmp, returns *zero* on equality (-1 for less, +1 for
greater, by ASCII lexical comparison, though strcasecmp() is case insensitive).
Thus, the common idiom when comparing strings for equality:

if (!strcmp(..., "whatever")) ...

which is in all respects equivalent to:

if (strcmp(..., "whatever") != 0) ...

Sheesh.

rst