]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Code should always execute. WARNings are always emitted, and code applies fixup...
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 4 Jan 2019 07:07:19 +0000 (15:07 +0800)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 4 Jan 2019 07:30:34 +0000 (15:30 +0800)
src/modules/rlm_files/rlm_files.c

index 9756f1d9cc110226b128a0714a0170a2a08aff6a..0131f73955df22d91ecdaaa7cec02c97e70c8e04 100644 (file)
@@ -121,6 +121,7 @@ static int pairlist_cmp(void const *a, void const *b)
 static int getusersfile(TALLOC_CTX *ctx, char const *filename, rbtree_t **ptree)
 {
        int rcode;
+       VALUE_PAIR *vp;
        PAIR_LIST *users = NULL;
        PAIR_LIST *entry, *next;
        PAIR_LIST *user_list, *default_list, **default_tail;
@@ -137,77 +138,73 @@ static int getusersfile(TALLOC_CTX *ctx, char const *filename, rbtree_t **ptree)
        }
 
        /*
-        *      Walk through the 'users' file list, if we're debugging.
+        *      Walk through the 'users' file list
         */
-       if (rad_debug_lvl) {
-               VALUE_PAIR *vp;
-
-               entry = users;
-               while (entry) {
-                       fr_cursor_t cursor;
+       entry = users;
+       while (entry) {
+               fr_cursor_t cursor;
 
+               /*
+                *      Look for improper use of '=' in the
+                *      check items.  They should be using
+                *      '==' for on-the-wire RADIUS attributes,
+                *      and probably ':=' for server
+                *      configuration items.
+                */
+               for (vp = fr_cursor_init(&cursor, &entry->check);
+                    vp;
+                    vp = fr_cursor_next(&cursor)) {
                        /*
-                        *      Look for improper use of '=' in the
-                        *      check items.  They should be using
-                        *      '==' for on-the-wire RADIUS attributes,
-                        *      and probably ':=' for server
-                        *      configuration items.
+                        *      Ignore attributes which are set
+                        *      properly.
                         */
-                       for (vp = fr_cursor_init(&cursor, &entry->check);
-                            vp;
-                            vp = fr_cursor_next(&cursor)) {
-                               /*
-                                *      Ignore attributes which are set
-                                *      properly.
-                                */
-                               if (vp->op != T_OP_EQ) {
-                                       continue;
-                               }
-
-                               /*
-                                *      If it's a vendor attribute,
-                                *      or it's a wire protocol,
-                                *      ensure it has '=='.
-                                */
-                               if ((fr_dict_vendor_num_by_da(vp->da) != 0) ||
-                                   (vp->da->attr < 0x100)) {
-                                       WARN("[%s]:%d Changing '%s =' to '%s =='\n\tfor comparing RADIUS attribute in check item list for user %s",
-                                            filename, entry->lineno,
-                                            vp->da->name, vp->da->name,
-                                            entry->name);
-                                       vp->op = T_OP_CMP_EQ;
-                                       continue;
-                               }
-                       } /* end of loop over check items */
+                       if (vp->op != T_OP_EQ) {
+                               continue;
+                       }
 
                        /*
-                        *      Look for server configuration items
-                        *      in the reply list.
-                        *
-                        *      It's a common enough mistake, that it's
-                        *      worth doing.
+                        *      If it's a vendor attribute,
+                        *      or it's a wire protocol,
+                        *      ensure it has '=='.
                         */
-                       for (vp = fr_cursor_init(&cursor, &entry->reply);
-                            vp;
-                            vp = fr_cursor_next(&cursor)) {
-                               /*
-                                *      If it's NOT a vendor attribute,
-                                *      and it's NOT a wire protocol
-                                *      and we ignore Fall-Through,
-                                *      then bitch about it, giving a
-                                *      good warning message.
-                                */
-                                if (fr_dict_attr_is_top_level(vp->da) && (vp->da->attr > 1000)) {
-                                       WARN("[%s]:%d Check item \"%s\"\n"
-                                              "\tfound in reply item list for user \"%s\".\n"
-                                              "\tThis attribute MUST go on the first line"
-                                              " with the other check items", filename, entry->lineno, vp->da->name,
-                                              entry->name);
-                               }
+                       if ((fr_dict_vendor_num_by_da(vp->da) != 0) ||
+                           (vp->da->attr < 0x100)) {
+                               WARN("[%s]:%d Changing '%s =' to '%s =='\n\tfor comparing RADIUS attribute in check item list for user %s",
+                                    filename, entry->lineno,
+                                    vp->da->name, vp->da->name,
+                                    entry->name);
+                               vp->op = T_OP_CMP_EQ;
+                               continue;
                        }
+               } /* end of loop over check items */
 
-                       entry = entry->next;
+               /*
+                *      Look for server configuration items
+                *      in the reply list.
+                *
+                *      It's a common enough mistake, that it's
+                *      worth doing.
+                */
+               for (vp = fr_cursor_init(&cursor, &entry->reply);
+                    vp;
+                    vp = fr_cursor_next(&cursor)) {
+                       /*
+                        *      If it's NOT a vendor attribute,
+                        *      and it's NOT a wire protocol
+                        *      and we ignore Fall-Through,
+                        *      then bitch about it, giving a
+                        *      good warning message.
+                        */
+                        if (fr_dict_attr_is_top_level(vp->da) && (vp->da->attr > 1000)) {
+                               WARN("[%s]:%d Check item \"%s\"\n"
+                                      "\tfound in reply item list for user \"%s\".\n"
+                                      "\tThis attribute MUST go on the first line"
+                                      " with the other check items", filename, entry->lineno, vp->da->name,
+                                      entry->name);
+                       }
                }
+
+               entry = entry->next;
        }
 
        tree = rbtree_create(ctx, pairlist_cmp, NULL, RBTREE_FLAG_NONE);