lookups in smbpasswd file

Jim Farrell jwf at platinum.com
Wed Mar 4 18:22:08 GMT 1998

On Thu, 5 Mar 1998, Jeremy Allison wrote:

> Gerald W. Carter wrote:
> > 
> > If this is a limitation, a possible solution would be to keep the
> > standard smbpasswd file  but translate it to a DBM hash ( *.dir & *.pag
> > files ) similiar to NIS maps.  Smbpasswd could be modified to interface
> > directly iwith the DBM files.  Also add an option to dump the map to a
> > flat ASCII file.
> > 
> That's a very good idea, and one I've been wanting
> to do for a while. Issues you will need to consider :
> 1). Concurrent updates - as I recall, most dbm hash
> libraries don't allow record locking for concurrent
> updates. smbpasswd will need this I think.

I think sendmail solves this by using some scheme of locking the data file
(flock()/lockf()/fcntl()) and inserting some internal record/token to
inform other sendmails that the data base is being written to.  The
locking could really turn out be a nightmare ... especially if someone
were crazy enough to run samba with a smbpasswd file on NFS ...  and then
of course converting smbpasswd to a data base format has some obvious
ramifications on porting to NT/VMS/Novell, etc. so this would probably
have to be a compile-time option of some sort. 

Something like NIS lookups would be nice ... however plain old NIS has no 
protections, so those smb passwords would be easily accessible.  NIS+ 
might work out better, but could turn out to be just as bad if NIS 
compatibility were on and ill configured.

> 2). Transaction security - losing your password
> file due to a smbd/smbpasswd crash won't be popular.
> This may be solvable by keeping a ascii snapshot also
> but we should have some method of dealing with this.

Once you go to a data base format, there will need to be some utility to 
write new entries .... that would either be smbpaswd or a utility like 
sendmail's makemap.  If smbpasswd is used, that program could just 
automatically dump before/after snapshots for ease of mind.  If makemap 
is used, then the flat file is already available.

> 3). Setuid security. smbpasswd is a setuid root
> program - adding dbm libraries to it means that
> the dbm libraries must also pass the strict
> security requirements for such a program. Do they ?

Well, sendmail uses ndbm and such ;) I don't think that it in itself
creates any additional security issues. Sendmail, Perl, NIS, and some
BSD/auth all use ndbm in setuid executables. Someone might want to look at
GNU's dbm or the new BSD DB package. 

Hope that helps ....

-- jim

More information about the samba-ntdom mailing list