🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #69

Re: Changing a User's Password

#69
From: Allan E Johannesen
Date: Tue, 21 Jul 1992 13:59
28 lines
1392 bytes
>>>>> On Monday, 20 Jul 1992 15:40:06 CDT, <NIBMSCM@NDSUVM1.BITNET> said:

NIBMSCM> I am trying to set up new users on a Sun System from within a
NIBMSCM> 'C' program.  Everything seems to be working fine except I am
NIBMSCM> not able to set up a password for the new user.  Some how I
NIBMSCM> need each users password setup before they logon for the
NIBMSCM> first time.

Use crypt() to generate one.  e.g.

char
  *ky="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./",
  salt[2],
  result[14];

char *
generate_passwd(input)
char *
  input;
{ int
    now;
  time(&now);
  salt[0] = ky[now % 64];
  salt[1] = ky[(now / 64) % 64];
  return(strcpy(result,crypt(input,salt))); }

The above chooses a "random" salt and runs a word across the crypt.
My assumption was that you just wanted the mechanics.
Technical Details
Message-ID: <AEJ.92Jul21085956@manyjars.WPI.EDU>
Path: arc1-ca.pugleaf.net!sparky!uunet!noc.near.net!wpi.WPI.EDU!nntp!aej
References: <92202.154006NIBMSCM@NDSUVM1.BITNET>

Show Full Headers
Complete Article Headers
Newsgroups: comp.unix.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!noc.near.net!wpi.WPI.EDU!nntp!aej
From: aej@manyjars.WPI.EDU (Allan E Johannesen)
Subject: Re: Changing a User's Password
In-Reply-To: 's message of Monday, 20 Jul 1992 15:40:06 CDT
Message-ID: <AEJ.92Jul21085956@manyjars.WPI.EDU>
Sender: news@wpi.WPI.EDU (USENET News System)
Nntp-Posting-Host: manyjars.wpi.edu
Organization: Worcester Polytechnic Institute, Worcester, MA 01609-2280
References: <92202.154006NIBMSCM@NDSUVM1.BITNET>
Date: Tue, 21 Jul 1992 13:59:56 GMT
Lines: 28