|
|
64c3c4 |
diff -up openchange-openchange-2.3-VULCAN/configure.ac.samba44 openchange-openchange-2.3-VULCAN/configure.ac
|
|
|
64c3c4 |
--- openchange-openchange-2.3-VULCAN/configure.ac.samba44 2016-02-09 11:51:31.089982153 +0100
|
|
|
64c3c4 |
+++ openchange-openchange-2.3-VULCAN/configure.ac 2016-02-09 12:04:55.985948047 +0100
|
|
|
64c3c4 |
@@ -657,10 +657,11 @@ AC_CHECK_LIB([popt], [poptFreeContext],
|
|
|
64c3c4 |
enable_libpopt="no"
|
|
|
64c3c4 |
])
|
|
|
64c3c4 |
|
|
|
64c3c4 |
+mapitest=0
|
|
|
64c3c4 |
if test x"$enable_libpopt" = x"yes"; then
|
|
|
64c3c4 |
if test x"$enable_libmapiadmin" = x"yes"; then
|
|
|
64c3c4 |
openchangepfadmin=1
|
|
|
64c3c4 |
- mapitest=1
|
|
|
64c3c4 |
+ mapitest=0
|
|
|
64c3c4 |
fi
|
|
|
64c3c4 |
|
|
|
64c3c4 |
if test x"$enable_libocpf" = x"yes"; then
|
|
|
64c3c4 |
@@ -692,7 +693,7 @@ OC_RULE_ADD(mapipropsdump, TOOLS)
|
|
|
64c3c4 |
OC_RULE_ADD(exchange2ical, TOOLS)
|
|
|
64c3c4 |
#OC_RULE_ADD(rpcextract, TOOLS)
|
|
|
64c3c4 |
OC_RULE_ADD(openchangepfadmin, TOOLS)
|
|
|
64c3c4 |
-OC_RULE_ADD(mapitest, TOOLS)
|
|
|
64c3c4 |
+#OC_RULE_ADD(mapitest, TOOLS)
|
|
|
64c3c4 |
OC_RULE_ADD(mapiprofile, TOOLS)
|
|
|
64c3c4 |
OC_RULE_ADD(openchangemapidump, TOOLS)
|
|
|
64c3c4 |
OC_RULE_ADD(schemaIDGUID, TOOLS)
|
|
|
64c3c4 |
diff -up openchange-openchange-2.3-VULCAN/libexchange2ical/exchange2ical_property.c.samba44 openchange-openchange-2.3-VULCAN/libexchange2ical/exchange2ical_property.c
|
|
|
64c3c4 |
--- openchange-openchange-2.3-VULCAN/libexchange2ical/exchange2ical_property.c.samba44 2016-02-09 11:46:45.211994266 +0100
|
|
|
64c3c4 |
+++ openchange-openchange-2.3-VULCAN/libexchange2ical/exchange2ical_property.c 2016-02-09 12:04:07.330950109 +0100
|
|
|
64c3c4 |
@@ -22,6 +22,37 @@
|
|
|
64c3c4 |
#include "libexchange2ical/libexchange2ical.h"
|
|
|
64c3c4 |
#include <ldb.h>
|
|
|
64c3c4 |
|
|
|
64c3c4 |
+static void openchange_all_string_sub(char *s,const char *pattern,const char *insert, size_t len)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ char *p;
|
|
|
64c3c4 |
+ ssize_t ls,lp,li;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (!insert || !pattern || !s)
|
|
|
64c3c4 |
+ return;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ ls = (ssize_t)strlen(s);
|
|
|
64c3c4 |
+ lp = (ssize_t)strlen(pattern);
|
|
|
64c3c4 |
+ li = (ssize_t)strlen(insert);
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (!*pattern)
|
|
|
64c3c4 |
+ return;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (len == 0)
|
|
|
64c3c4 |
+ len = ls + 1; /* len is number of *bytes* */
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ while (lp <= ls && (p = strstr_m(s,pattern))) {
|
|
|
64c3c4 |
+ if (ls + (li-lp) >= len) {
|
|
|
64c3c4 |
+ break;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ if (li != lp) {
|
|
|
64c3c4 |
+ memmove(p+li,p+lp,strlen(p+lp)+1);
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ memcpy(p, insert, li);
|
|
|
64c3c4 |
+ s = p + li;
|
|
|
64c3c4 |
+ ls += (li-lp);
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
struct RRULE_byday {
|
|
|
64c3c4 |
uint16_t DayOfWeek;
|
|
|
64c3c4 |
const char *DayName;
|
|
|
64c3c4 |
@@ -1019,7 +1050,7 @@ void ical_property_RESOURCES(struct exch
|
|
|
64c3c4 |
if (!exchange2ical->NonSendableBcc) return;
|
|
|
64c3c4 |
|
|
|
64c3c4 |
NonSendableBcc = talloc_strdup(exchange2ical->mem_ctx, exchange2ical->NonSendableBcc);
|
|
|
64c3c4 |
- all_string_sub(NonSendableBcc, ";", ",", 0);
|
|
|
64c3c4 |
+ openchange_all_string_sub(NonSendableBcc, ";", ",", 0);
|
|
|
64c3c4 |
prop = icalproperty_new_resources(NonSendableBcc);
|
|
|
64c3c4 |
icalcomponent_add_property(exchange2ical->vevent, prop);
|
|
|
64c3c4 |
talloc_free(NonSendableBcc);
|
|
|
64c3c4 |
diff -up openchange-openchange-2.3-VULCAN/libmapiadmin/mapiadmin_user.c.samba44 openchange-openchange-2.3-VULCAN/libmapiadmin/mapiadmin_user.c
|
|
|
64c3c4 |
--- openchange-openchange-2.3-VULCAN/libmapiadmin/mapiadmin_user.c.samba44 2015-05-16 17:22:04.000000000 +0200
|
|
|
64c3c4 |
+++ openchange-openchange-2.3-VULCAN/libmapiadmin/mapiadmin_user.c 2016-02-08 22:19:17.750956440 +0100
|
|
|
64c3c4 |
@@ -24,19 +24,251 @@
|
|
|
64c3c4 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
64c3c4 |
*/
|
|
|
64c3c4 |
|
|
|
64c3c4 |
+#include <ldb.h>
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
#include "libmapiadmin/libmapiadmin.h"
|
|
|
64c3c4 |
|
|
|
64c3c4 |
#include <param.h>
|
|
|
64c3c4 |
#include <credentials.h>
|
|
|
64c3c4 |
+#include <ctype.h>
|
|
|
64c3c4 |
#include <ldb_errors.h>
|
|
|
64c3c4 |
#include <ldb_wrap.h>
|
|
|
64c3c4 |
-#include <ldap_ndr.h>
|
|
|
64c3c4 |
|
|
|
64c3c4 |
#include <gen_ndr/ndr_samr.h>
|
|
|
64c3c4 |
#include <gen_ndr/ndr_samr_c.h>
|
|
|
64c3c4 |
|
|
|
64c3c4 |
#include <time.h>
|
|
|
64c3c4 |
|
|
|
64c3c4 |
+static ssize_t openchange_sys_read(int fd, void *buf, size_t count)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ ssize_t ret;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ do {
|
|
|
64c3c4 |
+ ret = read(fd, buf, count);
|
|
|
64c3c4 |
+ } while (ret == -1 && (errno == EINTR || errno == EAGAIN ||
|
|
|
64c3c4 |
+ errno == EWOULDBLOCK));
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ return ret;
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+static ssize_t openchange_read_data(int fd, void *buffer, size_t n)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ ssize_t nread;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ nread = 0;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ while (nread < n) {
|
|
|
64c3c4 |
+ ssize_t ret;
|
|
|
64c3c4 |
+ ret = openchange_sys_read(fd, ((char *)buffer) + nread, n - nread);
|
|
|
64c3c4 |
+ if (ret <= 0) {
|
|
|
64c3c4 |
+ return ret;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ nread += ret;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ return nread;
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+static int openchange_urand_fd = -1;
|
|
|
64c3c4 |
+static void openchange_open_urandom(void)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ if (openchange_urand_fd != -1) {
|
|
|
64c3c4 |
+ return;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ openchange_urand_fd = open( "/dev/urandom", O_RDONLY,0);
|
|
|
64c3c4 |
+ if (openchange_urand_fd == -1) {
|
|
|
64c3c4 |
+ abort();
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+static void openchange_generate_random_buffer(uint8_t *out, int len)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ ssize_t rw_ret;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ openchange_open_urandom();
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ rw_ret = openchange_read_data(openchange_urand_fd, out, len);
|
|
|
64c3c4 |
+ if (rw_ret != len) {
|
|
|
64c3c4 |
+ abort();
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+static enum ndr_err_code openchange_ndr_push_dom_sid(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *r)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ uint32_t cntr_sub_auths_0;
|
|
|
64c3c4 |
+ if (ndr_flags & NDR_SCALARS) {
|
|
|
64c3c4 |
+ NDR_CHECK(ndr_push_align(ndr, 4));
|
|
|
64c3c4 |
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->sid_rev_num));
|
|
|
64c3c4 |
+ NDR_CHECK(ndr_push_int8(ndr, NDR_SCALARS, r->num_auths));
|
|
|
64c3c4 |
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->id_auth, 6));
|
|
|
64c3c4 |
+ if (r->num_auths < 0 || r->num_auths > ARRAY_SIZE(r->sub_auths)) {
|
|
|
64c3c4 |
+ return ndr_push_error(ndr, NDR_ERR_RANGE, "value out of range");
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ for (cntr_sub_auths_0 = 0; cntr_sub_auths_0 < r->num_auths; cntr_sub_auths_0++) {
|
|
|
64c3c4 |
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->sub_auths[cntr_sub_auths_0]));
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ return NDR_ERR_SUCCESS;
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+static char *openchange_ldap_encode_ndr_dom_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+#undef ldb_val
|
|
|
64c3c4 |
+ DATA_BLOB blob;
|
|
|
64c3c4 |
+ struct ldb_val val;
|
|
|
64c3c4 |
+ enum ndr_err_code ndr_err;
|
|
|
64c3c4 |
+ char *ret;
|
|
|
64c3c4 |
+ ndr_err = ndr_push_struct_blob(&blob, mem_ctx, sid,
|
|
|
64c3c4 |
+ (ndr_push_flags_fn_t)openchange_ndr_push_dom_sid);
|
|
|
64c3c4 |
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
|
|
64c3c4 |
+ return NULL;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ val.data = blob.data;
|
|
|
64c3c4 |
+ val.length = blob.length;
|
|
|
64c3c4 |
+ ret = ldb_binary_encode(mem_ctx, val);
|
|
|
64c3c4 |
+ data_blob_free(&blob;;
|
|
|
64c3c4 |
+ return ret;
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+static bool openchange_check_password_quality(const char *pwd)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ size_t ofs = 0;
|
|
|
64c3c4 |
+ size_t num_chars = 0;
|
|
|
64c3c4 |
+ size_t num_digits = 0;
|
|
|
64c3c4 |
+ size_t num_upper = 0;
|
|
|
64c3c4 |
+ size_t num_lower = 0;
|
|
|
64c3c4 |
+ size_t num_nonalpha = 0;
|
|
|
64c3c4 |
+ size_t num_unicode = 0;
|
|
|
64c3c4 |
+ size_t num_categories = 0;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (pwd == NULL) {
|
|
|
64c3c4 |
+ return false;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ while (true) {
|
|
|
64c3c4 |
+ const char *s = &pwd[ofs];
|
|
|
64c3c4 |
+ size_t len = 0;
|
|
|
64c3c4 |
+ codepoint_t c;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ c = next_codepoint(s, &len;;
|
|
|
64c3c4 |
+ if (c == INVALID_CODEPOINT) {
|
|
|
64c3c4 |
+ return false;
|
|
|
64c3c4 |
+ } else if (c == 0) {
|
|
|
64c3c4 |
+ break;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ ofs += len;
|
|
|
64c3c4 |
+ num_chars += 1;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (len == 1) {
|
|
|
64c3c4 |
+ const char *na = "~!@#$%^&*_-+=`|\\(){}[]:;\"'<>,.?/";
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (isdigit(c)) {
|
|
|
64c3c4 |
+ num_digits += 1;
|
|
|
64c3c4 |
+ continue;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (isupper(c)) {
|
|
|
64c3c4 |
+ num_upper += 1;
|
|
|
64c3c4 |
+ continue;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (islower(c)) {
|
|
|
64c3c4 |
+ num_lower += 1;
|
|
|
64c3c4 |
+ continue;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (strchr(na, c)) {
|
|
|
64c3c4 |
+ num_nonalpha += 1;
|
|
|
64c3c4 |
+ continue;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ /*
|
|
|
64c3c4 |
+ * the rest does not belong to
|
|
|
64c3c4 |
+ * a category.
|
|
|
64c3c4 |
+ */
|
|
|
64c3c4 |
+ continue;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (isupper_m(c)) {
|
|
|
64c3c4 |
+ num_upper += 1;
|
|
|
64c3c4 |
+ continue;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (islower_m(c)) {
|
|
|
64c3c4 |
+ num_lower += 1;
|
|
|
64c3c4 |
+ continue;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ /*
|
|
|
64c3c4 |
+ * Note: for now do not check if the unicode category is
|
|
|
64c3c4 |
+ * alphabetic character
|
|
|
64c3c4 |
+ *
|
|
|
64c3c4 |
+ * We would have to import the details from
|
|
|
64c3c4 |
+ * ftp://ftp.unicode.org/Public/6.3.0/ucd/UnicodeData-6.3.0d1.txt
|
|
|
64c3c4 |
+ */
|
|
|
64c3c4 |
+ num_unicode += 1;
|
|
|
64c3c4 |
+ continue;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (num_digits > 0) {
|
|
|
64c3c4 |
+ num_categories += 1;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ if (num_upper > 0) {
|
|
|
64c3c4 |
+ num_categories += 1;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ if (num_lower > 0) {
|
|
|
64c3c4 |
+ num_categories += 1;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ if (num_nonalpha > 0) {
|
|
|
64c3c4 |
+ num_categories += 1;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ if (num_unicode > 0) {
|
|
|
64c3c4 |
+ num_categories += 1;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (num_categories >= 3) {
|
|
|
64c3c4 |
+ return true;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ return false;
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+static char *openchange_generate_random_str_list(TALLOC_CTX *mem_ctx, size_t len, const char *list)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ size_t i;
|
|
|
64c3c4 |
+ size_t list_len = strlen(list);
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ char *retstr = talloc_array(mem_ctx, char, len + 1);
|
|
|
64c3c4 |
+ if (!retstr) return NULL;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ openchange_generate_random_buffer((uint8_t *)retstr, len);
|
|
|
64c3c4 |
+ for (i = 0; i < len; i++) {
|
|
|
64c3c4 |
+ retstr[i] = list[retstr[i] % list_len];
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ retstr[i] = '\0';
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ return retstr;
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+static char *openchange_generate_random_str(TALLOC_CTX *mem_ctx, size_t len)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ char *retstr;
|
|
|
64c3c4 |
+ const char *c_list = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+_-#.,";
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+again:
|
|
|
64c3c4 |
+ retstr = openchange_generate_random_str_list(mem_ctx, len, c_list);
|
|
|
64c3c4 |
+ if (!retstr) return NULL;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ /* we need to make sure the random string passes basic quality tests
|
|
|
64c3c4 |
+ or it might be rejected by windows as a password */
|
|
|
64c3c4 |
+ if (len >= 7 && !openchange_check_password_quality(retstr)) {
|
|
|
64c3c4 |
+ talloc_free(retstr);
|
|
|
64c3c4 |
+ goto again;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ return retstr;
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
/**
|
|
|
64c3c4 |
\file
|
|
|
64c3c4 |
User management functions for mapiadmin
|
|
|
64c3c4 |
@@ -232,10 +464,10 @@ _PUBLIC_ enum MAPISTATUS mapiadmin_user_
|
|
|
64c3c4 |
/* Search the user_dn */
|
|
|
64c3c4 |
account_dn = samdb_search_dn(remote_ldb, mem_ctx, NULL,
|
|
|
64c3c4 |
"(&(objectSid=%s)(objectClass=user))",
|
|
|
64c3c4 |
- ldap_encode_ndr_dom_sid(mem_ctx, dom_sid));
|
|
|
64c3c4 |
+ openchange_ldap_encode_ndr_dom_sid(mem_ctx, dom_sid));
|
|
|
64c3c4 |
|
|
|
64c3c4 |
ret = ldb_search(remote_ldb, mem_ctx, &res, account_dn, LDB_SCOPE_SUBTREE, dom_attrs, "(objectSid=%s)",
|
|
|
64c3c4 |
- ldap_encode_ndr_dom_sid(mem_ctx, dom_sid));
|
|
|
64c3c4 |
+ openchange_ldap_encode_ndr_dom_sid(mem_ctx, dom_sid));
|
|
|
64c3c4 |
MAPI_RETVAL_IF(ret != LDB_SUCCESS, MAPI_E_NOT_FOUND, mem_ctx);
|
|
|
64c3c4 |
MAPI_RETVAL_IF(res->count != 1, MAPI_E_NOT_FOUND, mem_ctx);
|
|
|
64c3c4 |
|
|
|
64c3c4 |
@@ -422,7 +654,7 @@ again:
|
|
|
64c3c4 |
}
|
|
|
64c3c4 |
|
|
|
64c3c4 |
if (!mapiadmin_ctx->password) {
|
|
|
64c3c4 |
- mapiadmin_ctx->password = generate_random_str(mapiadmin_ctx->user_ctx, MAX(8, policy_min_pw_len));
|
|
|
64c3c4 |
+ mapiadmin_ctx->password = openchange_generate_random_str(mapiadmin_ctx->user_ctx, MAX(8, policy_min_pw_len));
|
|
|
64c3c4 |
}
|
|
|
64c3c4 |
|
|
|
64c3c4 |
OC_DEBUG(3, "Setting account password '%s'", mapiadmin_ctx->password);
|
|
|
64c3c4 |
diff -up openchange-openchange-2.3-VULCAN/libmapi/mapidump.c.samba44 openchange-openchange-2.3-VULCAN/libmapi/mapidump.c
|
|
|
64c3c4 |
--- openchange-openchange-2.3-VULCAN/libmapi/mapidump.c.samba44 2016-02-09 11:03:18.565104717 +0100
|
|
|
64c3c4 |
+++ openchange-openchange-2.3-VULCAN/libmapi/mapidump.c 2016-02-09 11:03:29.508104254 +0100
|
|
|
64c3c4 |
@@ -119,7 +119,7 @@ _PUBLIC_ void mapidump_SPropValue(struct
|
|
|
64c3c4 |
data = get_SPropValue_data(&lpProp);
|
|
|
64c3c4 |
if (data) {
|
|
|
64c3c4 |
printf("%s%s:\n", sep?sep:"", proptag);
|
|
|
64c3c4 |
- dump_data(0, ((const struct Binary_r *)data)->lpb, ((const struct Binary_r *)data)->cb);
|
|
|
64c3c4 |
+ oc_dump_data(0, ((const struct Binary_r *)data)->lpb, ((const struct Binary_r *)data)->cb);
|
|
|
64c3c4 |
} else {
|
|
|
64c3c4 |
printf("%s%s: (NULL)\n", sep?sep:"", proptag);
|
|
|
64c3c4 |
}
|
|
|
64c3c4 |
@@ -153,7 +153,7 @@ _PUBLIC_ void mapidump_SPropValue(struct
|
|
|
64c3c4 |
printf("%s%s: ARRAY(%d)\n", sep?sep:"", proptag, BinaryArray_r->cValues);
|
|
|
64c3c4 |
for (i = 0; i < BinaryArray_r->cValues; i++) {
|
|
|
64c3c4 |
printf("\tPT_MV_BINARY [%d]:\n", i);
|
|
|
64c3c4 |
- dump_data(0, BinaryArray_r->lpbin[i].lpb, BinaryArray_r->lpbin[i].cb);
|
|
|
64c3c4 |
+ oc_dump_data(0, BinaryArray_r->lpbin[i].lpb, BinaryArray_r->lpbin[i].cb);
|
|
|
64c3c4 |
}
|
|
|
64c3c4 |
break;
|
|
|
64c3c4 |
default:
|
|
|
64c3c4 |
diff -up openchange-openchange-2.3-VULCAN/libmapi/mapi_object.c.samba44 openchange-openchange-2.3-VULCAN/libmapi/mapi_object.c
|
|
|
64c3c4 |
--- openchange-openchange-2.3-VULCAN/libmapi/mapi_object.c.samba44 2016-02-09 11:02:57.062105628 +0100
|
|
|
64c3c4 |
+++ openchange-openchange-2.3-VULCAN/libmapi/mapi_object.c 2016-02-09 11:03:01.012105461 +0100
|
|
|
64c3c4 |
@@ -412,7 +412,7 @@ _PUBLIC_ enum MAPISTATUS mapi_object_boo
|
|
|
64c3c4 |
while (bookmark) {
|
|
|
64c3c4 |
OC_DEBUG(0, "mapi_object_bookmark {");
|
|
|
64c3c4 |
OC_DEBUG(0, ".index == %u", bookmark->index);
|
|
|
64c3c4 |
- dump_data(0, bookmark->bin.lpb, bookmark->bin.cb);
|
|
|
64c3c4 |
+ oc_dump_data(0, bookmark->bin.lpb, bookmark->bin.cb);
|
|
|
64c3c4 |
OC_DEBUG(0, "};");
|
|
|
64c3c4 |
|
|
|
64c3c4 |
bookmark = bookmark->next;
|
|
|
64c3c4 |
diff -up openchange-openchange-2.3-VULCAN/libmapi/oc_log.c.samba44 openchange-openchange-2.3-VULCAN/libmapi/oc_log.c
|
|
|
64c3c4 |
--- openchange-openchange-2.3-VULCAN/libmapi/oc_log.c.samba44 2016-02-09 10:49:20.292140237 +0100
|
|
|
64c3c4 |
+++ openchange-openchange-2.3-VULCAN/libmapi/oc_log.c 2016-02-09 11:30:13.912036271 +0100
|
|
|
64c3c4 |
@@ -21,6 +21,12 @@
|
|
|
64c3c4 |
|
|
|
64c3c4 |
#include "libmapi/libmapi.h"
|
|
|
64c3c4 |
#include <stdio.h>
|
|
|
64c3c4 |
+#include <stdlib.h>
|
|
|
64c3c4 |
+#include <ctype.h>
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+#ifndef MIN
|
|
|
64c3c4 |
+#define MIN(a,b) ((a)<(b)?(a):(b))
|
|
|
64c3c4 |
+#endif
|
|
|
64c3c4 |
|
|
|
64c3c4 |
int _oc_log_samba_level = 0;
|
|
|
64c3c4 |
|
|
|
64c3c4 |
@@ -84,3 +90,119 @@ void oc_log_init_server(const char *prog
|
|
|
64c3c4 |
{
|
|
|
64c3c4 |
setup_logging(progname, DEBUG_FILE);
|
|
|
64c3c4 |
}
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+void oc_panic(const char *why)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ if (why) {
|
|
|
64c3c4 |
+ fprintf(stderr, "PANIC: %s\n", why);
|
|
|
64c3c4 |
+ fflush(stderr);
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ abort();
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
+static void oc_debugadd_cb(const char *buf, void *private_data)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ int *plevel = (int *)private_data;
|
|
|
64c3c4 |
+ if (plevel && *plevel <= _oc_log_samba_level) {
|
|
|
64c3c4 |
+ printf ("%s", buf);
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+static void oc_print_asc_cb(const uint8_t *buf, int len,
|
|
|
64c3c4 |
+ void (*cb)(const char *buf, void *private_data),
|
|
|
64c3c4 |
+ void *private_data)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ int i;
|
|
|
64c3c4 |
+ char s[2];
|
|
|
64c3c4 |
+ s[1] = 0;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ for (i=0; i
|
|
|
64c3c4 |
+ s[0] = isprint(buf[i]) ? buf[i] : '.';
|
|
|
64c3c4 |
+ cb(s, private_data);
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+static void oc_dump_data_cb(const uint8_t *buf, int len,
|
|
|
64c3c4 |
+ bool omit_zero_bytes,
|
|
|
64c3c4 |
+ void (*cb)(const char *buf, void *private_data),
|
|
|
64c3c4 |
+ void *private_data)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ int i=0;
|
|
|
64c3c4 |
+ static const uint8_t empty[16] = { 0, };
|
|
|
64c3c4 |
+ bool skipped = false;
|
|
|
64c3c4 |
+ char tmp[16];
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (len<=0) return;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ for (i=0;i
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (i%16 == 0) {
|
|
|
64c3c4 |
+ if ((omit_zero_bytes == true) &&
|
|
|
64c3c4 |
+ (i > 0) &&
|
|
|
64c3c4 |
+ (len > i+16) &&
|
|
|
64c3c4 |
+ (memcmp(&buf[i], &empty, 16) == 0))
|
|
|
64c3c4 |
+ {
|
|
|
64c3c4 |
+ i +=16;
|
|
|
64c3c4 |
+ continue;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (i
|
|
|
64c3c4 |
+ snprintf(tmp, sizeof(tmp), "[%04X] ", i);
|
|
|
64c3c4 |
+ cb(tmp, private_data);
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ snprintf(tmp, sizeof(tmp), "%02X ", (int)buf[i]);
|
|
|
64c3c4 |
+ cb(tmp, private_data);
|
|
|
64c3c4 |
+ i++;
|
|
|
64c3c4 |
+ if (i%8 == 0) {
|
|
|
64c3c4 |
+ cb(" ", private_data);
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ if (i%16 == 0) {
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ oc_print_asc_cb(&buf[i-16], 8, cb, private_data);
|
|
|
64c3c4 |
+ cb(" ", private_data);
|
|
|
64c3c4 |
+ oc_print_asc_cb(&buf[i-8], 8, cb, private_data);
|
|
|
64c3c4 |
+ cb("\n", private_data);
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if ((omit_zero_bytes == true) &&
|
|
|
64c3c4 |
+ (len > i+16) &&
|
|
|
64c3c4 |
+ (memcmp(&buf[i], &empty, 16) == 0)) {
|
|
|
64c3c4 |
+ if (!skipped) {
|
|
|
64c3c4 |
+ cb("skipping zero buffer bytes\n",
|
|
|
64c3c4 |
+ private_data);
|
|
|
64c3c4 |
+ skipped = true;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (i%16) {
|
|
|
64c3c4 |
+ int n;
|
|
|
64c3c4 |
+ n = 16 - (i%16);
|
|
|
64c3c4 |
+ cb(" ", private_data);
|
|
|
64c3c4 |
+ if (n>8) {
|
|
|
64c3c4 |
+ cb(" ", private_data);
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ while (n--) {
|
|
|
64c3c4 |
+ cb(" ", private_data);
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ n = MIN(8,i%16);
|
|
|
64c3c4 |
+ oc_print_asc_cb(&buf[i-(i%16)], n, cb, private_data);
|
|
|
64c3c4 |
+ cb(" ", private_data);
|
|
|
64c3c4 |
+ n = (i%16) - n;
|
|
|
64c3c4 |
+ if (n>0) {
|
|
|
64c3c4 |
+ oc_print_asc_cb(&buf[i-n], n, cb, private_data);
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ cb("\n", private_data);
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+void oc_dump_data(int level, const uint8_t *buf,int len)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ if (_oc_log_samba_level < level || !buf || !len)
|
|
|
64c3c4 |
+ return;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ oc_dump_data_cb(buf, len, false, oc_debugadd_cb, &level);
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
diff -up openchange-openchange-2.3-VULCAN/libmapi/oc_log.h.samba44 openchange-openchange-2.3-VULCAN/libmapi/oc_log.h
|
|
|
64c3c4 |
--- openchange-openchange-2.3-VULCAN/libmapi/oc_log.h.samba44 2016-02-09 10:49:16.132140414 +0100
|
|
|
64c3c4 |
+++ openchange-openchange-2.3-VULCAN/libmapi/oc_log.h 2016-02-09 10:51:57.121133592 +0100
|
|
|
64c3c4 |
@@ -79,4 +79,7 @@ void oc_log_init_server(const char *prog
|
|
|
64c3c4 |
|
|
|
64c3c4 |
extern int _oc_log_samba_level; /* Private, do not change it other than by SetMAPIDebugLevel() */
|
|
|
64c3c4 |
|
|
|
64c3c4 |
+void oc_panic(const char *why);
|
|
|
64c3c4 |
+void oc_dump_data(int level, const uint8_t *buf,int len);
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
#endif /* _OC_LOG_H_ */
|
|
|
64c3c4 |
diff -up openchange-openchange-2.3-VULCAN/libmapi/property.c.samba44 openchange-openchange-2.3-VULCAN/libmapi/property.c
|
|
|
64c3c4 |
--- openchange-openchange-2.3-VULCAN/libmapi/property.c.samba44 2016-02-09 10:46:51.040146561 +0100
|
|
|
64c3c4 |
+++ openchange-openchange-2.3-VULCAN/libmapi/property.c 2016-02-09 10:48:47.626141621 +0100
|
|
|
64c3c4 |
@@ -777,7 +777,7 @@ _PUBLIC_ void mapi_copy_spropvalues(TALL
|
|
|
64c3c4 |
// TODO: Replace this with OC_PANIC() macro when it gets visible in libmapi too
|
|
|
64c3c4 |
OC_DEBUG(0, "Unexpected multi-value property type: %s.",
|
|
|
64c3c4 |
get_proptag_name(source_value->ulPropTag));
|
|
|
64c3c4 |
- smb_panic("Unexpected multi-value property type while copying 'struct SPropValue'");
|
|
|
64c3c4 |
+ oc_panic("Unexpected multi-value property type while copying 'struct SPropValue'");
|
|
|
64c3c4 |
}
|
|
|
64c3c4 |
}
|
|
|
64c3c4 |
}
|
|
|
64c3c4 |
diff -up openchange-openchange-2.3-VULCAN/libmapi/socket/interface.c.samba44 openchange-openchange-2.3-VULCAN/libmapi/socket/interface.c
|
|
|
64c3c4 |
--- openchange-openchange-2.3-VULCAN/libmapi/socket/interface.c.samba44 2016-02-09 11:09:43.147088421 +0100
|
|
|
64c3c4 |
+++ openchange-openchange-2.3-VULCAN/libmapi/socket/interface.c 2016-02-09 11:31:47.664032298 +0100
|
|
|
64c3c4 |
@@ -90,6 +90,213 @@ static void add_interface(TALLOC_CTX *me
|
|
|
64c3c4 |
OC_DEBUG(2, "added interface ip=%s nmask=%s", iface->ip_s, iface->nmask_s);
|
|
|
64c3c4 |
}
|
|
|
64c3c4 |
|
|
|
64c3c4 |
+enum oc_protocol_types {
|
|
|
64c3c4 |
+ PROTOCOL_DEFAULT=-1,
|
|
|
64c3c4 |
+ PROTOCOL_NONE=0,
|
|
|
64c3c4 |
+ PROTOCOL_CORE,
|
|
|
64c3c4 |
+ PROTOCOL_COREPLUS,
|
|
|
64c3c4 |
+ PROTOCOL_LANMAN1,
|
|
|
64c3c4 |
+ PROTOCOL_LANMAN2,
|
|
|
64c3c4 |
+ PROTOCOL_NT1,
|
|
|
64c3c4 |
+ PROTOCOL_SMB2_02,
|
|
|
64c3c4 |
+ PROTOCOL_SMB2_10,
|
|
|
64c3c4 |
+ PROTOCOL_SMB2_22,
|
|
|
64c3c4 |
+ PROTOCOL_SMB2_24,
|
|
|
64c3c4 |
+ PROTOCOL_SMB3_00,
|
|
|
64c3c4 |
+ PROTOCOL_SMB3_02,
|
|
|
64c3c4 |
+ PROTOCOL_SMB3_10,
|
|
|
64c3c4 |
+ PROTOCOL_SMB3_11
|
|
|
64c3c4 |
+};
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+static int openchange_null_match(const char *p)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ for (;*p;p++) {
|
|
|
64c3c4 |
+ if (*p != '*' &&
|
|
|
64c3c4 |
+ *p != '<' &&
|
|
|
64c3c4 |
+ *p != '"' &&
|
|
|
64c3c4 |
+ *p != '>') return -1;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ return 0;
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+/*
|
|
|
64c3c4 |
+ the max_n structure is purely for efficiency, it doesn't contribute
|
|
|
64c3c4 |
+ to the matching algorithm except by ensuring that the algorithm does
|
|
|
64c3c4 |
+ not grow exponentially
|
|
|
64c3c4 |
+*/
|
|
|
64c3c4 |
+struct max_n {
|
|
|
64c3c4 |
+ const char *predot;
|
|
|
64c3c4 |
+ const char *postdot;
|
|
|
64c3c4 |
+};
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+/*
|
|
|
64c3c4 |
+ p and n are the pattern and string being matched. The max_n array is
|
|
|
64c3c4 |
+ an optimisation only. The ldot pointer is NULL if the string does
|
|
|
64c3c4 |
+ not contain a '.', otherwise it points at the last dot in 'n'.
|
|
|
64c3c4 |
+*/
|
|
|
64c3c4 |
+static int openchange_ms_fnmatch_core(const char *p, const char *n,
|
|
|
64c3c4 |
+ struct max_n *max_n, const char *ldot)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ codepoint_t c, c2;
|
|
|
64c3c4 |
+ int i;
|
|
|
64c3c4 |
+ size_t size, size_n;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ while ((c = next_codepoint(p, &size))) {
|
|
|
64c3c4 |
+ p += size;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ switch (c) {
|
|
|
64c3c4 |
+ case '*':
|
|
|
64c3c4 |
+ /* a '*' matches zero or more characters of any type */
|
|
|
64c3c4 |
+ if (max_n->predot && max_n->predot <= n) {
|
|
|
64c3c4 |
+ return openchange_null_match(p);
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ for (i=0; n[i]; i += size_n) {
|
|
|
64c3c4 |
+ next_codepoint(n+i, &size_n);
|
|
|
64c3c4 |
+ if (openchange_ms_fnmatch_core(p, n+i, max_n+1, ldot) == 0) {
|
|
|
64c3c4 |
+ return 0;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ if (!max_n->predot || max_n->predot > n) max_n->predot = n;
|
|
|
64c3c4 |
+ return openchange_null_match(p);
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ case '<':
|
|
|
64c3c4 |
+ /* a '<' matches zero or more characters of
|
|
|
64c3c4 |
+ any type, but stops matching at the last
|
|
|
64c3c4 |
+ '.' in the string. */
|
|
|
64c3c4 |
+ if (max_n->predot && max_n->predot <= n) {
|
|
|
64c3c4 |
+ return openchange_null_match(p);
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ if (max_n->postdot && max_n->postdot <= n && n <= ldot) {
|
|
|
64c3c4 |
+ return -1;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ for (i=0; n[i]; i += size_n) {
|
|
|
64c3c4 |
+ next_codepoint(n+i, &size_n);
|
|
|
64c3c4 |
+ if (openchange_ms_fnmatch_core(p, n+i, max_n+1, ldot) == 0) return 0;
|
|
|
64c3c4 |
+ if (n+i == ldot) {
|
|
|
64c3c4 |
+ if (openchange_ms_fnmatch_core(p, n+i+size_n, max_n+1, ldot) == 0) return 0;
|
|
|
64c3c4 |
+ if (!max_n->postdot || max_n->postdot > n) max_n->postdot = n;
|
|
|
64c3c4 |
+ return -1;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ if (!max_n->predot || max_n->predot > n) max_n->predot = n;
|
|
|
64c3c4 |
+ return openchange_null_match(p);
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ case '?':
|
|
|
64c3c4 |
+ /* a '?' matches any single character */
|
|
|
64c3c4 |
+ if (! *n) {
|
|
|
64c3c4 |
+ return -1;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ next_codepoint(n, &size_n);
|
|
|
64c3c4 |
+ n += size_n;
|
|
|
64c3c4 |
+ break;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ case '>':
|
|
|
64c3c4 |
+ /* a '?' matches any single character, but
|
|
|
64c3c4 |
+ treats '.' specially */
|
|
|
64c3c4 |
+ if (n[0] == '.') {
|
|
|
64c3c4 |
+ if (! n[1] && openchange_null_match(p) == 0) {
|
|
|
64c3c4 |
+ return 0;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ break;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ if (! *n) return openchange_null_match(p);
|
|
|
64c3c4 |
+ next_codepoint(n, &size_n);
|
|
|
64c3c4 |
+ n += size_n;
|
|
|
64c3c4 |
+ break;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ case '"':
|
|
|
64c3c4 |
+ /* a bit like a soft '.' */
|
|
|
64c3c4 |
+ if (*n == 0 && openchange_null_match(p) == 0) {
|
|
|
64c3c4 |
+ return 0;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ if (*n != '.') return -1;
|
|
|
64c3c4 |
+ next_codepoint(n, &size_n);
|
|
|
64c3c4 |
+ n += size_n;
|
|
|
64c3c4 |
+ break;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ default:
|
|
|
64c3c4 |
+ c2 = next_codepoint(n, &size_n);
|
|
|
64c3c4 |
+ if (c != c2 && codepoint_cmpi(c, c2) != 0) {
|
|
|
64c3c4 |
+ return -1;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ n += size_n;
|
|
|
64c3c4 |
+ break;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (! *n) {
|
|
|
64c3c4 |
+ return 0;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ return -1;
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+static int openchange_ms_fnmatch_protocol(const char *pattern, const char *string, int protocol)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ int ret, count, i;
|
|
|
64c3c4 |
+ struct max_n *max_n = NULL;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (strcmp(string, "..") == 0) {
|
|
|
64c3c4 |
+ string = ".";
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (strpbrk(pattern, "<>*?\"") == NULL) {
|
|
|
64c3c4 |
+ /* this is not just an optimisation - it is essential
|
|
|
64c3c4 |
+ for LANMAN1 correctness */
|
|
|
64c3c4 |
+ return strcasecmp_m(pattern, string);
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (protocol <= PROTOCOL_LANMAN2) {
|
|
|
64c3c4 |
+ char *p = talloc_strdup(NULL, pattern);
|
|
|
64c3c4 |
+ if (p == NULL) {
|
|
|
64c3c4 |
+ return -1;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ /*
|
|
|
64c3c4 |
+ for older negotiated protocols it is possible to
|
|
|
64c3c4 |
+ translate the pattern to produce a "new style"
|
|
|
64c3c4 |
+ pattern that exactly matches w2k behaviour
|
|
|
64c3c4 |
+ */
|
|
|
64c3c4 |
+ for (i=0;p[i];i++) {
|
|
|
64c3c4 |
+ if (p[i] == '?') {
|
|
|
64c3c4 |
+ p[i] = '>';
|
|
|
64c3c4 |
+ } else if (p[i] == '.' &&
|
|
|
64c3c4 |
+ (p[i+1] == '?' ||
|
|
|
64c3c4 |
+ p[i+1] == '*' ||
|
|
|
64c3c4 |
+ p[i+1] == 0)) {
|
|
|
64c3c4 |
+ p[i] = '"';
|
|
|
64c3c4 |
+ } else if (p[i] == '*' &&
|
|
|
64c3c4 |
+ p[i+1] == '.') {
|
|
|
64c3c4 |
+ p[i] = '<';
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ ret = openchange_ms_fnmatch_protocol(p, string, PROTOCOL_NT1);
|
|
|
64c3c4 |
+ talloc_free(p);
|
|
|
64c3c4 |
+ return ret;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ for (count=i=0;pattern[i];i++) {
|
|
|
64c3c4 |
+ if (pattern[i] == '*' || pattern[i] == '<') count++;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ max_n = talloc_zero_array(NULL, struct max_n, count);
|
|
|
64c3c4 |
+ if (max_n == NULL) {
|
|
|
64c3c4 |
+ return -1;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ ret = openchange_ms_fnmatch_core(pattern, string, max_n, strrchr(string, '.'));
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ talloc_free(max_n);
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ return ret;
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+/** a generic fnmatch function - uses for non-CIFS pattern matching */
|
|
|
64c3c4 |
+static int openchange_gen_fnmatch(const char *pattern, const char *string)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ return openchange_ms_fnmatch_protocol(pattern, string, PROTOCOL_NT1);
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
|
|
|
64c3c4 |
|
|
|
64c3c4 |
/**
|
|
|
64c3c4 |
@@ -119,7 +326,7 @@ static void interpret_interface(TALLOC_C
|
|
|
64c3c4 |
|
|
|
64c3c4 |
/* first check if it is an interface name */
|
|
|
64c3c4 |
for (i=0;i
|
|
|
64c3c4 |
- if (gen_fnmatch(token, probed_ifaces[i].name) == 0) {
|
|
|
64c3c4 |
+ if (openchange_gen_fnmatch(token, probed_ifaces[i].name) == 0) {
|
|
|
64c3c4 |
add_interface(mem_ctx, probed_ifaces[i].ip,
|
|
|
64c3c4 |
probed_ifaces[i].netmask,
|
|
|
64c3c4 |
local_interfaces);
|
|
|
64c3c4 |
diff -up openchange-openchange-2.3-VULCAN/mapiproxy/servers/default/emsmdb/emsmdbp.c.samba44 openchange-openchange-2.3-VULCAN/mapiproxy/servers/default/emsmdb/emsmdbp.c
|
|
|
64c3c4 |
--- openchange-openchange-2.3-VULCAN/mapiproxy/servers/default/emsmdb/emsmdbp.c.samba44 2015-05-16 17:22:04.000000000 +0200
|
|
|
64c3c4 |
+++ openchange-openchange-2.3-VULCAN/mapiproxy/servers/default/emsmdb/emsmdbp.c 2016-02-08 17:43:52.578645298 +0100
|
|
|
64c3c4 |
@@ -31,8 +31,6 @@
|
|
|
64c3c4 |
#include "mapiproxy/libmapiserver/libmapiserver.h"
|
|
|
64c3c4 |
#include "mapiproxy/libmapiproxy/fault_util.h"
|
|
|
64c3c4 |
|
|
|
64c3c4 |
-#include <ldap_ndr.h>
|
|
|
64c3c4 |
-
|
|
|
64c3c4 |
/* Expose samdb_connect prototype */
|
|
|
64c3c4 |
struct ldb_context *samdb_connect(TALLOC_CTX *, struct tevent_context *,
|
|
|
64c3c4 |
struct loadparm_context *,
|
|
|
64c3c4 |
diff -up openchange-openchange-2.3-VULCAN/ndr_mapi.c.samba44 openchange-openchange-2.3-VULCAN/ndr_mapi.c
|
|
|
64c3c4 |
--- openchange-openchange-2.3-VULCAN/ndr_mapi.c.samba44 2016-02-09 11:04:30.054101688 +0100
|
|
|
64c3c4 |
+++ openchange-openchange-2.3-VULCAN/ndr_mapi.c 2016-02-09 11:04:49.763100853 +0100
|
|
|
64c3c4 |
@@ -1616,7 +1616,7 @@ _PUBLIC_ void ndr_print_EcDoRpcExt(struc
|
|
|
64c3c4 |
if (ndr_pull_mapi2k7_request(ndr_pull, NDR_SCALARS|NDR_BUFFERS, mapi_request) == NDR_ERR_SUCCESS) {
|
|
|
64c3c4 |
ndr_print_mapi2k7_request(ndr, "mapi_request", (const struct mapi2k7_request *)mapi_request);
|
|
|
64c3c4 |
} else {
|
|
|
64c3c4 |
- dump_data(0, ndr_pull->data + ndr_pull->offset, ndr_pull->data_size - ndr_pull->offset);
|
|
|
64c3c4 |
+ oc_dump_data(0, ndr_pull->data + ndr_pull->offset, ndr_pull->data_size - ndr_pull->offset);
|
|
|
64c3c4 |
talloc_free(mapi_request);
|
|
|
64c3c4 |
break;
|
|
|
64c3c4 |
}
|
|
|
64c3c4 |
@@ -1662,7 +1662,7 @@ _PUBLIC_ void ndr_print_EcDoRpcExt(struc
|
|
|
64c3c4 |
if (ndr_pull_mapi2k7_response(ndr_pull, NDR_SCALARS|NDR_BUFFERS, mapi_response) == NDR_ERR_SUCCESS) {
|
|
|
64c3c4 |
ndr_print_mapi2k7_response(ndr, "mapi_response", (const struct mapi2k7_response *)mapi_response);
|
|
|
64c3c4 |
} else {
|
|
|
64c3c4 |
- dump_data(0, ndr_pull->data + ndr_pull->offset, ndr_pull->data_size - ndr_pull->offset);
|
|
|
64c3c4 |
+ oc_dump_data(0, ndr_pull->data + ndr_pull->offset, ndr_pull->data_size - ndr_pull->offset);
|
|
|
64c3c4 |
talloc_free(mapi_response);
|
|
|
64c3c4 |
break;
|
|
|
64c3c4 |
}
|
|
|
64c3c4 |
@@ -1735,7 +1735,7 @@ _PUBLIC_ void ndr_print_EcDoRpcExt2(stru
|
|
|
64c3c4 |
if (ndr_pull_mapi2k7_request(ndr_pull, NDR_SCALARS|NDR_BUFFERS, mapi_request) == NDR_ERR_SUCCESS) {
|
|
|
64c3c4 |
ndr_print_mapi2k7_request(ndr, "mapi_request", (const struct mapi2k7_request *)mapi_request);
|
|
|
64c3c4 |
} else {
|
|
|
64c3c4 |
- dump_data(0, ndr_pull->data + ndr_pull->offset, ndr_pull->data_size - ndr_pull->offset);
|
|
|
64c3c4 |
+ oc_dump_data(0, ndr_pull->data + ndr_pull->offset, ndr_pull->data_size - ndr_pull->offset);
|
|
|
64c3c4 |
talloc_free(mapi_request);
|
|
|
64c3c4 |
return;
|
|
|
64c3c4 |
}
|
|
|
64c3c4 |
@@ -1786,7 +1786,7 @@ _PUBLIC_ void ndr_print_EcDoRpcExt2(stru
|
|
|
64c3c4 |
if (ndr_pull_mapi2k7_response(ndr_pull, NDR_SCALARS|NDR_BUFFERS, mapi_response) == NDR_ERR_SUCCESS) {
|
|
|
64c3c4 |
ndr_print_mapi2k7_response(ndr, "mapi_response", (const struct mapi2k7_response *)mapi_response);
|
|
|
64c3c4 |
} else {
|
|
|
64c3c4 |
- dump_data(0, ndr_pull->data + ndr_pull->offset, ndr_pull->data_size - ndr_pull->offset);
|
|
|
64c3c4 |
+ oc_dump_data(0, ndr_pull->data + ndr_pull->offset, ndr_pull->data_size - ndr_pull->offset);
|
|
|
64c3c4 |
talloc_free(mapi_response);
|
|
|
64c3c4 |
break;
|
|
|
64c3c4 |
}
|
|
|
64c3c4 |
@@ -2041,7 +2041,7 @@ _PUBLIC_ void ndr_print_SBinary_short(st
|
|
|
64c3c4 |
uint32_t _flags_save_STRUCT = ndr->flags;
|
|
|
64c3c4 |
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
|
|
|
64c3c4 |
ndr->depth++;
|
|
|
64c3c4 |
- dump_data(0, r->lpb, r->cb);
|
|
|
64c3c4 |
+ oc_dump_data(0, r->lpb, r->cb);
|
|
|
64c3c4 |
ndr->depth--;
|
|
|
64c3c4 |
ndr->flags = _flags_save_STRUCT;
|
|
|
64c3c4 |
}
|
|
|
64c3c4 |
@@ -2054,7 +2054,7 @@ _PUBLIC_ void ndr_print_Binary_r(struct
|
|
|
64c3c4 |
uint32_t _flags_save_STRUCT = ndr->flags;
|
|
|
64c3c4 |
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
|
|
|
64c3c4 |
ndr->depth++;
|
|
|
64c3c4 |
- dump_data(0, r->lpb, r->cb);
|
|
|
64c3c4 |
+ oc_dump_data(0, r->lpb, r->cb);
|
|
|
64c3c4 |
ndr->depth--;
|
|
|
64c3c4 |
ndr->flags = _flags_save_STRUCT;
|
|
|
64c3c4 |
}
|
|
|
64c3c4 |
diff -up openchange-openchange-2.3-VULCAN/utils/mapipropsdump.c.samba44 openchange-openchange-2.3-VULCAN/utils/mapipropsdump.c
|
|
|
64c3c4 |
--- openchange-openchange-2.3-VULCAN/utils/mapipropsdump.c.samba44 2015-05-16 17:22:04.000000000 +0200
|
|
|
64c3c4 |
+++ openchange-openchange-2.3-VULCAN/utils/mapipropsdump.c 2016-02-09 10:35:42.207174902 +0100
|
|
|
64c3c4 |
@@ -24,6 +24,9 @@
|
|
|
64c3c4 |
#include "gen_ndr/ndr_exchange.h"
|
|
|
64c3c4 |
#include <popt.h>
|
|
|
64c3c4 |
#include <dlfcn.h>
|
|
|
64c3c4 |
+#include <sys/types.h>
|
|
|
64c3c4 |
+#include <sys/stat.h>
|
|
|
64c3c4 |
+#include <unistd.h>
|
|
|
64c3c4 |
|
|
|
64c3c4 |
#define PLUGIN "libmapi.so"
|
|
|
64c3c4 |
#define FUNCTION 0xB
|
|
|
64c3c4 |
@@ -97,6 +100,51 @@ static const const struct ndr_interface_
|
|
|
64c3c4 |
return p;
|
|
|
64c3c4 |
}
|
|
|
64c3c4 |
|
|
|
64c3c4 |
+static char *openchange_fd_load(int fd, size_t *psize, size_t maxsize, TALLOC_CTX *mem_ctx)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ struct stat sbuf;
|
|
|
64c3c4 |
+ char *p;
|
|
|
64c3c4 |
+ size_t size;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (fstat(fd, &sbuf) != 0) return NULL;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ size = sbuf.st_size;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (maxsize) {
|
|
|
64c3c4 |
+ size = size < maxsize ? size : maxsize;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ p = (char *)talloc_size(mem_ctx, size+1);
|
|
|
64c3c4 |
+ if (!p) return NULL;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (read(fd, p, size) != size) {
|
|
|
64c3c4 |
+ talloc_free(p);
|
|
|
64c3c4 |
+ return NULL;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ p[size] = 0;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (psize) *psize = size;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ return p;
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+static char *openchange_file_load(const char *fname, size_t *size, size_t maxsize, TALLOC_CTX *mem_ctx)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ int fd;
|
|
|
64c3c4 |
+ char *p;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (!fname || !*fname) return NULL;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ fd = open(fname,O_RDONLY);
|
|
|
64c3c4 |
+ if (fd == -1) return NULL;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ p = openchange_fd_load(fd, size, maxsize, mem_ctx);
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ close(fd);
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ return p;
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
static struct SPropTagArray *process_request(TALLOC_CTX *mem_ctx,
|
|
|
64c3c4 |
const struct ndr_interface_call *f,
|
|
|
64c3c4 |
const char *filename,
|
|
|
64c3c4 |
@@ -123,7 +171,7 @@ static struct SPropTagArray *process_req
|
|
|
64c3c4 |
return NULL;
|
|
|
64c3c4 |
}
|
|
|
64c3c4 |
|
|
|
64c3c4 |
- data = (uint8_t *) file_load(filename, &size, 0, mem_ctx);
|
|
|
64c3c4 |
+ data = (uint8_t *) openchange_file_load(filename, &size, 0, mem_ctx);
|
|
|
64c3c4 |
if (!data) {
|
|
|
64c3c4 |
perror(filename);
|
|
|
64c3c4 |
return NULL;
|
|
|
64c3c4 |
@@ -224,7 +272,7 @@ static int process_response(TALLOC_CTX *
|
|
|
64c3c4 |
return -1;
|
|
|
64c3c4 |
}
|
|
|
64c3c4 |
|
|
|
64c3c4 |
- data = (uint8_t *) file_load(filename, &size, 0, mem_ctx);
|
|
|
64c3c4 |
+ data = (uint8_t *) openchange_file_load(filename, &size, 0, mem_ctx);
|
|
|
64c3c4 |
if (!data) {
|
|
|
64c3c4 |
perror(filename);
|
|
|
64c3c4 |
return -1;
|
|
|
64c3c4 |
diff -up openchange-openchange-2.3-VULCAN/utils/mapitest/modules/module_lzxpress.c.samba44 openchange-openchange-2.3-VULCAN/utils/mapitest/modules/module_lzxpress.c
|
|
|
64c3c4 |
--- openchange-openchange-2.3-VULCAN/utils/mapitest/modules/module_lzxpress.c.samba44 2016-02-09 11:06:00.717097846 +0100
|
|
|
64c3c4 |
+++ openchange-openchange-2.3-VULCAN/utils/mapitest/modules/module_lzxpress.c 2016-02-09 11:48:38.200989479 +0100
|
|
|
64c3c4 |
@@ -19,11 +19,61 @@
|
|
|
64c3c4 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
64c3c4 |
*/
|
|
|
64c3c4 |
|
|
|
64c3c4 |
+#include <sys/types.h>
|
|
|
64c3c4 |
+#include <sys/stat.h>
|
|
|
64c3c4 |
+#include <unistd.h>
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
#include "utils/mapitest/mapitest.h"
|
|
|
64c3c4 |
#include "utils/mapitest/proto.h"
|
|
|
64c3c4 |
#include "gen_ndr/ndr_exchange.h"
|
|
|
64c3c4 |
+#include "libmapi/libmapi.h"
|
|
|
64c3c4 |
#include "libmapi/libmapi_private.h"
|
|
|
64c3c4 |
|
|
|
64c3c4 |
+static char *openchange_fd_load(int fd, size_t *psize, size_t maxsize, TALLOC_CTX *mem_ctx)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ struct stat sbuf;
|
|
|
64c3c4 |
+ char *p;
|
|
|
64c3c4 |
+ size_t size;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (fstat(fd, &sbuf) != 0) return NULL;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ size = sbuf.st_size;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (maxsize) {
|
|
|
64c3c4 |
+ size = size < maxsize ? size : maxsize;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ p = (char *)talloc_size(mem_ctx, size+1);
|
|
|
64c3c4 |
+ if (!p) return NULL;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (read(fd, p, size) != size) {
|
|
|
64c3c4 |
+ talloc_free(p);
|
|
|
64c3c4 |
+ return NULL;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ p[size] = 0;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (psize) *psize = size;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ return p;
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+static char *openchange_file_load(const char *fname, size_t *size, size_t maxsize, TALLOC_CTX *mem_ctx)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ int fd;
|
|
|
64c3c4 |
+ char *p;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (!fname || !*fname) return NULL;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ fd = open(fname,O_RDONLY);
|
|
|
64c3c4 |
+ if (fd == -1) return NULL;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ p = openchange_fd_load(fd, size, maxsize, mem_ctx);
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ close(fd);
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ return p;
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
/**
|
|
|
64c3c4 |
\file module_lzxpress.c
|
|
|
64c3c4 |
|
|
|
64c3c4 |
@@ -51,7 +101,7 @@ _PUBLIC_ bool mapitest_lzxpress_validate
|
|
|
64c3c4 |
/* Step 1. Load Test File 001_Outlook_2007_in_ModifyRecipients_comp.dat */
|
|
|
64c3c4 |
filename = talloc_asprintf(mt->mem_ctx, "%s/001_Outlook_2007_in_ModifyRecipients_comp.dat", LZXPRESS_DATADIR);
|
|
|
64c3c4 |
/* filename = talloc_asprintf(mt->mem_ctx, "%s/002_Outlook_2007_in_Tables_operations_comp.dat", LZXPRESS_DATADIR); */
|
|
|
64c3c4 |
- data = (uint8_t *)file_load(filename, &size, 0, mt->mem_ctx);
|
|
|
64c3c4 |
+ data = (uint8_t *)openchange_file_load(filename, &size, 0, mt->mem_ctx);
|
|
|
64c3c4 |
if (!data) {
|
|
|
64c3c4 |
perror(filename);
|
|
|
64c3c4 |
mapitest_print_retval_fmt(mt, "lzxpress_validate", "Error while loading %s", filename);
|
|
|
64c3c4 |
@@ -137,12 +187,12 @@ _PUBLIC_ bool mapitest_lzxpress_validate
|
|
|
64c3c4 |
|
|
|
64c3c4 |
mapitest_print(mt, "Compressed rgbIn by Outlook\n");
|
|
|
64c3c4 |
mapitest_print(mt, "==============================\n");
|
|
|
64c3c4 |
- dump_data(0, r.in.rgbIn, r.in.cbIn);
|
|
|
64c3c4 |
+ oc_dump_data(0, r.in.rgbIn, r.in.cbIn);
|
|
|
64c3c4 |
mapitest_print(mt, "==============================\n");
|
|
|
64c3c4 |
|
|
|
64c3c4 |
mapitest_print(mt, "Compressed rgbIn by OpenChange\n");
|
|
|
64c3c4 |
mapitest_print(mt, "==============================\n");
|
|
|
64c3c4 |
- dump_data(0, ndr_rgbIn->data, ndr_rgbIn->offset);
|
|
|
64c3c4 |
+ oc_dump_data(0, ndr_rgbIn->data, ndr_rgbIn->offset);
|
|
|
64c3c4 |
mapitest_print(mt, "==============================\n");
|
|
|
64c3c4 |
|
|
|
64c3c4 |
talloc_free(ndr_rgbIn);
|
|
|
64c3c4 |
diff -up openchange-openchange-2.3-VULCAN/utils/openchangeclient.c.samba44 openchange-openchange-2.3-VULCAN/utils/openchangeclient.c
|
|
|
64c3c4 |
--- openchange-openchange-2.3-VULCAN/utils/openchangeclient.c.samba44 2015-05-16 17:22:04.000000000 +0200
|
|
|
64c3c4 |
+++ openchange-openchange-2.3-VULCAN/utils/openchangeclient.c 2016-02-08 22:24:59.212942206 +0100
|
|
|
64c3c4 |
@@ -97,6 +97,52 @@ static void init_oclient(struct oclient
|
|
|
64c3c4 |
oclient->ocpf_dump = NULL;
|
|
|
64c3c4 |
}
|
|
|
64c3c4 |
|
|
|
64c3c4 |
+static char **openchange_str_list_make(TALLOC_CTX *mem_ctx, const char *string, const char *sep)
|
|
|
64c3c4 |
+{
|
|
|
64c3c4 |
+ int num_elements = 0;
|
|
|
64c3c4 |
+ char **ret = NULL;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (sep == NULL) {
|
|
|
64c3c4 |
+ sep = " \t,\n\r";
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ ret = talloc_array(mem_ctx, char *, 1);
|
|
|
64c3c4 |
+ if (ret == NULL) {
|
|
|
64c3c4 |
+ return NULL;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ while (string && *string) {
|
|
|
64c3c4 |
+ size_t len = strcspn(string, sep);
|
|
|
64c3c4 |
+ char **ret2;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ if (len == 0) {
|
|
|
64c3c4 |
+ string += strspn(string, sep);
|
|
|
64c3c4 |
+ continue;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ ret2 = talloc_realloc(mem_ctx, ret, char *,
|
|
|
64c3c4 |
+ num_elements+2);
|
|
|
64c3c4 |
+ if (ret2 == NULL) {
|
|
|
64c3c4 |
+ talloc_free(ret);
|
|
|
64c3c4 |
+ return NULL;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+ ret = ret2;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ ret[num_elements] = talloc_strndup(ret, string, len);
|
|
|
64c3c4 |
+ if (ret[num_elements] == NULL) {
|
|
|
64c3c4 |
+ talloc_free(ret);
|
|
|
64c3c4 |
+ return NULL;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ num_elements++;
|
|
|
64c3c4 |
+ string += len;
|
|
|
64c3c4 |
+ }
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ ret[num_elements] = NULL;
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
+ return ret;
|
|
|
64c3c4 |
+}
|
|
|
64c3c4 |
+
|
|
|
64c3c4 |
static enum MAPISTATUS openchangeclient_getdir(TALLOC_CTX *mem_ctx,
|
|
|
64c3c4 |
mapi_object_t *obj_container,
|
|
|
64c3c4 |
mapi_object_t *obj_child,
|
|
|
64c3c4 |
@@ -115,7 +161,7 @@ static enum MAPISTATUS openchangeclient_
|
|
|
64c3c4 |
uint32_t i;
|
|
|
64c3c4 |
|
|
|
64c3c4 |
/* Step 1. Extract the folder list from full path */
|
|
|
64c3c4 |
- folder = str_list_make(mem_ctx, path, "/");
|
|
|
64c3c4 |
+ folder = openchange_str_list_make(mem_ctx, path, "/");
|
|
|
64c3c4 |
mapi_object_copy(&obj_folder, obj_container);
|
|
|
64c3c4 |
|
|
|
64c3c4 |
for (i = 0; folder[i]; i++) {
|