🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.sysadmin
Article #126

Re: Preferences Password module

#126
From: Eric P. Scott
Date: Wed, 04 Nov 1992 07:45
60 lines
2968 bytes
In article <16657@umd5.umd.edu> matthews@oberon.umd.edu
	(Mike Matthews) writes:
>Has anyone else written a replacement Password changing module for
>Preferences (for NeXTstep 2.2 and/or 3.0) that changes the user's NIS
>password a la yppasswd instead of their NetInfo password?

Preferences' Password module already does this.

>Right now I'm thinking of making a module (at least 3.0 has the API) that
>does nothing but subprocess out to yppasswd since you can't just say
>yppasword userid oldpassword newpassword.  [At least, I HOPE you can't.]

(1) Subprocesses are bad.  Avoid them unless absolutely
    necessary.  (Especially for something as trivial as this.)

(2) yppasswd simply does a getpwent(getlogin()) to obtain the old
    passwd information--it doesn't "specifically" look things up
    in NIS.  [i.e. if Preferences doesn't do what you want, this
    probably won't either.]

(3) There's nothing wrong with the yppasswd(3r) routine, other
    than not returning detailed error status if it fails.

(4) It's not that difficult to write a "better" version of
    yppasswd():

    #include <pwd.h>
    #include <rpc/rpc.h>
    #include <rpcsvc/ypclnt.h>
    #include <rpcsvc/yppasswd.h>

    + use getdomainname() or yp_get_default_domain() to obtain
      your NIS domain name
    + yp_master() to find which host serves that domain
    + getrpcport() to verify that the server can be trusted
    + callrpc() with xdr_yppasswd() as inproc and xdr_int() as
      outproc

    [Note that using lower-level RPC functions would be more
    efficient and secure.  The code would be somewhat more
    complex, and you would need to be reasonably comfortable with
    TCP/IP programming using the sockets interface.]

    Link with -lrpcsvc


If you're not familiar with ONC/RPC, consider this a valuable
learning opportunity.  The usual UNIX Networking resources
(technical books, magazine articles, seminars/tutorials, college
courses, etc.) will help you here.  NeXT still provides the man
pages (but you really want to read the "real" documentation
first, which NeXT stopped shipping when 2.0 came out).

Of course, the "real" documentation--along with the source code
and some examples--is widely available on the net (try
ftp.uu.net:~ftp/systems/sun/sextape/rpc4.0/).
It's also included as part of BSD's NET2 release (lib/librpc/).
Or find someone with a SunOS 4.x doc set.  It's all the same.

					-=EPS=-
Technical Details
Message-ID: <1992Nov4.074550.28762@csus.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!spool.mu.edu!umn.edu!csus.edu!news
References: <16657@umd5.umd.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.sysadmin
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!spool.mu.edu!umn.edu!csus.edu!news
From: eps@futon.SFSU.EDU (Eric P. Scott)
Subject: Re: Preferences Password module
Message-ID: <1992Nov4.074550.28762@csus.edu>
Sender: news@csus.edu
Reply-To: eps@cs.sfsu.edu
Organization: San Francisco State University
References: <16657@umd5.umd.edu>
Date: Wed, 4 Nov 1992 07:45:50 GMT
Lines: 60