[vhffs-dev] [1187] added a function to check the password of a mailbox |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1187
Author: gradator
Date: 2008-04-07 00:45:04 +0200 (Mon, 07 Apr 2008)
Log Message:
-----------
added a function to check the password of a mailbox
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Services/Mail.pm
Modified: trunk/vhffs-api/src/Vhffs/Services/Mail.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Mail.pm 2008-04-05 21:53:47 UTC (rev 1186)
+++ trunk/vhffs-api/src/Vhffs/Services/Mail.pm 2008-04-06 22:45:04 UTC (rev 1187)
@@ -552,6 +552,21 @@
return crypt( $clear , $salt );
}
+
+# return 1 if the password is good, else return something 0
+sub check_box_password
+{
+ my $self = shift;
+ my $local_part = shift;
+ my $clearpw = shift;
+
+ return 0 unless defined $self->{'boxes'}{$local_part};
+ my $dbpass = $self->{'boxes'}{$local_part}{'password'};
+
+ return 1 if( $dbpass eq crypt( $clearpw, $dbpass ) );
+ return 0;
+}
+
# Returns an hashref with all boxes
# The key of this hash is the local_part of each mailbox
sub get_boxes