Patch to allow FreeRADIUS server 2.1.8 to compile on non-GCC systems

Scott Neugroschl redfloyd at gmail.com
Wed Apr 21 00:11:07 CEST 2010


Change Description:
   * Allow code to compile on non-GCC systems, by providing const casting
     when necessary (command.c, for example)
   * Allow code to compile on non-GCC systems, by fixing variable
     declarations that are not at the beginning of a block (ltdl.c,
     for example)


diff -urN freeradius-server-2.1.8/libltdl/ltdl.c
freeradiusd-gnucleanup/libltdl/ltdl.c
--- freeradius-server-2.1.8/libltdl/ltdl.c	2009-12-30
07:44:35.000000000 -0800
+++ freeradiusd-gnucleanup/libltdl/ltdl.c	2010-04-20
07:25:27.000000000 -0700
@@ -2442,12 +2442,14 @@
 
   while (loader)
     {
+    lt_user_data data; /* san */
       if (useloader && strcmp(loader->loader_name, useloader))
 	{
 	  loader = loader->next;
 	  continue;
 	}
-      lt_user_data data = loader->dlloader_data;
+/*      lt_user_data data = loader->dlloader_data; */ /* SAN */
+	data = loader->dlloader_data; /* SAN */
 
       cur->module = loader->module_open (data, filename);
 
diff -urN freeradius-server-2.1.8/src/main/auth.c
freeradiusd-gnucleanup/src/main/auth.c
--- freeradius-server-2.1.8/src/main/auth.c	2009-12-30
07:44:35.000000000 -0800
+++ freeradiusd-gnucleanup/src/main/auth.c	2010-04-20
09:28:18.000000000 -0700
@@ -175,9 +175,13 @@
 	 */
 	cur_config_item = request->config_items;
 	while(((auth_type_pair = pairfind(cur_config_item, PW_AUTH_TYPE)))
!= NULL) {
+		DICT_VALUE *dv = NULL; /* SAN */
 		auth_type = auth_type_pair->vp_integer;
 		auth_type_count++;
-		DICT_VALUE *dv = dict_valbyattr(auth_type_pair->attribute,
+/* SAN		DICT_VALUE *dv = dict_valbyattr(auth_type_pair->attribute,
+						auth_type_pair->vp_integer);
+*/
+		dv = dict_valbyattr(auth_type_pair->attribute,
 						auth_type_pair->vp_integer);
 
 		RDEBUG2("Found Auth-Type = %s",
diff -urN freeradius-server-2.1.8/src/main/command.c
freeradiusd-gnucleanup/src/main/command.c
--- freeradius-server-2.1.8/src/main/command.c	2009-12-30
07:44:35.000000000 -0800
+++ freeradiusd-gnucleanup/src/main/command.c	2010-04-20
09:33:16.000000000 -0700
@@ -842,7 +842,7 @@
 		return 0;
 	}
 
-	cf_section2file(fp, client->cs);
+	cf_section2file(fp, /* SAN */(CONF_SECTION*)client->cs);
 	fclose(fp);
 
 	return 1;
diff -urN freeradius-server-2.1.8/src/main/listen.c
freeradiusd-gnucleanup/src/main/listen.c
--- freeradius-server-2.1.8/src/main/listen.c	2009-12-30
07:44:35.000000000 -0800
+++ freeradiusd-gnucleanup/src/main/listen.c	2010-04-20
09:33:05.000000000 -0700
@@ -126,7 +126,7 @@
 			last_printed = now;
 		}
 
-		listener->print(listener, name, sizeof(name));
+		listener->print(/* SAN */(rad_listen_t*)listener, name,
sizeof(name));
 
 		radlog(L_ERR, "Ignoring request to %s from unknown client %s
port %d",
 		       name, inet_ntop(ipaddr->af, &ipaddr->ipaddr,
@@ -206,7 +206,7 @@
 	request = request_alloc();
 	if (!request) goto unknown;
 
-	request->listener = listener;
+	request->listener = /* SAN */(rad_listen_t*)listener;
 	request->client = client;
 	request->packet = rad_recv(listener->fd, 0x02); /* MSG_PEEK */
 	if (!request->packet) {				/* badly formed, etc
*/
diff -urN freeradius-server-2.1.8/src/main/log.c
freeradiusd-gnucleanup/src/main/log.c
--- freeradius-server-2.1.8/src/main/log.c	2009-12-30
07:44:35.000000000 -0800
+++ freeradiusd-gnucleanup/src/main/log.c	2010-04-20
09:35:58.000000000 -0700
@@ -384,7 +384,7 @@
 			s[1] = '\0';
 		}
 		
-		s = fr_int2str(levels, (lvl & ~L_CONS), ": ");
+		s = /* SAN */ (char *) fr_int2str(levels, (lvl & ~L_CONS),
": ");
 		
 		strcat(buffer, s);
 		len = strlen(buffer);
diff -urN freeradius-server-2.1.8/src/main/xlat.c
freeradiusd-gnucleanup/src/main/xlat.c
--- freeradius-server-2.1.8/src/main/xlat.c	2009-12-30
07:44:35.000000000 -0800
+++ freeradiusd-gnucleanup/src/main/xlat.c	2010-04-20
09:49:52.000000000 -0700
@@ -572,7 +572,7 @@
 		 *	Register the internal packet xlat's.
 		 */
 		for (i = 0; internal_xlat[i] != NULL; i++) {
-			xlat_register(internal_xlat[i], xlat_packet,
&xlat_inst[i]);
+			xlat_register(internal_xlat[i], xlat_packet, /* SAN
*/(void*)&xlat_inst[i]);
 			c = xlat_find(internal_xlat[i]);
 			rad_assert(c != NULL);
 			c->internal = TRUE;
@@ -581,7 +581,7 @@
 		/*
 		 *	New name: "control"
 		 */
-		xlat_register("control", xlat_packet, &xlat_inst[0]);
+		xlat_register("control", xlat_packet, /* SAN
*/(void*)&xlat_inst[0]);
 		c = xlat_find("control");
 		rad_assert(c != NULL);
 		c->internal = TRUE;
@@ -593,7 +593,7 @@
 		buffer[1] = '\0';
 		for (i = 0; i <= REQUEST_MAX_REGEX; i++) {
 			buffer[0] = '0' + i;
-			xlat_register(buffer, xlat_regex, &xlat_inst[i]);
+			xlat_register(buffer, xlat_regex, /* SAN
*/(void*)&xlat_inst[i]);
 			c = xlat_find(buffer);
 			rad_assert(c != NULL);
 			c->internal = TRUE;
@@ -601,12 +601,12 @@
 #endif /* HAVE_REGEX_H */
 
 
-		xlat_register("debug", xlat_debug, &xlat_inst[0]);
+		xlat_register("debug", xlat_debug, /* SAN
*/(void*)&xlat_inst[0]);
 		c = xlat_find("debug");
 		rad_assert(c != NULL);
 		c->internal = TRUE;
 
-		xlat_register("md5", xlat_md5, &xlat_inst[0]);
+		xlat_register("md5", xlat_md5, /* SAN
*/(void*)&xlat_inst[0]);
 		c = xlat_find("md5");
 		rad_assert(c != NULL);
 		c->internal = TRUE;
diff -urN freeradius-server-2.1.8/src/modules/rlm_dbm/rlm_dbm.c
freeradiusd-gnucleanup/src/modules/rlm_dbm/rlm_dbm.c
--- freeradius-server-2.1.8/src/modules/rlm_dbm/rlm_dbm.c	2009-12-30
07:44:35.000000000 -0800
+++ freeradiusd-gnucleanup/src/modules/rlm_dbm/rlm_dbm.c	2010-04-20
07:43:17.000000000 -0700
@@ -206,7 +206,7 @@
    	 				if ( parse_state == SMP_PATTERN ) {
/* pattern line found */
    	 					DEBUG2("process pattern");
    	 					/* check pattern against
request */
-						if ( paircompare(req,
request, vp, reply ) == 0 ) {
+						if ( paircompare(req, /* SAN
*/ (VALUE_PAIR*)request, vp, reply ) == 0 ) {
 							DEBUG2("rlm_dbm:
Pattern matched, look for request");
 
pairmove(&tmp_config, &vp);
    	 						pairfree(&vp);
diff -urN freeradius-server-2.1.8/src/modules/rlm_policy/parse.c
freeradiusd-gnucleanup/src/modules/rlm_policy/parse.c
--- freeradius-server-2.1.8/src/modules/rlm_policy/parse.c	2009-12-30
07:44:35.000000000 -0800
+++ freeradiusd-gnucleanup/src/modules/rlm_policy/parse.c	2010-04-20
09:24:14.000000000 -0700
@@ -1532,7 +1532,7 @@
 	}
 
 	if ((lexer->debug & POLICY_DEBUG_PRINT_POLICY) != 0) {
-		rlm_policy_print(this);
+		rlm_policy_print(/* SAN */(policy_item_t*)this);
 	}
 
        	return 1;






More information about the Freeradius-Devel mailing list