-/* $Id: passwddb.c,v 1.16 2007-01-15 15:10:26 adam Exp $
+/* $Id: passwddb.c,v 1.17 2007-10-29 08:19:39 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#include <crypt.h>
#endif
+#include <assert.h>
#include <yaz/log.h>
#include <yaz/xmalloc.h>
int passwd_db_auth(Passwd_db db, const char *user, const char *pass)
{
struct passwd_entry *pe;
+
+ assert(db);
for (pe = db->entries; pe; pe = pe->next)
if (user && !strcmp (user, pe->name))
break;
{
#if HAVE_CRYPT_H
const char *des_try;
+ assert(pe->des);
if (strlen (pe->des) < 3)
return -3;
if (!pass)
}
des_try = crypt (pass, pe->des);
+ assert(des_try);
if (strcmp (des_try, pe->des))
return -2;
#else
}
else
{
+ assert(pass);
+ assert(pe->des);
if (strcmp (pe->des, pass))
return -2;
}