version 1.236, 2004/08/24 06:43:21
|
version 1.237, 2004/08/24 07:26:04
|
Line 1902 sub mkdir_user_file_handler {
|
Line 1902 sub mkdir_user_file_handler {
|
} |
} |
®ister_handler("mkdiruserfile", \&mkdir_user_file_handler, 0,1,0); |
®ister_handler("mkdiruserfile", \&mkdir_user_file_handler, 0,1,0); |
|
|
|
# |
|
# rename a file in a user's home directory userfiles subdirectory. |
|
# Parameters: |
|
# cmd - the Lond request keyword that got us here. |
|
# tail - the part of the command past the keyword. |
|
# client- File descriptor connected with the client. |
|
# |
|
# Returns: |
|
# 1 - Continue processing. |
|
|
|
sub rename_user_file_handler { |
|
my ($cmd, $tail, $client) = @_; |
|
|
|
my ($udom,$uname,$old,$new) = split(/:/, $tail); |
|
$old=&unescape($old); |
|
$new=&unescape($new); |
|
if ($new =~m|/\.\./| || $old =~m|/\.\./|) { |
|
# any files paths with /../ in them refuse to deal with |
|
&Failure($client, "refused\n", "$cmd:$tail"); |
|
} else { |
|
my $udir = &propath($udom,$uname); |
|
if (-e $udir) { |
|
my $oldfile=$udir.'/userfiles/'.$old; |
|
my $newfile=$udir.'/userfiles/'.$new; |
|
if (-e $newfile) { |
|
&Failure($client, "exists\n", "$cmd:$tail"); |
|
} elsif (! -e $oldfile) { |
|
&Failure($client, "not_found\n", "$cmd:$tail"); |
|
} else { |
|
if (!rename($oldfile,$newfile)) { |
|
&Failure($client, "failed\n", "$cmd:$tail"); |
|
} else { |
|
&Reply($client, "ok\n", "$cmd:$tail"); |
|
} |
|
} |
|
} else { |
|
&Failure($client, "not_home\n", "$cmd:$tail"); |
|
} |
|
} |
|
return 1; |
|
} |
|
®ister_handler("renameuserfile", \&rename_user_file_handler, 0,1,0); |
|
|
|
|
# |
# |
# Authenticate access to a user file by checking the user's |
# Authenticate access to a user file by checking the user's |