From: pacman Date: Tue, 17 Oct 2000 06:23:21 +0000 (+0000) Subject: Quiet many instances of "warning: passing arg N of str___ discards const from X-Git-Tag: release_0_1_0~665 X-Git-Url: http://www.project-moonshot.org/gitweb/?a=commitdiff_plain;h=4f16788153fb63b5975892cf6bf3a07857f234de;p=freeradius.git Quiet many instances of "warning: passing arg N of str___ discards const from pointer target type" --- diff --git a/src/lib/filters.c b/src/lib/filters.c index 2ec238c..652009c 100644 --- a/src/lib/filters.c +++ b/src/lib/filters.c @@ -644,10 +644,10 @@ unsigned char* src; int temp; unsigned char *src1; - src1 = (unsigned char *) strchr(src, 'x'); + src1 = (unsigned char *) strchr((char *)src, 'x'); if (src1 == NULL) - src1 = (unsigned char *) strchr(src,'X'); + src1 = (unsigned char *) strchr((char *)src,'X'); if (src1 == NULL) src1 = src; diff --git a/src/lib/radius.c b/src/lib/radius.c index 511655d..a15d411 100644 --- a/src/lib/radius.c +++ b/src/lib/radius.c @@ -812,7 +812,7 @@ int rad_pwencode(char *passwd, int *pwlen, const char *secret, const char *vecto * Use the secret to setup the decryption digest */ secretlen = strlen(secret); - strcpy(buffer, secret); + memcpy(buffer, secret, secretlen); memcpy(buffer + secretlen, vector, AUTH_VECTOR_LEN); librad_md5_calc((u_char *)digest, buffer, secretlen + AUTH_VECTOR_LEN); @@ -854,7 +854,7 @@ int rad_pwdecode(char *passwd, int pwlen, const char *secret, const char *vector * Use the secret to setup the decryption digest */ secretlen = strlen(secret); - strcpy(buffer, secret); + memcpy(buffer, secret, secretlen); memcpy(buffer + secretlen, vector, AUTH_VECTOR_LEN); librad_md5_calc((u_char *)digest, buffer, secretlen + AUTH_VECTOR_LEN); diff --git a/src/lib/valuepair.c b/src/lib/valuepair.c index 698a452..89e0743 100644 --- a/src/lib/valuepair.c +++ b/src/lib/valuepair.c @@ -226,8 +226,8 @@ void pairmove(VALUE_PAIR **to, VALUE_PAIR **from) case T_OP_SUB: /* -= */ if (found) { if (!i->strvalue[0] || - (strcmp(found->strvalue, - i->strvalue) == 0)) { + (strcmp((char *)found->strvalue, + (char *)i->strvalue) == 0)){ pairdelete(to, found->attribute); } } diff --git a/src/main/auth.c b/src/main/auth.c index f7cdc33..3255139 100644 --- a/src/main/auth.c +++ b/src/main/auth.c @@ -188,9 +188,11 @@ static int rad_check_password(REQUEST *request) * UNIX if auth_type was not set. */ if (auth_type < 0) { - if (password_pair && !strcmp(password_pair->strvalue, "UNIX")) + if (password_pair && + !strcmp((char *)password_pair->strvalue, "UNIX")) auth_type = PW_AUTHTYPE_SYSTEM; - else if(password_pair && !strcmp(password_pair->strvalue,"PAM")) + else if(password_pair && + !strcmp((char *)password_pair->strvalue,"PAM")) auth_type = PW_AUTHTYPE_PAM; else auth_type = PW_AUTHTYPE_LOCAL; @@ -203,9 +205,9 @@ static int rad_check_password(REQUEST *request) result = auth_item->strvalue ? -1 : 0; break; } - if (strcmp(password_pair->strvalue, - crypt(auth_item->strvalue, - password_pair->strvalue)) != 0) + if (strcmp((char *)password_pair->strvalue, + crypt((char *)auth_item->strvalue, + (char *)password_pair->strvalue)) != 0) result = -1; break; case PW_AUTHTYPE_LOCAL: @@ -218,8 +220,8 @@ static int rad_check_password(REQUEST *request) * Plain text password. */ if (password_pair == NULL || - strcmp(password_pair->strvalue, - auth_item->strvalue)!=0) + strcmp((char *)password_pair->strvalue, + (char *)auth_item->strvalue)!=0) result = -1; break; } @@ -619,12 +621,12 @@ int rad_authenticate(REQUEST *request) exec_wait = 0; if ((auth_item = pairfind(request->reply->vps, PW_EXEC_PROGRAM)) != NULL) { exec_wait = 0; - exec_program = strdup(auth_item->strvalue); + exec_program = strdup((char *)auth_item->strvalue); pairdelete(&request->reply->vps, PW_EXEC_PROGRAM); } if ((auth_item = pairfind(request->reply->vps, PW_EXEC_PROGRAM_WAIT)) != NULL) { exec_wait = 1; - exec_program = strdup(auth_item->strvalue); + exec_program = strdup((char *)auth_item->strvalue); pairdelete(&request->reply->vps, PW_EXEC_PROGRAM_WAIT); } diff --git a/src/main/conffile.c b/src/main/conffile.c index 27df21d..56d4a3c 100644 --- a/src/main/conffile.c +++ b/src/main/conffile.c @@ -626,7 +626,7 @@ static int generate_realms(const char *filename) strlen(s), sizeof(c->secret) - 1); return -1; } - strNcpy(c->secret, s, sizeof(c->secret)); + strNcpy((char *)c->secret, s, sizeof(c->secret)); c->striprealm = 1; @@ -691,7 +691,7 @@ static int generate_clients(const char *filename) } c->ipaddr = ip_getaddr(hostnm); - strcpy(c->secret, secret); + strcpy((char *)c->secret, secret); strcpy(c->shortname, shortnm); ip_hostname(c->longname, sizeof(c->longname), c->ipaddr); diff --git a/src/main/exec.c b/src/main/exec.c index 4d98ea4..e494489 100644 --- a/src/main/exec.c +++ b/src/main/exec.c @@ -103,7 +103,8 @@ char *radius_xlate(char *output, size_t outputlen, const char *fmt, case 'u': /* User name */ if ((tmp = pairfind(request, PW_USER_NAME)) != NULL) - strcpy(output + i, tmp->strvalue); + strcpy(output + i, + (char *)tmp->strvalue); else strcpy(output + i, "unknown"); i += strlen(output + i); @@ -111,7 +112,8 @@ char *radius_xlate(char *output, size_t outputlen, const char *fmt, case 'U': /* Stripped User name */ if ((tmp = pairfind(request, PW_STRIPPED_USER_NAME)) != NULL) - strcpy(output + i, tmp->strvalue); + strcpy(output + i, + (char *)tmp->strvalue); else strcpy(output + i, "unknown"); i += strlen(output + i); @@ -119,7 +121,8 @@ char *radius_xlate(char *output, size_t outputlen, const char *fmt, case 'i': /* Calling station ID */ if ((tmp = pairfind(request, PW_CALLING_STATION_ID)) != NULL) - strcpy(output + i, tmp->strvalue); + strcpy(output + i, + (char *)tmp->strvalue); else strcpy(output + i, "unknown"); i += strlen(output + i); @@ -127,7 +130,8 @@ char *radius_xlate(char *output, size_t outputlen, const char *fmt, case 'c': /* Callback-Number */ if ((tmp = pairfind(reply, PW_CALLBACK_NUMBER)) != NULL) - strcpy(output + i, tmp->strvalue); + strcpy(output + i, + (char *)tmp->strvalue); else strcpy(output + i, "unknown"); i += strlen(output + i); @@ -143,7 +147,8 @@ char *radius_xlate(char *output, size_t outputlen, const char *fmt, case 's': /* Speed */ if ((tmp = pairfind(request, PW_CONNECT_INFO)) != NULL) - strcpy(output + i, tmp->strvalue); + strcpy(output + i, + (char *)tmp->strvalue); else strcpy(output + i, "unknown"); i += strlen(output + i); diff --git a/src/main/files.c b/src/main/files.c index 57e7aa6..62f95af 100644 --- a/src/main/files.c +++ b/src/main/files.c @@ -420,7 +420,7 @@ static int read_clients_file(const char *file) file, lineno, hostnm); return -1; } - strcpy(c->secret, secret); + strcpy((char *)c->secret, secret); strcpy(c->shortname, shortnm); ip_hostname(c->longname, sizeof(c->longname), c->ipaddr); diff --git a/src/main/modules.c b/src/main/modules.c index f10f510..74d2bf2 100644 --- a/src/main/modules.c +++ b/src/main/modules.c @@ -684,7 +684,7 @@ static void update_username(REQUEST *request, char *newname) exit(1); } DEBUG2(" authorize: Creating Stripped-User-Name of %s", newname); - strcpy(vp->strvalue, newname); + strcpy((char *)vp->strvalue, newname); vp->length = strlen((char *)vp->strvalue); pairadd(&request->packet->vps, vp); request->username = vp; @@ -697,7 +697,7 @@ static void update_username(REQUEST *request, char *newname) vp = request->username; DEBUG2(" authorize: Updating Stripped-User-Name from %s to %s", vp->strvalue, newname); - strcpy(vp->strvalue, newname); + strcpy((char *)vp->strvalue, newname); vp->length = strlen((char *)vp->strvalue); } @@ -745,7 +745,7 @@ int module_authorize(REQUEST *request) request->username->strvalue); continue; } - strcpy(newname, vp->strvalue); + strcpy(newname, (char *)vp->strvalue); strcat(newname, (char *)request->username->strvalue); update_username(request, newname); break; @@ -757,7 +757,8 @@ int module_authorize(REQUEST *request) vp->strvalue); continue; } - strcpy(newname, request->username->strvalue); + strcpy(newname, + (char *)request->username->strvalue); strcat(newname, (char *)vp->strvalue); update_username(request, newname); break; diff --git a/src/main/radiusd.c b/src/main/radiusd.c index 372227c..eec0254 100644 --- a/src/main/radiusd.c +++ b/src/main/radiusd.c @@ -832,7 +832,7 @@ int main(int argc, char **argv) if (debug_flag) setlinebuf(stdout); if (myip == 0) { - strcpy(buffer, "*"); + strcpy((char *)buffer, "*"); } else { ip_ntoa((char *)buffer, myip); } @@ -963,7 +963,7 @@ int main(int argc, char **argv) request->child_pid = NO_SUCH_CHILD_PID; request->prev = NULL; request->next = NULL; - strNcpy(request->secret, cl->secret, sizeof(request->secret)); + strNcpy(request->secret, (char *)cl->secret, sizeof(request->secret)); rad_process(request, spawn_flag); } /* loop over authfd, acctfd, proxyfd */ diff --git a/src/main/radutmp.c b/src/main/radutmp.c index 70bcf23..8f50ccc 100644 --- a/src/main/radutmp.c +++ b/src/main/radutmp.c @@ -210,7 +210,8 @@ int radutmp_add(REQUEST *request) for (vp = request->packet->vps; vp; vp = vp->next) { switch (vp->attribute) { case PW_USER_NAME: - strncpy(ut.login, vp->strvalue, RUT_NAMESIZE); + strncpy(ut.login, (char *)vp->strvalue, + RUT_NAMESIZE); break; case PW_LOGIN_IP_HOST: case PW_FRAMED_IP_ADDRESS: @@ -247,7 +248,7 @@ int radutmp_add(REQUEST *request) nas_port_type = vp->lvalue; break; case PW_CALLING_STATION_ID: - strncpy(ut.caller_id, vp->strvalue, + strncpy(ut.caller_id, (char *)vp->strvalue, sizeof(ut.caller_id)); ut.caller_id[sizeof(ut.caller_id) - 1] = 0; break; diff --git a/src/main/valuepair.c b/src/main/valuepair.c index 3a10afc..b705863 100644 --- a/src/main/valuepair.c +++ b/src/main/valuepair.c @@ -77,7 +77,8 @@ static int paircompare(VALUE_PAIR *request, VALUE_PAIR *check, request->length); break; case PW_TYPE_STRING: - ret = strcmp(request->strvalue, check->strvalue); + ret = strcmp((char *)request->strvalue, + (char *)check->strvalue); break; case PW_TYPE_INTEGER: case PW_TYPE_DATE: @@ -314,13 +315,13 @@ static int portcmp(VALUE_PAIR *request, VALUE_PAIR *check, check_pairs = check_pairs; /* shut the compiler up */ reply_pairs = reply_pairs; - if ((strchr(check->strvalue, ',') == NULL) && - (strchr(check->strvalue, '-') == NULL)) { + if ((strchr((char *)check->strvalue, ',') == NULL) && + (strchr((char *)check->strvalue, '-') == NULL)) { return (request->lvalue - check->lvalue); } /* Same size */ - strcpy(buf, check->strvalue); + strcpy(buf, (char *)check->strvalue); s = strtok(buf, ","); while (s) { @@ -367,7 +368,7 @@ static int presufcmp(VALUE_PAIR *request, VALUE_PAIR *check, len = strlen((char *)check->strvalue); switch (check->attribute) { case PW_PREFIX: - ret = strncmp(name, check->strvalue, len); + ret = strncmp(name, (char *)check->strvalue, len); if (ret == 0 && rest) strcpy(rest, name + len); break; @@ -375,7 +376,8 @@ static int presufcmp(VALUE_PAIR *request, VALUE_PAIR *check, namelen = strlen(name); if (namelen < len) break; - ret = strcmp(name + namelen - len, check->strvalue); + ret = strcmp(name + namelen - len, + (char *)check->strvalue); if (ret == 0 && rest) { strncpy(rest, name, namelen - len); rest[namelen - len] = 0; @@ -390,15 +392,15 @@ static int presufcmp(VALUE_PAIR *request, VALUE_PAIR *check, * I don't think we want to update the User-Name * attribute in place... - atd */ - strcpy(request->strvalue, rest); + strcpy((char *)request->strvalue, rest); request->length = strlen(rest); } else { if ((vp = pairfind(check_pairs, PW_STRIPPED_USER_NAME)) != NULL){ - strcpy(vp->strvalue, rest); + strcpy((char *)vp->strvalue, rest); vp->length = strlen(rest); } else if ((vp = paircreate(PW_STRIPPED_USER_NAME, PW_TYPE_STRING)) != NULL) { - strcpy(vp->strvalue, rest); + strcpy((char *)vp->strvalue, rest); vp->length = strlen(rest); pairadd(&request, vp); } /* else no memory! Die, die!: FIXME!! */ diff --git a/src/modules/rlm_preprocess/rlm_preprocess.c b/src/modules/rlm_preprocess/rlm_preprocess.c index 4f01dde..1a55184 100644 --- a/src/modules/rlm_preprocess/rlm_preprocess.c +++ b/src/modules/rlm_preprocess/rlm_preprocess.c @@ -185,7 +185,7 @@ static int presufcmp(VALUE_PAIR *check, char *name, char *rest) len = strlen((char *)check->strvalue); switch (check->attribute) { case PW_PREFIX: - ret = strncmp(name, check->strvalue, len); + ret = strncmp(name, (char *)check->strvalue, len); if (ret == 0 && rest) strcpy(rest, name + len); break; @@ -193,7 +193,8 @@ static int presufcmp(VALUE_PAIR *check, char *name, char *rest) namelen = strlen(name); if (namelen < len) break; - ret = strcmp(name + namelen - len, check->strvalue); + ret = strcmp(name + namelen - len, + (char *)check->strvalue); if (ret == 0 && rest) { strncpy(rest, name, namelen - len); rest[namelen - len] = 0; @@ -333,7 +334,7 @@ static int hints_setup(REQUEST *request) if (do_strip) { tmp = pairfind(request_pairs, PW_STRIPPED_USER_NAME); if (tmp) { - strcpy(tmp->strvalue, newname); + strcpy((char *)tmp->strvalue, newname); tmp->length = strlen((char *)tmp->strvalue); } else { /* @@ -344,7 +345,7 @@ static int hints_setup(REQUEST *request) radlog(L_ERR|L_CONS, "no memory"); exit(1); } - strcpy(tmp->strvalue, newname); + strcpy((char *)tmp->strvalue, newname); tmp->length = strlen((char *)tmp->strvalue); pairadd(&request_pairs, tmp); } diff --git a/src/modules/rlm_realm/rlm_realm.c b/src/modules/rlm_realm/rlm_realm.c index 4e030de..09becc4 100644 --- a/src/modules/rlm_realm/rlm_realm.c +++ b/src/modules/rlm_realm/rlm_realm.c @@ -67,7 +67,7 @@ static REALM *check_for_realm(REQUEST *request) radlog(L_ERR|L_CONS, "no memory"); exit(1); } - strcpy(vp->strvalue, name); + strcpy((char *)vp->strvalue, name); vp->length = strlen((char *)vp->strvalue); pairadd(&request->packet->vps, vp); request->username = vp; diff --git a/src/modules/rlm_unix/cache.c b/src/modules/rlm_unix/cache.c index 4527df7..ae4e125 100644 --- a/src/modules/rlm_unix/cache.c +++ b/src/modules/rlm_unix/cache.c @@ -570,7 +570,7 @@ int H_groupcmp(VALUE_PAIR *check, char *username) { /* let's find this group */ if(grphead) { cur = grphead; - while((cur) && (strcmp(cur->gr_name, check->strvalue))) { + while((cur) && (strcmp(cur->gr_name, (char *)check->strvalue))){ cur = cur->next; } /* found the group, now compare it */