From 0317105cfbe03ea591b2c3cbb2aaf9523509a564 Mon Sep 17 00:00:00 2001 From: zacheiss Date: Tue, 13 Nov 2007 17:37:31 +0000 Subject: [PATCH] From mark: Make sure status 9 users appear in data file. --- gen/ldap.gen | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/gen/ldap.gen b/gen/ldap.gen index e59081a8..a1a81815 100755 --- a/gen/ldap.gen +++ b/gen/ldap.gen @@ -18,18 +18,18 @@ umask 022; $dbh = DBI->connect("dbi:Oracle:moira", "moira", "moira") || exit $MR_DBMS_ERR; -$sth = $dbh->prepare("SELECT u.login, u.first, u.middle, u.last, " . - "u.clearid, u.unix_uid, u.shell, f.type, f.name " . - "FROM users u, filesys f " . - "WHERE (u.status = 1 OR u.status = 9) " . - "AND f.label = u.login"); +$sth0 = $dbh->prepare("SELECT u.login, u.first, u.middle, u.last, " . + "u.clearid, u.unix_uid, u.shell FROM users u " . + "WHERE (u.status = 1 OR u.status = 9)") + || exit $MR_DBMS_ERR; + -$sth->execute; +$sth0->execute; open(OUT, ">$outdir/users") || exit $MR_OCONFIG; -while(($login, $first, $middle, $last, $clearid, $unix_uid, $shell, $f_type, - $f_name) = $sth->fetchrow_array) { +while(($login, $first, $middle, $last, $clearid, $unix_uid, + $shell) = $sth0->fetchrow_array) { $row = "dn: uid=$login,ou=users,dc=mit,dc=edu\n"; $row .= "objectclass: top\n"; $row .= "objectclass: person\n"; @@ -69,8 +69,15 @@ while(($login, $first, $middle, $last, $clearid, $unix_uid, $shell, $f_type, $givenName .= "\n"; } - if($f_type eq "AFS") { - $row .= "homeDirectory: $f_name\n"; + $sth = $dbh->prepare("SELECT f.type, f.name FROM filesys f " . + "WHERE f.label = '$login'") || exit $MR_DBMS_ERR; + + $sth->execute; + + if(($f_type, $f_name) = $sth->fetchrow_array) { + if($f_type eq "AFS") { + $row .= "homeDirectory: $f_name\n"; + } } $row .= $sn; -- 2.45.1