From: Alan T. DeKok Date: Tue, 20 Dec 2011 13:14:40 +0000 (-0500) Subject: Note that "hashsize=0" is a bad idea X-Git-Tag: release_2_2_0~230 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3bbaa077d754afa49820771bc9196d58b20f14fa;p=thirdparty%2Ffreeradius-server.git Note that "hashsize=0" is a bad idea --- diff --git a/raddb/modules/passwd b/raddb/modules/passwd index b7ac2a9161b..92496bfc323 100644 --- a/raddb/modules/passwd +++ b/raddb/modules/passwd @@ -21,16 +21,15 @@ # Attributes marked as '=' are added to reply_items instead # of default configure_itmes # -# Attributse marked as '~' are added to request_items +# Attributes marked as '~' are added to request_items # # Field marked as ',' may contain a comma separated list # of attributes. # -# hashsize - hashtable size. If 0 or not specified records are not -# stored in memory and file is read on every request. -# This configuration is *not* recommended, as it can be -# very slow. The "passwd" module reloads its configuration -# on HUP, so setting "hashsize = 0" is unnecessary. +# hashsize - hashtable size. Setting it to 0 is no longer permitted +# A future version of the server will have the module +# automatically determine the hash size. Having it set +# manually should not be necessary. # # allowmultiplekeys - if many records for a key are allowed # diff --git a/src/modules/rlm_passwd/rlm_passwd.c b/src/modules/rlm_passwd/rlm_passwd.c index 25f6cc01589..cc5a26f3329 100644 --- a/src/modules/rlm_passwd/rlm_passwd.c +++ b/src/modules/rlm_passwd/rlm_passwd.c @@ -404,12 +404,21 @@ static int passwd_instantiate(CONF_SECTION *conf, void **instance) return -1; } if(!inst->filename || *inst->filename == '\0' || !inst->format || *inst->format == '\0') { - radlog(L_ERR, "rlm_passwd: cann't find passwd file and/or format in configuration"); + radlog(L_ERR, "rlm_passwd: can't find passwd file and/or format in configuration"); + free(inst); return -1; } + + if (inst->hashsize == 0) { + radlog(L_ERR, "rlm_passwd: hashsize=0 is no longer permitted as it will break the server."); + free(inst); + return -1; + } + lf=strdup(inst->format); if ( lf == NULL) { radlog(L_ERR, "rlm_passwd: memory allocation failed for lf"); + free(inst); return -1; } memset(lf, 0, strlen(inst->format));