]> andersk Git - moira.git/commitdiff
From mark: Make sure status 9 users appear in data file.
authorzacheiss <zacheiss>
Tue, 13 Nov 2007 17:37:31 +0000 (17:37 +0000)
committerzacheiss <zacheiss>
Tue, 13 Nov 2007 17:37:31 +0000 (17:37 +0000)
gen/ldap.gen

index e59081a899e1c82ede5a12ef30ff91f09d2327fd..a1a81815d02ef7097712a96f091ef5b4327ab56f 100755 (executable)
@@ -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;
This page took 0.041825 seconds and 5 git commands to generate.