Ignore:
Timestamp:
Apr 17, 2008, 4:10:17 AM (16 years ago)
Author:
andersk
Message:
Rewrite hesinfo parsing in perl.
Location:
server/common/oursrc/accountadm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • server/common/oursrc/accountadm/configure.in

    r544 r731  
    1818
    1919LOCATE(hesinfo)
    20 LOCATE(sort)
    21 LOCATE(head)
    2220LOCATE(ldapadd)
    2321LOCATE(sudo)
  • server/common/oursrc/accountadm/signup-scripts-backend.in

    r501 r731  
    3636close(BANNEDUSERS);
    3737
    38 my $homedir;
    39 my $filsys = `@hesinfo_path@ $username filsys | @sort_path@ -nk5 | @head_path@ -n1`;
    40 # AFS /afs/athena.mit.edu/user/j/b/jbarnold w /mit/jbarnold
    41 if($filsys =~ /^AFS\s(\/afs\/[\w\._\/-]+)\s.*\s\/mit\/$username(?: [0-9]+)?$/) {
    42         $homedir = $1;
     38my %filsys;
     39open HESINFO, '-|', '@hesinfo_path@', '--', $username, 'filsys' or
     40    complain("internal error");
     41while (<HESINFO>) {
     42        chomp;
     43        my %f; @f{qw(type path rw mount order)} = split / /;
     44        %filsys = %f if (($f{order} || 9999) <= ($filsys{order} || 9999));
    4345}
    44 else {
     46close HESINFO;
     47unless (defined(%filsys) &&
     48        $filsys{type} eq 'AFS' &&
     49        $filsys{path} =~ /^\/afs\/[\w\._\/-]+/ &&
     50        $filsys{mount} eq "/mit/$username") {
    4551        complain("athena user not found");
    4652}
     53my $homedir = $filsys{path};
    4754
    4855# Tell AFS that we don't want to trigger fakestat, and confirm user's homedir
     
    5057
    5158# Obtain user's homedir uid
    52 my ($spam, $spam, $spam, $spam, $uid1, $gid1, $spam, $spam, $spam, $spam, $spam, $egg, $spam) = stat '.' or complain("athena homedir not found");
     59my (undef, undef, undef, undef, $uid1, $gid1, undef, undef, undef, undef, undef, undef, undef) = stat '.' or complain("athena homedir not found");
    5360
    5461# Complain if user's uid is too low or too high
Note: See TracChangeset for help on using the changeset viewer.