[BUILD] auth: don't use unnamed unions

unnamed unions are not compatible with older compilers (eg: gcc 2.95) so
name it "u" instead.
This commit is contained in:
Willy Tarreau 2010-02-02 11:28:20 +01:00
parent b05613d72b
commit b4c06b7be6
3 changed files with 11 additions and 13 deletions

View File

@ -36,12 +36,10 @@ struct req_acl_rule {
struct list list; struct list list;
struct acl_cond *cond; /* acl condition to meet */ struct acl_cond *cond; /* acl condition to meet */
unsigned int action; unsigned int action;
union {
struct { struct {
char *realm; char *realm;
} http_auth; } http_auth;
}; };
};
struct auth_users { struct auth_users {
struct auth_users *next; struct auth_users *next;
@ -50,7 +48,7 @@ struct auth_users {
union { union {
char *groups; char *groups;
unsigned int group_mask; unsigned int group_mask;
}; } u;
}; };
struct userlist { struct userlist {

View File

@ -208,7 +208,7 @@ check_user(struct userlist *ul, unsigned int group_mask, const char *user, const
* if user matches but group does not, * if user matches but group does not,
* it makes no sens to check passwords * it makes no sens to check passwords
*/ */
if (group_mask && !(group_mask & u->group_mask)) if (group_mask && !(group_mask & u->u.group_mask))
return 0; return 0;
if (!(u->flags & AU_O_INSECURE)) { if (!(u->flags & AU_O_INSECURE)) {

View File

@ -4223,7 +4223,7 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm)
cur_arg += 2; cur_arg += 2;
continue; continue;
} else if (!strcmp(args[cur_arg], "groups")) { } else if (!strcmp(args[cur_arg], "groups")) {
newuser->groups = strdup(args[cur_arg + 1]); newuser->u.groups = strdup(args[cur_arg + 1]);
cur_arg += 2; cur_arg += 2;
continue; continue;
} else { } else {
@ -5110,10 +5110,10 @@ out_uri_auth_compat:
unsigned int group_mask = 0; unsigned int group_mask = 0;
char *group = NULL; char *group = NULL;
if (!curuser->groups) if (!curuser->u.groups)
continue; continue;
while ((group = strtok(group?NULL:curuser->groups, ","))) { while ((group = strtok(group?NULL:curuser->u.groups, ","))) {
for (g = 0; g < curuserlist->grpcnt; g++) for (g = 0; g < curuserlist->grpcnt; g++)
if (!strcmp(curuserlist->groups[g], group)) if (!strcmp(curuserlist->groups[g], group))
@ -5129,8 +5129,8 @@ out_uri_auth_compat:
group_mask |= (1 << g); group_mask |= (1 << g);
} }
free(curuser->groups); free(curuser->u.groups);
curuser->group_mask = group_mask; curuser->u.group_mask = group_mask;
} }
for (g = 0; g < curuserlist->grpcnt; g++) { for (g = 0; g < curuserlist->grpcnt; g++) {
@ -5151,7 +5151,7 @@ out_uri_auth_compat:
goto out; goto out;
} }
curuser->group_mask |= (1 << g); curuser->u.group_mask |= (1 << g);
} }
free(curuserlist->groupusers[g]); free(curuserlist->groupusers[g]);