Get rid of some absurd warnings

Stephen R. van den Berg srb at cuci.nl
Sat Jul 9 12:42:09 CEST 2011


---

During compilation I find numerous warnings.  Some rather absurd, so it
might make more sense to turn off the warnings instead; but just in case
someone feels strongly about the warnings, here are some offered remedies.
I'm using gcc 4.6.

 src/modules/rlm_ippool/rlm_ippool.c |    5 +++--
 src/modules/rlm_ldap/rlm_ldap.c     |   14 +++++++++-----
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/modules/rlm_ippool/rlm_ippool.c b/src/modules/rlm_ippool/rlm_ippool.c
index bdb8e35..6478e0c 100644
--- a/src/modules/rlm_ippool/rlm_ippool.c
+++ b/src/modules/rlm_ippool/rlm_ippool.c
@@ -342,7 +342,8 @@ static int ippool_accounting(void *instance, REQUEST *request)
 				return RLM_MODULE_NOOP;
 			}
 			fr_MD5Init(&md5_context);
-			fr_MD5Update(&md5_context, xlat_str, strlen(xlat_str));
+			fr_MD5Update(&md5_context, (unsigned char*)xlat_str,
+			 strlen(xlat_str));
 			fr_MD5Final(key_str, &md5_context);
 			key_str[16] = '\0';
 			fr_bin2hex(key_str,hex_str,16);
@@ -499,7 +500,7 @@ static int ippool_postauth(void *instance, REQUEST *request)
 		return RLM_MODULE_NOOP;
 	}
 	fr_MD5Init(&md5_context);
-	fr_MD5Update(&md5_context, xlat_str, strlen(xlat_str));
+	fr_MD5Update(&md5_context, (unsigned char*)xlat_str, strlen(xlat_str));
 	fr_MD5Final(key_str, &md5_context);
 	key_str[16] = '\0';
 	fr_bin2hex(key_str,hex_str,16);
diff --git a/src/modules/rlm_ldap/rlm_ldap.c b/src/modules/rlm_ldap/rlm_ldap.c
index 129e5ea..c53293d 100644
--- a/src/modules/rlm_ldap/rlm_ldap.c
+++ b/src/modules/rlm_ldap/rlm_ldap.c
@@ -677,7 +677,10 @@ ldap_instantiate(CONF_SECTION * conf, void **instance)
 		}
 	}
 #ifdef NOVELL
-	inst->atts[atts_num - 1] = "sasdefaultloginsequence";
+	{
+		static char ts[] = "sasdefaultloginsequence";
+		inst->atts[atts_num - 1] = ts;
+	}
 #endif
 	inst->atts[atts_num] = NULL;
 
@@ -765,7 +768,7 @@ read_mappings(ldap_instance* inst)
 			operator = T_OP_INVALID; /* use defaults */
 		} else {
 			ptr = opstring;
-			operator = gettoken(&ptr, buf, sizeof(buf));
+			operator = gettoken((void*)&ptr, buf, sizeof(buf));
 			if ((operator < T_OP_ADD) || (operator > T_OP_CMP_EQ)) {
 				radlog(L_ERR, "rlm_ldap: file %s: skipping line %i: unknown or invalid operator %s",
 				       filename, linenumber, opstring);
@@ -989,7 +992,8 @@ static int ldap_groupcmp(void *instance, REQUEST *req,
         LDAPMessage     *result = NULL;
         LDAPMessage     *msg = NULL;
         char            basedn[MAX_FILTER_STR_LEN];
-	char		*attrs[] = {"dn",NULL};
+	static char	firstattr[] = "dn";
+	char		*attrs[] = {firstattr,NULL};
 	char		**vals;
         ldap_instance   *inst = instance;
 	char		*group_attrs[] = {inst->groupmemb_attr,NULL};
@@ -1541,7 +1545,6 @@ static int ldap_authorize(void *instance, REQUEST * request)
 				value = passwd_vals[i];
 				if (!value) continue;
 
-			create_attr:
 				passwd_item = radius_paircreate(request,
 								&request->config_items,
 								attr, 0,
@@ -1761,7 +1764,8 @@ static int ldap_authenticate(void *instance, REQUEST * request)
 	LDAP           *ld_user;
 	LDAPMessage    *result, *msg;
 	ldap_instance  *inst = instance;
-	char           *user_dn, *attrs[] = {"uid", NULL};
+	static char	firstattr[] = "uid";
+	char           *user_dn, *attrs[] = {firstattr, NULL};
 	char		filter[MAX_FILTER_STR_LEN];
 	char		basedn[MAX_FILTER_STR_LEN];
 	int		res;
-- 
1.7.5.4


-- 
Stephen.



More information about the Freeradius-Devel mailing list