sulfericacid has asked for the wisdom of the Perl Monks concerning the following question:
I could be doing it wrong I suppose so I posted the script below to see if anyone notices a bug pertaining to this problem. I know you're not likely to change ownership without being a superuser but 1220 is my account information so I don't see what's holding back.
Any advice?
#!/usr/bin/perl -w use strict; use diagnostics; use CGI qw(:standard); use POSIX; require SDBM_File; my $location = "stored.dbm"; my %stored; my @chars = ("a".."z","A".."Z"); my $chars; my $ID; my $uid = "1220"; my $gid = "1220"; chomp( my $user = param('user') ); chomp( my $pass = param('pass') ); tie %stored, 'SDBM_File', $location, O_CREAT | O_RDWR, 0644; print header, start_html('Log In'); print start_form(), table( Tr( td("Username"), ), Tr( td( textfield( -name => 'user', -size => 20 ), ) ), Tr( td("Password"), ), Tr( td( textfield( -name => 'pass', -size => 20 ), ) ) ), Tr( td(submit), ), end_form(); if ( param() ) { if (exists $stored{$user}) { print "User name already in use, please try another"; exit; } if (($pass) && ($user)) { $ID = join '', map { $chars[ rand @chars ] } 1..10; } my @combine = ($pass, $ID); $stored{$user} = join "::", @combine; print "random id was $ID<br>"; my $dir = $ENV{'DOCUMENT_ROOT'} . "/new/" . $ID; mkdir($dir, 0755); chown $uid, $gid, $dir; print "folder $dir was created"; print "<br>"; print "Test printing<br>"; foreach (sort keys(%stored)) { print "$_ => $stored{$_}<br>"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File ownership
by Improv (Pilgrim) on Apr 23, 2003 at 15:56 UTC | |
by sulfericacid (Deacon) on Apr 23, 2003 at 16:01 UTC | |
by Improv (Pilgrim) on Apr 23, 2003 at 17:56 UTC | |
by sulfericacid (Deacon) on Apr 23, 2003 at 18:12 UTC | |
by Improv (Pilgrim) on Apr 23, 2003 at 18:15 UTC | |
| |
|
Re: File ownership
by jasonk (Parson) on Apr 23, 2003 at 15:57 UTC | |
|
Re: File ownership
by Limbic~Region (Chancellor) on Apr 23, 2003 at 23:48 UTC | |
|
Re: File ownership
by TVSET (Chaplain) on Apr 23, 2003 at 16:05 UTC | |
by Coplan (Pilgrim) on Apr 23, 2003 at 16:47 UTC |