commit:55a663cc23551253c89d19c99c52d8dceeda9575
author:Chip Black
committer:Chip Black
date:Tue Aug 12 02:00:49 2008 -0500
parents:d8497d5150b1cc84443ad10838462d5b93bf4582
Changed everything to use /etc/master.passwd, require bcrypt passwd for new users
diff --git a/ag-update-openbsd b/ag-update-openbsd
line changes: +7/-3
index d44c37b..25c986d
--- a/ag-update-openbsd
+++ b/ag-update-openbsd
@@ -18,16 +18,16 @@ close USERS;
 my @sysusers;
 my @allsysusers;
 
-open PASSWD, "$etc/passwd";
+open PASSWD, "$etc/master.passwd";
 while (<PASSWD>) {
-	my ($username, undef, $uid, $gid, $gecos, $home, $shell) = split(/:/);
+	my ($username, undef, $uid, $gid, $class, $change, $expire, $gecos, $home, $shell) = split(/:/);
 	push(@allsysusers, $username);
 	next unless $gecos =~ /^\[AG\]/;	# Skip non-AG-managed users
 	push(@sysusers, $username);
 }
 close PASSWD;
 
-# Check to see what there is in /etc/passwd that should be removed.
+# Check to see what there is in /etc/master.passwd that should be removed.
 my @deletes;
 for my $sysuser (@sysusers) {
 	unless (grep { $_ eq $sysuser } @agusers) {
@@ -88,6 +88,10 @@ if (@adds or @updates) {
 
 	for my $add (@updates,@adds) {
 		my $agu = AwesomeGrid::User->load($add);
+		unless (exists $agu->{'passwd-bcrypt'}) {
+			print "$agu->{username} does not have a bcrypt password! Not adding user!\n";
+			next;
+		}
 
 		printf PASSWD "%s:%s:%d:%d::0:0:[AG]:%s:%s\n",
 			$agu->{username}, $agu->{'passwd-bcrypt'},