[aMail-checkins] CVS: new_project/program/lib/Storage EMail.pm,1.4,1.5
Brought to you by:
bit-man
|
From: Victor A. R. <bi...@us...> - 2002-08-16 21:49:59
|
Update of /cvsroot/amail/new_project/program/lib/Storage
In directory usw-pr-cvs1:/tmp/cvs-serv10999/program/lib/Storage
Modified Files:
EMail.pm
Log Message:
A litlle advance on aMail::Storage::Email class definition and implementation
Index: EMail.pm
===================================================================
RCS file: /cvsroot/amail/new_project/program/lib/Storage/EMail.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** EMail.pm 6 Aug 2002 22:41:23 -0000 1.4
--- EMail.pm 16 Aug 2002 21:49:55 -0000 1.5
***************
*** 5,65 ****
use Exporter;
@ISA = ('Exporter');
! @EXPORT = qw/auth_methods/;
use aMail::PAM;
my @acceptedMethods = [ 'AMAIL' ];
my $SID = "";
my $problem = "";
! sub auth_methods() {
return @acceptedMethods;
}
! sub open() {
my $self = shift;
! my $input = shift;
! $_ = $$input{'AUTH_METHOD'};
- /$AMAIL/ && do { print "AUTH_PARM: " . $$input{'AUTH_PARAMETERS'} . "\n";
- print "AUTH_METHOD: " . $$input{'AUTH_METHOD'} . "\n";
! my $authParams = $$input{'AUTH_PARAMETERS'};
! $SID = $$authParams{'SID'};
! print "aMail_ID: " . $$authParams{'aMail_ID'} . "\n";
! print "SID: " . $$authParams{'SID'} . "-" . $SID . "\n";
- print "Starting PAM\n";
- my $sec_handle = new aMail::PAM( "aMail_Storage_EMail", $$authParams{'aMail_ID'}, \&pam_conversation );
- $problem = ( ref($sec_handle) ? PAM_SUCCESS() : ref($sec_handle) );
- print "Problem: $problem\n";
- return undef unless ( $problem == PAM_SUCCESS() );
! print "Authenticate\n";
! $problem = $sec_handle->pam_authenticate();
! return undef unless ( $problem == PAM_SUCCESS() );
! print "Mgmt\n";
! $problem = $sec_handle->pam_acct_mgmt();
! return undef unless ( $problem == PAM_SUCCESS() );
! print "open_session\n";
! $problem = $sec_handle->pam_open_session();
! return undef unless ( $problem == PAM_SUCCESS() );
!
! print "END\n";
! return 1;
! };
}
! sub close() {
my $self = shift;
! return 1;
}
=pod
--- 5,139 ----
use Exporter;
@ISA = ('Exporter');
! @EXPORT = qw/authGetMethods authAuthenticate/;
use aMail::PAM;
+ use aMail::Common;
+ use aMail::Sec;
+ ##
+ ## Pending issues:
+ ##
+ ## 1.- The returned values for each fucntion are not defined
+
+
+ ################ Settings
my @acceptedMethods = [ 'AMAIL' ];
+ my $db_path = '/home/bit-man';
+ #########################################
+
my $SID = "";
my $problem = "";
! sub authGetMethods() {
return @acceptedMethods;
}
! sub authAuthenticate() {
my $self = shift;
! my $authMethod = shift;
! my @param = @_;
!
! print "Auth. Method: $authMethod \n";
! $_ = $authMethod;
! /$AMAIL/ && do { $SID = $param[1];
! return handlePAM( $param[0] );
! };
!
! ## I'm sorry, no valid authentication method;
! return 0;
! }
! sub folderCreate() {
! my $self = shift;
! my $folder = shift;
! my @param = @_;
! $SID = $param[1];
! my $aMail_ID = $param[0];
!
! return 0 if ( ! defined handlePAM( $aMail_ID ) );
! print "Folder creation: $folder\n";
!
! ###########################################
! my $user_path = "$db_path/$aMail_ID";
!
! return 0 if ( ! Check_folder_name($folder) );
! my $mailbox_file = "$user_path/folders";
! safe_open_update( *MAILBOX{IO}, $mailbox_file);
! flock(MAILBOX,2) || return 2;
!
! while (($_ = <MAILBOX>) and $_ ne "\n") {
! push @folders,$_;
! }
!
! foreach (@folders) {
! if ($_ =~ /^$folder,/) {
! close MAILBOX;
! return 1;
! }
! }
! my @messages = <MAILBOX>;
! push @folders, "$folder,0,0,0\n";
! seek MAILBOX, 0, 0;
! print MAILBOX @folders,"\n",@messages;
! close MAILBOX;
!
! ###########################################
! return 1;
! }
! sub folderDestroy() {
! my $self = shift;
! return 0;
}
+ sub folderRename() {
+ my $self = shift;
+
+ return 0;
+ }
! sub folderRetrieve() {
my $self = shift;
! return 0;
! }
!
! sub msgStore() {
! my $self = shift;
!
! return 0;
! }
!
! sub msgRetrieve() {
! my $self = shift;
!
! return 0;
! }
!
! sub msgDelete() {
! my $self = shift;
!
! return 0;
! }
!
! sub msgMove() {
! my $self = shift;
!
! return 0;
}
+ sub msgTag() {
+ my $self = shift;
+
+ return 0;
+ }
+
+
=pod
***************
*** 102,104 ****
--- 176,204 ----
}
+
+
+ sub handlePAM() {
+ my $aMail_ID = shift;
+ my $sec_handle = new aMail::PAM( "aMail_Storage_EMail", $aMail_ID, \&pam_conversation );
+ $problem = ( ref($sec_handle) ? PAM_SUCCESS() : ref($sec_handle) );
+ print "Problem: $problem\n";
+ return undef unless ( $problem == PAM_SUCCESS() );
+
+ print "Authenticate\n";
+ $problem = $sec_handle->pam_authenticate();
+ return undef unless ( $problem == PAM_SUCCESS() );
+
+ print "Mgmt\n";
+ $problem = $sec_handle->pam_acct_mgmt();
+ return undef unless ( $problem == PAM_SUCCESS() );
+
+ print "Open_session\n";
+ $problem = $sec_handle->pam_open_session();
+ return undef unless ( $problem == PAM_SUCCESS() );
+
+ print "END\n";
+ return 1;
+ }
1;
+
+
|