Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] Looking for c source code which can generate passwords for cvs


----- Original Message -----
Subject: Re: [SLUG] Looking for c source code which can generate
passwords for cvs
> On Tue, May 01, 2001 at 06:52:54PM +0900, Antony Stace wrote:
> > Does anyone know where I can find some c source code which
> > can generate the passwords used by cvs.


Here is what I use to add users, its not pretty but it works.
and outputs it in the cvs passwd form ie
cvsusername:cryptpasswd:systemusername


#!/usr/bin/perl
use strict;
use Getopt::Std;
our($opt_f,$opt_c,$opt_u,$opt_p);
getopt('fcup');
#check command line options make sense
if ( (!$opt_f) || (!$opt_c) || (!$opt_u) || (!$opt_p)){
print "usage:\n$0\t  -f filename -c cvs_username  -u
unix_username -p passwd\n";
  exit(1);
}
# adding a user
my $outp = crypt($opt_p,substr($opt_p,0,2));
open(Ufile, ">> $opt_f") or die "cannot open password file: $!";
print Ufile "$opt_c:$outp:$opt_u\n";
exit(0);





-------Gareth Walters