svn commit: r438440 - in head/www/baikal: . files
Pietro Cerutti
gahr at FreeBSD.org
Thu Apr 13 12:34:53 UTC 2017
Author: gahr
Date: Thu Apr 13 12:34:51 2017
New Revision: 438440
URL: https://svnweb.freebsd.org/changeset/ports/438440
Log:
www/baikal: import IMAP auth backend from sabre/dav master
To authenticate against an IMAP server, you'll need to:
1) Change the authBackend in Core/Frameworks/Baikal/Core/Server.php:135 to
$authBackend = new \Sabre\DAV\Auth\Backend\IMAP(IMAP_OPEN);
2) Set the IMAP_OPEN configuration entry in Specific/config.php, e.g.,
define("IMAP_OPEN", '{192.168.1.1:993/imap/ssl/novalidate-cert}INBOX');
Obtained from: https://github.com/fruux/sabre-dav/blob/master/lib/DAV/Auth/Backend/IMAP.php
Added:
head/www/baikal/files/patch-vendor_sabre_dav_lib_DAV_Auth_Backend_IMAP.php (contents, props changed)
Modified:
head/www/baikal/Makefile
head/www/baikal/pkg-plist
Modified: head/www/baikal/Makefile
==============================================================================
--- head/www/baikal/Makefile Thu Apr 13 12:31:37 2017 (r438439)
+++ head/www/baikal/Makefile Thu Apr 13 12:34:51 2017 (r438440)
@@ -3,7 +3,7 @@
PORTNAME= baikal
PORTVERSION= 0.4.6
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= www
MASTER_SITES= https://github.com/fruux/Baikal/releases/download/${PORTVERSION}/
@@ -14,7 +14,8 @@ LICENSE= GPLv3
LICENSE_FILE= ${WRKSRC}/LICENSE
USES= php zip
-USE_PHP= ctype dom filter json mbstring openssl pdo_sqlite session xml xmlreader xmlwriter
+USE_PHP= ctype dom filter imap json mbstring openssl pdo_sqlite \
+ session xml xmlreader xmlwriter
WRKSRC= ${WRKDIR}/${PORTNAME}
NO_BUILD= yes
Added: head/www/baikal/files/patch-vendor_sabre_dav_lib_DAV_Auth_Backend_IMAP.php
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/www/baikal/files/patch-vendor_sabre_dav_lib_DAV_Auth_Backend_IMAP.php Thu Apr 13 12:34:51 2017 (r438440)
@@ -0,0 +1,82 @@
+--- /dev/null 12:27:00 UTC
++++ vendor/sabre/dav/lib/DAV/Auth/Backend/IMAP.php
+@@ -0,0 +1,79 @@
++<?php
++
++namespace Sabre\DAV\Auth\Backend;
++
++/**
++ * This is an authentication backend that uses imap.
++ *
++ * @copyright Copyright (C) fruux GmbH (https://fruux.com/)
++ * @author Michael Niewöhner (foss at mniewoehner.de)
++ * @author rosali (https://github.com/rosali)
++ * @author Evert Pot (http://evertpot.com/)
++ * @license http://sabre.io/license/ Modified BSD License
++ */
++class IMAP extends AbstractBasic {
++
++ /**
++ * IMAP server in the form {host[:port][/flag1/flag2...]}
++ * @see http://php.net/manual/en/function.imap-open.php
++ *
++ * @var string
++ */
++ protected $mailbox;
++
++ /**
++ * Creates the backend object.
++ *
++ * @param string $mailbox
++ */
++ function __construct($mailbox) {
++
++ $this->mailbox = $mailbox;
++
++ }
++
++ /**
++ * Connects to an IMAP server and tries to authenticate
++ *
++ * @param string $username
++ * @param string $password
++ * @return bool
++ */
++ protected function imapOpen($username, $password) {
++
++ $success = false;
++
++ try {
++ $imap = imap_open($this->mailbox, $username, $password, OP_HALFOPEN | OP_READONLY, 1);
++ if ($imap)
++ $success = true;
++ } catch (\ErrorException $e) {
++ error_log($e->getMessage());
++ }
++
++ $errors = imap_errors();
++ if ($errors)
++ foreach ($errors as $error)
++ error_log($error);
++
++ if (isset($imap) && $imap)
++ imap_close($imap);
++
++ return $success;
++
++ }
++
++ /**
++ * Validates a username and password by trying to authenticate against IMAP
++ *
++ * @param string $username
++ * @param string $password
++ * @return bool
++ */
++ protected function validateUserPass($username, $password) {
++
++ return $this->imapOpen($username, $password);
++
++ }
++
++}
Modified: head/www/baikal/pkg-plist
==============================================================================
--- head/www/baikal/pkg-plist Thu Apr 13 12:31:37 2017 (r438439)
+++ head/www/baikal/pkg-plist Thu Apr 13 12:34:51 2017 (r438440)
@@ -376,6 +376,7 @@
%%WWWDIR%%/vendor/sabre/dav/lib/DAV/Auth/Backend/BackendInterface.php
%%WWWDIR%%/vendor/sabre/dav/lib/DAV/Auth/Backend/BasicCallBack.php
%%WWWDIR%%/vendor/sabre/dav/lib/DAV/Auth/Backend/File.php
+%%WWWDIR%%/vendor/sabre/dav/lib/DAV/Auth/Backend/IMAP.php
%%WWWDIR%%/vendor/sabre/dav/lib/DAV/Auth/Backend/PDO.php
%%WWWDIR%%/vendor/sabre/dav/lib/DAV/Auth/Plugin.php
%%WWWDIR%%/vendor/sabre/dav/lib/DAV/Browser/GuessContentType.php
More information about the svn-ports-head
mailing list