~ubuntu-branches/ubuntu/natty/freeradius/natty-updates

« back to all changes in this revision

Viewing changes to src/main/radiusd.c

  • Committer: Bazaar Package Importer
  • Author(s): Josip Rodin
  • Date: 2009-11-23 03:57:37 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 28.
  • Revision ID: james.westby@ubuntu.com-20091123035737-zsgtzhfych8hir68
Tags: 2.1.7+dfsg-1
* Adopting the package, closes: #536623.
* New upstream version, closes: #513484.
  + Fixes the blooper in unlang evaluation logic, closes: #526175.
* Used quilt (and added README.source), and moved upstream file patching
  into debian/patches/. The source is no longer in collab-maint git
  (to make it simpler for me to finally get this out the door), but
  kept the .gitignore should we need that again.
* Dropped the dialup_admin/bin/backup_radacct patch (integrated upstream).
* Dropped the raddb/Makefile patch (problem no longer exists upstream).
* Dropped the lib/packet.c lib/radius.c main/listen.c patches (was from
  upstream 2.0.5 anyway).
* Dropped references to otp.conf, it no longer exists upstream.
  Keep removing the conffile statoverride in prerm.
* Dropped references to snmp.conf, it no longer exists upstream.
  Keep removing the conffile statoverride in prerm.
* Ship /etc/freeradius/modules/* in the freeradius package.
* Stop shipping sites-enabled symlinks in the package and instead create
  them only on initial install, thanks to Matej Vela, closes: #533396.
* Add export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" to the init script
  at the request of John Morrissey, closes: #550143.
* Stop installing /var/run/freeradius in the package to silence Lintian.
  The init script already recreates it at will.
* Remove executable bit from example.pl to silence Lintian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * radiusd.c    Main loop of the radius server.
3
3
 *
4
 
 * Version:     $Id: radiusd.c,v 1.391 2008/03/08 17:23:47 aland Exp $
 
4
 * Version:     $Id$
5
5
 *
6
6
 *   This program is free software; you can redistribute it and/or modify
7
7
 *   it under the terms of the GNU General Public License as published by
26
26
 */
27
27
 
28
28
#include <freeradius-devel/ident.h>
29
 
RCSID("$Id: radiusd.c,v 1.391 2008/03/08 17:23:47 aland Exp $")
 
29
RCSID("$Id$")
30
30
 
31
31
#include <freeradius-devel/radiusd.h>
32
 
#include <freeradius-devel/radius_snmp.h>
33
32
#include <freeradius-devel/modules.h>
34
33
#include <freeradius-devel/rad_assert.h>
35
34
 
68
67
 
69
68
const char *radiusd_version = "FreeRADIUS Version " RADIUSD_VERSION ", for host " HOSTINFO ", built on " __DATE__ " at " __TIME__;
70
69
 
71
 
time_t time_now;
72
70
pid_t radius_pid;
73
71
 
74
72
static int debug_memory = 0;
171
169
                                break;
172
170
 
173
171
                        case 'l':
 
172
                                if (strcmp(optarg, "stdout") == 0) {
 
173
                                        goto do_stdout;
 
174
                                }
174
175
                                mainconfig.log_file = strdup(optarg);
175
176
                                mainconfig.radlog_dest = RADLOG_FILES;
176
177
                                break;            
221
222
                                mainconfig.log_auth = TRUE;
222
223
                                mainconfig.log_auth_badpass = TRUE;
223
224
                                mainconfig.log_auth_goodpass = TRUE;
 
225
                do_stdout:
224
226
                                mainconfig.radlog_dest = RADLOG_STDOUT;
225
227
                                mainconfig.radlog_fd = STDOUT_FILENO;
226
228
                                fr_log_fp = stdout;
243
245
 
244
246
        if (debug_flag) {
245
247
                radlog(L_INFO, "%s", radiusd_version);
246
 
                radlog(L_INFO, "Copyright (C) 1999-2008 The FreeRADIUS server project and contributors.\n");
 
248
                radlog(L_INFO, "Copyright (C) 1999-2009 The FreeRADIUS server project and contributors.\n");
247
249
                radlog(L_INFO, "There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n");
248
250
                radlog(L_INFO, "PARTICULAR PURPOSE.\n");
249
251
                radlog(L_INFO, "You may redistribute copies of FreeRADIUS under the terms of the\n");
250
 
                radlog(L_INFO, "GNU General Public License.\n");
 
252
                radlog(L_INFO, "GNU General Public License v2.\n");
251
253
                fflush(NULL);
252
254
        }
253
255
 
384
386
         *      Everything seems to have loaded OK, exit gracefully.
385
387
         */
386
388
        if (check_config) {
387
 
                DEBUG("Configuration appears OK.");
 
389
                DEBUG("Configuration appears to be OK.");
388
390
                exit(0);
389
391
        }
390
392
 
 
393
        radius_stats_init(0);
 
394
 
391
395
        /*
392
396
         *      Process requests until HUP or exit.
393
397
         */
394
398
        while ((rcode = radius_event_process()) == 0x80) {
395
 
                module_hup(cf_section_sub_find(mainconfig.config, "modules"));
 
399
                radius_stats_init(1);
 
400
                radlog(L_INFO, "Received HUP.");
 
401
                hup_mainconfig();
396
402
        }
397
403
        
398
 
        DEBUG("Exiting...");
 
404
        radlog(L_INFO, "Exiting normally.");
399
405
        
400
406
        /*
401
407
         *      Ignore the TERM signal: we're
410
416
         *      ignored.)
411
417
         */
412
418
#ifndef __MINGW32__
413
 
        kill(-radius_pid, SIGTERM);
 
419
        if (spawn_flag) kill(-radius_pid, SIGTERM);
414
420
#endif
415
421
        
416
422
        /*
477
483
static void sig_fatal(int sig)
478
484
{
479
485
        switch(sig) {
480
 
                case SIGSEGV:
481
 
                        /*
482
 
                         *      We can't really do anything
483
 
                         *      intelligent here so just die
484
 
                         */
485
 
                        _exit(1);
486
 
 
487
486
                case SIGTERM:
488
487
                        radius_signal_self(RADIUS_SIGNAL_SELF_TERM);
489
488
                        break;
499
498
                        /* FALL-THROUGH */
500
499
 
501
500
                default:
502
 
                        radius_signal_self(RADIUS_SIGNAL_SELF_EXIT);
503
 
                        break;
 
501
                        _exit(sig);
504
502
        }
505
503
}
506
504