INN commit: branches/2.5/authprogs (radius.c)

INN Commit rra at isc.org
Sun Jul 17 18:06:00 UTC 2011


    Date: Sunday, July 17, 2011 @ 11:06:00
  Author: iulius
Revision: 9250

Build INN with the new "-Wunused-but-set-variable" and 
"-Wunused-but-set-parameter" GCC 4.6.0 warnings.

Remove unused variables.

Also fix a potential issue with the incorrect handling of
structs when passed by value instead of by reference.
Maybe a compiler-specific behaviour.

Modified:
  branches/2.5/authprogs/radius.c

----------+
 radius.c |   18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

Modified: radius.c
===================================================================
--- radius.c	2011-07-17 18:05:23 UTC (rev 9249)
+++ radius.c	2011-07-17 18:06:00 UTC (rev 9250)
@@ -104,7 +104,6 @@
     rad_config_t *radconfig=NULL;
     CONFFILE *file;
     CONFTOKEN *token;
-    char *server;
     int type;
     char *iter;
 
@@ -118,7 +117,6 @@
           die("expected server keyword on line %d", file->lineno);
 	if ((token = CONFgettoken(0, file)) == NULL)
           die("expected server name on line %d", file->lineno);
-	server = xstrdup(token->name);
 	if ((token = CONFgettoken(radtoks, file)) == NULL 
 	    || token->type != RADlbrace)
           die("expected { on line %d", file->lineno);
@@ -211,14 +209,14 @@
 #define RAD_NAS_IP_ADDRESS      4       /* IP address */
 #define RAD_NAS_PORT            5       /* Integer */
 
-static void req_copyto (auth_req to, sending_t *from)
+static void req_copyto (auth_req *to, sending_t *from)
 {
-    to = from->req;
+    *to = from->req;
 }
 
-static void req_copyfrom (sending_t *to, auth_req from)
+static void req_copyfrom (sending_t *to, auth_req *from)
 {
-    to->req = from;
+    to->req = *from;
 }
 
 static int rad_auth(rad_config_t *radconfig, char *uname, char *pass)
@@ -267,7 +265,7 @@
 	sreq->next = new;
 	sreq = sreq->next;
       }
-      req_copyto(req, sreq);
+      req_copyto(&req, sreq);
   
       /* first, build the sockaddrs */
       memset(&sinl, '\0', sizeof(sinl));
@@ -392,7 +390,7 @@
       sreq->reqlen = req.length;
       req.length = htons(req.length);
 
-      req_copyfrom(sreq, req);
+      req_copyfrom(sreq, &req);
 
       /* Go to the next record in the list */
       config = config->next;
@@ -415,7 +413,7 @@
     for(done = 0; authtries > 0 && !done; authtries--) {
       for (config = radconfig, sreq = reqtop; sreq != NULL && !done;
 	   config = config->next, sreq = sreq->next){
-	req_copyto(req, sreq);
+	req_copyto(&req, sreq);
 
 	/* send out the packet and wait for reply. */
 	if (sendto(sock, (char *)&req, sreq->reqlen, 0, 
@@ -481,7 +479,7 @@
 	close(sock);
 	return (req.code == PW_AUTHENTICATION_ACK) ? 0 : -1;
 	done = 1;
-	req_copyfrom(sreq, req);
+	req_copyfrom(sreq, &req);
 	break;
       }
     }




More information about the inn-committers mailing list