NEED equivalent 'C' command to 'SETPWFILE' under solaris 2.x

NEED equivalent 'C' command to 'SETPWFILE' under solaris 2.x

Post by The Travel » Wed, 06 Dec 1995 04:00:00



I am having a heck of a time modifying some existing code
that was originally designed for SUN-OS to run on SOLARIS.
The original command was 'setpwfile' which allowed you to
change the default referenced passwd file to an alternate
one.  Setpwfile does not appear to exist in the pwd.h file
in Solaris 2.x.  Any suggestions?

Thanks

James Hunter

?

 
 
 

NEED equivalent 'C' command to 'SETPWFILE' under solaris 2.x

Post by Lee Dunc » Wed, 06 Dec 1995 04:00:00


TT> I am having a heck of a time modifying some existing code that was
TT> originally designed for SUN-OS to run on SOLARIS.  The original
TT> command was 'setpwfile' which allowed you to change the default
TT> referenced passwd file to an alternate one.  Setpwfile does not
TT> appear to exist in the pwd.h file in Solaris 2.x.  Any
TT> suggestions?

TT> Thanks


James:

It looks like getmwnam(3C) shows that there's a function called
fgetpwent(), and this function takes a FILE ptr as an argument, so
this could be used to step through whatever password file you desire
(although you'll have to build your own fgetwent(), et. al., but that
shouldn't be too hard).

--

He who wonders discovers that this in itself is wonder.  -- M. C. Escher

 
 
 

NEED equivalent 'C' command to 'SETPWFILE' under solaris 2.x

Post by Robert L. Lamoth » Thu, 07 Dec 1995 04:00:00



> I am having a heck of a time modifying some existing code
> that was originally designed for SUN-OS to run on SOLARIS.
> The original command was 'setpwfile' which allowed you to
> change the default referenced passwd file to an alternate
> one.  Setpwfile does not appear to exist in the pwd.h file
> in Solaris 2.x.  Any suggestions?

> Thanks

> James Hunter

> ?

        I do have one, but its probably not what you want to hear.  Sun-OS 4.X
and Solaris 2.X are two completely different animals.  Sun-OS is BSD and
Solaris is SysVR4.  While there are many similarities, the differences can
be daunting.  While BSD uses a single passwd file to hold all login information
Solaris has several.  Under Solaris you have passwd and shadow to contain all
the information that was once in passwd.  By adding a shadow file, Solaris
reduces the risk of someone copying your encoded passwords and running
a password breaker on them.  To make matters worse (or better) Solaris is
heavily based on NIS+, it really, really wants to run NIS+, so all pw
functions are based on this.  Functions such as getpwent(), setpwent(),
putpwent(), etc.  are designed to reference /etc/nsswitch.conf for the
location of passwd files which can be local to the machine or available on
remote systems.  Unfortunately this means there's alot of hand waving going
on, since NIS is a part of the equation.  

        So my suggestion to you is, if you really need to use an alternate
passwd file, then write your own version of setpwfile() and rewrite all
functions that reference it so that you might use a BSD style of password
control.

                                                        -Bob

--
* Robert L. Lamothe                           Corporate Technologies Inc.     *
* Systems Engineer                            100 foot of John st.            *
* (508)459-2420                               Lowell MA 01852                 *

*                                                                             *
* "All I ask of life is a constant and exaggerated sense of my own            *
*  importance."                                                                  *

 
 
 

NEED equivalent 'C' command to 'SETPWFILE' under solaris 2.x

Post by Guy Harr » Thu, 07 Dec 1995 04:00:00



>It looks like getmwnam(3C) shows that there's a function called
>fgetpwent(),

...which is also in Solaris 1.x, so if the program is converted to use
both, that part of the program'd work under both Solaris 1.x/SunOS 4.1.y
and Solaris 2.x/SunOS 5.x.
 
 
 

NEED equivalent 'C' command to 'SETPWFILE' under solaris 2.x

Post by Guy Harr » Fri, 08 Dec 1995 04:00:00



Quote:>    I do have one, but its probably not what you want to hear.  Sun-OS 4.X
>and Solaris 2.X are two completely different animals.  Sun-OS is BSD and
>Solaris is SysVR4.  While there are many similarities, the differences can
>be daunting.  While BSD uses a single passwd file to hold all login information

Well, actually, in SunOS 4.x - which isn't "BSD", it's an OS derived from
BSD, as well as from other flavors of UNIX such as SVR3, and includes a
lot of Sunisms - you *do* have the option of having a shadow password
file (that being a Sunism - although BSDs more recent than the 4.3-tahoe
and earlier BSDs that are the BSD contributors to SunOS 4.x also have a
shadow password file capability, as I remember, different from the SunOS
4.x one).

It's the default in SunOS 5.x, though, and I think it might be the
default in other SVR4 systems.

Quote:>To make matters worse (or better) Solaris is
>heavily based on NIS+, it really, really wants to run NIS+, so all pw
>functions are based on this.  Functions such as getpwent(), setpwent(),
>putpwent(), etc.  are designed to reference /etc/nsswitch.conf for the
>location of passwd files which can be local to the machine or available on
>remote systems.  Unfortunately this means there's alot of hand waving going
>on, since NIS is a part of the equation.  

That's not unique to 5.x, either; SunOS 4.x also supports NIS access to
the password database, andd "getpwent()" and company will access NIS if
the password file has "switch off to NIS" entries in it.