From b4c06b7be64c9578ef075b8d4f28bbce44d59052 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 2 Feb 2010 11:28:20 +0100 Subject: [PATCH] [BUILD] auth: don't use unnamed unions unnamed unions are not compatible with older compilers (eg: gcc 2.95) so name it "u" instead. --- include/types/auth.h | 10 ++++------ src/auth.c | 2 +- src/cfgparse.c | 12 ++++++------ 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/include/types/auth.h b/include/types/auth.h index d278de6b8..f7e3dd641 100644 --- a/include/types/auth.h +++ b/include/types/auth.h @@ -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 { diff --git a/src/auth.c b/src/auth.c index 4740ca436..93af8d68c 100644 --- a/src/auth.c +++ b/src/auth.c @@ -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)) { diff --git a/src/cfgparse.c b/src/cfgparse.c index a30a88766..0b165e611 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -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]);