~yolanda.robla/ubuntu/saucy/freeradius/dep-8-tests

« back to all changes in this revision

Viewing changes to src/main/realms.c

  • Committer: Bazaar Package Importer
  • Author(s): Josip Rodin
  • Date: 2010-10-14 21:51:51 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20101014215151-po7jgf8lyf0zq5ht
Tags: 2.1.10+dfsg-1
* New upstream version, closes a bunch of reproducible SNAFUs,
  including two tagged as security issues, CVE-2010-3696, CVE-2010-3697,
  closes: #600176.
* Build-depend on newer Libtool because of lt_dladvise_init(), also
  upstream now has a configure check so we no longer need a patch,
  yet we still don't want the old behaviour. Noticed by John Morrissey,
  closes: #584151.
* Added the /etc/default/freeradius file as suggested by
  Rudy Gevaert and Matthew Newton, closes: #564716.
* Stop symlinking /dev/urandom into /etc/freeradius/certs/random,
  it breaks grep -r in /etc. Instead, replace it inside eap.conf,
  both in the new shipped conffile and in postinst.

Show diffs side-by-side

added added

removed removed

Lines of Context:
355
355
};
356
356
 
357
357
 
 
358
static void null_free(UNUSED void *data)
 
359
{
 
360
}
 
361
 
358
362
static int home_server_add(realm_config_t *rc, CONF_SECTION *cs, int pool_type)
359
363
{
360
364
        const char *name2;
385
389
        home->name = name2;
386
390
        home->cs = cs;
387
391
 
 
392
        /*
 
393
         *      For zombie period calculations.  We want to count
 
394
         *      zombies from the time when the server starts, instead
 
395
         *      of from 1970.
 
396
         */
 
397
        home->last_packet = time(NULL);
 
398
 
388
399
        /*
389
400
         *      Authentication servers have a default "no_response_fail = 0".
390
401
         *      Accounting servers have a default "no_response_fail = 1".
486
497
                if (pool_type != home->type) {
487
498
                mismatch:
488
499
                        cf_log_err(cf_sectiontoitem(cs),
489
 
                                   "Server pool cannot include home server %s of type \"%s\"",
 
500
                                   "Home server %s of unexpected type \"%s\"",
490
501
                                   name2, hs_type);
491
502
                        goto error;
492
503
                }
690
701
#endif
691
702
        }
692
703
 
 
704
        /*
 
705
         *      Mark it as already processed
 
706
         */
 
707
        cf_data_add(cs, "home_server", null_free, null_free);
 
708
 
693
709
        return 1;
694
710
}
695
711
 
1733
1749
                        return 0;
1734
1750
                }
1735
1751
        }
 
1752
 
 
1753
        /*
 
1754
         *      CoA home servers aren't tied to realms.
 
1755
         */
 
1756
        for (cs = cf_subsection_find_next(config, NULL, "home_server");
 
1757
             cs != NULL;
 
1758
             cs = cf_subsection_find_next(config, cs, "home_server")) {
 
1759
                /*
 
1760
                 *      Server was already loaded.
 
1761
                 */
 
1762
                if (cf_data_find(cs, "home_server")) continue;
 
1763
 
 
1764
                if (!home_server_add(rc, cs, HOME_TYPE_COA)) {
 
1765
                        return 0;
 
1766
                }
 
1767
        }
1736
1768
#endif
1737
1769
 
1738
1770
 
2064
2096
                         *      the 'hints' file.
2065
2097
                         */
2066
2098
                        request->proxy->vps =  paircopy(request->packet->vps);
2067
 
 
2068
 
                        /*
2069
 
                         *      Set the source IP address for proxying.
2070
 
                         */
2071
 
                        request->proxy->src_ipaddr = found->src_ipaddr;
2072
2099
                }
2073
2100
 
2074
2101
                /*
2075
2102
                 *      Update the various fields as appropriate.
2076
2103
                 */
 
2104
                request->proxy->src_ipaddr = found->src_ipaddr;
2077
2105
                request->proxy->dst_ipaddr = found->ipaddr;
2078
2106
                request->proxy->dst_port = found->port;
2079
2107
                request->home_server = found;
2200
2228
#endif
2201
2229
 
2202
2230
#ifdef WITH_PROXY
2203
 
static int home_server_create_callback(void *ctx, void *data)
 
2231
static int home_server_create_callback(UNUSED void *ctx, void *data)
2204
2232
{
2205
 
        rad_listen_t *head = ctx;
2206
2233
        home_server *home = data;
2207
2234
        rad_listen_t *this;
2208
2235
 
2218
2245
                 */
2219
2246
                if (!this) return 1;
2220
2247
 
2221
 
                this->next = head->next;
2222
 
                head->next = this;
 
2248
                /*
 
2249
                 *      Don't do anything else.  The function above
 
2250
                 *      takes care of adding the listener to the list.
 
2251
                 */
2223
2252
        }
2224
2253
 
2225
2254
        return 0;
2228
2257
/*
2229
2258
 *      Taking a void* here solves some header issues.
2230
2259
 */
2231
 
int home_server_create_listeners(void *ctx)
 
2260
int home_server_create_listeners(void)
2232
2261
{
2233
 
        rad_listen_t *head = ctx;
2234
 
 
2235
2262
        if (!home_servers_byaddr) return 0;
2236
2263
 
2237
 
        rad_assert(head != NULL);
2238
 
 
2239
2264
        /*
2240
2265
         *      Add the listeners to the TAIL of the list.
2241
2266
         */
2242
 
        while (head->next) head = head->next;
2243
 
 
2244
2267
        if (rbtree_walk(home_servers_byaddr, InOrder,
2245
 
                        home_server_create_callback, head) != 0) {
 
2268
                        home_server_create_callback, NULL) != 0) {
2246
2269
                return -1;
2247
2270
        }
2248
2271