#include <haproxy/server-t.h>
#include <haproxy/tcpcheck-t.h>
#include <haproxy/thread-t.h>
+#include <haproxy/uri_auth-t.h>
/* values for proxy->state */
enum pr_state {
#include <haproxy/api.h>
#include <haproxy/applet.h>
#include <haproxy/arg.h>
+#include <haproxy/auth.h>
#include <haproxy/cfgparse.h>
#include <haproxy/channel.h>
#include <haproxy/cli.h>
int min_arg;
int i, idx;
struct proxy *px;
+ struct userlist *ul;
const char *msg = NULL;
char *sname, *pname;
argp[idx].type = ARGT_MSK6;
break;
- case ARGT_MAP:
- case ARGT_REG:
case ARGT_USR:
- msg = "type not yet supported";
- goto error;
+ if (argp[idx].type != ARGT_STR) {
+ msg = "string expected";
+ goto error;
+ }
+ if (p->uri_auth && p->uri_auth->userlist &&
+ !strcmp(p->uri_auth->userlist->name, argp[idx].data.str.area))
+ ul = p->uri_auth->userlist;
+ else
+ ul = auth_find_userlist(argp[idx].data.str.area);
+
+ if (!ul) {
+ msg = lua_pushfstring(L, "unable to find userlist '%s'", argp[idx].data.str.area);
+ goto error;
+ }
+ argp[idx].type = ARGT_USR;
+ argp[idx].data.usr = ul;
break;
case ARGT_STR:
argp[idx].data.str = tmp;
break;
+ case ARGT_MAP:
+ case ARGT_REG:
+ msg = "type not yet supported";
+ goto error;
+ break;
+
}
/* Check for type of argument. */