radiusd error AFTER ok

Drew S. Dupont dsdupont at alumni.indiana.edu
Mon Nov 14 04:57:38 CET 2005


When I run radiusd from the command line in a Fedora Core 1/RedHat 9 
base system, it will start w/o any problems. However, when I try to 
start radiusd from inside a helper app., it says it is ready to 
process requests but then throws the following error to the 
radius.log file:

Sun Nov 13 22:39:10 2005 : Info: Using deprecated naslist file. 
Support for this will go away soon.
Sun Nov 13 22:39:10 2005 : Info: rlm_exec: Wait=yes but no output 
defined. Did you mean output=none?
Sun Nov 13 22:39:10 2005 : Info: Ready to process requests.
Sun Nov 13 22:39:10 2005 : Error: Error receiving packet: Socket 
operation on non-socket
Sun Nov 13 22:39:10 2005 : Error: Error receiving packet: Socket 
operation on non-socket
Sun Nov 13 22:39:10 2005 : Error: Error receiving packet: Socket 
operation on non-socket

The helper script is as follows:
=======================
/* This program is distributed under the terms of the GNU General Public
  * Licence.  See the file COPYING for details.
  *
  * filename: radctrl
  * Simple program intended to be installed setuid(0) that can be used for
  * controling the Captive Portal service (FreeRadius).
  */

#include "setuid.h"

int main(int argc, char *argv[]) {
         int fd = -1;

         if (!(initsetuid(1)))
                 exit(1);

         if (argc < 2) {
                 fprintf(stderr, "Missing arg\n");
                 exit(1);
         }

         if (((fd = open("/var/smoothwall/mods/captiveportal/enable", 
O_RDONLY)) != -1) || (strcmp(argv[1], "X") == 0)) {
                 close(fd);
         } else {
                 return 0;
         }

         // Declare used vars
         FILE *radpidfile = NULL;
         FILE *radstatusfile = NULL;
         char radstatusfilepath[STRING_SIZE];
         memset(radstatusfilepath, 0, STRING_SIZE);
         char command[STRING_SIZE];
         memset(command, 0, STRING_SIZE);
         char radpid[STRING_SIZE];
         memset(radpid, 0, STRING_SIZE);
         int radrunning = 0;

         // Open freeradius's pid file
         if ((radpidfile = fopen("/var/run/radiusd/radiusd.pid", "r"))) {
                 // Read in freeradius's pid
                 fgets(radpid, STRING_SIZE, radpidfile);

                 if (radpid[strlen(radpid) - 1] == '\n') {
                         radpid[strlen(radpid) - 1] = '\0';
                 }

                 fclose (radpidfile);
         } else {
                 // Set -1 flag
                 snprintf(radpid, STRING_SIZE - 1, "-1");
         }

         // Null out file pointer
         radpidfile = NULL;

         // Check to see if have a valid pid
         if (strcmp(radpid, "-1")) {
                 // Get freeradius status file path
                 snprintf(radstatusfilepath, STRING_SIZE - 1, 
"/proc/%s/status", radpid);

                 // Open freeradius's status file
                 if ((radstatusfile = fopen(radstatusfilepath, "r"))) {
                         // Set status and close file
                         radrunning = 1;
                         fclose (radstatusfile);
                 } else {
                         radrunning = 0;
                 }

                 // Null out file poinnter
                 radstatusfile = NULL;
         } else {
                 radrunning = 0;
         }

         // Check for start
         if (strcmp(argv[1], "S") == 0) {
                 if (radrunning == 0) {
                         system("/usr/local/sbin/radiusd > /dev/null");
                          system("/usr/bin/logger -t smoothwall 
'FreeRadius has been started'");
                 } else {
                         system("/usr/bin/logger -t smoothwall 
'FreeRadius is already running'");
                 }

         // Check for restart
         } else if (strcmp(argv[1], "R") == 0) {
                 if (radrunning == 1) {
                         snprintf(command, STRING_SIZE - 1, "/bin/kill 
-9 %s > /dev/null", radpid);
                         system(command);
                         sleep(1);
                         system("/usr/local/sbin/radiusd > /dev/null");
                         system("/usr/bin/logger -t smoothwall 
'FreeRadius has been restarted'");
                 } else {
                         system("/usr/bin/logger -t smoothwall 'Can 
not restart FreeRadius since it is not running'");
                 }

         // Check for stop
         } else if (strcmp(argv[1], "X") == 0) {
                 if (radrunning == 1) {
                         snprintf(command, STRING_SIZE - 1, "/bin/kill 
-1 %s > /dev/null", radpid);
                         system(command);
                         system("/usr/bin/logger -t smoothwall 
'FreeRadius has been stopped'");
                 } else {
                         system("/usr/bin/logger -t smoothwall 'Can 
not stop FreeRadius since it is not running'");
                 }
         } else {
                 fprintf(stderr, "Bad arg\n");
                 exit(1);
         }

         return 0;
}
================
This app used to work just fine before my recent HD and MoBo crashes 
today. I had to restore the system from a backup and the app. will no 
longer work. Like I said, radiusd from the command line starts 
FreeRadius just fine. It is only in this app. that it is now causing 
me problems.

Thank you,
Drew Dupont
-- 
------------------------------------------------------------------------------------------------------
   Drew S. Dupont		           dsdupont at alumni.indiana.edu
   AIM: NetWhizOne		           FWD #: 271144
   YIM: dsdupont
------------------------------------------------------------------------------------------------------



More information about the Freeradius-Users mailing list