]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUILD] auth: don't use unnamed unions
authorWilly Tarreau <w@1wt.eu>
Tue, 2 Feb 2010 10:28:20 +0000 (11:28 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 2 Feb 2010 10:28:20 +0000 (11:28 +0100)
unnamed unions are not compatible with older compilers (eg: gcc 2.95) so
name it "u" instead.

include/types/auth.h
src/auth.c
src/cfgparse.c

index d278de6b89a4e139ba85ca54ae2deaded008a596..f7e3dd641d90d5beb6deb7ea08b5b531a56f01bb 100644 (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 {
index 4740ca436149426aeb84ff8e10f746169bd341ec..93af8d68cce922d64400d1a5fe6d5bdd72a6d887 100644 (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)) {
index a30a88766e5d7b5f8926712fcd93b90b460ff843..0b165e6115fca83a78820d02e7f43058c1c1e5b7 100644 (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]);