[vhffs-dev] [400] Groupname length is now checked within the regex

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 400
Author:   beuss
Date:     2007-01-15 08:30:08 +0000 (Mon, 15 Jan 2007)

Log Message:
-----------
Groupname length is now checked within the regex
Fixes bug #191 (http://bugs.vhffs.org/view.php?id=191)

Modified Paths:
--------------
    branches/vhffs_4.1/vhffs-api/src/Vhffs/Group.pm


Modified: branches/vhffs_4.1/vhffs-api/src/Vhffs/Group.pm
===================================================================
--- branches/vhffs_4.1/vhffs-api/src/Vhffs/Group.pm	2007-01-15 02:20:34 UTC (rev 399)
+++ branches/vhffs_4.1/vhffs-api/src/Vhffs/Group.pm	2007-01-15 08:30:08 UTC (rev 400)
@@ -215,7 +215,7 @@
 
 sub check_groupname($) {
     my $groupname = shift;
-    return ( defined $groupname  &&  $groupname =~ /^[a-z0-9]+$/ && length( $groupname ) >= 3 );
+    return ( defined $groupname  &&  $groupname =~ /^[a-z0-9]{3,12}$/ );
 }
         
 
@@ -245,7 +245,7 @@
     
     my $query = 'INSERT INTO vhffs_groups(gid, groupname, passwd, quota, quota_used, object_id) VALUES(?, ?, NULL, ?, 0, ?)';
     my $sth = $dbh->prepare( $query ) or return undef;
-    $sth->execute($gid, $groupname, $quota, $parent->get_oid) or return -3;
+    $sth->execute($gid, $groupname, $quota, $parent->get_oid) or return undef;
 
     $query = 'INSERT INTO vhffs_groups_info(gid, owner_uid, uid_mod) VALUES( ?, ?, ?)';
     $sth = $dbh->prepare( $query ) or return undef;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/