From: Alan T. DeKok Date: Fri, 11 May 2012 09:06:21 +0000 (+0200) Subject: Fix compiler warnings X-Git-Tag: release_3_0_0_beta0~175 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a79b039bc1ded48926f82649c8fa73215cfb983;p=thirdparty%2Ffreeradius-server.git Fix compiler warnings --- diff --git a/src/modules/rlm_passwd/rlm_passwd.c b/src/modules/rlm_passwd/rlm_passwd.c index be6f064f409..cd96eeee980 100644 --- a/src/modules/rlm_passwd/rlm_passwd.c +++ b/src/modules/rlm_passwd/rlm_passwd.c @@ -155,8 +155,6 @@ static void release_ht(struct hashtable * ht){ static struct hashtable * build_hash_table (const char * file, int nfields, int keyfield, int islist, int tablesize, int ignorenis, char delimiter) { -#define passwd ((struct mypasswd *) ht->buffer) - char buffer[1024]; struct hashtable* ht; size_t len; unsigned int h; @@ -164,6 +162,7 @@ static struct hashtable * build_hash_table (const char * file, int nfields, char *list; char *nextlist=0; int i; + char buffer[1024]; ht = (struct hashtable *) rad_malloc(sizeof(struct hashtable)); if(!ht) { @@ -247,12 +246,14 @@ static struct hashtable * build_hash_table (const char * file, int nfields, static struct mypasswd * get_next(char *name, struct hashtable *ht, struct mypasswd **last_found) { -#define passwd ((struct mypasswd *) ht->buffer) + struct mypasswd * passwd; struct mypasswd * hashentry; char buffer[1024]; int len; char *list, *nextlist; + passwd = (struct mypasswd *) ht->buffer; + if (ht->tablesize > 0) { /* get saved address of next item to check from buffer */ hashentry = *last_found; @@ -267,6 +268,9 @@ static struct mypasswd * get_next(char *name, struct hashtable *ht, } /* printf("try to find in file\n"); */ if (!ht->fp) return NULL; + + passwd = (struct mypasswd *) ht->buffer; + while (fgets(buffer, 1024,ht->fp)) { if(*buffer && *buffer!='\n' && (len = string_to_entry(buffer, ht->nfields, ht->delimiter, passwd, sizeof(ht->buffer)-1)) && (!ht->ignorenis || (*buffer !='-' && *buffer != '+') ) ){ @@ -288,7 +292,6 @@ static struct mypasswd * get_next(char *name, struct hashtable *ht, fclose(ht->fp); ht->fp = NULL; return NULL; -#undef passwd } static struct mypasswd * get_pw_nam(char * name, struct hashtable* ht,