Changeset bdab2c5 in github
- Timestamp:
- Sep 20, 2009 6:25:14 AM (4 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- 104a14d
- Parents:
- 67bb96f
- Location:
- program
- Files:
-
- 3 edited
-
include/rcmail.php (modified) (1 diff)
-
include/rcube_imap.php (modified) (1 diff)
-
lib/imap.inc (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
program/include/rcmail.php
rb48d9bf rbdab2c5 379 379 // using NAMESPACE and LIST 380 380 $options = array( 381 ' imap' => $this->config->get('imap_auth_type', 'check'),381 'auth_method' => $this->config->get('imap_auth_type', 'check'), 382 382 'delimiter' => isset($_SESSION['imap_delimiter']) ? $_SESSION['imap_delimiter'] : $this->config->get('imap_delimiter'), 383 383 'rootdir' => isset($_SESSION['imap_root']) ? $_SESSION['imap_root'] : $this->config->get('imap_root'), -
program/include/rcube_imap.php
r59395e7 rbdab2c5 70 70 var $debug_level = 1; 71 71 var $error_code = 0; 72 var $options = array(' imap' => 'check');72 var $options = array('auth_method' => 'check'); 73 73 74 74 private $host, $user, $pass, $port, $ssl; -
program/lib/imap.inc
r587444f rbdab2c5 304 304 $a = explode(' ', trim($string)); 305 305 if (count($a) >= 2) { 306 if (strcasecmp($a[1], 'OK') == 0) { 306 $res = strtoupper($a[1]); 307 if ($res == 'OK') { 307 308 return 0; 308 } else if ( strcasecmp($a[1], 'NO') == 0) {309 } else if ($res == 'NO') { 309 310 return -1; 310 } else if ( strcasecmp($a[1], 'BAD') == 0) {311 } else if ($res == 'BAD') { 311 312 return -2; 312 } else if ( strcasecmp($a[1], 'BYE') == 0) {313 } else if ($res == 'BYE') { 313 314 return -3; 314 315 } … … 556 557 foreach($options as $optkey => $optval) { 557 558 if ($optkey == 'imap') { 558 $auth_method = $optval;559 $auth_method = strtoupper($optval); 559 560 } else if ($optkey == 'rootdir') { 560 561 $my_prefs['rootdir'] = $optval; … … 568 569 569 570 if (empty($auth_method)) 570 $auth_method = ' check';571 $auth_method = 'CHECK'; 571 572 572 573 $message = "INITIAL: $auth_method\n"; … … 666 667 } 667 668 668 if ( strcasecmp($auth_method, "check") == 0) {669 if ($auth_method == 'CHECK') { 669 670 //check for supported auth methods 670 671 if (iil_C_GetCapability($conn, 'AUTH=CRAM-MD5') || iil_C_GetCapability($conn, 'AUTH=CRAM_MD5')) { 671 $auth_method = ' auth';672 $auth_method = 'AUTH'; 672 673 } 673 674 else { 674 675 //default to plain text auth 675 $auth_method = 'plain'; 676 } 677 } 678 679 if (strcasecmp($auth_method, 'auth') == 0) { 680 $conn->message .= "Trying CRAM-MD5\n"; 681 676 $auth_method = 'PLAIN'; 677 } 678 } 679 680 if ($auth_method == 'AUTH') { 682 681 //do CRAM-MD5 authentication 683 682 iil_PutLine($conn->fp, "a000 AUTHENTICATE CRAM-MD5"); 684 683 $line = trim(iil_ReadLine($conn->fp, 1024)); 685 684 686 $conn->message .= "$line\n";687 688 685 if ($line[0] == '+') { 689 $conn->message .= 'Got challenge: ' . htmlspecialchars($line) . "\n";690 691 686 //got a challenge string, try CRAM-5 692 687 $result = iil_C_Authenticate($conn, $user, $password, substr($line,2)); … … 698 693 return false; 699 694 } 700 $conn->message .= " Tried CRAM-MD5: $result\n";695 $conn->message .= "AUTH CRAM-MD5: $result\n"; 701 696 } else { 702 $conn->message .= 'No challenge ('.htmlspecialchars($line)."), try plain\n";703 $auth = 'plain';697 $conn->message .= "AUTH CRAM-MD5: failed\n"; 698 $auth_method = 'PLAIN'; 704 699 } 705 700 } 706 701 707 if (!$result || strcasecmp($auth, "plain") == 0) {702 if (!$result || $auth_method == 'PLAIN') { 708 703 //do plain text auth 709 704 $result = iil_C_Login($conn, $user, $password); 710 $conn->message .= " Tried PLAIN: $result\n";705 $conn->message .= "AUTH PLAIN: $result\n"; 711 706 } 712 707 713 $conn->message .= $auth;714 715 708 if (!is_int($result)) { 716 709 iil_C_Namespace($conn); … … 780 773 return false; 781 774 } 782 if ( strcmp($conn->selected, $mailbox) == 0) {775 if ($conn->selected == $mailbox) { 783 776 return true; 784 777 } … … 789 782 $a = explode(' ', $line); 790 783 if (count($a) == 3) { 791 if (strcasecmp($a[2], 'EXISTS') == 0) { 784 $token = strtoupper($a[2]); 785 if ($token == 'EXISTS') { 792 786 $conn->exists = (int) $a[1]; 793 787 } 794 else if ( strcasecmp($a[2], 'RECENT') == 0) {788 else if ($token == 'RECENT') { 795 789 $conn->recent = (int) $a[1]; 796 790 } … … 800 794 } 801 795 } while (!iil_StartsWith($line, 'sel1', true)); 802 803 $a = explode(' ', $line);804 796 805 797 if (strcasecmp($a[1], 'OK') == 0) { … … 1478 1470 if ($parts_count>=6) { 1479 1471 for ($i=0; $i<$parts_count; $i=$i+2) { 1480 if ( strcasecmp($a[$i],'UID') == 0)1472 if ($a[$i] == 'UID') 1481 1473 $result[$id]->uid = $a[$i+1]; 1482 else if ( strcasecmp($a[$i],'RFC822.SIZE') == 0)1474 else if ($a[$i] == 'RFC822.SIZE') 1483 1475 $result[$id]->size = $a[$i+1]; 1484 else if ( strcasecmp($a[$i],'INTERNALDATE') == 0)1476 else if ($a[$i] == 'INTERNALDATE') 1485 1477 $time_str = $a[$i+1]; 1486 else if ( strcasecmp($a[$i],'FLAGS') == 0)1478 else if ($a[$i] == 'FLAGS') 1487 1479 $flags_str = $a[$i+1]; 1488 1480 } … … 1645 1637 1646 1638 if (is_array($flags_a)) { 1647 reset($flags_a); 1648 while (list(,$val)=each($flags_a)) { 1649 if (strcasecmp($val,'Seen') == 0) { 1639 // reset($flags_a); 1640 foreach($flags_a as $flag) { 1641 $flag = strtoupper($flag); 1642 if ($flag == 'SEEN') { 1650 1643 $result[$id]->seen = true; 1651 } else if ( strcasecmp($val, 'Deleted') == 0) {1652 $result[$id]->deleted =true;1653 } else if ( strcasecmp($val, 'Recent') == 0) {1644 } else if ($flag == 'DELETED') { 1645 $result[$id]->deleted = true; 1646 } else if ($flag == 'RECENT') { 1654 1647 $result[$id]->recent = true; 1655 } else if ( strcasecmp($val, 'Answered') == 0) {1648 } else if ($flag == 'ANSWERED') { 1656 1649 $result[$id]->answered = true; 1657 } else if ( strcasecmp($val, '$Forwarded') == 0) {1650 } else if ($flag == '$FORWARDED') { 1658 1651 $result[$id]->forwarded = true; 1659 } else if ( strcasecmp($val, 'Draft') == 0) {1652 } else if ($flag == 'DRAFT') { 1660 1653 $result[$id]->is_draft = true; 1661 } else if ( strcasecmp($val, '$MDNSent') == 0) {1654 } else if ($flag == '$MDNSENT') { 1662 1655 $result[$id]->mdn_sent = true; 1663 } else if ( strcasecmp($val, 'Flagged') == 0) {1656 } else if ($flag == 'FLAGGED') { 1664 1657 $result[$id]->flagged = true; 1665 1658 }
Note: See TracChangeset
for help on using the changeset viewer.
