[ Usenet FAQs | Web FAQs | Documents | RFC Index ]
Single Page
Top Document: ph (cso nameserver) Frequently Asked Questions (FAQ)
Previous Document: 1.6 How can I register my CSO server?
Next Document: Section 2: Common problems / error messages
-
Search the FAQ Archives
Single Page
Top Document: ph (cso nameserver) Frequently Asked Questions (FAQ)
Previous Document: 1.6 How can I register my CSO server?
Next Document: Section 2: Common problems / error messages
1.7 How to I give everyone passwords?
(contributed by Brian T. Shelden) Password is just a field in the database, like any other. So, in your tab-separated input file (see question 1.3) just add values for the Password field in your .cnf file. (Usually 7.) Here's how I give everyone randomly generated passwords for the Directory of Legal Academia <gopher://gopher.law.cornell.edu/11/csodir/>. % mdump all > output.qi % qi2readable output.qi | givepw | readable2qi > input.qi Now remake the database with input.qi. Below are the scripts qi2readable, givepw, and readable2qi. (Yes, it could be done in one script, but qi2readable and and readable2qi are useful for other things, too.) ==================== qi2readable ==================== (cut here) #! /usr/local/bin/perl while (<>) { chop; @a = split(/\t/); foreach $a (@a) { print "$a\n" if $a !~ /^\s*$/; } print "--------------------\n"; } ==================== readable2qi ==================== (cut here) #! /usr/local/bin/perl while (<>) { if (/^[-]+$/) { print "\t\n"; } elsif (/\S+/) { chop; print $_, "\t"; } } ==================== givepw ==================== (cut here) #! /usr/local/bin/perl -w $pwnum = 7; srand($$|time); $hadapw = 0; while (<>) { if (/^[\-]+$/) { if (! $hadapw) { $ascii_passwd = &pw_generate; print "${pwnum}:$ascii_passwd\n"; } $hadapw = 0; } elsif (/^${pwnum}:/) { $hadapw = 1; } print; } #------------------------------------------------------------------------------ # Generate funky random password: #------------------------------------------------------------------------------ sub pw_generate { local(@passset, $rnd_passwd, $randum_num); local($randum_num); @passset = ('a'..'k', 'm'..'z', 'A'..'N', 'P'..'Z', '2'..'9'); $rnd_passwd = ""; for ($i = 0; $i < 8; $i++) { $randum_num = int(rand($#passset + 1)); $rnd_passwd .= @passset[$randum_num]; } return $rnd_passwd; }
Top Document: ph (cso nameserver) Frequently Asked Questions (FAQ)
Previous Document: 1.6 How can I register my CSO server?
Next Document: Section 2: Common problems / error messages
Single Page
[ Usenet FAQs | Web FAQs | Documents | RFC Index ]
Send corrections/additions to the FAQ Maintainer:
noel@camelcity.com (PH FAQ Coordinators)
Last Update October 23 2009 @ 09:12 AM