[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,11 +36,9 @@ struct req_acl_rule {
struct list list;
struct acl_cond *cond; /* acl condition to meet */
unsigned int action;
union {
struct {
char *realm;
} http_auth;
};
struct {
char *realm;
} http_auth;
};
struct auth_users {
@ -50,7 +48,7 @@ struct auth_users {
union {
char *groups;
unsigned int group_mask;
};
} u;
};
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,
* 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;
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;
continue;
} 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;
continue;
} else {
@ -5110,10 +5110,10 @@ out_uri_auth_compat:
unsigned int group_mask = 0;
char *group = NULL;
if (!curuser->groups)
if (!curuser->u.groups)
continue;
while ((group = strtok(group?NULL:curuser->groups, ","))) {
while ((group = strtok(group?NULL:curuser->u.groups, ","))) {
for (g = 0; g < curuserlist->grpcnt; g++)
if (!strcmp(curuserlist->groups[g], group))
@ -5129,8 +5129,8 @@ out_uri_auth_compat:
group_mask |= (1 << g);
}
free(curuser->groups);
curuser->group_mask = group_mask;
free(curuser->u.groups);
curuser->u.group_mask = group_mask;
}
for (g = 0; g < curuserlist->grpcnt; g++) {
@ -5151,7 +5151,7 @@ out_uri_auth_compat:
goto out;
}
curuser->group_mask |= (1 << g);
curuser->u.group_mask |= (1 << g);
}
free(curuserlist->groupusers[g]);