*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* Copyright 2001 Koulik Andrei, Sandy Service
+ * Copyright 2006 The FreeRADIUS server project
*/
-#include <string.h>
-#include <stdlib.h>
+#include <freeradius-devel/ident.h>
+RCSID("$Id$")
+
+#include <freeradius-devel/radiusd.h>
+#include <freeradius-devel/modules.h>
#ifdef HAVE_NDBM_H
#include <ndbm.h>
#include <fcntl.h>
-#include "libradius.h"
-#include "radiusd.h"
-#include "modules.h"
-
#ifdef SANDY_MOD
# include "sandymod.h"
#endif
-static const char rcsid[] = "$Id$";
-
#define MYDBM DBM
#define get_user_content dbm_fetch
} SM_USER_ENTRY;
-static CONF_PARSER module_config[] = {
+static const CONF_PARSER module_config[] = {
{ "usersfile", PW_TYPE_STRING_PTR,offsetof(struct rlm_dbm_t,userfile),
NULL, "/etc/uf" },
{ NULL, -1, 0, NULL, NULL }
DEBUG2("parse buffer: <<%s>>\n",beg);
retcod = userparse(beg,&vp);
- if ( retcod == T_INVALID ) librad_perror("parse error ");
+ if ( retcod == T_OP_INVALID ) librad_perror("parse error ");
switch ( retcod ) {
case T_COMMA: break; /* continue parse the current list */
if ( parse_state == SMP_PATTERN ) { /* pattern line found */
DEBUG2("process pattern");
/* check pattern against request */
- if ( paircmp(NULL, request, vp, reply ) == 0 ) {
+ if ( paircompare(NULL, request, vp, reply ) == 0 ) {
DEBUG2("rlm_dbm: Pattern matched, look for request");
pairmove(&tmp_config, &vp);
pairfree(&vp);
join_attr = vp;
while( (join_attr = pairfind(join_attr,SM_JOIN_ATTR) ) != NULL ) {
DEBUG2("rlm_dbm: Proccess nested record: username %s",
- (char *)join_attr->strvalue);
+ (char *)join_attr->vp_strvalue);
/* res = RLM_MODULE_NOTFOUND; */
- res = sm_parse_user(pdb, (char *)join_attr->strvalue, request, &tmp_config,
+ res = sm_parse_user(pdb, (char *)join_attr->vp_strvalue, request, &tmp_config,
&nu_reply, ulist);
DEBUG("rlm_dbm: recived: %d\n",res);
switch ( res ) {
* Grab the canonical user name.
*/
namepair = request->username;
- name = namepair ? (char *) namepair->strvalue : "NONE";
+ name = namepair ? (char *) namepair->vp_strvalue : "NONE";
DEBUG2("rlm_dbm: try open database file: %s\n",inst -> userfile);
static int rlm_dbm_detach(void *instance)
{
struct rlm_dbm_t *inst = instance;
- free(inst -> userfile);
free(inst);
return 0;
}
/* globally exported name */
module_t rlm_dbm = {
+ RLM_MODULE_INIT,
"dbm",
0, /* type: reserved */
- NULL, /* initialization */
rlm_dbm_instantiate, /* instantiation */
+ rlm_dbm_detach, /* detach */
{
NULL, /* authentication */
rlm_dbm_authorize, /* authorization */
NULL, /* post-proxy */
NULL /* post-auth */
},
- rlm_dbm_detach, /* detach */
- NULL /* destroy */
};