home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
1
/
1350
/
readme
< prev
next >
Wrap
Text File
|
1990-12-28
|
3KB
|
75 lines
MS-DOS passwd library
Stephen C. Trier
In the process of porting UNIX software to MS-DOS, especially news and
mail packages, I've run into a need for the UNIX-style password file
functions. This time I couldn't find a different way out, so I whipped up
these functions. They aren't secure, and they aren't intended to be. Instead,
they are meant to access the second function of the UNIX passwd file, which is
to contain information about various users. This they should do well.
I cannot guarantee that these functions are a wonderfully exact clone of
the UNIX versions; there may even be some big differences. This is because I
have no real documentation available about the UNIX versions. However, that
also means that I am free to place my version in the public domain. Use it as
you wish, and I would be quite interested in hearing of any changes or
improvements you make.
There is a simple makefile included, but it is not capable of building
more than one library at a time. That's a bit beyond my makefile-writing
ability, so if you want a fully-automated, whiz-bang makefile, you'll have to
write it yourself. (I'd be rather interested in such a beast, to tell the
truth.)
Hope these are useful to you.
Stephen
How to reach me by email:
sct%seldon@scl.cwru.edu
sct@po.cwru.edu if your mailer doesn't undertand "%" syntax.
Sample output from the test program:
---------- cut here ----------
Name: user1 Password: password1 User Num: 1 Group Num: 11
Full Name: Joe User Home Dir: \homes\user1 Shell: sh1
Name: user2 Password: password2 User Num: 2 Group Num: 12
Full Name: Joe User Jr. Home Dir: \homes\user2 Shell: sh2
Name: user3 Password: password3 User Num: 3 Group Num: 13
Full Name: Joe User III Home Dir: \homes\user3 Shell: sh3
setpwent returns 0
Name: user1 Password: password1 User Num: 1 Group Num: 11
Full Name: Joe User Home Dir: \homes\user1 Shell: sh1
Name: user2 Password: password2 User Num: 2 Group Num: 12
Full Name: Joe User Jr. Home Dir: \homes\user2 Shell: sh2
Name: user3 Password: password3 User Num: 3 Group Num: 13
Full Name: Joe User III Home Dir: \homes\user3 Shell: sh3
setpwent returns 0
Finding user3: user3
Finding user1: user1
Finding user2: user2
Finding user4: NULL (Should be NULL)
Finding user id 2: user2
Finding user id 1: user1
Finding user id 3: user3
Finding user id 4: NULL (Should be NULL)
endpwent returns 0
--------- cut here ---------
Remember that in order to get this output, one of the following must be true:
(1) the included "passwd" file is in \etc\passwd, or (2) the $PASSWD
environment variable must point to its location. (set PASSWD=passwd is
probably sufficient.)