gunnar: server/apache-php KOLAB_php-5.2.6_Annotations.patch, NONE, 1.1 KOLAB_php-5.2.6_myrights.patch, NONE, 1.1 Makefile, NONE, 1.1 kolab.patch, NONE, 1.1
cvs at kolab.org
cvs at kolab.org
Thu May 15 07:48:05 CEST 2008
Author: gunnar
Update of /kolabrepository/server/apache-php
In directory doto:/tmp/cvs-serv11890/apache-php
Added Files:
KOLAB_php-5.2.6_Annotations.patch
KOLAB_php-5.2.6_myrights.patch Makefile kolab.patch
Log Message:
Not only php needs the patch but primarily apache-php.
--- NEW FILE: KOLAB_php-5.2.6_Annotations.patch ---
Provides get/set ANNOTATIONS support to PHP. [Version: 5.2.6]
diff -r 4f78d3c907b7 ext/imap/php_imap.c
--- a/ext/imap/php_imap.c Fri May 02 11:21:11 2008 +0200
+++ b/ext/imap/php_imap.c Fri May 02 11:22:09 2008 +0200
@@ -129,6 +129,7 @@ zend_function_entry imap_functions[] = {
PHP_FE(imap_binary, NULL)
PHP_FE(imap_utf8, NULL)
PHP_FE(imap_status, NULL)
+ PHP_FE(imap_status_current, NULL)
PHP_FE(imap_mailboxmsginfo, NULL)
PHP_FE(imap_setflag_full, NULL)
PHP_FE(imap_clearflag_full, NULL)
@@ -155,6 +156,10 @@ zend_function_entry imap_functions[] = {
PHP_FE(imap_setacl, NULL)
PHP_FE(imap_getacl, NULL)
#endif
+#if defined(HAVE_IMAP2005)
+ PHP_FE(imap_setannotation, NULL)
+ PHP_FE(imap_getannotation, NULL)
+#endif
PHP_FE(imap_mail, NULL)
@@ -415,6 +420,30 @@ void mail_getacl(MAILSTREAM *stream, cha
#endif
+
+#if defined(HAVE_IMAP2005)
+/* {{{ mail_getannotation
+ *
+ * Mail GET_ANNOTATION callback
+ * Called via the mail_parameter function in c-client:src/c-client/mail.c
+ */
+void mail_getannotation(MAILSTREAM *stream, ANNOTATION *alist)
+{
+ ANNOTATION_VALUES *cur;
+
+ TSRMLS_FETCH();
+
+ /* walk through the ANNOTATION_VALUES */
+
+ for(cur = alist->values; cur; cur = cur->next) {
+ if (cur->value)
+ add_assoc_stringl(IMAPG(imap_annotation_list), cur->attr, cur->value, strlen(cur->value), 1);
+ else
+ add_assoc_stringl(IMAPG(imap_annotation_list), cur->attr, "", 0, 1);
+ }
+}
+/* }}} */
+#endif
/* {{{ PHP_GINIT_FUNCTION
*/
@@ -1097,6 +1126,122 @@ PHP_FUNCTION(imap_getacl)
#endif /* HAVE_IMAP2000 || HAVE_IMAP2001 */
+#if defined(HAVE_IMAP2005)
+
+/* {{{ proto bool imap_setannotation(resource stream_id, string mailbox, string entry, string attr, string value)
+ Sets an annotation for a given mailbox */
+PHP_FUNCTION(imap_setannotation)
+{
+ zval **streamind, **mailbox, **entry, **attr, **value;
+ pils *imap_le_struct;
+ long ret;
+
+ // TODO: Use zend_parse_parameters here
+ if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &streamind, &mailbox, &entry, &attr, &value) == FAILURE) {
+ ZEND_WRONG_PARAM_COUNT();
+ }
+
+ ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
+
+ convert_to_string_ex(mailbox);
+ convert_to_string_ex(entry);
+ convert_to_string_ex(attr);
+ convert_to_string_ex(value);
+
+ // create annotation object
+ ANNOTATION *annotation = mail_newannotation();
+ if (!annotation)
+ RETURN_FALSE;
+ annotation->values = mail_newannotationvalue();
+ if (!annotation->values) {
+ mail_free_annotation(&annotation);
+ RETURN_FALSE;
+ }
+
+ // fill in annotation values
+ annotation->mbox = Z_STRVAL_PP(mailbox);
+ annotation->entry = Z_STRVAL_PP(entry);
+ annotation->values->attr = Z_STRVAL_PP(attr);
+ annotation->values->value = Z_STRVAL_PP(value);
+
+ ret = imap_setannotation(imap_le_struct->imap_stream, annotation);
+
+ // make sure mail_free_annotation doesn't free our variables
+ annotation->mbox = NULL;
+ annotation->entry = NULL;
+ annotation->values->attr = NULL;
+ annotation->values->value = NULL;
+ mail_free_annotation(&annotation);
+
+ RETURN_BOOL(ret);
+}
+/* }}} */
+
+/* {{{ proto array imap_getannotation(resource stream_id, string mailbox, string entry, string attr)
+ Gets the ACL for a given mailbox */
+PHP_FUNCTION(imap_getannotation)
+{
+ zval **streamind, **mailbox, **entry, **attr;
+ pils *imap_le_struct;
+ long ret;
+
+ if(ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &streamind, &mailbox, &entry, &attr) == FAILURE) {
+ ZEND_WRONG_PARAM_COUNT();
+ }
+
+ ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
+
+ convert_to_string_ex(mailbox);
+ convert_to_string_ex(entry);
+ convert_to_string_ex(attr);
+
+ /* initializing the special array for the return values */
+ if (array_init(return_value) == FAILURE) {
+ RETURN_FALSE;
+ }
+
+ // fillup calling parameters
+ STRINGLIST *entries = mail_newstringlist();
+ if (!entries)
+ RETURN_FALSE;
+
+ STRINGLIST *cur = entries;
+ cur->text.data = (unsigned char *)cpystr(Z_STRVAL_PP(entry));
+ cur->text.size = Z_STRLEN_PP(entry);
+ cur->next = NIL;
+
+ STRINGLIST *attributes = mail_newstringlist();
+ cur = attributes;
+ cur->text.data = (unsigned char *)cpystr (Z_STRVAL_PP(attr));
+ cur->text.size = Z_STRLEN_PP(attr);
+ cur->next = NIL;
+
+ /* initializing the special array for the return values */
+ if (array_init(return_value) == FAILURE) {
+ mail_free_stringlist(&entries);
+ mail_free_stringlist(&attributes);
+ RETURN_FALSE;
+ }
+
+ IMAPG(imap_annotation_list) = return_value;
+
+ /* set the callback for the GET_ANNOTATION function */
+ mail_parameters(NIL, SET_ANNOTATION, (void *) mail_getannotation);
+ ret = imap_getannotation(imap_le_struct->imap_stream, Z_STRVAL_PP(mailbox), entries, attributes);
+
+ mail_free_stringlist(&entries);
+ mail_free_stringlist(&attributes);
+
+ if (!ret) {
+ zval_dtor(return_value);
+ RETURN_FALSE;
+ }
+
+ IMAPG(imap_annotation_list) = NIL;
+}
+/* }}} */
+
+#endif /* HAVE_IMAP2005 */
/* {{{ proto bool imap_expunge(resource stream_id)
Permanently delete all messages marked for deletion */
@@ -2707,6 +2852,42 @@ PHP_FUNCTION(imap_msgno)
}
/* }}} */
+/* {{{ proto object imap_status_current(resource stream_id, int options)
+ Get (cached) status info from current mailbox */
+PHP_FUNCTION(imap_status_current)
+{
+ zval **streamind, **pflags;
+ pils *imap_le_struct;
+ long flags = 0L;
+
+ if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &pflags) == FAILURE) {
+ ZEND_WRONG_PARAM_COUNT();
+ }
+
+ ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
+
+ convert_to_long_ex(pflags);
+ flags = Z_LVAL_PP(pflags);
+
+ if (object_init(return_value) == FAILURE) {
+ RETURN_FALSE;
+ }
+
+ if (flags & SA_MESSAGES) {
+ add_property_long(return_value, "messages", imap_le_struct->imap_stream->nmsgs);
+ }
+ if (flags & SA_RECENT) {
+ add_property_long(return_value, "recent", imap_le_struct->imap_stream->recent);
+ }
+ if (flags & SA_UIDNEXT) {
+ add_property_long(return_value, "uidnext", imap_le_struct->imap_stream->uid_last+1);
+ }
+ if (flags & SA_UIDVALIDITY) {
+ add_property_long(return_value, "uidvalidity", imap_le_struct->imap_stream->uid_validity);
+ }
+}
+/* }}} */
+
/* {{{ proto object imap_status(resource stream_id, string mailbox, int options)
Get status info from a mailbox */
PHP_FUNCTION(imap_status)
diff -r 4f78d3c907b7 ext/imap/php_imap.h
--- a/ext/imap/php_imap.h Fri May 02 11:21:11 2008 +0200
+++ b/ext/imap/php_imap.h Fri May 02 11:22:09 2008 +0200
@@ -152,6 +152,7 @@ PHP_FUNCTION(imap_lsub_full);
PHP_FUNCTION(imap_lsub_full);
PHP_FUNCTION(imap_create);
PHP_FUNCTION(imap_rename);
+PHP_FUNCTION(imap_status_current);
PHP_FUNCTION(imap_status);
PHP_FUNCTION(imap_bodystruct);
PHP_FUNCTION(imap_fetch_overview);
@@ -168,6 +169,9 @@ PHP_FUNCTION(imap_thread);
PHP_FUNCTION(imap_thread);
PHP_FUNCTION(imap_timeout);
+// TODO: Needs fixing in configure in
+#define HAVE_IMAP2005 1
+
#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
PHP_FUNCTION(imap_get_quota);
PHP_FUNCTION(imap_get_quotaroot);
@@ -175,7 +179,10 @@ PHP_FUNCTION(imap_setacl);
PHP_FUNCTION(imap_setacl);
PHP_FUNCTION(imap_getacl);
#endif
-
+#if defined(HAVE_IMAP2005)
+PHP_FUNCTION(imap_setannotation);
+PHP_FUNCTION(imap_getannotation);
+#endif
ZEND_BEGIN_MODULE_GLOBALS(imap)
char *imap_user;
@@ -206,6 +213,9 @@ ZEND_BEGIN_MODULE_GLOBALS(imap)
zval **quota_return;
zval *imap_acl_list;
#endif
+#if defined(HAVE_IMAP2005)
+ zval *imap_annotation_list;
+#endif
/* php_stream for php_mail_gets() */
php_stream *gets_stream;
ZEND_END_MODULE_GLOBALS(imap)
--- NEW FILE: KOLAB_php-5.2.6_myrights.patch ---
diff -r 63c608b3e283 ext/imap/php_imap.c
--- a/ext/imap/php_imap.c Fri May 02 11:22:09 2008 +0200
+++ b/ext/imap/php_imap.c Tue May 13 15:36:56 2008 +0200
@@ -155,6 +155,7 @@ zend_function_entry imap_functions[] = {
PHP_FE(imap_set_quota, NULL)
PHP_FE(imap_setacl, NULL)
PHP_FE(imap_getacl, NULL)
+ PHP_FE(imap_myrights, NULL)
#endif
#if defined(HAVE_IMAP2005)
PHP_FE(imap_setannotation, NULL)
@@ -415,6 +416,20 @@ void mail_getacl(MAILSTREAM *stream, cha
for(; alist; alist = alist->next) {
add_assoc_stringl(IMAPG(imap_acl_list), alist->identifier, alist->rights, strlen(alist->rights), 1);
}
+}
+/* }}} */
+
+/* {{{ mail_myrights
+ *
+ * Mail MYRIGHTS callback
+ * Called via the mail_parameter function in c-client:src/c-client/mail.c
+ */
+void mail_myrights(MAILSTREAM *stream, char *mailbox, char *rights)
+{
+ TSRMLS_FETCH();
+
+ ZVAL_STRING(IMAPG(imap_acl_list), rights, 1)
+
}
/* }}} */
@@ -1124,6 +1139,38 @@ PHP_FUNCTION(imap_getacl)
}
/* }}} */
+/* {{{ proto array imap_getacl(resource stream_id, string mailbox)
+ Gets the ACL for a given mailbox */
+PHP_FUNCTION(imap_myrights)
+{
+ zval **streamind, **mailbox;
+ pils *imap_le_struct;
+
+ if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &mailbox) == FAILURE) {
+ ZEND_WRONG_PARAM_COUNT();
+ }
+
+ ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
+
+ convert_to_string_ex(mailbox);
+
+ /* initializing the special array for the return values */
+ array_init(return_value);
+
+ IMAPG(imap_acl_list) = return_value;
+
+ /* set the callback for the GET_ACL function */
+ mail_parameters(NIL, SET_MYRIGHTS, (void *) mail_myrights);
+ if(!imap_myrights(imap_le_struct->imap_stream, Z_STRVAL_PP(mailbox))) {
+ php_error(E_WARNING, "c-client imap_myrights failed");
+ zval_dtor(return_value);
+ RETURN_FALSE;
+ }
+
+ IMAPG(imap_acl_list) = NIL;
+}
+/* }}} */
+
#endif /* HAVE_IMAP2000 || HAVE_IMAP2001 */
#if defined(HAVE_IMAP2005)
diff -r 63c608b3e283 ext/imap/php_imap.h
--- a/ext/imap/php_imap.h Fri May 02 11:22:09 2008 +0200
+++ b/ext/imap/php_imap.h Tue May 13 15:36:56 2008 +0200
@@ -178,6 +178,7 @@ PHP_FUNCTION(imap_set_quota);
PHP_FUNCTION(imap_set_quota);
PHP_FUNCTION(imap_setacl);
PHP_FUNCTION(imap_getacl);
+PHP_FUNCTION(imap_myrights);
#endif
#if defined(HAVE_IMAP2005)
PHP_FUNCTION(imap_setannotation);
--- NEW FILE: Makefile ---
ifeq "x$(KOLABPKGURI)" "x"
KOLABPKGURI = http://ftp.gwdg.de/pub/linux/kolab/server/development-2.2/openpkg-orig-srpms/
endif
ifeq "x$(KOLABRPMSRC)" "x"
KOLABRPMSRC = $(HOME)/RPM/SRC
endif
ifeq "x$(KOLABRPMPKG)" "x"
KOLABRPMPKG = $(HOME)/RPM/PKG
endif
ifeq "x$(KOLABCVSDIR)" "x"
KOLABCVSDIR = $(CURDIR)
endif
ifeq "x$(RPM)" "x"
RPM = $(HOME)/bin/openpkg rpm
endif
PACKAGE=apache-php
VERSION=5.2.6
RELEASE=20080514
KOLABRELEASE=20080514_kolab1
PATCHES=$(KOLABCVSDIR)/KOLAB_php-5.2.6_Annotations.patch \
$(KOLABCVSDIR)/KOLAB_php-5.2.6_myrights.patch
all: $(PACKAGE)-$(VERSION)-$(KOLABRELEASE).src.rpm
$(PACKAGE)-$(VERSION)-$(KOLABRELEASE).src.rpm: $(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm $(KOLABCVSDIR)/kolab.patch $(PATCHES) Makefile
$(RPM) -ihv $(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm
cp $(PATCHES) $(KOLABRPMSRC)/$(PACKAGE)/
cd $(KOLABRPMSRC)/$(PACKAGE) && patch < $(KOLABCVSDIR)/kolab.patch && $(RPM) -ba $(PACKAGE).spec --define 'with_imap_annotate yes' --define 'with_imap_myrights yes'
cp -p $(KOLABRPMPKG)/$(PACKAGE)-$(VERSION)-$(KOLABRELEASE).src.rpm $(KOLABCVSDIR)
$(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm:
wget -c http://files.pardus.de/$(PACKAGE)-$(VERSION)-$(RELEASE).src.rpm
dist: all
cp $(KOLABCVSDIR)/$(PACKAGE)-$(VERSION)-$(KOLABRELEASE).src.rpm ../stage/
clean:
rm $(KOLABCVSDIR)/$(PACKAGE)-$(VERSION)-$(KOLABRELEASE).src.rpm
--- NEW FILE: kolab.patch ---
Index: apache-php.spec
===================================================================
RCS file: /v/openpkg/cvs/openpkg-src/apache-php/apache-php.spec,v
retrieving revision 1.30
diff -u -B -r1.30 apache-php.spec
--- apache-php.spec 14 May 2008 10:38:56 -0000 1.30
+++ apache-php.spec 15 May 2008 05:47:24 -0000
@@ -39,7 +39,7 @@
Group: Web
License: PHP
Version: %{V_php}
-Release: 20080514
+Release: 20080514_kolab1
# package options
%option with_suhosin no
@@ -61,6 +61,7 @@
%option with_iconv no
%option with_imap no
%option with_imap_annotate no
+%option with_imap_myrights no
%option with_json no
%option with_mbregex no
%option with_mbstring no
@@ -134,7 +135,8 @@
Source3: apache-php.conf
Source4: http://pecl.php.net/get/memcache-%{V_php_pecl_memcache}.tgz
Patch0: http://download.suhosin.org/suhosin-patch-%{V_php_suhosin_p}.patch.gz
-Patch1: http://kolab.org/cgi-bin/viewcvs-kolab.cgi/*checkout*/server/patches/php/php-%{V_php_kolab}/KOLAB_Annotations.patch
+Patch1: http://kolab.org/cgi-bin/viewcvs-kolab.cgi/*checkout*/server/patches/php/php-%{V_php_kolab}/KOLAB_php-%{V_php_kolab}_Annotations.patch
+Patch2: http://kolab.org/cgi-bin/viewcvs-kolab.cgi/*checkout*/server/patches/php/php-%{V_php_kolab}/KOLAB_php-%{V_php_kolab}_myrights.patch
# build information
Prefix: %{l_prefix}
@@ -340,7 +342,10 @@
configure \
ext/gd/config.m4
%if "%{with_imap_annotate}" == "yes"
- sed <%{PATCH1} -e '/php-5.2.1\/ext\/imap\/php_imap.c.orig/,/^[^\+]/d' | %{l_patch} -p1
+ %patch -p1 -P 1
+%endif
+%if "%{with_imap_myrights}" == "yes"
+ %patch -p1 -P 2
%endif
%build
More information about the commits
mailing list