*BSD News Article 63896


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!spool.mu.edu!pravda.aa.msen.com!nntp.coast.net!zombie.ncsc.mil!news.mathworks.com!newsfeed.internetmci.com!news.ac.net!news.serv.net!news.serv.net!not-for-mail
From: zeno@serv.net (Sean T. Lamont)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Does NDBM dbm_delete() work?
Date: 21 Mar 1996 01:52:59 -0800
Organization: ServNet Internet Services, Seattle, WA
Lines: 43
Message-ID: <4ir8tr$kbt@zebu.serv.net>
NNTP-Posting-Host: zebu.serv.net

I have a dbm password database system that I've been using under various
unix versions which seems to work fine execpt under FreeBSD. It looks
like the call to dbm_delete() -claims- to succeed, but doesn't
do anything.

All other dbm functions (add, fetch, etc.) seem to work fine.

any hints would be appreciated.
--
The code looks as follows.

#define DBM_REPLACE O_RDWR|O_CREAT


void remove_user(char *dbname,char *username)
{
  datum key,value;
  DBM *database;
  /* remove pw to database */
  database = dbm_open(dbname,DBM_REPLACE,0755);
  if (!database){
    printf("Can't open database %s. \n",dbname);
    return;
  }
  key.dptr = username;
  key.dsize = 1+strlen(username);
  if (dbm_delete(database,key))
    printf("User %s not deleted.\n",username);
  else
    printf("User %s deleted.\n",username);
  dbm_close(database);
}






-- 
Sean T. Lamont, President / CEO, Abstract Software (ServNet)  
- Internet access * WWW hosting * TCP/IP * UNIX * NEXTSTEP * WWW Development -
email: lamont@abstractsoft.com              WWW:  http://www.serv.net
"...There's no moral, it's just a lot of stuff that happens". - H. Simpson