INN commit: trunk/authprogs (radius.c)

INN Commit rra at isc.org
Tue Jun 14 19:12:18 UTC 2011


    Date: Tuesday, June 14, 2011 @ 12:12:18
  Author: iulius
Revision: 9208

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:
  trunk/authprogs/radius.c

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

Modified: radius.c
===================================================================
--- radius.c	2011-06-14 19:09:53 UTC (rev 9207)
+++ radius.c	2011-06-14 19:12:18 UTC (rev 9208)
@@ -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