Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

Determining need for authentication from Application

Russ Allbery eagle at windlord.stanford.edu
Thu Jan 20 16:51:52 PST 2011


niklas | brueckenschlaeger <niklas at brueckenschlaeger.de> writes:

> Ok, I've given this a try.

> I did the following:
> * Defined some constants:
>   #define CD_WebAuthOptional "WebAuthOptional"
>   #define CM_WebAuthOptional \
>     "Make authentication optional for the current directory"

> * Added E_WebAuthOptional all the way in the bottom of the "enum for
> config directives"

> * Added this to cmds:
>   DFLAG(CD_WebAuthOptional, E_WebAuthOptional, CM_WebAuthOptional)

> * Added to typedef struct {} MWA_DCONF:
>   int web_auth_optional;
>   /* I don't really understand why this is needed, but all flags use
>    * it, so I thought I'd play along */
>   int web_auth_optional_ex; 

It's a flag indicating whether that configuration option was set
explicitly.

> * In cfg_flag(cmd_parms*, void*, int flag) I added to the big switch:
>   case E_WebAuthOptional:
>     dconf->web_auth_optional = flag;
>     dconf->web_auth_optional_ex = 1;
>     break;

Everything above looks good.

> With this configuration, the logging from "cmd_flag" tells me that
> dconf->web_auth_optional and dconf->web_auth_optional_ex both == 1, but
> from gather_tokens they are always 0.

> Am I missing anything important here?

You probably need to add the option to config_dir_merge().  I suspect that
it's getting merged with something else that doesn't have it and the
merged configuration doesn't have it set since that function doesn't
handle it.

Just:

    conf->web_auth_optional = oconf->web_auth_optional_ex ?
        oconf->web_auth_optional : bconf->web_auth_optional;
    conf->web_auth_optional_ex = oconf->web_auth_optional_ex || 
        bconf->web_auth_optional_ex;

should do it, I think.

-- 
Russ Allbery <eagle at windlord.stanford.edu>
Technical Lead, ITS Infrastructure Delivery Group, Stanford University



More information about the webauth-info mailing list