Where: UBB 6.3 BR 1 - ubb_lib_secgroups.cgi
Description: Incorrect usage of $_[0]. $_[0] is a anonymous hash that seems to contain the %in as well %filehandler (%filehandler has %lockfile which has %config). There is also a shortcut {CONFIG} reference. The problem lies in the following code:
<pre>
if (!-d "$_[0]->{NonCGIPath}/cache-$_[0]->{cache_pw}") {
mkdir("$_[0]->{NonCGIPath}/cache-$_[0]->{cache_pw}", 0777);
chmod(0777, "$_[0]->{NonCGIPath}/cache-$_[0]->{cache_pw}");
} # cache
if (!-d "$_[0]->{MembersPath}/user_groups") {
mkdir("$_[0]->{MembersPath}/user_groups", 0777);
chmod(0777, "$_[0]->{MembersPath}/user_groups");
} # user_groups
</pre>
$_[0] is incorrectly referenced and thus will cause unnecessary directories to be created.
Fix: To fix this, make use of $_[0]->{CONFIG} like the following:
<pre>
if (!-d "$_[0]->{CONFIG}->{NonCGIPath}/cache-$_[0]->{cache_pw}") {
mkdir("$_[0]->{CONFIG}->{NonCGIPath}/cache-$_[0]->{cache_pw}", 0777);
chmod(0777, "$_[0]->{CONFIG}=>{NonCGIPath}/cache-$_[0]->{cache_pw}");
} # cache
if (!-d "$_[0]->{CONFIG}->{MembersPath}/user_groups") {
mkdir("$_[0]->{CONFIG}->{MembersPath}/user_groups", 0777);
chmod(0777, "$_[0]->{CONFIG}->{MembersPath}/user_groups");
} # user_groups
</pre>
[This message was edited by Charles Capps on August 23, 2002 at 10:35 AM.]