sha,github,commit_message,git_diff,is_security 11e741098be9fb63cf55558871f9d829f4e21548,https://github.com/openbsd/src/commit/11e741098be9fb63cf55558871f9d829f4e21548,Rename bNumInterface to bNumInterfaces to fix build on arm64.,"diff --git a/sys/dev/usb/dwc2/dwc2.c b/sys/dev/usb/dwc2/dwc2.c index 3ad7dc479f49..a7ea0ff4d0d1 100644 --- a/sys/dev/usb/dwc2/dwc2.c +++ b/sys/dev/usb/dwc2/dwc2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwc2.c,v 1.52 2020/04/03 20:11:47 patrick Exp $ */ +/* $OpenBSD: dwc2.c,v 1.53 2021/01/28 01:48:54 kurt Exp $ */ /* $NetBSD: dwc2.c,v 1.32 2014/09/02 23:26:20 macallan Exp $ */ /*- @@ -643,7 +643,7 @@ STATIC const struct dwc2_config_desc dwc2_confd = { .bLength = USB_CONFIG_DESCRIPTOR_SIZE, .bDescriptorType = UDESC_CONFIG, .wTotalLength[0] = sizeof(dwc2_confd), - .bNumInterface = 1, + .bNumInterfaces = 1, .bConfigurationValue = 1, .iConfiguration = 0, .bmAttributes = UC_BUS_POWERED | UC_SELF_POWERED, ",0 483a96693a5c342d3bd6b57564267fdd09aec67b,https://github.com/tillkamppeter/ippusbxd/commit/483a96693a5c342d3bd6b57564267fdd09aec67b,"If we mirror our printer to a port of localhost, advertise its web interface If we mirror our USB printer to a port on localhost (loopback interface), we can easily DNS-SD-advertise the web admin interface of the printer as ""http://localhost:PORT/"", whereas using other interfaces causes problems with the host name. Therefore we add the ""adminurl"" field to the TXT record of our DNS-SD advertising only if we have mirrored the printer to the loopback interface.","diff --git a/src/dnssd.c b/src/dnssd.c index 0ea3267..caf8524 100644 --- a/src/dnssd.c +++ b/src/dnssd.c @@ -285,7 +285,8 @@ dnssd_register(AvahiClient *c) ipp_txt = NULL; ipp_txt = avahi_string_list_add_printf(ipp_txt, ""rp=ipp/print""); ipp_txt = avahi_string_list_add_printf(ipp_txt, ""ty=%s %s"", make, model); - /* ipp_txt = avahi_string_list_add_printf(ipp_txt, ""adminurl=%s"", temp); */ + if (strcasecmp(g_options.interface, ""lo"") == 0) + ipp_txt = avahi_string_list_add_printf(ipp_txt, ""adminurl=%s"", temp); ipp_txt = avahi_string_list_add_printf(ipp_txt, ""product=(%s)"", model); ipp_txt = avahi_string_list_add_printf(ipp_txt, ""pdl=%s"", formats); ipp_txt = avahi_string_list_add_printf(ipp_txt, ""Color=U""); ",0 b6f13a5ef9d6280cf984826a5de012a32c396cd4?w=1,https://github.com/php/php-src/commit/b6f13a5ef9d6280cf984826a5de012a32c396cd4?w=1,Fix bug#72697 - select_colors write out-of-bounds,"diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 533dc502cabd3..cdfbaa2c4e4d2 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -99,7 +99,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int, int); #include ""gd_ctx.c"" -/* as it is not really public, duplicate declaration here to avoid +/* as it is not really public, duplicate declaration here to avoid pointless warnings */ int overflow2(int a, int b); @@ -1197,7 +1197,7 @@ PHP_MINIT_FUNCTION(gd) REGISTER_LONG_CONSTANT(""IMG_CROP_SIDES"", GD_CROP_SIDES, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""IMG_CROP_THRESHOLD"", GD_CROP_THRESHOLD, CONST_CS | CONST_PERSISTENT); - + REGISTER_LONG_CONSTANT(""IMG_BELL"", GD_BELL, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""IMG_BESSEL"", GD_BESSEL, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""IMG_BILINEAR_FIXED"", GD_BILINEAR_FIXED, CONST_CS | CONST_PERSISTENT); @@ -1651,11 +1651,11 @@ PHP_FUNCTION(imagetruecolortopalette) ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, ""Image"", le_gd); - if (ncolors <= 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Number of colors has to be greater than zero""); + if (ncolors <= 0 || ncolors > INT_MAX) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Number of colors has to be greater than zero and no more than %d"", INT_MAX); RETURN_FALSE; } - gdImageTrueColorToPalette(im, dither, ncolors); + gdImageTrueColorToPalette(im, dither, (int)ncolors); RETURN_TRUE; } @@ -3906,7 +3906,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int #endif /* VIRTUAL_DIR */ PHP_GD_CHECK_OPEN_BASEDIR(fontname, ""Invalid font filename""); - + #ifdef HAVE_GD_FREETYPE if (extended) { error = gdImageStringFTEx(im, brect, col, fontname, ptsize, angle, x, y, str, &strex); @@ -4484,7 +4484,7 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) int x, y; float x_ratio, y_ratio; long ignore_warning; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""pplll"", &f_org, &f_org_len, &f_dest, &f_dest_len, &height, &width, &threshold) == FAILURE) { return; } @@ -5367,7 +5367,7 @@ PHP_FUNCTION(imageaffinematrixget) php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Missing y position""); RETURN_FALSE; } - + if (type == GD_AFFINE_TRANSLATE) { res = gdAffineTranslate(affine, x, y); } else { diff --git a/ext/gd/tests/bug72697.phpt b/ext/gd/tests/bug72697.phpt new file mode 100644 index 0000000000000..6110385fcb807 --- /dev/null +++ b/ext/gd/tests/bug72697.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #72697: select_colors write out-of-bounds +--SKIPIF-- + +--FILE-- + +DONE +--EXPECTF-- +Warning: imagetruecolortopalette(): Number of colors has to be greater than zero and no more than 2147483647 in %sbug72697.php on line %d +DONE \ No newline at end of file ",1 fd9689745c44341b1bd6af4756f324be8abba2fb,https://github.com/php/php-src/commit/fd9689745c44341b1bd6af4756f324be8abba2fb,Fix bug #72061 - Out-of-bounds reads in zif_grapheme_stripos with negative offset,"diff --git a/ext/intl/grapheme/grapheme_string.c b/ext/intl/grapheme/grapheme_string.c index 8a094e015e433..3ba9b515240d3 100644 --- a/ext/intl/grapheme/grapheme_string.c +++ b/ext/intl/grapheme/grapheme_string.c @@ -112,7 +112,7 @@ PHP_FUNCTION(grapheme_strpos) int haystack_len, needle_len; unsigned char *found; long loffset = 0; - int32_t offset = 0; + int32_t offset = 0, noffset = 0; int ret_pos; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""ss|l"", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) { @@ -132,6 +132,7 @@ PHP_FUNCTION(grapheme_strpos) /* we checked that it will fit: */ offset = (int32_t) loffset; + noffset = offset >= 0 ? offset : haystack_len + offset; /* the offset is 'grapheme count offset' so it still might be invalid - we'll check it later */ @@ -146,7 +147,7 @@ PHP_FUNCTION(grapheme_strpos) /* quick check to see if the string might be there * I realize that 'offset' is 'grapheme count offset' but will work in spite of that */ - found = (unsigned char *)php_memnstr((char *)haystack + offset, (char *)needle, needle_len, (char *)haystack + haystack_len); + found = (unsigned char *)php_memnstr((char *)haystack + noffset, (char *)needle, needle_len, (char *)haystack + haystack_len); /* if it isn't there the we are done */ if (!found) { @@ -214,12 +215,13 @@ PHP_FUNCTION(grapheme_stripos) is_ascii = ( grapheme_ascii_check(haystack, haystack_len) >= 0 ); if ( is_ascii ) { + int32_t noffset = offset >= 0 ? offset : haystack_len + offset; needle_dup = (unsigned char *)estrndup((char *)needle, needle_len); php_strtolower((char *)needle_dup, needle_len); haystack_dup = (unsigned char *)estrndup((char *)haystack, haystack_len); php_strtolower((char *)haystack_dup, haystack_len); - found = (unsigned char*) php_memnstr((char *)haystack_dup + offset, (char *)needle_dup, needle_len, (char *)haystack_dup + haystack_len); + found = (unsigned char*) php_memnstr((char *)haystack_dup + noffset, (char *)needle_dup, needle_len, (char *)haystack_dup + haystack_len); efree(haystack_dup); efree(needle_dup); @@ -537,7 +539,7 @@ PHP_FUNCTION(grapheme_substr) efree(ustr); } ubrk_close(bi); - RETURN_EMPTY_STRING(); + RETURN_EMPTY_STRING(); } /* find the end point of the string to return */ @@ -576,7 +578,7 @@ PHP_FUNCTION(grapheme_substr) sub_str_end_pos = ustr_len; } } - + if(sub_str_start_pos > sub_str_end_pos) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, ""grapheme_substr: length is beyond start"", 1 TSRMLS_CC ); diff --git a/ext/intl/tests/bug72061.phpt b/ext/intl/tests/bug72061.phpt new file mode 100644 index 0000000000000..782c32c11cc7f --- /dev/null +++ b/ext/intl/tests/bug72061.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #72061: Out-of-bounds reads in zif_grapheme_stripos with negative offset +--SKIPIF-- + +--FILE-- + +DONE +--EXPECT-- +int(65336) +int(65336) +DONE \ No newline at end of file ",1 8fd069f6dedb064339f1091069ac96f3f8bdb552,https://github.com/civetweb/civetweb/commit/8fd069f6dedb064339f1091069ac96f3f8bdb552,Check length of memcmp,"diff --git a/src/civetweb.c b/src/civetweb.c index 4c8855134..f3fcb8c0a 100644 --- a/src/civetweb.c +++ b/src/civetweb.c @@ -11611,10 +11611,10 @@ send_ssi_file(struct mg_connection *conn, /* Handle SSI tag */ buf[len] = 0; - if (!memcmp(buf + 5, ""include"", 7)) { + if ((len > 12) && !memcmp(buf + 5, ""include"", 7)) { do_ssi_include(conn, path, buf + 12, include_level + 1); #if !defined(NO_POPEN) - } else if (!memcmp(buf + 5, ""exec"", 4)) { + } else if ((len > 9) && !memcmp(buf + 5, ""exec"", 4)) { do_ssi_exec(conn, buf + 9); #endif /* !NO_POPEN */ } else { ",1 afdeff86aaa89adeb2615307f1f0afe425f87a5d,https://github.com/jenkinsci/git-plugin/commit/afdeff86aaa89adeb2615307f1f0afe425f87a5d,Consistent examples in Pipeline branch help,"diff --git a/src/main/resources/jenkins/plugins/git/GitStep/help-branch.html b/src/main/resources/jenkins/plugins/git/GitStep/help-branch.html index 76b23a0dc..8e5a4125f 100644 --- a/src/main/resources/jenkins/plugins/git/GitStep/help-branch.html +++ b/src/main/resources/jenkins/plugins/git/GitStep/help-branch.html @@ -8,6 +8,6 @@ Remote branch names like 'origin/master' and 'origin/develop' are not supported as the branch argument. Tag names are not supported as the branch argument. SHA-1 hashes are not supported as the branch argument. - Remote branch names and SHA-1 hashes are supported by the general purpose checkout step. + Remote branch names, tag names, and SHA-1 hashes are supported by the general purpose checkout step.

",0 2c3348be647ae8eb4f959e5fac55d5ab2f98fb5c,https://github.com/jenkinsci/monitoring-plugin/commit/2c3348be647ae8eb4f959e5fac55d5ab2f98fb5c,[maven-release-plugin] prepare release monitoring-1.86.0,"diff --git a/pom.xml b/pom.xml index f5e2c7c..8ad1600 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.jvnet.hudson.plugins monitoring hpi - 1.86.0-SNAPSHOT + 1.86.0 Monitoring Monitoring of Jenkins https://github.com/jenkinsci/monitoring-plugin @@ -79,7 +79,7 @@ scm:git:ssh://github.com/jenkinsci/${project.artifactId}-plugin.git scm:git:ssh://git@github.com/jenkinsci/${project.artifactId}-plugin.git https://github.com/jenkinsci/${project.artifactId}-plugin - HEAD + monitoring-1.86.0 ",0 d0ab0ee7047d3cc385b66d2983ba7ef108cd9083,https://github.com/cyrusimap/cyrus-imapd/commit/d0ab0ee7047d3cc385b66d2983ba7ef108cd9083,index: log errors and partially indexed messages when indexing,"diff --git a/imap/index.c b/imap/index.c index f4975a9bd9..4b88d80513 100644 --- a/imap/index.c +++ b/imap/index.c @@ -5998,14 +5998,22 @@ EXPORTED int index_getsearchtext(message_t *msg, const strarray_t *partids, /* Finalize message. */ r = receiver->end_message(receiver, str.indexlevel); - /* Log partially indexed message */ - if (!r && (str.indexlevel & SEARCH_INDEXLEVEL_PARTIAL)) { - struct mailbox *mailbox = msg_mailbox(msg); + if (r == IMAP_OK_COMPLETED) r = 0; + + /* Log erroneous or partially indexed message */ + if (r || (str.indexlevel & SEARCH_INDEXLEVEL_PARTIAL)) { + struct mailbox *mbox = msg_mailbox(msg); uint32_t uid = 0; message_get_uid(msg, &uid); - if (uid && mailbox) { - syslog(LOG_ERR, ""IOERROR: index: partially indexed %s:%d"", - mailbox->name, uid); + const char *mboxname = mbox ? mbox->name : """"; + if (r) { + xsyslog(LOG_ERR, ""IOERROR: failed to index msg"", + ""mailbox=<%s> uid=<%d> r=<%s>"", + mboxname, uid, error_message(r)); + } + else { + xsyslog(LOG_ERR, ""IOERROR: partially indexed msg"", + ""mailbox=<%s> uid=<%d>"", mboxname, uid); } } ",0 e8c42b689df8c6752d635d02c6518da3fece3870,https://github.com/hibernate/hibernate-validator/commit/e8c42b689df8c6752d635d02c6518da3fece3870,HV-912 Removing methods from ReflectionHelper which make privileged operations publicly accessible,"diff --git a/cdi/src/main/java/org/hibernate/validator/internal/cdi/InheritedMethodsHelper.java b/cdi/src/main/java/org/hibernate/validator/internal/cdi/InheritedMethodsHelper.java new file mode 100644 index 000000000..97e0e4619 --- /dev/null +++ b/cdi/src/main/java/org/hibernate/validator/internal/cdi/InheritedMethodsHelper.java @@ -0,0 +1,71 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2014, Red Hat, Inc. and/or its affiliates, and individual contributors + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * Licensed under the Apache License, Version 2.0 (the ""License""); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an ""AS IS"" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.hibernate.validator.internal.cdi; + +import static org.hibernate.validator.internal.util.CollectionHelper.newArrayList; + +import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.Collections; +import java.util.List; + +import org.hibernate.validator.internal.util.Contracts; +import org.hibernate.validator.internal.util.classhierarchy.ClassHierarchyHelper; +import org.hibernate.validator.internal.util.privilegedactions.GetMethods; + +/** + * Deals with methods of types in inheritance hierarchies. + * + * @author Hardy Ferentschik + * @author Gunnar Morling + * + */ +class InheritedMethodsHelper { + + /** + * Get a list of all methods wich the given class declares, implements, + * overrides or inherits. Methods are added by adding first all methods of + * the class itself and its implemented interfaces, then the super class and + * its interfaces, etc. + * + * @param clazz the class for which to retrieve the methods + * + * @return set of all methods of the given class + */ + static List getAllMethods(Class clazz) { + Contracts.assertNotNull( clazz ); + + List methods = newArrayList(); + + for ( Class hierarchyClass : ClassHierarchyHelper.getHierarchy( clazz ) ) { + Collections.addAll( methods, run( GetMethods.action( hierarchyClass ) ) ); + } + + return methods; + } + + /** + * Runs the given privileged action, using a privileged block if required. + *

+ * NOTE: This must never be changed into a publicly available method to avoid execution of arbitrary + * privileged actions within HV's protection domain. + */ + private static T run(PrivilegedAction action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); + } +} diff --git a/cdi/src/main/java/org/hibernate/validator/internal/cdi/ValidationExtension.java b/cdi/src/main/java/org/hibernate/validator/internal/cdi/ValidationExtension.java index a52db0ebe..5d8c51ee9 100644 --- a/cdi/src/main/java/org/hibernate/validator/internal/cdi/ValidationExtension.java +++ b/cdi/src/main/java/org/hibernate/validator/internal/cdi/ValidationExtension.java @@ -26,6 +26,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Set; + import javax.enterprise.event.Observes; import javax.enterprise.inject.Default; import javax.enterprise.inject.spi.AfterBeanDiscovery; @@ -60,7 +61,6 @@ import org.hibernate.validator.internal.util.ExecutableHelper; import org.hibernate.validator.internal.util.ReflectionHelper; import org.hibernate.validator.internal.util.TypeResolutionHelper; -import org.hibernate.validator.internal.util.classhierarchy.ClassHierarchyHelper; import org.hibernate.validator.internal.util.logging.Log; import org.hibernate.validator.internal.util.logging.LoggerFactory; @@ -268,7 +268,7 @@ else if ( bean.getTypes().contains( Validator.class ) || bean instanceof Validat private void determineConstrainedMethod(AnnotatedType type, BeanDescriptor beanDescriptor, Set> callables) { - List overriddenAndImplementedMethods = ClassHierarchyHelper.getAllMethods( type.getJavaClass() ); + List overriddenAndImplementedMethods = InheritedMethodsHelper.getAllMethods( type.getJavaClass() ); for ( AnnotatedMethod annotatedMethod : type.getMethods() ) { Method method = annotatedMethod.getJavaMember(); diff --git a/cdi/src/main/java/org/hibernate/validator/internal/cdi/ValidatorFactoryBean.java b/cdi/src/main/java/org/hibernate/validator/internal/cdi/ValidatorFactoryBean.java index e172a2a73..655c636e2 100644 --- a/cdi/src/main/java/org/hibernate/validator/internal/cdi/ValidatorFactoryBean.java +++ b/cdi/src/main/java/org/hibernate/validator/internal/cdi/ValidatorFactoryBean.java @@ -18,8 +18,11 @@ import java.lang.annotation.Annotation; import java.lang.reflect.Type; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Collections; import java.util.Set; + import javax.enterprise.context.ApplicationScoped; import javax.enterprise.context.spi.CreationalContext; import javax.enterprise.inject.spi.Bean; @@ -36,8 +39,8 @@ import javax.validation.ValidatorFactory; import org.hibernate.validator.internal.util.CollectionHelper; -import org.hibernate.validator.internal.util.ReflectionHelper; import org.hibernate.validator.internal.util.classhierarchy.ClassHierarchyHelper; +import org.hibernate.validator.internal.util.privilegedactions.LoadClass; import static org.hibernate.validator.internal.util.CollectionHelper.newHashSet; @@ -141,9 +144,11 @@ private MessageInterpolator createMessageInterpolator(Configuration config) { } @SuppressWarnings(""unchecked"") - Class messageInterpolatorClass = (Class) ReflectionHelper.loadClass( - messageInterpolatorFqcn, - this.getClass() + Class messageInterpolatorClass = (Class) run( + LoadClass.action( + messageInterpolatorFqcn, + this.getClass() + ) ); return createInstance( messageInterpolatorClass ); @@ -158,9 +163,11 @@ private TraversableResolver createTraversableResolver(Configuration config) { } @SuppressWarnings(""unchecked"") - Class traversableResolverClass = (Class) ReflectionHelper.loadClass( - traversableResolverFqcn, - this.getClass() + Class traversableResolverClass = (Class) run( + LoadClass.action( + traversableResolverFqcn, + this.getClass() + ) ); return createInstance( traversableResolverClass ); @@ -175,9 +182,11 @@ private ParameterNameProvider createParameterNameProvider(Configuration confi } @SuppressWarnings(""unchecked"") - Class parameterNameProviderClass = (Class) ReflectionHelper.loadClass( - parameterNameProviderFqcn, - this.getClass() + Class parameterNameProviderClass = (Class) run( + LoadClass.action( + parameterNameProviderFqcn, + this.getClass() + ) ); return createInstance( parameterNameProviderClass ); @@ -193,11 +202,12 @@ private ConstraintValidatorFactory createConstraintValidatorFactory(Configuratio } @SuppressWarnings(""unchecked"") - Class constraintValidatorFactoryClass = (Class) ReflectionHelper - .loadClass( + Class constraintValidatorFactoryClass = (Class) run( + LoadClass.action( constraintValidatorFactoryFqcn, this.getClass() - ); + ) + ); return createInstance( constraintValidatorFactoryClass ); } @@ -214,6 +224,16 @@ private ConstraintValidatorFactory createConstraintValidatorFactory(Configuratio Validation.byProvider( org.hibernate.validator.HibernateValidator.class ).configure(); } + /** + * Runs the given privileged action, using a privileged block if required. + *

+ * NOTE: This must never be changed into a publicly available method to avoid execution of arbitrary + * privileged actions within HV's protection domain. + */ + private T run(PrivilegedAction action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); + } + @Override public String getId() { return ValidatorFactoryBean.class.getName() + ""_"" + ( validationProviderHelper.isDefaultProvider() ? ""default"" : ""hv"" ); diff --git a/engine/src/main/java/org/hibernate/validator/internal/cfg/context/TypeConstraintMappingContextImpl.java b/engine/src/main/java/org/hibernate/validator/internal/cfg/context/TypeConstraintMappingContextImpl.java index a7058dac8..a37e414aa 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/cfg/context/TypeConstraintMappingContextImpl.java +++ b/engine/src/main/java/org/hibernate/validator/internal/cfg/context/TypeConstraintMappingContextImpl.java @@ -20,9 +20,12 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Member; import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Arrays; import java.util.List; import java.util.Set; + import javax.validation.ParameterNameProvider; import org.hibernate.validator.cfg.ConstraintDef; @@ -44,6 +47,11 @@ import org.hibernate.validator.internal.util.StringHelper; import org.hibernate.validator.internal.util.logging.Log; import org.hibernate.validator.internal.util.logging.LoggerFactory; +import org.hibernate.validator.internal.util.privilegedactions.GetDeclaredConstructor; +import org.hibernate.validator.internal.util.privilegedactions.GetDeclaredField; +import org.hibernate.validator.internal.util.privilegedactions.GetDeclaredMethod; +import org.hibernate.validator.internal.util.privilegedactions.GetMethod; +import org.hibernate.validator.internal.util.privilegedactions.NewInstance; import org.hibernate.validator.spi.group.DefaultGroupSequenceProvider; import static org.hibernate.validator.internal.util.CollectionHelper.newHashSet; @@ -114,7 +122,7 @@ public PropertyConstraintMappingContext property(String property, ElementType el Contracts.assertNotNull( elementType, ""The element type must not be null."" ); Contracts.assertNotEmpty( property, MESSAGES.propertyNameMustNotBeEmpty() ); - Member member = ReflectionHelper.getMember( + Member member = getMember( beanClass, property, elementType ); @@ -140,7 +148,7 @@ public PropertyConstraintMappingContext property(String property, ElementType el public MethodConstraintMappingContext method(String name, Class... parameterTypes) { Contracts.assertNotNull( name, MESSAGES.methodNameMustNotBeNull() ); - Method method = ReflectionHelper.getDeclaredMethod( beanClass, name, parameterTypes ); + Method method = run( GetDeclaredMethod.action( beanClass, name, parameterTypes ) ); if ( method == null || method.getDeclaringClass() != beanClass ) { throw log.getUnableToFindMethodException( @@ -165,7 +173,7 @@ public MethodConstraintMappingContext method(String name, Class... parameterT @Override public ConstructorConstraintMappingContext constructor(Class... parameterTypes) { - Constructor constructor = ReflectionHelper.getDeclaredConstructor( beanClass, parameterTypes ); + Constructor constructor = run( GetDeclaredConstructor.action( beanClass, parameterTypes ) ); if ( constructor == null || constructor.getDeclaringClass() != beanClass ) { throw log.getBeanDoesNotContainConstructorException( @@ -227,9 +235,11 @@ public ConstructorConstraintMappingContext constructor(Class... parameterType } private DefaultGroupSequenceProvider getDefaultGroupSequenceProvider() { - return defaultGroupSequenceProviderClass != null ? ReflectionHelper.newInstance( - defaultGroupSequenceProviderClass, - ""default group sequence provider"" + return defaultGroupSequenceProviderClass != null ? run( + NewInstance.action( + defaultGroupSequenceProviderClass, + ""default group sequence provider"" + ) ) : null; } @@ -241,4 +251,50 @@ public ConstructorConstraintMappingContext constructor(Class... parameterType protected ConstraintType getConstraintType() { return ConstraintType.GENERIC; } + + /** + * Returns the member with the given name and type. + * + * @param clazz The class from which to retrieve the member. Cannot be {@code null}. + * @param property The property name without ""is"", ""get"" or ""has"". Cannot be {@code null} or empty. + * @param elementType The element type. Either {@code ElementType.FIELD} or {@code ElementType METHOD}. + * + * @return the member which matching the name and type or {@code null} if no such member exists. + */ + private Member getMember(Class clazz, String property, ElementType elementType) { + Contracts.assertNotNull( clazz, MESSAGES.classCannotBeNull() ); + + if ( property == null || property.length() == 0 ) { + throw log.getPropertyNameCannotBeNullOrEmptyException(); + } + + if ( !( ElementType.FIELD.equals( elementType ) || ElementType.METHOD.equals( elementType ) ) ) { + throw log.getElementTypeHasToBeFieldOrMethodException(); + } + + Member member = null; + if ( ElementType.FIELD.equals( elementType ) ) { + member = run( GetDeclaredField.action( clazz, property ) ); + } + else { + String methodName = property.substring( 0, 1 ).toUpperCase() + property.substring( 1 ); + for ( String prefix : ReflectionHelper.PROPERTY_ACCESSOR_PREFIXES ) { + member = run( GetMethod.action( clazz, prefix + methodName ) ); + if ( member != null ) { + break; + } + } + } + return member; + } + + /** + * Runs the given privileged action, using a privileged block if required. + *

+ * NOTE: This must never be changed into a publicly available method to avoid execution of arbitrary + * privileged actions within HV's protection domain. + */ + private T run(PrivilegedAction action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); + } } diff --git a/engine/src/main/java/org/hibernate/validator/internal/engine/ConfigurationImpl.java b/engine/src/main/java/org/hibernate/validator/internal/engine/ConfigurationImpl.java index bf4f1fc37..74eb67cec 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/engine/ConfigurationImpl.java +++ b/engine/src/main/java/org/hibernate/validator/internal/engine/ConfigurationImpl.java @@ -19,6 +19,8 @@ import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.List; import java.util.Map; import java.util.Set; @@ -28,6 +30,7 @@ import javax.validation.MessageInterpolator; import javax.validation.ParameterNameProvider; import javax.validation.TraversableResolver; +import javax.validation.ValidationException; import javax.validation.ValidationProviderResolver; import javax.validation.ValidatorFactory; import javax.validation.spi.BootstrapState; @@ -43,11 +46,11 @@ import org.hibernate.validator.internal.engine.valuehandling.OptionalValueUnwrapper; import org.hibernate.validator.internal.util.CollectionHelper; import org.hibernate.validator.internal.util.Contracts; -import org.hibernate.validator.internal.util.ReflectionHelper; import org.hibernate.validator.internal.util.TypeResolutionHelper; import org.hibernate.validator.internal.util.Version; import org.hibernate.validator.internal.util.logging.Log; import org.hibernate.validator.internal.util.logging.LoggerFactory; +import org.hibernate.validator.internal.util.privilegedactions.LoadClass; import org.hibernate.validator.internal.xml.ValidationBootstrapParameters; import org.hibernate.validator.internal.xml.ValidationXmlParser; import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator; @@ -433,6 +436,26 @@ private void applyXmlSettings(ValidationBootstrapParameters xmlParameters) { } private boolean isJavaFxInClasspath() { - return ReflectionHelper.isClassPresent( ""javafx.application.Application"", this.getClass() ); + return isClassPresent( ""javafx.application.Application"" ); + } + + private boolean isClassPresent(String className) { + try { + run( LoadClass.action( className, getClass() ) ); + return true; + } + catch ( ValidationException e ) { + return false; + } + } + + /** + * Runs the given privileged action, using a privileged block if required. + *

+ * NOTE: This must never be changed into a publicly available method to avoid execution of arbitrary + * privileged actions within HV's protection domain. + */ + private static T run(PrivilegedAction action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); } } diff --git a/engine/src/main/java/org/hibernate/validator/internal/engine/ValidatorFactoryImpl.java b/engine/src/main/java/org/hibernate/validator/internal/engine/ValidatorFactoryImpl.java index 70a93957c..f7094c719 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/engine/ValidatorFactoryImpl.java +++ b/engine/src/main/java/org/hibernate/validator/internal/engine/ValidatorFactoryImpl.java @@ -16,6 +16,8 @@ */ package org.hibernate.validator.internal.engine; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Collections; import java.util.IdentityHashMap; import java.util.List; @@ -40,10 +42,11 @@ import org.hibernate.validator.internal.metadata.provider.ProgrammaticMetaDataProvider; import org.hibernate.validator.internal.metadata.provider.XmlMetaDataProvider; import org.hibernate.validator.internal.util.ExecutableHelper; -import org.hibernate.validator.internal.util.ReflectionHelper; import org.hibernate.validator.internal.util.TypeResolutionHelper; import org.hibernate.validator.internal.util.logging.Log; import org.hibernate.validator.internal.util.logging.LoggerFactory; +import org.hibernate.validator.internal.util.privilegedactions.LoadClass; +import org.hibernate.validator.internal.util.privilegedactions.NewInstance; import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator; import org.hibernate.validator.spi.valuehandling.ValidatedValueUnwrapper; @@ -257,7 +260,7 @@ Validator createValidator(ConstraintValidatorFactory constraintValidatorFactory, throw log.getMissingELDependenciesException(); } } - + BeanMetaDataManager beanMetaDataManager; if ( !beanMetaDataManagerMap.containsKey( parameterNameProvider ) ) { beanMetaDataManager = new BeanMetaDataManager( @@ -337,12 +340,21 @@ private boolean checkPropertiesForFailFast(Map properties, boole for ( String handlerName : handlerNames ) { @SuppressWarnings(""unchecked"") - Class> handlerType = (Class>) ReflectionHelper - .loadClass( handlerName, ValidatorFactoryImpl.class ); - handlers.add( ReflectionHelper.newInstance( handlerType, ""validated value handler class"" ) ); + Class> handlerType = (Class>) + run( LoadClass.action( handlerName, ValidatorFactoryImpl.class ) ); + handlers.add( run( NewInstance.action( handlerType, ""validated value handler class"" ) ) ); } return handlers; } + /** + * Runs the given privileged action, using a privileged block if required. + *

+ * NOTE: This must never be changed into a publicly available method to avoid execution of arbitrary + * privileged actions within HV's protection domain. + */ + private T run(PrivilegedAction action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); + } } diff --git a/engine/src/main/java/org/hibernate/validator/internal/engine/constraintvalidation/ConstraintValidatorFactoryImpl.java b/engine/src/main/java/org/hibernate/validator/internal/engine/constraintvalidation/ConstraintValidatorFactoryImpl.java index 90743225d..3252b4692 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/engine/constraintvalidation/ConstraintValidatorFactoryImpl.java +++ b/engine/src/main/java/org/hibernate/validator/internal/engine/constraintvalidation/ConstraintValidatorFactoryImpl.java @@ -16,10 +16,13 @@ */ package org.hibernate.validator.internal.engine.constraintvalidation; +import java.security.AccessController; +import java.security.PrivilegedAction; + import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorFactory; -import org.hibernate.validator.internal.util.ReflectionHelper; +import org.hibernate.validator.internal.util.privilegedactions.NewInstance; /** * Default {@code ConstraintValidatorFactory} using a no-arg constructor. @@ -27,15 +30,26 @@ * @author Emmanuel Bernard * @author Hardy Ferentschik */ +//TODO Can we make the constructor non-public? public class ConstraintValidatorFactoryImpl implements ConstraintValidatorFactory { @Override public final > T getInstance(Class key) { - return ReflectionHelper.newInstance( key, ""ConstraintValidator"" ); + return run( NewInstance.action( key, ""ConstraintValidator"" ) ); } @Override public void releaseInstance(ConstraintValidator instance) { // noop } + + /** + * Runs the given privileged action, using a privileged block if required. + *

+ * NOTE: This must never be changed into a publicly available method to avoid execution of arbitrary + * privileged actions within HV's protection domain. + */ + private T run(PrivilegedAction action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); + } } diff --git a/engine/src/main/java/org/hibernate/validator/internal/engine/resolver/DefaultTraversableResolver.java b/engine/src/main/java/org/hibernate/validator/internal/engine/resolver/DefaultTraversableResolver.java index 03faac84d..e8bd59293 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/engine/resolver/DefaultTraversableResolver.java +++ b/engine/src/main/java/org/hibernate/validator/internal/engine/resolver/DefaultTraversableResolver.java @@ -18,6 +18,9 @@ import java.lang.annotation.ElementType; import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedAction; + import javax.validation.Path; import javax.validation.TraversableResolver; import javax.validation.ValidationException; @@ -25,6 +28,9 @@ import org.hibernate.validator.internal.util.ReflectionHelper; import org.hibernate.validator.internal.util.logging.Log; import org.hibernate.validator.internal.util.logging.LoggerFactory; +import org.hibernate.validator.internal.util.privilegedactions.GetMethod; +import org.hibernate.validator.internal.util.privilegedactions.LoadClass; +import org.hibernate.validator.internal.util.privilegedactions.NewInstance; /** * A JPA 2 aware {@code TraversableResolver}. @@ -68,7 +74,7 @@ private void detectJPA() { // check whether we have Persistence on the classpath Class persistenceClass; try { - persistenceClass = ReflectionHelper.loadClass( PERSISTENCE_CLASS_NAME, this.getClass() ); + persistenceClass = run( LoadClass.action( PERSISTENCE_CLASS_NAME, this.getClass() ) ); } catch ( ValidationException e ) { log.debugf( @@ -79,7 +85,7 @@ private void detectJPA() { } // check whether Persistence contains getPersistenceUtil - Method persistenceUtilGetter = ReflectionHelper.getMethod( persistenceClass, PERSISTENCE_UTIL_METHOD ); + Method persistenceUtilGetter = run( GetMethod.action( persistenceClass, PERSISTENCE_UTIL_METHOD ) ); if ( persistenceUtilGetter == null ) { log.debugf( ""Found %s on classpath, but no method '%s'. Assuming JPA 1 environment. All properties will per default be traversable."", @@ -92,7 +98,7 @@ private void detectJPA() { // try to invoke the method to make sure that we are dealing with a complete JPA2 implementation // unfortunately there are several incomplete implementations out there (see HV-374) try { - Object persistence = ReflectionHelper.newInstance( persistenceClass, ""persistence provider"" ); + Object persistence = run( NewInstance.action( persistenceClass, ""persistence provider"" ) ); ReflectionHelper.getValue(persistenceUtilGetter, persistence ); } catch ( Exception e ) { @@ -112,8 +118,8 @@ private void detectJPA() { try { @SuppressWarnings(""unchecked"") Class jpaAwareResolverClass = (Class) - ReflectionHelper.loadClass( JPA_AWARE_TRAVERSABLE_RESOLVER_CLASS_NAME, this.getClass() ); - jpaTraversableResolver = ReflectionHelper.newInstance( jpaAwareResolverClass, """" ); + run( LoadClass.action( JPA_AWARE_TRAVERSABLE_RESOLVER_CLASS_NAME, this.getClass() ) ); + jpaTraversableResolver = run( NewInstance.action( jpaAwareResolverClass, """" ) ); log.debugf( ""Instantiated JPA aware TraversableResolver of type %s."", JPA_AWARE_TRAVERSABLE_RESOLVER_CLASS_NAME ); @@ -126,15 +132,27 @@ private void detectJPA() { } } + @Override public boolean isReachable(Object traversableObject, Path.Node traversableProperty, Class rootBeanType, Path pathToTraversableObject, ElementType elementType) { return jpaTraversableResolver == null || jpaTraversableResolver.isReachable( traversableObject, traversableProperty, rootBeanType, pathToTraversableObject, elementType ); } + @Override public boolean isCascadable(Object traversableObject, Path.Node traversableProperty, Class rootBeanType, Path pathToTraversableObject, ElementType elementType) { return jpaTraversableResolver == null || jpaTraversableResolver.isCascadable( traversableObject, traversableProperty, rootBeanType, pathToTraversableObject, elementType ); } + + /** + * Runs the given privileged action, using a privileged block if required. + *

+ * NOTE: This must never be changed into a publicly available method to avoid execution of arbitrary + * privileged actions within HV's protection domain. + */ + private T run(PrivilegedAction action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); + } } diff --git a/engine/src/main/java/org/hibernate/validator/internal/metadata/core/ConstraintHelper.java b/engine/src/main/java/org/hibernate/validator/internal/metadata/core/ConstraintHelper.java index 19943c94a..5c8a97f54 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/metadata/core/ConstraintHelper.java +++ b/engine/src/main/java/org/hibernate/validator/internal/metadata/core/ConstraintHelper.java @@ -18,13 +18,17 @@ import java.lang.annotation.Annotation; import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.concurrent.ConcurrentMap; + import javax.validation.Constraint; import javax.validation.ConstraintTarget; import javax.validation.ConstraintValidator; +import javax.validation.ValidationException; import javax.validation.constraints.AssertFalse; import javax.validation.constraints.AssertTrue; import javax.validation.constraints.DecimalMax; @@ -115,10 +119,13 @@ import org.hibernate.validator.internal.constraintvalidators.bv.size.SizeValidatorForMap; import org.hibernate.validator.internal.constraintvalidators.hv.URLValidator; import org.hibernate.validator.internal.util.Contracts; -import org.hibernate.validator.internal.util.ReflectionHelper; import org.hibernate.validator.internal.util.Version; import org.hibernate.validator.internal.util.logging.Log; import org.hibernate.validator.internal.util.logging.LoggerFactory; +import org.hibernate.validator.internal.util.privilegedactions.GetAnnotationParameter; +import org.hibernate.validator.internal.util.privilegedactions.GetDeclaredMethods; +import org.hibernate.validator.internal.util.privilegedactions.GetMethod; +import org.hibernate.validator.internal.util.privilegedactions.LoadClass; import static org.hibernate.validator.internal.util.CollectionHelper.newArrayList; import static org.hibernate.validator.internal.util.CollectionHelper.newConcurrentHashMap; @@ -415,7 +422,7 @@ private boolean supportsValidationTarget(Class annotationType) { boolean isMultiValueConstraint = false; - final Method method = ReflectionHelper.getMethod( annotationType, ""value"" ); + final Method method = run( GetMethod.action( annotationType, ""value"" ) ); if ( method != null ) { Class returnType = method.getReturnType(); if ( returnType.isArray() && returnType.getComponentType().isAnnotation() ) { @@ -444,10 +451,12 @@ public boolean isMultiValueConstraint(Class annotationType * @return A list of constraint annotations, may be empty but never {@code null}. */ public List getConstraintsFromMultiValueConstraint(A multiValueConstraint) { - Annotation[] annotations = ReflectionHelper.getAnnotationParameter( - multiValueConstraint, - ""value"", - Annotation[].class + Annotation[] annotations = run( + GetAnnotationParameter.action( + multiValueConstraint, + ""value"", + Annotation[].class + ) ); return Arrays.asList( annotations ); } @@ -481,7 +490,7 @@ public boolean isConstraintAnnotation(Class annotationType } private void assertNoParameterStartsWithValid(Class annotationType) { - final Method[] methods = ReflectionHelper.getDeclaredMethods( annotationType ); + final Method[] methods = run( GetDeclaredMethods.action( annotationType ) ); for ( Method m : methods ) { if ( m.getName().startsWith( ""valid"" ) && !m.getName().equals( VALIDATION_APPLIES_TO ) ) { throw log.getConstraintParametersCannotStartWithValidException(); @@ -491,7 +500,7 @@ private void assertNoParameterStartsWithValid(Class annota private void assertPayloadParameterExists(Class annotationType) { try { - final Method method = ReflectionHelper.getMethod( annotationType, PAYLOAD ); + final Method method = run( GetMethod.action( annotationType, PAYLOAD ) ); if ( method == null ) { throw log.getConstraintWithoutMandatoryParameterException( PAYLOAD, annotationType.getName() ); } @@ -507,7 +516,7 @@ private void assertPayloadParameterExists(Class annotation private void assertGroupsParameterExists(Class annotationType) { try { - final Method method = ReflectionHelper.getMethod( annotationType, GROUPS ); + final Method method = run( GetMethod.action( annotationType, GROUPS ) ); if ( method == null ) { throw log.getConstraintWithoutMandatoryParameterException( GROUPS, annotationType.getName() ); } @@ -522,7 +531,7 @@ private void assertGroupsParameterExists(Class annotationT } private void assertMessageParameterExists(Class annotationType) { - final Method method = ReflectionHelper.getMethod( annotationType, MESSAGE ); + final Method method = run( GetMethod.action( annotationType, MESSAGE ) ); if ( method == null ) { throw log.getConstraintWithoutMandatoryParameterException( MESSAGE, annotationType.getName() ); } @@ -540,7 +549,7 @@ private void assertValidationAppliesToParameterSetUpCorrectly(Class annotationTyp return annotationType == ConstraintComposition.class; } - private boolean isJodaTimeInClasspath() { - return ReflectionHelper.isClassPresent( JODA_TIME_CLASS_NAME, this.getClass() ); + private static boolean isJodaTimeInClasspath() { + return isClassPresent( JODA_TIME_CLASS_NAME ); } /** @@ -593,6 +602,26 @@ private boolean isJodaTimeInClasspath() { } } + private static boolean isClassPresent(String className) { + try { + run( LoadClass.action( className, ConstraintHelper.class ) ); + return true; + } + catch ( ValidationException e ) { + return false; + } + } + + /** + * Runs the given privileged action, using a privileged block if required. + *

+ * NOTE: This must never be changed into a publicly available method to avoid execution of arbitrary + * privileged actions within HV's protection domain. + */ + private static T run(PrivilegedAction action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); + } + /** * A type-safe wrapper around a concurrent map from constraint types to * associated validator classes. The casts are safe as data is added trough diff --git a/engine/src/main/java/org/hibernate/validator/internal/metadata/descriptor/ConstraintDescriptorImpl.java b/engine/src/main/java/org/hibernate/validator/internal/metadata/descriptor/ConstraintDescriptorImpl.java index 3fa85e337..7f6840522 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/metadata/descriptor/ConstraintDescriptorImpl.java +++ b/engine/src/main/java/org/hibernate/validator/internal/metadata/descriptor/ConstraintDescriptorImpl.java @@ -26,11 +26,14 @@ import java.lang.reflect.Field; import java.lang.reflect.Member; import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; + import javax.validation.Constraint; import javax.validation.ConstraintTarget; import javax.validation.ConstraintValidator; @@ -46,11 +49,13 @@ import org.hibernate.validator.constraints.ConstraintComposition; import org.hibernate.validator.internal.metadata.core.ConstraintHelper; import org.hibernate.validator.internal.metadata.core.ConstraintOrigin; -import org.hibernate.validator.internal.util.ReflectionHelper; import org.hibernate.validator.internal.util.annotationfactory.AnnotationDescriptor; import org.hibernate.validator.internal.util.annotationfactory.AnnotationFactory; import org.hibernate.validator.internal.util.logging.Log; import org.hibernate.validator.internal.util.logging.LoggerFactory; +import org.hibernate.validator.internal.util.privilegedactions.GetAnnotationParameter; +import org.hibernate.validator.internal.util.privilegedactions.GetDeclaredMethods; +import org.hibernate.validator.internal.util.privilegedactions.GetMethod; import static org.hibernate.validator.internal.util.CollectionHelper.newHashMap; import static org.hibernate.validator.internal.util.CollectionHelper.newHashSet; @@ -505,10 +510,8 @@ private boolean isExecutable(ElementType elementType) { Class[] payloadFromAnnotation; try { //TODO be extra safe and make sure this is an array of Payload - payloadFromAnnotation = ReflectionHelper.getAnnotationParameter( - annotation, - ConstraintHelper.PAYLOAD, - Class[].class + payloadFromAnnotation = run( + GetAnnotationParameter.action( annotation, ConstraintHelper.PAYLOAD, Class[].class ) ); } catch ( ValidationException e ) { @@ -523,8 +526,8 @@ private boolean isExecutable(ElementType elementType) { private Set> buildGroupSet(Class implicitGroup) { Set> groupSet = newHashSet(); - final Class[] groupsFromAnnotation = ReflectionHelper.getAnnotationParameter( - annotation, ConstraintHelper.GROUPS, Class[].class + final Class[] groupsFromAnnotation = run( + GetAnnotationParameter.action( annotation, ConstraintHelper.GROUPS, Class[].class ) ); if ( groupsFromAnnotation.length == 0 ) { groupSet.add( Default.class ); @@ -541,10 +544,10 @@ private boolean isExecutable(ElementType elementType) { } private Map buildAnnotationParameterMap(Annotation annotation) { - final Method[] declaredMethods = ReflectionHelper.getDeclaredMethods( annotation.annotationType() ); + final Method[] declaredMethods = run( GetDeclaredMethods.action( annotation.annotationType() ) ); Map parameters = newHashMap( declaredMethods.length ); for ( Method m : declaredMethods ) { - Object value = ReflectionHelper.getAnnotationParameter( annotation, m.getName(), Object.class ); + Object value = run( GetAnnotationParameter.action( annotation, m.getName(), Object.class ) ); parameters.put( m.getName(), value ); } return Collections.unmodifiableMap( parameters ); @@ -552,7 +555,7 @@ private boolean isExecutable(ElementType elementType) { private Map> parseOverrideParameters() { Map> overrideParameters = newHashMap(); - final Method[] methods = ReflectionHelper.getDeclaredMethods( annotationType ); + final Method[] methods = run( GetDeclaredMethods.action( annotationType ) ); for ( Method m : methods ) { if ( m.getAnnotation( OverridesAttribute.class ) != null ) { addOverrideAttributes( @@ -571,7 +574,7 @@ else if ( m.getAnnotation( OverridesAttribute.List.class ) != null ) { } private void addOverrideAttributes(Map> overrideParameters, Method m, OverridesAttribute... attributes) { - Object value = ReflectionHelper.getAnnotationParameter( annotation, m.getName(), Object.class ); + Object value = run( GetAnnotationParameter.action( annotation, m.getName(), Object.class ) ); for ( OverridesAttribute overridesAttribute : attributes ) { ensureAttributeIsOverridable( m, overridesAttribute ); @@ -588,7 +591,7 @@ private void addOverrideAttributes(Map> o } private void ensureAttributeIsOverridable(Method m, OverridesAttribute overridesAttribute) { - final Method method = ReflectionHelper.getMethod( overridesAttribute.constraint(), overridesAttribute.name() ); + final Method method = run( GetMethod.action( overridesAttribute.constraint(), overridesAttribute.name() ) ); if ( method == null ) { throw log.getOverriddenConstraintAttributeNotFoundException( overridesAttribute.name() ); } @@ -704,6 +707,16 @@ private CompositionType parseCompositionType(ConstraintHelper constraintHelper) ); } + /** + * Runs the given privileged action, using a privileged block if required. + *

+ * NOTE: This must never be changed into a publicly available method to avoid execution of arbitrary + * privileged actions within HV's protection domain. + */ + private

P run(PrivilegedAction

action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); + } + /** * @return the compositionType */ diff --git a/engine/src/main/java/org/hibernate/validator/internal/metadata/provider/AnnotationMetaDataProvider.java b/engine/src/main/java/org/hibernate/validator/internal/metadata/provider/AnnotationMetaDataProvider.java index a1ac7133e..8abe85ccc 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/metadata/provider/AnnotationMetaDataProvider.java +++ b/engine/src/main/java/org/hibernate/validator/internal/metadata/provider/AnnotationMetaDataProvider.java @@ -23,6 +23,8 @@ import java.lang.reflect.Member; import java.lang.reflect.Method; import java.lang.reflect.Modifier; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -57,6 +59,11 @@ import org.hibernate.validator.internal.util.classhierarchy.ClassHierarchyHelper; import org.hibernate.validator.internal.util.logging.Log; import org.hibernate.validator.internal.util.logging.LoggerFactory; +import org.hibernate.validator.internal.util.privilegedactions.GetDeclaredConstructors; +import org.hibernate.validator.internal.util.privilegedactions.GetDeclaredFields; +import org.hibernate.validator.internal.util.privilegedactions.GetDeclaredMethods; +import org.hibernate.validator.internal.util.privilegedactions.GetMethods; +import org.hibernate.validator.internal.util.privilegedactions.NewInstance; import org.hibernate.validator.spi.group.DefaultGroupSequenceProvider; import org.hibernate.validator.valuehandling.UnwrapValidatedValue; @@ -65,8 +72,6 @@ import static org.hibernate.validator.internal.util.CollectionHelper.newHashSet; import static org.hibernate.validator.internal.util.CollectionHelper.partition; import static org.hibernate.validator.internal.util.ConcurrentReferenceHashMap.ReferenceType.SOFT; -import static org.hibernate.validator.internal.util.ReflectionHelper.getMethods; -import static org.hibernate.validator.internal.util.ReflectionHelper.newInstance; /** * {@code MetaDataProvider} which reads the metadata from annotations which is the default configuration source. @@ -184,14 +189,14 @@ public AnnotationProcessingOptions getAnnotationProcessingOptions() { private DefaultGroupSequenceProvider newGroupSequenceProviderClassInstance(Class beanClass, Class> providerClass) { - Method[] providerMethods = getMethods( providerClass ); + Method[] providerMethods = run( GetMethods.action( providerClass ) ); for ( Method method : providerMethods ) { Class[] paramTypes = method.getParameterTypes(); if ( ""getValidationGroups"".equals( method.getName() ) && !method.isBridge() && paramTypes.length == 1 && paramTypes[0].isAssignableFrom( beanClass ) ) { - return newInstance( - providerClass, ""the default group sequence provider"" + return run( + NewInstance.action( providerClass, ""the default group sequence provider"" ) ); } } @@ -219,7 +224,7 @@ public AnnotationProcessingOptions getAnnotationProcessingOptions() { private Set getFieldMetaData(Class beanClass) { Set propertyMetaData = newHashSet(); - for ( Field field : ReflectionHelper.getDeclaredFields( beanClass ) ) { + for ( Field field : run( GetDeclaredFields.action ( beanClass ) ) ) { // HV-172 if ( Modifier.isStatic( field.getModifiers() ) || annotationProcessingOptions.areMemberConstraintsIgnoredFor( field ) || @@ -268,7 +273,7 @@ private ConstrainedField findPropertyMetaData(Field field) { private Set getConstructorMetaData(Class clazz) { List declaredConstructors = ExecutableElement.forConstructors( - ReflectionHelper.getDeclaredConstructors( clazz ) + run( GetDeclaredConstructors.action( clazz ) ) ); return getMetaData( declaredConstructors ); @@ -276,7 +281,7 @@ private ConstrainedField findPropertyMetaData(Field field) { private Set getMethodMetaData(Class clazz) { List declaredMethods = ExecutableElement.forMethods( - ReflectionHelper.getDeclaredMethods( clazz ) + run( GetDeclaredMethods.action( clazz ) ) ); return getMetaData( declaredMethods ); @@ -608,4 +613,14 @@ public ConstraintType getPartition(ConstraintDescriptorImpl v) { type ); } + + /** + * Runs the given privileged action, using a privileged block if required. + *

+ * NOTE: This must never be changed into a publicly available method to avoid execution of arbitrary + * privileged actions within HV's protection domain. + */ + private T run(PrivilegedAction action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); + } } diff --git a/engine/src/main/java/org/hibernate/validator/internal/metadata/raw/ConstrainedExecutable.java b/engine/src/main/java/org/hibernate/validator/internal/metadata/raw/ConstrainedExecutable.java index 1ce0aa106..acbfd2407 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/metadata/raw/ConstrainedExecutable.java +++ b/engine/src/main/java/org/hibernate/validator/internal/metadata/raw/ConstrainedExecutable.java @@ -18,17 +18,20 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; + import javax.validation.metadata.ConstraintDescriptor; import org.hibernate.validator.internal.metadata.core.MetaConstraint; import org.hibernate.validator.internal.metadata.location.ConstraintLocation; -import org.hibernate.validator.internal.util.ReflectionHelper; import org.hibernate.validator.internal.util.logging.Log; import org.hibernate.validator.internal.util.logging.LoggerFactory; +import org.hibernate.validator.internal.util.privilegedactions.SetAccessibility; import static org.hibernate.validator.internal.util.CollectionHelper.newArrayList; import static org.hibernate.validator.internal.util.CollectionHelper.newHashMap; @@ -142,7 +145,7 @@ public ConstrainedExecutable( this.hasParameterConstraints = hasParameterConstraints( parameterMetaData ) || !crossParameterConstraints.isEmpty(); if ( isConstrained() ) { - ReflectionHelper.setAccessibility( location.getMember() ); + run( SetAccessibility.action( location.getMember() ) ); } } @@ -350,4 +353,8 @@ else if ( !executable.equals( other.executable ) ) { } return true; } + + private T run(PrivilegedAction action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); + } } diff --git a/engine/src/main/java/org/hibernate/validator/internal/metadata/raw/ConstrainedField.java b/engine/src/main/java/org/hibernate/validator/internal/metadata/raw/ConstrainedField.java index d1fd63367..a43374dda 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/metadata/raw/ConstrainedField.java +++ b/engine/src/main/java/org/hibernate/validator/internal/metadata/raw/ConstrainedField.java @@ -17,12 +17,14 @@ package org.hibernate.validator.internal.metadata.raw; import java.lang.reflect.Member; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Map; import java.util.Set; import org.hibernate.validator.internal.metadata.core.MetaConstraint; import org.hibernate.validator.internal.metadata.location.ConstraintLocation; -import org.hibernate.validator.internal.util.ReflectionHelper; +import org.hibernate.validator.internal.util.privilegedactions.SetAccessibility; /** * Represents a field of a Java type and all its associated meta-data relevant @@ -54,7 +56,7 @@ public ConstrainedField(ConfigurationSource source, Member member = location.getMember(); if ( member != null && isConstrained() ) { - ReflectionHelper.setAccessibility( member ); + run( SetAccessibility.action( member ) ); } } @@ -88,4 +90,8 @@ else if ( !getLocation().getMember().equals( other.getLocation().getMember() ) ) } return true; } + + private T run(PrivilegedAction action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); + } } diff --git a/engine/src/main/java/org/hibernate/validator/internal/util/ReflectionHelper.java b/engine/src/main/java/org/hibernate/validator/internal/util/ReflectionHelper.java index 1e6bdbe20..162329264 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/util/ReflectionHelper.java +++ b/engine/src/main/java/org/hibernate/validator/internal/util/ReflectionHelper.java @@ -16,8 +16,6 @@ */ package org.hibernate.validator.internal.util; -import java.lang.annotation.Annotation; -import java.lang.annotation.ElementType; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; @@ -27,37 +25,17 @@ import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; import java.lang.reflect.WildcardType; -import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; -import javax.validation.ValidationException; - import org.hibernate.validator.internal.metadata.raw.ExecutableElement; import org.hibernate.validator.internal.util.logging.Log; import org.hibernate.validator.internal.util.logging.LoggerFactory; -import org.hibernate.validator.internal.util.privilegedactions.ConstructorInstance; -import org.hibernate.validator.internal.util.privilegedactions.GetAnnotationParameter; -import org.hibernate.validator.internal.util.privilegedactions.GetClassLoader; -import org.hibernate.validator.internal.util.privilegedactions.GetDeclaredConstructor; -import org.hibernate.validator.internal.util.privilegedactions.GetDeclaredConstructors; -import org.hibernate.validator.internal.util.privilegedactions.GetDeclaredField; -import org.hibernate.validator.internal.util.privilegedactions.GetDeclaredFields; -import org.hibernate.validator.internal.util.privilegedactions.GetDeclaredMethod; -import org.hibernate.validator.internal.util.privilegedactions.GetDeclaredMethods; -import org.hibernate.validator.internal.util.privilegedactions.GetMethod; -import org.hibernate.validator.internal.util.privilegedactions.GetMethodFromPropertyName; -import org.hibernate.validator.internal.util.privilegedactions.GetMethods; -import org.hibernate.validator.internal.util.privilegedactions.LoadClass; -import org.hibernate.validator.internal.util.privilegedactions.NewInstance; -import org.hibernate.validator.internal.util.privilegedactions.SetAccessibility; import static org.hibernate.validator.internal.util.CollectionHelper.newHashMap; -import static org.hibernate.validator.internal.util.logging.Messages.MESSAGES; /** * Some reflection utility methods. Where necessary calls will be performed as {@code PrivilegedAction} which is necessary @@ -69,14 +47,10 @@ */ public final class ReflectionHelper { - private static final String PACKAGE_SEPARATOR = "".""; - private static final String ARRAY_CLASS_NAME_PREFIX = ""[L""; - private static final String ARRAY_CLASS_NAME_SUFFIX = "";""; - private static final String PROPERTY_ACCESSOR_PREFIX_GET = ""get""; private static final String PROPERTY_ACCESSOR_PREFIX_IS = ""is""; private static final String PROPERTY_ACCESSOR_PREFIX_HAS = ""has""; - private static final String[] PROPERTY_ACCESSOR_PREFIXES = { + public static final String[] PROPERTY_ACCESSOR_PREFIXES = { PROPERTY_ACCESSOR_PREFIX_GET, PROPERTY_ACCESSOR_PREFIX_IS, PROPERTY_ACCESSOR_PREFIX_HAS @@ -84,24 +58,6 @@ private static final Log log = LoggerFactory.make(); - private static final Map> PRIMITIVE_NAME_TO_PRIMITIVE; - - static { - Map> tmpMap = newHashMap( 9 ); - - tmpMap.put( boolean.class.getName(), boolean.class ); - tmpMap.put( char.class.getName(), char.class ); - tmpMap.put( double.class.getName(), double.class ); - tmpMap.put( float.class.getName(), float.class ); - tmpMap.put( long.class.getName(), long.class ); - tmpMap.put( int.class.getName(), int.class ); - tmpMap.put( short.class.getName(), short.class ); - tmpMap.put( byte.class.getName(), byte.class ); - tmpMap.put( Void.TYPE.getName(), Void.TYPE ); - - PRIMITIVE_NAME_TO_PRIMITIVE = Collections.unmodifiableMap( tmpMap ); - } - private static final Map, Class> PRIMITIVE_TO_WRAPPER_TYPES; static { @@ -144,84 +100,6 @@ private ReflectionHelper() { } - public static ClassLoader getClassLoaderFromContext() { - return run( GetClassLoader.fromContext() ); - } - - public static ClassLoader getClassLoaderFromClass(Class clazz) { - return run( GetClassLoader.fromClass( clazz ) ); - } - - public static Class loadClass(String className, Class caller) { - return run( LoadClass.action( className, caller ) ); - } - - public static Class loadClass(String className, String defaultPackage) { - return loadClass( className, defaultPackage, ReflectionHelper.class ); - } - - public static boolean isClassPresent(String className, Class caller) { - try { - ReflectionHelper.loadClass( className, caller ); - return true; - } - catch ( ValidationException e ) { - return false; - } - } - - public static Class loadClass(String className, String defaultPackage, Class caller) { - if ( PRIMITIVE_NAME_TO_PRIMITIVE.containsKey( className ) ) { - return PRIMITIVE_NAME_TO_PRIMITIVE.get( className ); - } - - StringBuilder fullyQualifiedClass = new StringBuilder(); - String tmpClassName = className; - if ( isArrayClassName( className ) ) { - fullyQualifiedClass.append( ARRAY_CLASS_NAME_PREFIX ); - tmpClassName = getArrayElementClassName( className ); - } - - if ( isQualifiedClass( tmpClassName ) ) { - fullyQualifiedClass.append( tmpClassName ); - } - else { - fullyQualifiedClass.append( defaultPackage ); - fullyQualifiedClass.append( PACKAGE_SEPARATOR ); - fullyQualifiedClass.append( tmpClassName ); - } - - if ( isArrayClassName( className ) ) { - fullyQualifiedClass.append( ARRAY_CLASS_NAME_SUFFIX ); - } - - return loadClass( fullyQualifiedClass.toString(), caller ); - } - - private static boolean isArrayClassName(String className) { - return className.startsWith( ARRAY_CLASS_NAME_PREFIX ) && className.endsWith( ARRAY_CLASS_NAME_SUFFIX ); - } - - private static String getArrayElementClassName(String className) { - return className.substring( 2, className.length() - 1 ); - } - - private static boolean isQualifiedClass(String clazz) { - return clazz.contains( PACKAGE_SEPARATOR ); - } - - public static T newInstance(Class clazz, String message) { - return run( NewInstance.action( clazz, message ) ); - } - - public static T newConstructorInstance(Constructor constructor, Object... initArgs) { - return run( ConstructorInstance.action( constructor, initArgs ) ); - } - - public static T getAnnotationParameter(Annotation annotation, String parameterName, Class type) { - return run( GetAnnotationParameter.action( annotation, parameterName, type ) ); - } - /** * Returns the JavaBeans property name of the given member. *

@@ -301,42 +179,6 @@ else if ( methodName.startsWith( PROPERTY_ACCESSOR_PREFIX_HAS ) && method.getRet return false; } - /** - * Returns the member with the given name and type. - * - * @param clazz The class from which to retrieve the member. Cannot be {@code null}. - * @param property The property name without ""is"", ""get"" or ""has"". Cannot be {@code null} or empty. - * @param elementType The element type. Either {@code ElementType.FIELD} or {@code ElementType METHOD}. - * - * @return the member which matching the name and type or {@code null} if no such member exists. - */ - public static Member getMember(Class clazz, String property, ElementType elementType) { - Contracts.assertNotNull( clazz, MESSAGES.classCannotBeNull() ); - - if ( property == null || property.length() == 0 ) { - throw log.getPropertyNameCannotBeNullOrEmptyException(); - } - - if ( !( ElementType.FIELD.equals( elementType ) || ElementType.METHOD.equals( elementType ) ) ) { - throw log.getElementTypeHasToBeFieldOrMethodException(); - } - - Member member = null; - if ( ElementType.FIELD.equals( elementType ) ) { - member = run( GetDeclaredField.action( clazz, property ) ); - } - else { - String methodName = property.substring( 0, 1 ).toUpperCase() + property.substring( 1 ); - for ( String prefix : PROPERTY_ACCESSOR_PREFIXES ) { - member = run( GetMethod.action( clazz, prefix + methodName ) ); - if ( member != null ) { - break; - } - } - } - return member; - } - /** * @param member The Member instance for which to retrieve the type. * @@ -420,10 +262,6 @@ public static Object getValue(Method method, Object object) { } } - public static void setAccessibility(Member member) { - run( SetAccessibility.action( member ) ); - } - /** * Determines the type of elements of an Iterable, array or the value of a Map. * @@ -565,128 +403,6 @@ public static Object getMappedValue(Object value, Object key) { return map.get( key ); } - /** - * Returns the declared field with the specified name or {@code null} if it does not exist. - * - * @param clazz The class to check. - * @param fieldName The field name. - * - * @return Returns the declared field with the specified name or {@code null} if it does not exist. - */ - public static Field getDeclaredField(Class clazz, String fieldName) { - return run( GetDeclaredField.action( clazz, fieldName ) ); - } - - /** - * Returns the fields of the specified class. - * - * @param clazz The class for which to retrieve the fields. - * - * @return Returns the fields for this class. - */ - public static Field[] getDeclaredFields(Class clazz) { - return run( GetDeclaredFields.action( clazz ) ); - } - - /** - * Returns the method with the specified property name or {@code null} if it does not exist. This method will - * prepend 'is' and 'get' to the property name and capitalize the first letter. - * - * @param clazz The class to check. - * @param methodName The property name. - * - * @return Returns the method with the specified property or {@code null} if it does not exist. - */ - public static Method getMethodFromPropertyName(Class clazz, String methodName) { - return run( GetMethodFromPropertyName.action( clazz, methodName ) ); - } - - /** - * Returns the method with the specified name or {@code null} if it does not exist. - * - * @param clazz The class to check. - * @param methodName The method name. - * - * @return Returns the method with the specified property or {@code null} if it does not exist. - */ - public static Method getMethod(Class clazz, String methodName) { - return run( GetMethod.action( clazz, methodName ) ); - } - - /** - * Returns the declared method with the specified name and parameter types or {@code null} if - * it does not exist. - * - * @param clazz The class to check. - * @param methodName The method name. - * @param parameterTypes The method parameter types. - * - * @return Returns the declared method with the specified name or {@code null} if it does not exist. - */ - public static Method getDeclaredMethod(Class clazz, String methodName, Class... parameterTypes) { - return run( GetDeclaredMethod.action( clazz, methodName, parameterTypes ) ); - } - - /** - * Returns the declared methods of the specified class. - * - * @param clazz The class for which to retrieve the methods. - * - * @return Returns the declared methods for this class. - */ - public static Method[] getDeclaredMethods(Class clazz) { - return run( GetDeclaredMethods.action( clazz ) ); - } - - /** - * Returns the methods of the specified class (include inherited methods). - * - * @param clazz The class for which to retrieve the methods. - * - * @return Returns the methods for this class. - */ - public static Method[] getMethods(Class clazz) { - return run( GetMethods.action( clazz ) ); - } - - /** - * Returns the declared constructors of the specified class. - * - * @param clazz The class for which to retrieve the constructors. - * - * @return Returns the declared constructors for this class. - */ - public static Constructor[] getDeclaredConstructors(Class clazz) { - return run( GetDeclaredConstructors.action( clazz ) ); - } - - /** - * Returns the declared constructor with the specified parameter types or {@code null} if - * it does not exist. - * - * @param clazz The class to check. - * @param params The constructor parameter types. - * @param The type of class to get the constructor for. - * - * @return Returns the declared constructor with the specified name or {@code null} if it does not exist. - */ - public static Constructor getDeclaredConstructor(Class clazz, Class... params) { - return run( GetDeclaredConstructor.action( clazz, params ) ); - } - - /** - * Executes the given privileged action either directly or with privileges - * enabled, depending on whether a security manager is around or not. - * - * @param The return type of the privileged action to run. - * @param action The action to run. - * - * @return The result of the privileged action's execution. - */ - private static T run(PrivilegedAction action) { - return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); - } - /** * Returns the auto-boxed type of a primitive type. * diff --git a/engine/src/main/java/org/hibernate/validator/internal/util/ResourceLoaderHelper.java b/engine/src/main/java/org/hibernate/validator/internal/util/ResourceLoaderHelper.java index d373e38c5..0a7ade05c 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/util/ResourceLoaderHelper.java +++ b/engine/src/main/java/org/hibernate/validator/internal/util/ResourceLoaderHelper.java @@ -9,7 +9,7 @@ * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an ""AS IS"" BASIS, +* distributed under the License is distributed on an ""AS IS"" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. @@ -18,9 +18,12 @@ import java.io.BufferedInputStream; import java.io.InputStream; +import java.security.AccessController; +import java.security.PrivilegedAction; import org.hibernate.validator.internal.util.logging.Log; import org.hibernate.validator.internal.util.logging.LoggerFactory; +import org.hibernate.validator.internal.util.privilegedactions.GetClassLoader; /** * Helper methods for loading resource files @@ -50,18 +53,18 @@ public static InputStream getResettableInputStreamForPath(String path) { boolean isContextCL = true; // try the context class loader first - ClassLoader loader = ReflectionHelper.getClassLoaderFromContext(); + ClassLoader loader = run( GetClassLoader.fromContext() ); if ( loader == null ) { log.debug( ""No default context class loader, fall back to Bean Validation's loader"" ); - loader = ReflectionHelper.getClassLoaderFromClass( ResourceLoaderHelper.class ); + loader = run( GetClassLoader.fromClass( ResourceLoaderHelper.class ) ); isContextCL = false; } InputStream inputStream = loader.getResourceAsStream( inputPath ); // try the current class loader if ( isContextCL && inputStream == null ) { - loader = ReflectionHelper.getClassLoaderFromClass( ResourceLoaderHelper.class ); + loader = run( GetClassLoader.fromClass( ResourceLoaderHelper.class ) ); inputStream = loader.getResourceAsStream( inputPath ); } @@ -75,4 +78,14 @@ else if ( inputStream.markSupported() ) { return new BufferedInputStream( inputStream ); } } + + /** + * Runs the given privileged action, using a privileged block if required. + *

+ * NOTE: This must never be changed into a publicly available method to avoid execution of arbitrary + * privileged actions within HV's protection domain. + */ + private static T run(PrivilegedAction action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); + } } diff --git a/engine/src/main/java/org/hibernate/validator/internal/util/annotationfactory/AnnotationFactory.java b/engine/src/main/java/org/hibernate/validator/internal/util/annotationfactory/AnnotationFactory.java index 0ce6e4490..9ee1f8613 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/util/annotationfactory/AnnotationFactory.java +++ b/engine/src/main/java/org/hibernate/validator/internal/util/annotationfactory/AnnotationFactory.java @@ -21,8 +21,12 @@ import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Proxy; +import java.security.AccessController; +import java.security.PrivilegedAction; -import org.hibernate.validator.internal.util.ReflectionHelper; +import org.hibernate.validator.internal.util.privilegedactions.ConstructorInstance; +import org.hibernate.validator.internal.util.privilegedactions.GetClassLoader; +import org.hibernate.validator.internal.util.privilegedactions.GetDeclaredConstructor; /** * Creates live annotations (actually {@link AnnotationProxy} instances) from {@code AnnotationDescriptor}s. @@ -37,7 +41,7 @@ public static T create(AnnotationDescriptor descriptor) { @SuppressWarnings(""unchecked"") Class proxyClass = (Class) Proxy.getProxyClass( - ReflectionHelper.getClassLoaderFromClass( descriptor.type() ), + run( GetClassLoader.fromClass( descriptor.type() ) ), descriptor.type() ); InvocationHandler handler = new AnnotationProxy( descriptor ); @@ -55,10 +59,20 @@ private static T getProxyInstance(Class proxyClass, InvocationHandler handler) throws SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException { - final Constructor constructor = ReflectionHelper.getDeclaredConstructor( + final Constructor constructor = run( GetDeclaredConstructor.action( proxyClass, InvocationHandler.class - ); - return ReflectionHelper.newConstructorInstance( constructor, handler ); + ) ); + return run( ConstructorInstance.action( constructor, handler ) ); + } + + /** + * Runs the given privileged action, using a privileged block if required. + *

+ * NOTE: This must never be changed into a publicly available method to avoid execution of arbitrary + * privileged actions within HV's protection domain. + */ + private static T run(PrivilegedAction action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); } } diff --git a/engine/src/main/java/org/hibernate/validator/internal/util/annotationfactory/AnnotationProxy.java b/engine/src/main/java/org/hibernate/validator/internal/util/annotationfactory/AnnotationProxy.java index 38decc589..25e6b2fab 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/util/annotationfactory/AnnotationProxy.java +++ b/engine/src/main/java/org/hibernate/validator/internal/util/annotationfactory/AnnotationProxy.java @@ -21,6 +21,8 @@ import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Arrays; import java.util.Collections; import java.util.Map; @@ -29,9 +31,10 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.hibernate.validator.internal.util.ReflectionHelper; import org.hibernate.validator.internal.util.logging.Log; import org.hibernate.validator.internal.util.logging.LoggerFactory; +import org.hibernate.validator.internal.util.privilegedactions.GetDeclaredMethod; +import org.hibernate.validator.internal.util.privilegedactions.GetDeclaredMethods; import static org.hibernate.validator.internal.util.CollectionHelper.newHashMap; @@ -154,7 +157,7 @@ public String toString() { private Map getAnnotationValues(AnnotationDescriptor descriptor) { Map result = newHashMap(); int processedValuesFromDescriptor = 0; - final Method[] declaredMethods = ReflectionHelper.getDeclaredMethods( annotationType ); + final Method[] declaredMethods = run( GetDeclaredMethods.action( annotationType ) ); for ( Method m : declaredMethods ) { if ( descriptor.containsElement( m.getName() ) ) { result.put( m.getName(), descriptor.valueOf( m.getName() ) ); @@ -252,8 +255,7 @@ private boolean areEqual(Object o1, Object o2) { private Object getAnnotationMemberValue(Annotation annotation, String name) { try { - return ReflectionHelper.getDeclaredMethod( annotation.annotationType(), name ) - .invoke( annotation ); + return run( GetDeclaredMethod.action( annotation.annotationType(), name ) ).invoke( annotation ); } catch ( IllegalAccessException e ) { throw log.getUnableToRetrieveAnnotationParameterValueException( e ); @@ -265,4 +267,14 @@ private Object getAnnotationMemberValue(Annotation annotation, String name) { throw log.getUnableToRetrieveAnnotationParameterValueException( e ); } } + + /** + * Runs the given privileged action, using a privileged block if required. + *

+ * NOTE: This must never be changed into a publicly available method to avoid execution of arbitrary + * privileged actions within HV's protection domain. + */ + private T run(PrivilegedAction action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); + } } diff --git a/engine/src/main/java/org/hibernate/validator/internal/util/classhierarchy/ClassHierarchyHelper.java b/engine/src/main/java/org/hibernate/validator/internal/util/classhierarchy/ClassHierarchyHelper.java index 4719067f1..0ebce78ff 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/util/classhierarchy/ClassHierarchyHelper.java +++ b/engine/src/main/java/org/hibernate/validator/internal/util/classhierarchy/ClassHierarchyHelper.java @@ -16,14 +16,11 @@ */ package org.hibernate.validator.internal.util.classhierarchy; -import java.lang.reflect.Method; import java.util.Arrays; -import java.util.Collections; import java.util.List; import java.util.Set; import org.hibernate.validator.internal.util.Contracts; -import org.hibernate.validator.internal.util.ReflectionHelper; import static org.hibernate.validator.internal.util.CollectionHelper.newArrayList; import static org.hibernate.validator.internal.util.CollectionHelper.newHashSet; @@ -130,26 +127,4 @@ private static boolean acceptedByAllFilters(Class clazz, Iterable fil getImplementedInterfaces( currentInterfaceCasted, classes ); } } - - /** - * Get a list of all methods wich the given class declares, implements, - * overrides or inherits. Methods are added by adding first all methods of - * the class itself and its implemented interfaces, then the super class and - * its interfaces, etc. - * - * @param clazz the class for which to retrieve the methods - * - * @return set of all methods of the given class - */ - public static List getAllMethods(Class clazz) { - Contracts.assertNotNull( clazz ); - - List methods = newArrayList(); - - for ( Class hierarchyClass : getHierarchy( clazz ) ) { - Collections.addAll( methods, ReflectionHelper.getMethods( hierarchyClass ) ); - } - - return methods; - } } diff --git a/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredConstructor.java b/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredConstructor.java index da24fa80d..3918983b2 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredConstructor.java +++ b/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredConstructor.java @@ -20,6 +20,8 @@ import java.security.PrivilegedAction; /** + * Returns the declared constructor with the specified parameter types or {@code null} if it does not exist. + * * @author Emmanuel Bernard */ public final class GetDeclaredConstructor implements PrivilegedAction> { @@ -35,6 +37,7 @@ private GetDeclaredConstructor(Class clazz, Class... params) { this.params = params; } + @Override public Constructor run() { try { return clazz.getDeclaredConstructor( params ); diff --git a/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredConstructors.java b/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredConstructors.java index 53230ac1b..0c970d8e0 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredConstructors.java +++ b/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredConstructors.java @@ -20,6 +20,8 @@ import java.security.PrivilegedAction; /** + * Returns the declared constructors of the specified class. + * * @author Gunnar Morling */ public final class GetDeclaredConstructors implements PrivilegedAction[]> { @@ -33,6 +35,7 @@ private GetDeclaredConstructors(Class clazz) { this.clazz = clazz; } + @Override public Constructor[] run() { return clazz.getDeclaredConstructors(); } diff --git a/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredField.java b/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredField.java index cbc5e4d06..3617d6399 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredField.java +++ b/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredField.java @@ -20,6 +20,8 @@ import java.security.PrivilegedAction; /** + * Returns the declared field with the specified name or {@code null} if it does not exist. + * * @author Emmanuel Bernard */ public final class GetDeclaredField implements PrivilegedAction { @@ -35,6 +37,7 @@ private GetDeclaredField(Class clazz, String fieldName) { this.fieldName = fieldName; } + @Override public Field run() { try { final Field field = clazz.getDeclaredField( fieldName ); diff --git a/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredFields.java b/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredFields.java index ff1b233de..06cdce364 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredFields.java +++ b/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredFields.java @@ -20,6 +20,8 @@ import java.lang.reflect.Field; /** + * Returns the fields of the specified class. + * * @author Emmanuel Bernard */ public final class GetDeclaredFields implements PrivilegedAction { @@ -33,6 +35,7 @@ private GetDeclaredFields(Class clazz) { this.clazz = clazz; } + @Override public Field[] run() { return clazz.getDeclaredFields(); } diff --git a/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredMethod.java b/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredMethod.java index 4a609cde7..692e3de41 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredMethod.java +++ b/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredMethod.java @@ -20,6 +20,8 @@ import java.security.PrivilegedAction; /** + * Returns the declared method with the specified name and parameter types or {@code null} if it does not exist. + * * @author Kevin Pollet <kevin.pollet@serli.com> (C) 2011 SERLI */ public final class GetDeclaredMethod implements PrivilegedAction { @@ -37,6 +39,7 @@ private GetDeclaredMethod(Class clazz, String methodName, Class... paramet this.parameterTypes = parameterTypes; } + @Override public Method run() { try { return clazz.getDeclaredMethod( methodName, parameterTypes ); diff --git a/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredMethods.java b/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredMethods.java index 309ba2241..f87b3c061 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredMethods.java +++ b/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetDeclaredMethods.java @@ -20,6 +20,8 @@ import java.lang.reflect.Method; /** + * Returns the declared methods of the specified class. + * * @author Emmanuel Bernard */ public final class GetDeclaredMethods implements PrivilegedAction { @@ -33,6 +35,7 @@ private GetDeclaredMethods(Class clazz) { this.clazz = clazz; } + @Override public Method[] run() { return clazz.getDeclaredMethods(); } diff --git a/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetMethod.java b/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetMethod.java index 90cbda591..db4a00a50 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetMethod.java +++ b/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetMethod.java @@ -20,6 +20,8 @@ import java.security.PrivilegedAction; /** + * Returns the method with the specified name or {@code null} if it does not exist. + * * @author Emmanuel Bernard */ public final class GetMethod implements PrivilegedAction { @@ -35,6 +37,7 @@ private GetMethod(Class clazz, String methodName) { this.methodName = methodName; } + @Override public Method run() { try { return clazz.getMethod(methodName); diff --git a/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetMethodFromPropertyName.java b/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetMethodFromPropertyName.java index 63e530350..f4c7ee8fd 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetMethodFromPropertyName.java +++ b/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetMethodFromPropertyName.java @@ -20,6 +20,9 @@ import java.security.PrivilegedAction; /** + * Returns the method with the specified property name or {@code null} if it does not exist. This method will prepend + * 'is' and 'get' to the property name and capitalize the first letter. + * * @author Emmanuel Bernard * @author Hardy Ferentschik */ @@ -36,6 +39,7 @@ private GetMethodFromPropertyName(Class clazz, String property) { this.property = property; } + @Override public Method run() { try { char[] string = property.toCharArray(); diff --git a/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetMethods.java b/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetMethods.java index 58bc37714..bb9196c87 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetMethods.java +++ b/engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/GetMethods.java @@ -20,6 +20,8 @@ import java.lang.reflect.Method; /** + * Returns the methods of the specified class (include inherited methods). + * * @author Emmanuel Bernard */ public final class GetMethods implements PrivilegedAction { @@ -33,6 +35,7 @@ private GetMethods(Class clazz) { this.clazz = clazz; } + @Override public Method[] run() { return clazz.getMethods(); } diff --git a/engine/src/main/java/org/hibernate/validator/internal/xml/ClassLoadingHelper.java b/engine/src/main/java/org/hibernate/validator/internal/xml/ClassLoadingHelper.java new file mode 100644 index 000000000..a7694b3f9 --- /dev/null +++ b/engine/src/main/java/org/hibernate/validator/internal/xml/ClassLoadingHelper.java @@ -0,0 +1,119 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2014, Red Hat, Inc. and/or its affiliates, and individual contributors +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* Licensed under the Apache License, Version 2.0 (the ""License""); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* http://www.apache.org/licenses/LICENSE-2.0 +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an ""AS IS"" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package org.hibernate.validator.internal.xml; + +import static org.hibernate.validator.internal.util.CollectionHelper.newHashMap; + +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.Collections; +import java.util.Map; + +import org.hibernate.validator.internal.util.ReflectionHelper; +import org.hibernate.validator.internal.util.privilegedactions.LoadClass; + +/** + * A helper for loading classes by names, as given in XML constraint mappings. Given names can be the names of primitive + * types, qualified names or unqualified names (in which case a given default package will be assumed). + * + * @author Gunnar Morling + */ +/*package*/ class ClassLoadingHelper { + + private static final String PACKAGE_SEPARATOR = "".""; + private static final String ARRAY_CLASS_NAME_PREFIX = ""[L""; + private static final String ARRAY_CLASS_NAME_SUFFIX = "";""; + + private static final Map> PRIMITIVE_NAME_TO_PRIMITIVE; + + static { + Map> tmpMap = newHashMap( 9 ); + + tmpMap.put( boolean.class.getName(), boolean.class ); + tmpMap.put( char.class.getName(), char.class ); + tmpMap.put( double.class.getName(), double.class ); + tmpMap.put( float.class.getName(), float.class ); + tmpMap.put( long.class.getName(), long.class ); + tmpMap.put( int.class.getName(), int.class ); + tmpMap.put( short.class.getName(), short.class ); + tmpMap.put( byte.class.getName(), byte.class ); + tmpMap.put( Void.TYPE.getName(), Void.TYPE ); + + PRIMITIVE_NAME_TO_PRIMITIVE = Collections.unmodifiableMap( tmpMap ); + } + + private ClassLoadingHelper() { + } + + /*package*/ static Class loadClass(String className, String defaultPackage) { + return loadClass( className, defaultPackage, ReflectionHelper.class ); + } + + /*package*/ static Class loadClass(String className, String defaultPackage, Class caller) { + if ( PRIMITIVE_NAME_TO_PRIMITIVE.containsKey( className ) ) { + return PRIMITIVE_NAME_TO_PRIMITIVE.get( className ); + } + + StringBuilder fullyQualifiedClass = new StringBuilder(); + String tmpClassName = className; + if ( isArrayClassName( className ) ) { + fullyQualifiedClass.append( ARRAY_CLASS_NAME_PREFIX ); + tmpClassName = getArrayElementClassName( className ); + } + + if ( isQualifiedClass( tmpClassName ) ) { + fullyQualifiedClass.append( tmpClassName ); + } + else { + fullyQualifiedClass.append( defaultPackage ); + fullyQualifiedClass.append( PACKAGE_SEPARATOR ); + fullyQualifiedClass.append( tmpClassName ); + } + + if ( isArrayClassName( className ) ) { + fullyQualifiedClass.append( ARRAY_CLASS_NAME_SUFFIX ); + } + + return loadClass( fullyQualifiedClass.toString(), caller ); + } + + private static Class loadClass(String className, Class caller) { + return run( LoadClass.action( className, caller ) ); + } + + private static boolean isArrayClassName(String className) { + return className.startsWith( ARRAY_CLASS_NAME_PREFIX ) && className.endsWith( ARRAY_CLASS_NAME_SUFFIX ); + } + + private static String getArrayElementClassName(String className) { + return className.substring( 2, className.length() - 1 ); + } + + private static boolean isQualifiedClass(String clazz) { + return clazz.contains( PACKAGE_SEPARATOR ); + } + + /** + * Runs the given privileged action, using a privileged block if required. + *

+ * NOTE: This must never be changed into a publicly available method to avoid execution of arbitrary + * privileged actions within HV's protection domain. + */ + private static T run(PrivilegedAction action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); + } +} diff --git a/engine/src/main/java/org/hibernate/validator/internal/xml/ConstrainedExecutableBuilder.java b/engine/src/main/java/org/hibernate/validator/internal/xml/ConstrainedExecutableBuilder.java index 54473220a..05792110c 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/xml/ConstrainedExecutableBuilder.java +++ b/engine/src/main/java/org/hibernate/validator/internal/xml/ConstrainedExecutableBuilder.java @@ -18,6 +18,8 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.List; import java.util.Map; import java.util.Set; @@ -34,10 +36,11 @@ import org.hibernate.validator.internal.metadata.raw.ConstrainedExecutable; import org.hibernate.validator.internal.metadata.raw.ConstrainedParameter; import org.hibernate.validator.internal.metadata.raw.ExecutableElement; -import org.hibernate.validator.internal.util.ReflectionHelper; import org.hibernate.validator.internal.util.StringHelper; import org.hibernate.validator.internal.util.logging.Log; import org.hibernate.validator.internal.util.logging.LoggerFactory; +import org.hibernate.validator.internal.util.privilegedactions.GetDeclaredConstructor; +import org.hibernate.validator.internal.util.privilegedactions.GetDeclaredMethod; import static org.hibernate.validator.internal.util.CollectionHelper.newArrayList; import static org.hibernate.validator.internal.util.CollectionHelper.newHashMap; @@ -73,10 +76,12 @@ private ConstrainedExecutableBuilder() { String methodName = methodType.getName(); - final Method method = ReflectionHelper.getDeclaredMethod( - beanClass, - methodName, - parameterTypes.toArray( new Class[parameterTypes.size()] ) + final Method method = run( + GetDeclaredMethod.action( + beanClass, + methodName, + parameterTypes.toArray( new Class[parameterTypes.size()] ) + ) ); if ( method == null ) { @@ -136,9 +141,11 @@ private ConstrainedExecutableBuilder() { defaultPackage ); - final Constructor constructor = ReflectionHelper.getDeclaredConstructor( - beanClass, - constructorParameterTypes.toArray( new Class[constructorParameterTypes.size()] ) + final Constructor constructor = run( + GetDeclaredConstructor.action( + beanClass, + constructorParameterTypes.toArray( new Class[constructorParameterTypes.size()] ) + ) ); if ( constructor == null ) { @@ -317,7 +324,7 @@ private static boolean parseReturnValueType(ReturnValueType returnValueType, String type = null; try { type = parameterType.getType(); - Class parameterClass = ReflectionHelper.loadClass( type, defaultPackage ); + Class parameterClass = ClassLoadingHelper.loadClass( type, defaultPackage ); parameterTypes.add( parameterClass ); } catch ( ValidationException e ) { @@ -327,4 +334,14 @@ private static boolean parseReturnValueType(ReturnValueType returnValueType, return parameterTypes; } + + /** + * Runs the given privileged action, using a privileged block if required. + *

+ * NOTE: This must never be changed into a publicly available method to avoid execution of arbitrary + * privileged actions within HV's protection domain. + */ + private static T run(PrivilegedAction action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); + } } diff --git a/engine/src/main/java/org/hibernate/validator/internal/xml/ConstrainedFieldBuilder.java b/engine/src/main/java/org/hibernate/validator/internal/xml/ConstrainedFieldBuilder.java index 5278e07bc..7721f9a7b 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/xml/ConstrainedFieldBuilder.java +++ b/engine/src/main/java/org/hibernate/validator/internal/xml/ConstrainedFieldBuilder.java @@ -17,6 +17,8 @@ package org.hibernate.validator.internal.xml; import java.lang.reflect.Field; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.List; import java.util.Map; import java.util.Set; @@ -27,9 +29,9 @@ import org.hibernate.validator.internal.metadata.location.ConstraintLocation; import org.hibernate.validator.internal.metadata.raw.ConfigurationSource; import org.hibernate.validator.internal.metadata.raw.ConstrainedField; -import org.hibernate.validator.internal.util.ReflectionHelper; import org.hibernate.validator.internal.util.logging.Log; import org.hibernate.validator.internal.util.logging.LoggerFactory; +import org.hibernate.validator.internal.util.privilegedactions.GetDeclaredField; import static org.hibernate.validator.internal.util.CollectionHelper.newArrayList; import static org.hibernate.validator.internal.util.CollectionHelper.newHashSet; @@ -103,12 +105,20 @@ private static Field findField(Class beanClass, String fieldName, List + * NOTE: This must never be changed into a publicly available method to avoid execution of arbitrary + * privileged actions within HV's protection domain. + */ + private static T run(PrivilegedAction action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); + } +} diff --git a/engine/src/main/java/org/hibernate/validator/internal/xml/ConstrainedGetterBuilder.java b/engine/src/main/java/org/hibernate/validator/internal/xml/ConstrainedGetterBuilder.java index aa371ee03..b4b4c6bf7 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/xml/ConstrainedGetterBuilder.java +++ b/engine/src/main/java/org/hibernate/validator/internal/xml/ConstrainedGetterBuilder.java @@ -17,6 +17,8 @@ package org.hibernate.validator.internal.xml; import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Collections; import java.util.List; import java.util.Map; @@ -29,9 +31,9 @@ import org.hibernate.validator.internal.metadata.raw.ConfigurationSource; import org.hibernate.validator.internal.metadata.raw.ConstrainedExecutable; import org.hibernate.validator.internal.metadata.raw.ConstrainedParameter; -import org.hibernate.validator.internal.util.ReflectionHelper; import org.hibernate.validator.internal.util.logging.Log; import org.hibernate.validator.internal.util.logging.LoggerFactory; +import org.hibernate.validator.internal.util.privilegedactions.GetMethodFromPropertyName; import static org.hibernate.validator.internal.util.CollectionHelper.newArrayList; import static org.hibernate.validator.internal.util.CollectionHelper.newHashSet; @@ -108,13 +110,21 @@ private static Method findGetter(Class beanClass, String getterName, List + * NOTE: This must never be changed into a publicly available method to avoid execution of arbitrary + * privileged actions within HV's protection domain. + */ + private static T run(PrivilegedAction action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); + } +} diff --git a/engine/src/main/java/org/hibernate/validator/internal/xml/ConstrainedTypeBuilder.java b/engine/src/main/java/org/hibernate/validator/internal/xml/ConstrainedTypeBuilder.java index 9e6b4fc60..09d7c8b8a 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/xml/ConstrainedTypeBuilder.java +++ b/engine/src/main/java/org/hibernate/validator/internal/xml/ConstrainedTypeBuilder.java @@ -26,7 +26,6 @@ import org.hibernate.validator.internal.metadata.location.ConstraintLocation; import org.hibernate.validator.internal.metadata.raw.ConfigurationSource; import org.hibernate.validator.internal.metadata.raw.ConstrainedType; -import org.hibernate.validator.internal.util.ReflectionHelper; import static org.hibernate.validator.internal.util.CollectionHelper.newArrayList; import static org.hibernate.validator.internal.util.CollectionHelper.newHashSet; @@ -91,7 +90,7 @@ public static ConstrainedType buildConstrainedType(ClassType classType, List> groupSequence = newArrayList(); if ( groupSequenceType != null ) { for ( String groupName : groupSequenceType.getValue() ) { - Class group = ReflectionHelper.loadClass( groupName, defaultPackage ); + Class group = ClassLoadingHelper.loadClass( groupName, defaultPackage ); groupSequence.add( group ); } } diff --git a/engine/src/main/java/org/hibernate/validator/internal/xml/GroupConversionBuilder.java b/engine/src/main/java/org/hibernate/validator/internal/xml/GroupConversionBuilder.java index 47242c880..023a909b3 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/xml/GroupConversionBuilder.java +++ b/engine/src/main/java/org/hibernate/validator/internal/xml/GroupConversionBuilder.java @@ -19,8 +19,6 @@ import java.util.List; import java.util.Map; -import org.hibernate.validator.internal.util.ReflectionHelper; - import static org.hibernate.validator.internal.util.CollectionHelper.newHashMap; /** @@ -37,13 +35,11 @@ private GroupConversionBuilder() { String defaultPackage) { Map, Class> groupConversionMap = newHashMap(); for ( GroupConversionType groupConversionType : groupConversionTypes ) { - Class fromClass = ReflectionHelper.loadClass( groupConversionType.getFrom(), defaultPackage ); - Class toClass = ReflectionHelper.loadClass( groupConversionType.getTo(), defaultPackage ); + Class fromClass = ClassLoadingHelper.loadClass( groupConversionType.getFrom(), defaultPackage ); + Class toClass = ClassLoadingHelper.loadClass( groupConversionType.getTo(), defaultPackage ); groupConversionMap.put( fromClass, toClass ); } return groupConversionMap; } } - - diff --git a/engine/src/main/java/org/hibernate/validator/internal/xml/MetaConstraintBuilder.java b/engine/src/main/java/org/hibernate/validator/internal/xml/MetaConstraintBuilder.java index cb80ee595..c1f34af36 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/xml/MetaConstraintBuilder.java +++ b/engine/src/main/java/org/hibernate/validator/internal/xml/MetaConstraintBuilder.java @@ -20,7 +20,10 @@ import java.lang.annotation.Annotation; import java.lang.reflect.Array; import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.List; + import javax.validation.Payload; import javax.validation.ValidationException; import javax.xml.bind.JAXBElement; @@ -29,11 +32,11 @@ import org.hibernate.validator.internal.metadata.core.MetaConstraint; import org.hibernate.validator.internal.metadata.descriptor.ConstraintDescriptorImpl; import org.hibernate.validator.internal.metadata.location.ConstraintLocation; -import org.hibernate.validator.internal.util.ReflectionHelper; import org.hibernate.validator.internal.util.annotationfactory.AnnotationDescriptor; import org.hibernate.validator.internal.util.annotationfactory.AnnotationFactory; import org.hibernate.validator.internal.util.logging.Log; import org.hibernate.validator.internal.util.logging.LoggerFactory; +import org.hibernate.validator.internal.util.privilegedactions.GetMethod; import static org.hibernate.validator.internal.util.CollectionHelper.newArrayList; @@ -61,7 +64,7 @@ private MetaConstraintBuilder() { ConstraintDescriptorImpl.ConstraintType constraintType) { Class annotationClass; try { - annotationClass = (Class) ReflectionHelper.loadClass( constraint.getAnnotation(), defaultPackage ); + annotationClass = (Class) ClassLoadingHelper.loadClass( constraint.getAnnotation(), defaultPackage ); } catch ( ValidationException e ) { throw log.getUnableToLoadConstraintAnnotationClassException( constraint.getAnnotation(), e ); @@ -117,7 +120,7 @@ private static void checkNameIsValid(String name) { } private static Class getAnnotationParameterType(Class annotationClass, String name) { - Method m = ReflectionHelper.getMethod( annotationClass, name ); + Method m = run( GetMethod.action( annotationClass, name ) ); if ( m == null ) { throw log.getAnnotationDoesNotContainAParameterException( annotationClass.getName(), name ); } @@ -249,7 +252,7 @@ else if ( returnType.getName().equals( String.class.getName() ) ) { returnValue = value; } else if ( returnType.getName().equals( Class.class.getName() ) ) { - returnValue = ReflectionHelper.loadClass( value, defaultPackage, MetaConstraintBuilder.class ); + returnValue = ClassLoadingHelper.loadClass( value, defaultPackage, MetaConstraintBuilder.class ); } else { try { @@ -271,7 +274,7 @@ else if ( returnType.getName().equals( Class.class.getName() ) ) { List> groupList = newArrayList(); for ( String groupClass : groupsType.getValue() ) { - groupList.add( ReflectionHelper.loadClass( groupClass, defaultPackage ) ); + groupList.add( ClassLoadingHelper.loadClass( groupClass, defaultPackage ) ); } return groupList.toArray( new Class[groupList.size()] ); } @@ -284,7 +287,7 @@ else if ( returnType.getName().equals( Class.class.getName() ) ) { List> payloadList = newArrayList(); for ( String groupClass : payloadType.getValue() ) { - Class payload = ReflectionHelper.loadClass( groupClass, defaultPackage ); + Class payload = ClassLoadingHelper.loadClass( groupClass, defaultPackage ); if ( !Payload.class.isAssignableFrom( payload ) ) { throw log.getWrongPayloadClassException( payload.getName() ); } @@ -294,6 +297,14 @@ else if ( returnType.getName().equals( Class.class.getName() ) ) { } return payloadList.toArray( new Class[payloadList.size()] ); } -} - + /** + * Runs the given privileged action, using a privileged block if required. + *

+ * NOTE: This must never be changed into a publicly available method to avoid execution of arbitrary + * privileged actions within HV's protection domain. + */ + private static T run(PrivilegedAction action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); + } +} diff --git a/engine/src/main/java/org/hibernate/validator/internal/xml/ValidationBootstrapParameters.java b/engine/src/main/java/org/hibernate/validator/internal/xml/ValidationBootstrapParameters.java index b49b266b9..4305955aa 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/xml/ValidationBootstrapParameters.java +++ b/engine/src/main/java/org/hibernate/validator/internal/xml/ValidationBootstrapParameters.java @@ -17,6 +17,8 @@ package org.hibernate.validator.internal.xml; import java.io.InputStream; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Collections; import java.util.List; import java.util.Map; @@ -30,10 +32,11 @@ import javax.validation.ValidationException; import javax.validation.spi.ValidationProvider; -import org.hibernate.validator.internal.util.ReflectionHelper; import org.hibernate.validator.internal.util.ResourceLoaderHelper; import org.hibernate.validator.internal.util.logging.Log; import org.hibernate.validator.internal.util.logging.LoggerFactory; +import org.hibernate.validator.internal.util.privilegedactions.LoadClass; +import org.hibernate.validator.internal.util.privilegedactions.NewInstance; import org.hibernate.validator.spi.valuehandling.ValidatedValueUnwrapper; import static org.hibernate.validator.internal.util.CollectionHelper.newArrayList; @@ -141,9 +144,8 @@ public void setParameterNameProvider(ParameterNameProvider parameterNameProvider private void setProviderClass(String providerFqcn) { if ( providerFqcn != null ) { try { - providerClass = (Class>) ReflectionHelper.loadClass( - providerFqcn, - this.getClass() + providerClass = (Class>) run( + LoadClass.action( providerFqcn, this.getClass() ) ); log.usingValidationProvider( providerFqcn ); } @@ -157,10 +159,10 @@ private void setMessageInterpolator(String messageInterpolatorFqcn) { if ( messageInterpolatorFqcn != null ) { try { @SuppressWarnings(""unchecked"") - Class messageInterpolatorClass = (Class) ReflectionHelper.loadClass( - messageInterpolatorFqcn, this.getClass() + Class messageInterpolatorClass = (Class) run( + LoadClass.action( messageInterpolatorFqcn, this.getClass() ) ); - messageInterpolator = ReflectionHelper.newInstance( messageInterpolatorClass, ""message interpolator"" ); + messageInterpolator = run( NewInstance.action( messageInterpolatorClass, ""message interpolator"" ) ); log.usingMessageInterpolator( messageInterpolatorFqcn ); } catch ( ValidationException e ) { @@ -173,10 +175,10 @@ private void setTraversableResolver(String traversableResolverFqcn) { if ( traversableResolverFqcn != null ) { try { @SuppressWarnings(""unchecked"") - Class clazz = (Class) ReflectionHelper.loadClass( - traversableResolverFqcn, this.getClass() + Class clazz = (Class) run( + LoadClass.action( traversableResolverFqcn, this.getClass() ) ); - traversableResolver = ReflectionHelper.newInstance( clazz, ""traversable resolver"" ); + traversableResolver = run( NewInstance.action( clazz, ""traversable resolver"" ) ); log.usingTraversableResolver( traversableResolverFqcn ); } catch ( ValidationException e ) { @@ -189,10 +191,10 @@ private void setConstraintFactory(String constraintFactoryFqcn) { if ( constraintFactoryFqcn != null ) { try { @SuppressWarnings(""unchecked"") - Class clazz = (Class) ReflectionHelper.loadClass( - constraintFactoryFqcn, this.getClass() + Class clazz = (Class) run ( + LoadClass.action( constraintFactoryFqcn, this.getClass() ) ); - constraintValidatorFactory = ReflectionHelper.newInstance( clazz, ""constraint factory class"" ); + constraintValidatorFactory = run( NewInstance.action( clazz, ""constraint factory class"" ) ); log.usingConstraintFactory( constraintFactoryFqcn ); } catch ( ValidationException e ) { @@ -205,10 +207,10 @@ private void setParameterNameProvider(String parameterNameProviderFqcn) { if ( parameterNameProviderFqcn != null ) { try { @SuppressWarnings(""unchecked"") - Class clazz = (Class) ReflectionHelper.loadClass( - parameterNameProviderFqcn, this.getClass() + Class clazz = (Class) run( + LoadClass.action( parameterNameProviderFqcn, this.getClass() ) ); - parameterNameProvider = ReflectionHelper.newInstance( clazz, ""parameter name provider class"" ); + parameterNameProvider = run( NewInstance.action( clazz, ""parameter name provider class"" ) ); log.usingParameterNameProvider( parameterNameProviderFqcn ); } catch ( ValidationException e ) { @@ -235,6 +237,16 @@ private void setConfigProperties(Map properties) { } } + /** + * Runs the given privileged action, using a privileged block if required. + *

+ * NOTE: This must never be changed into a publicly available method to avoid execution of arbitrary + * privileged actions within HV's protection domain. + */ + private T run(PrivilegedAction action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); + } + public void addValidatedValueHandler(ValidatedValueUnwrapper handler) { validatedValueHandlers.add( handler ); } diff --git a/engine/src/main/java/org/hibernate/validator/internal/xml/XmlMappingParser.java b/engine/src/main/java/org/hibernate/validator/internal/xml/XmlMappingParser.java index f902c386d..a5db48cfa 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/xml/XmlMappingParser.java +++ b/engine/src/main/java/org/hibernate/validator/internal/xml/XmlMappingParser.java @@ -20,12 +20,15 @@ import java.io.IOException; import java.io.InputStream; import java.lang.annotation.Annotation; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; + import javax.validation.ConstraintValidator; import javax.validation.ParameterNameProvider; import javax.xml.bind.JAXBContext; @@ -43,9 +46,9 @@ import org.hibernate.validator.internal.metadata.raw.ConstrainedExecutable; import org.hibernate.validator.internal.metadata.raw.ConstrainedField; import org.hibernate.validator.internal.metadata.raw.ConstrainedType; -import org.hibernate.validator.internal.util.ReflectionHelper; import org.hibernate.validator.internal.util.logging.Log; import org.hibernate.validator.internal.util.logging.LoggerFactory; +import org.hibernate.validator.internal.util.privilegedactions.LoadClass; import static org.hibernate.validator.internal.util.CollectionHelper.newArrayList; import static org.hibernate.validator.internal.util.CollectionHelper.newHashMap; @@ -118,7 +121,7 @@ public final void parse(Set mappingStreams) { ); for ( BeanType bean : mapping.getBean() ) { - Class beanClass = ReflectionHelper.loadClass( bean.getClazz(), defaultPackage ); + Class beanClass = ClassLoadingHelper.loadClass( bean.getClazz(), defaultPackage ); checkClassHasNotBeenProcessed( processedClasses, beanClass ); // update annotation ignores @@ -220,7 +223,7 @@ private void parseConstraintDefinitions(List constrain alreadyProcessedConstraintDefinitions.add( annotationClassName ); } - Class clazz = ReflectionHelper.loadClass( annotationClassName, defaultPackage ); + Class clazz = ClassLoadingHelper.loadClass( annotationClassName, defaultPackage ); if ( !clazz.isAnnotation() ) { throw log.getIsNotAnAnnotationException( annotationClassName ); } @@ -235,11 +238,9 @@ private void parseConstraintDefinitions(List constrain for ( String validatorClassName : validatedByType.getValue() ) { @SuppressWarnings(""unchecked"") - Class> validatorClass = (Class>) ReflectionHelper - .loadClass( - validatorClassName, - this.getClass() - ); + Class> validatorClass = (Class>) run( + LoadClass.action( validatorClassName, this.getClass() ) + ); if ( !ConstraintValidator.class.isAssignableFrom( validatorClass ) ) { @@ -335,6 +336,16 @@ private String getSchemaResourceName(String schemaVersion) { return schemaResource; } + /** + * Runs the given privileged action, using a privileged block if required. + *

+ * NOTE: This must never be changed into a publicly available method to avoid execution of arbitrary + * privileged actions within HV's protection domain. + */ + private T run(PrivilegedAction action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); + } + // JAXB closes the underlying input stream private static class CloseIgnoringInputStream extends FilterInputStream { public CloseIgnoringInputStream(InputStream in) { diff --git a/engine/src/main/java/org/hibernate/validator/internal/xml/XmlParserHelper.java b/engine/src/main/java/org/hibernate/validator/internal/xml/XmlParserHelper.java index 295349121..db578a4ab 100644 --- a/engine/src/main/java/org/hibernate/validator/internal/xml/XmlParserHelper.java +++ b/engine/src/main/java/org/hibernate/validator/internal/xml/XmlParserHelper.java @@ -19,8 +19,11 @@ import java.io.IOException; import java.io.InputStream; import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; + import javax.xml.namespace.QName; import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLInputFactory; @@ -32,11 +35,10 @@ import javax.xml.validation.SchemaFactory; import org.xml.sax.SAXException; - import org.hibernate.validator.internal.util.Contracts; -import org.hibernate.validator.internal.util.ReflectionHelper; import org.hibernate.validator.internal.util.logging.Log; import org.hibernate.validator.internal.util.logging.LoggerFactory; +import org.hibernate.validator.internal.util.privilegedactions.GetClassLoader; import static org.hibernate.validator.internal.util.logging.Messages.MESSAGES; @@ -148,7 +150,7 @@ public Schema getSchema(String schemaResource) { } private Schema loadSchema(String schemaResource) { - ClassLoader loader = ReflectionHelper.getClassLoaderFromClass( XmlParserHelper.class ); + ClassLoader loader = run( GetClassLoader.fromClass( XmlParserHelper.class ) ); URL schemaUrl = loader.getResource( schemaResource ); SchemaFactory sf = SchemaFactory.newInstance( javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI ); @@ -161,4 +163,14 @@ private Schema loadSchema(String schemaResource) { } return schema; } + + /** + * Runs the given privileged action, using a privileged block if required. + *

+ * NOTE: This must never be changed into a publicly available method to avoid execution of arbitrary + * privileged actions within HV's protection domain. + */ + private T run(PrivilegedAction action) { + return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run(); + } } diff --git a/engine/src/test/java/org/hibernate/validator/test/cfg/CascadingWithConstraintMappingTest.java b/engine/src/test/java/org/hibernate/validator/test/cfg/CascadingWithConstraintMappingTest.java index 7b2aa0ad0..2c028356a 100644 --- a/engine/src/test/java/org/hibernate/validator/test/cfg/CascadingWithConstraintMappingTest.java +++ b/engine/src/test/java/org/hibernate/validator/test/cfg/CascadingWithConstraintMappingTest.java @@ -19,17 +19,17 @@ import java.lang.reflect.Method; import java.util.Set; + import javax.validation.ConstraintViolation; import javax.validation.Validator; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; - import org.hibernate.validator.HibernateValidator; import org.hibernate.validator.HibernateValidatorConfiguration; import org.hibernate.validator.cfg.ConstraintMapping; import org.hibernate.validator.cfg.defs.NotNullDef; -import org.hibernate.validator.internal.util.ReflectionHelper; +import org.hibernate.validator.internal.util.privilegedactions.GetMethod; import org.hibernate.validator.testutil.TestForIssue; import static java.lang.annotation.ElementType.FIELD; @@ -108,7 +108,7 @@ public void testProgrammaticCascadingMethodValidation() { B b = new B(); b.c = new C(); - Method method = ReflectionHelper.getMethod( B.class, ""getC"" ); + Method method = GetMethod.action( B.class, ""getC"" ).run(); Set> violations = validator.forExecutables().validateReturnValue( b, method, b.getC() diff --git a/engine/src/test/java/org/hibernate/validator/test/internal/util/ReflectionHelperTest.java b/engine/src/test/java/org/hibernate/validator/test/internal/util/ReflectionHelperTest.java index 0c514989b..9d564a7fa 100644 --- a/engine/src/test/java/org/hibernate/validator/test/internal/util/ReflectionHelperTest.java +++ b/engine/src/test/java/org/hibernate/validator/test/internal/util/ReflectionHelperTest.java @@ -16,7 +16,6 @@ */ package org.hibernate.validator.test.internal.util; -import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.lang.reflect.Type; import java.util.ArrayList; @@ -27,10 +26,6 @@ import java.util.Map; import java.util.SortedMap; import java.util.TreeSet; -import javax.validation.Payload; -import javax.validation.ValidationException; -import javax.validation.constraints.NotNull; -import javax.validation.groups.Default; import org.testng.annotations.Test; @@ -41,7 +36,6 @@ import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; /** * Tests for the {@code ReflectionHelper}. @@ -126,57 +120,6 @@ public void testGetIndexedValueForNull() { assertNull( value ); } - @Test - public void testGetMessageParameter() { - NotNull testAnnotation = new NotNull() { - @Override - public String message() { - return ""test""; - } - - @Override - public Class[] groups() { - return new Class[] { Default.class }; - } - - @Override - public Class[] payload() { - @SuppressWarnings(""unchecked"") - Class[] classes = new Class[] { }; - return classes; - } - - @Override - public Class annotationType() { - return this.getClass(); - } - }; - String message = ReflectionHelper.getAnnotationParameter( testAnnotation, ""message"", String.class ); - assertEquals( ""test"", message, ""Wrong message"" ); - - Class[] group = ReflectionHelper.getAnnotationParameter( testAnnotation, ""groups"", Class[].class ); - assertEquals( group[0], Default.class, ""Wrong message"" ); - - try { - ReflectionHelper.getAnnotationParameter( testAnnotation, ""message"", Integer.class ); - fail(); - } - catch ( ValidationException e ) { - assertTrue( e.getMessage().contains( ""Wrong parameter type."" ), ""Wrong exception message"" ); - } - - try { - ReflectionHelper.getAnnotationParameter( testAnnotation, ""foo"", Integer.class ); - fail(); - } - catch ( ValidationException e ) { - assertTrue( - e.getMessage().contains( ""The specified annotation defines no parameter"" ), - ""Wrong exception message"" - ); - } - } - @Test @TestForIssue(jiraKey = ""HV-622"") public void testIsGetterMethod() throws Exception { diff --git a/engine/src/test/java/org/hibernate/validator/test/internal/util/annotationfactory/AnnotationProxyTest.java b/engine/src/test/java/org/hibernate/validator/test/internal/util/annotationfactory/AnnotationProxyTest.java index 7f0acd80c..b28590736 100644 --- a/engine/src/test/java/org/hibernate/validator/test/internal/util/annotationfactory/AnnotationProxyTest.java +++ b/engine/src/test/java/org/hibernate/validator/test/internal/util/annotationfactory/AnnotationProxyTest.java @@ -9,7 +9,7 @@ * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an ""AS IS"" BASIS, +* distributed under the License is distributed on an ""AS IS"" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. @@ -25,10 +25,9 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; - -import org.hibernate.validator.internal.util.ReflectionHelper; import org.hibernate.validator.internal.util.annotationfactory.AnnotationDescriptor; import org.hibernate.validator.internal.util.annotationfactory.AnnotationFactory; +import org.hibernate.validator.internal.util.privilegedactions.GetDeclaredMethods; /** * @author Gunnar Morling @@ -273,7 +272,7 @@ public void testHashCode() { AnnotationDescriptor descriptor = new AnnotationDescriptor( annotationType ); - for ( Method method : ReflectionHelper.getDeclaredMethods( annotationType ) ) { + for ( Method method : GetDeclaredMethods.action( annotationType ).run() ) { try { descriptor.setValue( method.getName(), method.invoke( annotation ) ); } diff --git a/engine/src/test/java/org/hibernate/validator/test/internal/util/classhierarchy/ClassHierarchyHelperTest.java b/engine/src/test/java/org/hibernate/validator/test/internal/util/classhierarchy/ClassHierarchyHelperTest.java index d0b8118e2..5ab78a17c 100644 --- a/engine/src/test/java/org/hibernate/validator/test/internal/util/classhierarchy/ClassHierarchyHelperTest.java +++ b/engine/src/test/java/org/hibernate/validator/test/internal/util/classhierarchy/ClassHierarchyHelperTest.java @@ -16,7 +16,6 @@ */ package org.hibernate.validator.test.internal.util.classhierarchy; -import java.lang.reflect.Method; import java.util.List; import org.testng.annotations.Test; @@ -25,7 +24,6 @@ import org.hibernate.validator.internal.util.classhierarchy.Filters; import static org.fest.assertions.Assertions.assertThat; -import static org.testng.Assert.assertTrue; /** * Unit test for {@link ClassHierarchyHelper}. @@ -35,13 +33,6 @@ */ public class ClassHierarchyHelperTest { - @Test - public void testGetAllMethods() throws Exception { - List methods = ClassHierarchyHelper.getAllMethods( Fubar.class ); - assertTrue( methods.contains( Snafu.class.getMethod( ""snafu"" ) ) ); - assertTrue( methods.contains( Susfu.class.getMethod( ""susfu"" ) ) ); - } - @Test public void testGetHierarchy() { List> hierarchy = ClassHierarchyHelper.getHierarchy( Fubar.class ); diff --git a/engine/src/test/java/org/hibernate/validator/test/internal/util/privilegedactions/GetAnnotationsParameterTest.java b/engine/src/test/java/org/hibernate/validator/test/internal/util/privilegedactions/GetAnnotationsParameterTest.java new file mode 100644 index 000000000..b2b556a99 --- /dev/null +++ b/engine/src/test/java/org/hibernate/validator/test/internal/util/privilegedactions/GetAnnotationsParameterTest.java @@ -0,0 +1,91 @@ +/* +* JBoss, Home of Professional Open Source +* Copyright 2014, Red Hat, Inc. and/or its affiliates, and individual contributors +* by the @authors tag. See the copyright.txt in the distribution for a +* full listing of individual contributors. +* +* Licensed under the Apache License, Version 2.0 (the ""License""); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* http://www.apache.org/licenses/LICENSE-2.0 +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an ""AS IS"" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package org.hibernate.validator.test.internal.util.privilegedactions; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; +import static org.testng.Assert.fail; + +import java.lang.annotation.Annotation; + +import javax.validation.Payload; +import javax.validation.ValidationException; +import javax.validation.constraints.NotNull; +import javax.validation.groups.Default; + +import org.hibernate.validator.internal.util.privilegedactions.GetAnnotationParameter; +import org.testng.annotations.Test; + +/** + * Unit test for {@link GetAnnotationsParameter}. + * + * @author Gunnar Morling + * + */ +public class GetAnnotationsParameterTest { + + @Test + public void testGetMessageParameter() { + NotNull testAnnotation = new NotNull() { + @Override + public String message() { + return ""test""; + } + + @Override + public Class[] groups() { + return new Class[] { Default.class }; + } + + @Override + public Class[] payload() { + @SuppressWarnings(""unchecked"") + Class[] classes = new Class[] { }; + return classes; + } + + @Override + public Class annotationType() { + return this.getClass(); + } + }; + String message = GetAnnotationParameter.action( testAnnotation, ""message"", String.class ).run(); + assertEquals( ""test"", message, ""Wrong message"" ); + + Class[] group = GetAnnotationParameter.action( testAnnotation, ""groups"", Class[].class ).run(); + assertEquals( group[0], Default.class, ""Wrong message"" ); + + try { + GetAnnotationParameter.action( testAnnotation, ""message"", Integer.class ).run(); + fail(); + } + catch ( ValidationException e ) { + assertTrue( e.getMessage().contains( ""Wrong parameter type."" ), ""Wrong exception message"" ); + } + + try { + GetAnnotationParameter.action( testAnnotation, ""foo"", Integer.class ).run(); + fail(); + } + catch ( ValidationException e ) { + assertTrue( + e.getMessage().contains( ""The specified annotation defines no parameter"" ), + ""Wrong exception message"" + ); + } + } +} ",1 9fd10cf630832b36a588c1545d8736539b2f1fb5,https://github.com/ImageMagick/ImageMagick/commit/9fd10cf630832b36a588c1545d8736539b2f1fb5,https://github.com/ImageMagick/ImageMagick/issues/592,"diff --git a/coders/gif.c b/coders/gif.c index 7a353ffd0a..bbfd5b2067 100644 --- a/coders/gif.c +++ b/coders/gif.c @@ -1018,6 +1018,8 @@ static Image *ReadGIFImage(const ImageInfo *image_info,ExceptionInfo *exception) MagickMax(global_colors,256),3UL*sizeof(*global_colormap)); if (global_colormap == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); + (void) ResetMagickMemory(global_colormap,0,3*MagickMax(global_colors,256)* + sizeof(*global_colormap)); if (BitSet((int) flag,0x80) != 0) { count=ReadBlob(image,(size_t) (3*global_colors),global_colormap); ",1 fb3569fbb9a2f55459aa8e1e22bc35a737e66329,https://github.com/apache/tomcat/commit/fb3569fbb9a2f55459aa8e1e22bc35a737e66329,"Add a new initialisation parameter, envHttpHeaders, to the CGI Servlet to mitigate httpoxy (CVE-2016-5388) by default and to provide a mechanism that can be used to mitigate any future, similar issues. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1756939 13f79535-47bb-0310-9956-ffa450edef68","diff --git a/conf/web.xml b/conf/web.xml index 970df256c6f..b5822f04b88 100644 --- a/conf/web.xml +++ b/conf/web.xml @@ -334,6 +334,15 @@ + + + + + + + + + @@ -353,7 +362,7 @@ cgiPathPrefix WEB-INF/cgi - 5 + 5 --> diff --git a/java/org/apache/catalina/servlets/CGIServlet.java b/java/org/apache/catalina/servlets/CGIServlet.java index 15dbf0efb25..d3746d5d447 100644 --- a/java/org/apache/catalina/servlets/CGIServlet.java +++ b/java/org/apache/catalina/servlets/CGIServlet.java @@ -35,6 +35,7 @@ import java.util.Map.Entry; import java.util.StringTokenizer; import java.util.Vector; +import java.util.regex.Pattern; import javax.servlet.RequestDispatcher; import javax.servlet.ServletConfig; @@ -265,6 +266,16 @@ */ private long stderrTimeout = 2000; + /** + * The regular expression used to select HTTP headers to be passed to the + * CGI process as environment variables. The name of the environment + * variable will be the name of the HTTP header converter to upper case, + * prefixed with HTTP_ and with all - characters + * converted to _. + */ + private Pattern envHttpHeadersPattern = Pattern.compile( + ""ACCEPT[-0-9A-Z]*|CACHE-CONTROL|COOKIE|HOST|IF-[-0-9A-Z]*|REFERER|USER-AGENT""); + /** object used to ensure multiple threads don't try to expand same file */ private static final Object expandFileLock = new Object(); @@ -326,6 +337,10 @@ public void init(ServletConfig config) throws ServletException { ""stderrTimeout"")); } + if (getServletConfig().getInitParameter(""envHttpHeaders"") != null) { + envHttpHeadersPattern = + Pattern.compile(getServletConfig().getInitParameter(""envHttpHeaders"")); + } } @@ -963,12 +978,8 @@ protected boolean setCGIEnvironment(HttpServletRequest req) throws IOException { //REMIND: rewrite multiple headers as if received as single //REMIND: change character set //REMIND: I forgot what the previous REMIND means - if (""AUTHORIZATION"".equalsIgnoreCase(header) || - ""PROXY_AUTHORIZATION"".equalsIgnoreCase(header)) { - //NOOP per CGI specification section 11.2 - } else { - envp.put(""HTTP_"" + header.replace('-', '_'), - req.getHeader(header)); + if (envHttpHeadersPattern.matcher(header).matches()) { + envp.put(""HTTP_"" + header.replace('-', '_'), req.getHeader(header)); } } diff --git a/webapps/docs/cgi-howto.xml b/webapps/docs/cgi-howto.xml index ef41f4c061c..b473c164041 100644 --- a/webapps/docs/cgi-howto.xml +++ b/webapps/docs/cgi-howto.xml @@ -103,6 +103,12 @@ if your script is itself executable (e.g. an exe file). Default is

  • executable-arg-1, executable-arg-2, and so on - additional arguments for the executable. These precede the CGI script name. By default there are no additional arguments.
  • +
  • envHttpHeaders - A regular expression used to select the +HTTP headers passed to the CGI process as environment variables. Note that +headers are converted to upper case before matching and that the entire header +name must match the pattern. Default is +ACCEPT[-0-9A-Z]*|CACHE-CONTROL|COOKIE|HOST|IF-[-0-9A-Z]*|REFERER|USER-AGENT +
  • parameterEncoding - Name of the parameter encoding to be used with the CGI servlet. Default is System.getProperty(""file.encoding"",""UTF-8""). That is the system diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index afe57c3d00e..afee1d16046 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -146,6 +146,13 @@ StandardRoot instance now invalidate the cache if caching is enabled. (markt) + + Add a new initialisation parameter, envHttpHeaders, to + the CGI Servlet to mitigate httpoxy + (CVE-2016-5388) by default and to provide a mechanism that can be + used to mitigate any future, similar issues. (markt) + ",1 ec3d0db81ba061b27e934d5ff56e9baca0049eb,https://github.com/apache/camel/commit/ec3d0db81ba061b27e934d5ff56e9baca0049eb,CAMEL-10894: Improve test fix,"diff --git a/camel-core/src/main/java/org/apache/camel/processor/validation/SchemaReader.java b/camel-core/src/main/java/org/apache/camel/processor/validation/SchemaReader.java index 65719faeb2bb..febcefe606df 100644 --- a/camel-core/src/main/java/org/apache/camel/processor/validation/SchemaReader.java +++ b/camel-core/src/main/java/org/apache/camel/processor/validation/SchemaReader.java @@ -173,7 +173,7 @@ protected SchemaFactory createSchemaFactory() { if (getResourceResolver() != null) { factory.setResourceResolver(getResourceResolver()); } - if (camelContext != null && !Boolean.parseBoolean(camelContext.getProperty(ACCESS_EXTERNAL_DTD))) { + if (camelContext == null || !Boolean.parseBoolean(camelContext.getProperty(ACCESS_EXTERNAL_DTD))) { try { factory.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, """"); } catch (SAXException e) { ",1 5982632109cad48bc6dab867298fdea4dea57c51,https://github.com/ImageMagick/ImageMagick6/commit/5982632109cad48bc6dab867298fdea4dea57c51,https://github.com/ImageMagick/ImageMagick/issues/1616,"diff --git a/wand/mogrify.c b/wand/mogrify.c index d641914f7c..fca494d2cc 100644 --- a/wand/mogrify.c +++ b/wand/mogrify.c @@ -7923,6 +7923,8 @@ WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info, channel,metric,&distortion,exception); if (difference_image == (Image *) NULL) break; + reconstruct_image=DestroyImage(reconstruct_image); + image=DestroyImage(image); if (*images != (Image *) NULL) *images=DestroyImageList(*images); *images=difference_image; @@ -8265,6 +8267,7 @@ WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info, q=GetImageFromList(*images,index-1); if (q == (Image *) NULL) { + p=DestroyImage(p); (void) ThrowMagickException(exception,GetMagickModule(), OptionError,""NoSuchImage"",""`%s'"",argv[i+1]); status=MagickFalse; ",1 f282d85e60e3df5e57ecdb82adccb4eaef404f03,https://github.com/sequelize/sequelize/pull/5167/commits/f282d85e60e3df5e57ecdb82adccb4eaef404f03,critical(sql): escape limit and order by arguments to counter possible injection attack,"diff --git a/changelog.md b/changelog.md index c17f47b907..8bb0418921 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,8 @@ +# Future +- [CRITICAL] Fixed injection vulnerability for order/limit +- [FIXED] MySQL throws error when null GEOMETRY data results in empty buffer [#4953](https://github.com/sequelize/sequelize/issues/4953) +- [ADDED] Support for benchmarking the execution time for SQL queries [#488](https://github.com/sequelize/sequelize/issues/488) + # 3.13.0 - [FIXED] timestamp columns are no longer undefined for associations loaded with `separate`. [#4740](https://github.com/sequelize/sequelize/issues/4740) - [FIXED] Mark unscoped model as `.scoped`, to prevent injection of default scope on includes [#4663](https://github.com/sequelize/sequelize/issues/4663) diff --git a/lib/dialects/abstract/query-generator.js b/lib/dialects/abstract/query-generator.js index 5936d3bb04..fc39077fd6 100644 --- a/lib/dialects/abstract/query-generator.js +++ b/lib/dialects/abstract/query-generator.js @@ -1742,12 +1742,12 @@ var QueryGenerator = { addLimitAndOffset: function(options, model) { var fragment = ''; if (options.offset && !options.limit) { - fragment += ' LIMIT ' + options.offset + ', ' + 18440000000000000000; + fragment += ' LIMIT ' + this.escape(options.offset) + ', ' + 18440000000000000000; } else if (options.limit) { if (options.offset) { - fragment += ' LIMIT ' + options.offset + ', ' + options.limit; + fragment += ' LIMIT ' + this.escape(options.offset) + ', ' + this.escape(options.limit); } else { - fragment += ' LIMIT ' + options.limit; + fragment += ' LIMIT ' + this.escape(options.limit); } } diff --git a/lib/dialects/mssql/query-generator.js b/lib/dialects/mssql/query-generator.js index 808cfa0a79..91bd835bf5 100644 --- a/lib/dialects/mssql/query-generator.js +++ b/lib/dialects/mssql/query-generator.js @@ -590,11 +590,11 @@ var QueryGenerator = { } if (options.offset || options.limit) { - fragment += ' OFFSET ' + offset + ' ROWS'; + fragment += ' OFFSET ' + this.escape(offset) + ' ROWS'; } if (options.limit) { - fragment += ' FETCH NEXT ' + options.limit + ' ROWS ONLY'; + fragment += ' FETCH NEXT ' + this.escape(options.limit) + ' ROWS ONLY'; } } diff --git a/lib/dialects/postgres/query-generator.js b/lib/dialects/postgres/query-generator.js index 4c7825eb21..efdea4a34e 100644 --- a/lib/dialects/postgres/query-generator.js +++ b/lib/dialects/postgres/query-generator.js @@ -422,8 +422,8 @@ var QueryGenerator = { addLimitAndOffset: function(options) { var fragment = ''; - if (options.limit) fragment += ' LIMIT ' + options.limit; - if (options.offset) fragment += ' OFFSET ' + options.offset; + if (options.limit) fragment += ' LIMIT ' + this.escape(options.limit); + if (options.offset) fragment += ' OFFSET ' + this.escape(options.offset); return fragment; }, diff --git a/lib/dialects/sqlite/query-generator.js b/lib/dialects/sqlite/query-generator.js index a984e4b7b4..5875436284 100644 --- a/lib/dialects/sqlite/query-generator.js +++ b/lib/dialects/sqlite/query-generator.js @@ -89,21 +89,6 @@ var QueryGenerator = { return !!value ? 1 : 0; }, - addLimitAndOffset: function(options){ - var fragment = ''; - if (options.offset && !options.limit) { - fragment += ' LIMIT ' + options.offset + ', ' + 10000000000000; - } else if (options.limit) { - if (options.offset) { - fragment += ' LIMIT ' + options.offset + ', ' + options.limit; - } else { - fragment += ' LIMIT ' + options.limit; - } - } - - return fragment; - }, - addColumnQuery: function(table, key, dataType) { var query = 'ALTER TABLE <%= table %> ADD <%= attribute %>;' , attributes = {}; diff --git a/test/unit/sql/offset-limit.test.js b/test/unit/sql/offset-limit.test.js new file mode 100644 index 0000000000..45f644bcdc --- /dev/null +++ b/test/unit/sql/offset-limit.test.js @@ -0,0 +1,76 @@ +'use strict'; + +/* jshint -W110 */ +var Support = require(__dirname + '/../support') + , DataTypes = require(__dirname + '/../../../lib/data-types') + , Model = require(__dirname + '/../../../lib/model') + , util = require('util') + , expectsql = Support.expectsql + , current = Support.sequelize + , sql = current.dialect.QueryGenerator; + +// Notice: [] will be replaced by dialect specific tick/quote character when there is not dialect specific expectation but only a default expectation + +suite(Support.getTestDialectTeaser('SQL'), function() { + suite('offset/limit', function () { + var testsql = function (options, expectation) { + var model = options.model; + + test(util.inspect(options, {depth: 2}), function () { + return expectsql( + sql.addLimitAndOffset( + options, + model + ), + expectation + ); + }); + }; + + testsql({ + limit: 10, + order: [ + ['email', 'DESC'] // for MSSQL + ] + }, { + default: ' LIMIT 10', + mssql: ' OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY' + }); + + testsql({ + limit: 10, + offset: 20, + order: [ + ['email', 'DESC'] // for MSSQL + ] + }, { + default: ' LIMIT 20, 10', + postgres: ' LIMIT 10 OFFSET 20', + mssql: ' OFFSET 20 ROWS FETCH NEXT 10 ROWS ONLY' + }); + + testsql({ + limit: ""';DELETE FROM user"", + order: [ + ['email', 'DESC'] // for MSSQL + ] + }, { + default: "" LIMIT ''';DELETE FROM user'"", + mysql: "" LIMIT '\\';DELETE FROM user'"", + mssql: "" OFFSET 0 ROWS FETCH NEXT N''';DELETE FROM user' ROWS ONLY"" + }); + + testsql({ + limit: 10, + offset: ""';DELETE FROM user"", + order: [ + ['email', 'DESC'] // for MSSQL + ] + }, { + sqlite: "" LIMIT ''';DELETE FROM user', 10"", + postgres: "" LIMIT 10 OFFSET ''';DELETE FROM user'"", + mysql: "" LIMIT '\\';DELETE FROM user', 10"", + mssql: "" OFFSET N''';DELETE FROM user' ROWS FETCH NEXT 10 ROWS ONLY"" + }); + }); +}); diff --git a/test/unit/sql/select.test.js b/test/unit/sql/select.test.js index 30601491d0..1584bd0298 100644 --- a/test/unit/sql/select.test.js +++ b/test/unit/sql/select.test.js @@ -36,9 +36,14 @@ suite(Support.getTestDialectTeaser('SQL'), function() { ], where: { email: 'jon.snow@gmail.com' - } + }, + order: [ + ['email', 'DESC'] + ], + limit: 10 }, { - default: ""SELECT [email], [first_name] AS [firstName] FROM [User] WHERE [User].[email] = 'jon.snow@gmail.com';"" + default: ""SELECT [email], [first_name] AS [firstName] FROM [User] WHERE [User].[email] = 'jon.snow@gmail.com' ORDER BY [email] DESC LIMIT 10;"", + mssql: ""SELECT [email], [first_name] AS [firstName] FROM [User] WHERE [User].[email] = N'jon.snow@gmail.com' ORDER BY [email] DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY;"" }); testsql({ ",1 fa6882be0476228800a4c32df9da489ea4f61eb9,https://github.com/cyu/rack-cors/commit/fa6882be0476228800a4c32df9da489ea4f61eb9,"Drop Ruby 2.2, add 2.7 Former-commit-id: 6292938f2ec7f75ee0d0d9ff783ac7d229b8ef08","diff --git a/.travis.yml b/.travis.yml index b1f1685..c1ee8e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,11 @@ language: ruby sudo: false rvm: - - 2.2 - 2.3 - 2.4 - 2.5 - 2.6 + - 2.7 before_install: - git clone https://github.com/TravisToolbox/rubocop-travis.git ",0 953ccb1608acbad1f0883498e469ba41fbda028e,https://github.com/x-stream/xstream/commit/953ccb1608acbad1f0883498e469ba41fbda028e,Use openjdk10 instead of oraclejdk10.,"diff --git a/.travis.yml b/.travis.yml index df3ab0ff..e9f6f41d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: java sudo: false jdk: - openjdk11 - - oraclejdk10 + - openjdk10 - oraclejdk9 - oraclejdk8 - openjdk7 ",0 8763c956223cb076b5ab6aab40e7842b11d44b9b,https://github.com/spring-projects/spring-integration/commit/8763c956223cb076b5ab6aab40e7842b11d44b9b,"GH-3469 New Sonar smell & volatile busyWaitMillis Fixes https://github.com/spring-projects/spring-integration/issues/3469 * Fix new Sonar smells * Mark `LockRegistryLeaderInitiator.busyWaitMillis` as `volatile` so runtime changes (e.g. `RedisLockRegistryLeaderInitiatorTests`) will make an immediate effect","diff --git a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/AmqpBaseInboundGatewaySpec.java b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/AmqpBaseInboundGatewaySpec.java index 4edfee473bf..25b1c2b1117 100644 --- a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/AmqpBaseInboundGatewaySpec.java +++ b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/dsl/AmqpBaseInboundGatewaySpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2020 the original author or authors. + * Copyright 2014-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the ""License""); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ import org.springframework.amqp.rabbit.batch.BatchingStrategy; import org.springframework.amqp.rabbit.retry.MessageRecoverer; import org.springframework.amqp.support.converter.MessageConverter; -import org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter; import org.springframework.integration.amqp.inbound.AmqpInboundGateway; import org.springframework.integration.amqp.support.AmqpHeaderMapper; import org.springframework.integration.amqp.support.DefaultAmqpHeaderMapper; @@ -183,7 +182,7 @@ public S replyHeadersMappedLast(boolean replyHeadersMappedLast) { * @param messageRecoverer the callback. * @return the spec. * @since 5.5 - * @see AmqpInboundChannelAdapter#setMessageRecoverer(MessageRecoverer) + * @see org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter#setMessageRecoverer(MessageRecoverer) */ public S messageRecoverer(MessageRecoverer messageRecoverer) { this.target.setMessageRecoverer(messageRecoverer); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/DelayHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/DelayHandler.java index 0a5273a8231..8c0006a0bd4 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/DelayHandler.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/DelayHandler.java @@ -565,7 +565,7 @@ public synchronized void reschedulePersistedMessages() { MessageGroup messageGroup = this.messageStore.getMessageGroup(this.messageGroupId); try (Stream> messageStream = messageGroup.streamMessages()) { TaskScheduler taskScheduler = getTaskScheduler(); - messageStream.forEach((message) -> + messageStream.forEach((message) -> // NOSONAR taskScheduler.schedule(() -> { // This is fine to keep the reference to the message, // because the scheduled task is performed immediately. diff --git a/spring-integration-core/src/main/java/org/springframework/integration/json/JsonNodeWrapperToJsonNodeConverter.java b/spring-integration-core/src/main/java/org/springframework/integration/json/JsonNodeWrapperToJsonNodeConverter.java index 75daf74c4f4..07ec5456927 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/json/JsonNodeWrapperToJsonNodeConverter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/json/JsonNodeWrapperToJsonNodeConverter.java @@ -20,15 +20,16 @@ import java.util.Set; import org.springframework.core.convert.TypeDescriptor; -import org.springframework.core.convert.converter.Converter; import org.springframework.core.convert.converter.GenericConverter; import org.springframework.integration.json.JsonPropertyAccessor.JsonNodeWrapper; +import org.springframework.lang.Nullable; import com.fasterxml.jackson.databind.JsonNode; /** - * The {@link Converter} implementation for the conversion of {@link JsonPropertyAccessor.JsonNodeWrapper} to - * {@link JsonNode}, when the {@link JsonPropertyAccessor.JsonNodeWrapper} can be a result of the expression + * The {@link org.springframework.core.convert.converter.Converter} implementation for the conversion + * of {@link JsonPropertyAccessor.JsonNodeWrapper} to {@link JsonNode}, + * when the {@link JsonPropertyAccessor.JsonNodeWrapper} can be a result of the expression * for JSON in case of the {@link JsonPropertyAccessor} usage. * * @author Pierre Lakreb @@ -44,8 +45,12 @@ } @Override - public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { - return targetType.getObjectType().cast(((JsonNodeWrapper) source).getRealNode()); + @Nullable + public Object convert(@Nullable Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { + if (source != null) { + return targetType.getObjectType().cast(((JsonNodeWrapper) source).getRealNode()); + } + return null; } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/json/JsonPropertyAccessor.java b/spring-integration-core/src/main/java/org/springframework/integration/json/JsonPropertyAccessor.java index 3064ddd4f54..a8ff685da5a 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/json/JsonPropertyAccessor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/json/JsonPropertyAccessor.java @@ -161,7 +161,7 @@ else if (json.isBinary()) { } catch (IOException e) { throw new AccessException( - ""Can not get content of binary value : "" + json); + ""Can not get content of binary value: "" + json, e); } } throw new IllegalArgumentException(""Json is not ValueNode.""); @@ -210,7 +210,7 @@ public String toString() { @Override public int compareTo(ComparableJsonNode o) { - return this.delegate.equals(o.delegate) ? 0 : 1; + return this.delegate.equals(o.delegate) ? 0 : 1; // NOSONAR } } @@ -239,15 +239,13 @@ public String toString() { @Override public Object get(int index) { - if (index < 0) { - // negative index can be handled with that conversion - index = this.delegate.size() + index; - } + // negative index - get from the end of list + int i = index < 0 ? this.delegate.size() + index : index; try { - return wrap(this.delegate.get(index)); + return wrap(this.delegate.get(i)); } - catch (AccessException e) { - throw new IllegalArgumentException(e); + catch (AccessException ex) { + throw new IllegalArgumentException(ex); } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/store/MessageGroupQueue.java b/spring-integration-core/src/main/java/org/springframework/integration/store/MessageGroupQueue.java index 9b1a4e54999..4205b427002 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/store/MessageGroupQueue.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/store/MessageGroupQueue.java @@ -169,7 +169,7 @@ public int size() { try { this.storeLock.lockInterruptibly(); try (Stream> messageStream = stream()) { - return messageStream.findFirst().orElse(null); + return messageStream.findFirst().orElse(null); // NOSONAR } finally { this.storeLock.unlock(); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/leader/LockRegistryLeaderInitiator.java b/spring-integration-core/src/main/java/org/springframework/integration/support/leader/LockRegistryLeaderInitiator.java index ef98dd73b13..1b590601025 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/leader/LockRegistryLeaderInitiator.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/leader/LockRegistryLeaderInitiator.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 the original author or authors. + * Copyright 2016-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the ""License""); * you may not use this file except in compliance with the License. @@ -121,17 +121,6 @@ public String getRole() { */ private long heartBeatMillis = DEFAULT_HEART_BEAT_TIME; - /** - * Time in milliseconds to wait in between attempts to acquire the lock, if it is not - * held. The longer this is, the longer the system can be leaderless, if the leader - * dies. If a leader dies without releasing its lock, the system might still have to - * wait for the old lock to expire, but after that it should not have to wait longer - * than the busy wait time to get a new leader. If the remote lock does not expire, or - * if you know it interrupts the current thread when it expires or is broken, then you - * can reduce the busy wait to zero. - */ - private long busyWaitMillis = DEFAULT_BUSY_WAIT_TIME; - private boolean publishFailedEvents = false; private LeaderSelector leaderSelector; @@ -153,6 +142,17 @@ public String getRole() { */ private int phase = Integer.MAX_VALUE - 1000; + /** + * Time in milliseconds to wait in between attempts to acquire the lock, if it is not + * held. The longer this is, the longer the system can be leaderless, if the leader + * dies. If a leader dies without releasing its lock, the system might still have to + * wait for the old lock to expire, but after that it should not have to wait longer + * than the busy wait time to get a new leader. If the remote lock does not expire, or + * if you know it interrupts the current thread when it expires or is broken, then you + * can reduce the busy wait to zero. + */ + private volatile long busyWaitMillis = DEFAULT_BUSY_WAIT_TIME; + /** * Flag that indicates whether the leadership election for this {@link #candidate} is * running. diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/FileWritingMessageHandler.java b/spring-integration-file/src/main/java/org/springframework/integration/file/FileWritingMessageHandler.java index 712f6e8c097..841893cdbc9 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/FileWritingMessageHandler.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/FileWritingMessageHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the ""License""); * you may not use this file except in compliance with the License. @@ -660,7 +660,7 @@ protected void whileLocked() throws IOException { byte[] buffer = new byte[StreamUtils.BUFFER_SIZE]; int bytesRead; - while ((bytesRead = inputStream.read(buffer)) != -1) { + while ((bytesRead = inputStream.read(buffer)) != -1) { // NOSONAR outputStream.write(buffer, 0, bytesRead); } if (this.appendNewLine) { @@ -680,7 +680,7 @@ private void appendStreamToFile(File fileToWriteTo, InputStream sourceFileInputS bos = state != null ? state.stream : createOutputStream(fileToWriteTo, true); byte[] buffer = new byte[StreamUtils.BUFFER_SIZE]; int bytesRead = -1; - while ((bytesRead = inputStream.read(buffer)) != -1) { + while ((bytesRead = inputStream.read(buffer)) != -1) { // NOSONAR bos.write(buffer, 0, bytesRead); } if (FileWritingMessageHandler.this.appendNewLine) { diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/RecursiveDirectoryScanner.java b/spring-integration-file/src/main/java/org/springframework/integration/file/RecursiveDirectoryScanner.java index b3754c88372..9fcefcc8c88 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/RecursiveDirectoryScanner.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/RecursiveDirectoryScanner.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 the original author or authors. + * Copyright 2017-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the ""License""); * you may not use this file except in compliance with the License. @@ -73,10 +73,9 @@ public void setFileVisitOptions(FileVisitOption... fileVisitOptions) { try (Stream pathStream = Files.walk(directory.toPath(), this.maxDepth, this.fileVisitOptions);) { Stream fileStream = pathStream - .skip(1) + .skip(1) // NOSONAR .map(Path::toFile) - .filter(file -> !supportAcceptFilter - || ((AbstractFileListFilter) filter).accept(file)); + .filter(file -> !supportAcceptFilter || filter.accept(file)); if (supportAcceptFilter) { return fileStream.collect(Collectors.toList()); diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java index 6af89e7e529..5ca454ec3bf 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the ""License""); * you may not use this file except in compliance with the License. @@ -55,6 +55,7 @@ import org.springframework.integration.handler.ExpressionEvaluatingMessageProcessor; import org.springframework.integration.support.MutableMessage; import org.springframework.integration.support.PartialSuccessException; +import org.springframework.integration.support.utils.IntegrationUtils; import org.springframework.lang.Nullable; import org.springframework.messaging.Message; import org.springframework.messaging.MessageHandlingException; @@ -586,38 +587,36 @@ protected Object handleRequestMessage(final Message requestMessage) { } private Object doLs(Message requestMessage) { - String dir = this.fileNameProcessor != null - ? this.fileNameProcessor.processMessage(requestMessage) - : null; - if (dir != null && !dir.endsWith(this.remoteFileTemplate.getRemoteFileSeparator())) { - dir += this.remoteFileTemplate.getRemoteFileSeparator(); - } - final String fullDir = dir; + String dir = obtainRemoteDir(requestMessage); return this.remoteFileTemplate.execute(session -> { - List payload = ls(requestMessage, session, fullDir); + List payload = ls(requestMessage, session, dir); return getMessageBuilderFactory() .withPayload(payload) - .setHeader(FileHeaders.REMOTE_DIRECTORY, fullDir) + .setHeader(FileHeaders.REMOTE_DIRECTORY, dir) .setHeader(FileHeaders.REMOTE_HOST_PORT, session.getHostPort()); }); } private Object doNlst(Message requestMessage) { + String dir = obtainRemoteDir(requestMessage); + return this.remoteFileTemplate.execute(session -> { + List payload = nlst(requestMessage, session, dir); + return getMessageBuilderFactory() + .withPayload(payload) + .setHeader(FileHeaders.REMOTE_DIRECTORY, dir) + .setHeader(FileHeaders.REMOTE_HOST_PORT, session.getHostPort()); + }); + } + + private String obtainRemoteDir(Message requestMessage) { String dir = this.fileNameProcessor != null ? this.fileNameProcessor.processMessage(requestMessage) : null; if (dir != null && !dir.endsWith(this.remoteFileTemplate.getRemoteFileSeparator())) { dir += this.remoteFileTemplate.getRemoteFileSeparator(); } - final String fullDir = dir; - return this.remoteFileTemplate.execute(session -> { - List payload = nlst(requestMessage, session, fullDir); - return getMessageBuilderFactory() - .withPayload(payload) - .setHeader(FileHeaders.REMOTE_DIRECTORY, fullDir) - .setHeader(FileHeaders.REMOTE_HOST_PORT, session.getHostPort()); - }); + return dir; } /** @@ -963,7 +962,7 @@ private String buildRemotePath(String parent, String child) { remotePath = (parent + child); } else if (StringUtils.hasText(child)) { - remotePath = ""."" + this.remoteFileTemplate.getRemoteFileSeparator() + child; + remotePath = '.' + this.remoteFileTemplate.getRemoteFileSeparator() + child; } return remotePath; } @@ -1055,7 +1054,7 @@ protected File get(Message message, Session session, String remoteDir, // try { session.read(remoteFilePath, outputStream); } - catch (Exception e) { + catch (Exception ex) { /* Some operation systems acquire exclusive file-lock during file processing and the file can't be deleted without closing streams before. */ @@ -1064,12 +1063,8 @@ protected File get(Message message, Session session, String remoteDir, // this.logger.warn(() -> ""Failed to delete tempFile "" + tempFile); } - if (e instanceof RuntimeException) { - throw (RuntimeException) e; - } - else { - throw new MessagingException(""Failure occurred while copying from remote to local directory"", e); - } + throw IntegrationUtils.wrapInHandlingExceptionIfNecessary(message, + () -> ""Failure occurred while copying from remote to local directory"", ex); } finally { try { diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/transformer/AbstractFilePayloadTransformer.java b/spring-integration-file/src/main/java/org/springframework/integration/file/transformer/AbstractFilePayloadTransformer.java index c98f616431f..bd27cda6b74 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/transformer/AbstractFilePayloadTransformer.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/transformer/AbstractFilePayloadTransformer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the ""License""); * you may not use this file except in compliance with the License. @@ -54,8 +54,7 @@ /** * Specify whether to delete the File after transformation. - * Default is false. - * + * Default is {@code false}. * @param deleteFiles true to delete the file. */ public void setDeleteFiles(boolean deleteFiles) { @@ -85,27 +84,26 @@ protected MessageBuilderFactory getMessageBuilderFactory() { Assert.notNull(payload, ""Message payload must not be null""); Assert.isInstanceOf(File.class, payload, ""Message payload must be of type [java.io.File]""); File file = (File) payload; - T result = this.transformFile(file); - Message transformedMessage = getMessageBuilderFactory().withPayload(result) - .copyHeaders(message.getHeaders()) - .setHeaderIfAbsent(FileHeaders.ORIGINAL_FILE, file) - .setHeaderIfAbsent(FileHeaders.FILENAME, file.getName()) - .build(); - if (this.deleteFiles) { - if (!file.delete() && this.logger.isWarnEnabled()) { - this.logger.warn(""failed to delete File '"" + file + ""'""); - } + T result = transformFile(file); + Message transformedMessage = + getMessageBuilderFactory() + .withPayload(result) + .copyHeaders(message.getHeaders()) + .setHeaderIfAbsent(FileHeaders.ORIGINAL_FILE, file) + .setHeaderIfAbsent(FileHeaders.FILENAME, file.getName()) + .build(); + if (this.deleteFiles && !file.delete() && this.logger.isWarnEnabled()) { + this.logger.warn(""failed to delete File '"" + file + ""'""); } return transformedMessage; } - catch (Exception e) { - throw new MessagingException(message, ""failed to transform File Message"", e); + catch (Exception ex) { + throw new MessagingException(message, ""failed to transform File Message"", ex); } } /** * Subclasses must implement this method to transform the File contents. - * * @param file The file. * @return The result of the transformation. * @throws IOException Any IOException. diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/gateway/FtpOutboundGateway.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/gateway/FtpOutboundGateway.java index 9ea83051835..18d55ef6f53 100644 --- a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/gateway/FtpOutboundGateway.java +++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/gateway/FtpOutboundGateway.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the ""License""); * you may not use this file except in compliance with the License. @@ -284,17 +284,8 @@ protected String put(Message message, Session session, String subDir } return task.call(); } - catch (Exception e) { - if (e instanceof IOException) { - throw (IOException) e; - - } - else if (e instanceof RuntimeException) { - throw (RuntimeException) e; - } - else { - throw new IOException(""Uncategorised IO exception"", e); - } + catch (Exception ex) { + throw rethrowAsIoExceptionIfAny(ex); } finally { if (restoreWorkingDirectory) { @@ -303,6 +294,19 @@ else if (e instanceof RuntimeException) { } } + private IOException rethrowAsIoExceptionIfAny(Exception ex) { + if (ex instanceof IOException) { + return (IOException) ex; + + } + else if (ex instanceof RuntimeException) { + throw (RuntimeException) ex; + } + else { + return new IOException(""Uncategorized IO exception"", ex); + } + } + @Override public boolean isChmodCapable() { return true; @@ -316,7 +320,7 @@ protected void doChmod(RemoteFileOperations remoteFileOperations, final client.sendSiteCommand(chModCommand); } catch (IOException e) { - throw new UncheckedIOException(""Failed to execute '"" + chModCommand + ""'"", e); + throw new UncheckedIOException(""Failed to execute '"" + chModCommand + ""'"", e); } }); } diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNioConnection.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNioConnection.java index 63b9bf96250..d00204b3298 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNioConnection.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNioConnection.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the ""License""); * you may not use this file except in compliance with the License. @@ -153,7 +153,7 @@ public void send(Message message) { if (this.bufferedOutputStream == null) { int writeBufferSize = this.socketChannel.socket().getSendBufferSize(); this.bufferedOutputStream = new BufferedOutputStream(getChannelOutputStream(), - writeBufferSize > 0 ? writeBufferSize : 8192); + writeBufferSize > 0 ? writeBufferSize : 8192); // NOSONAR } Object object = getMapper().fromMessage(message); Assert.state(object != null, ""Mapper mapped the message to 'null'.""); @@ -393,19 +393,17 @@ private void sendToChannel(Message message) { } listener.onMessage(message); } - catch (Exception e) { - if (e instanceof NoListenerException) { // could also be thrown by an interceptor - if (logger.isWarnEnabled()) { - logger.warn(""Unexpected message - no endpoint registered with connection: "" - + getConnectionId() - + "" - "" - + message); - } - } - else { - logger.error(""Exception sending message: "" + message, e); + catch (NoListenerException ex) { // could also be thrown by an interceptor + if (logger.isWarnEnabled()) { + logger.warn(""Unexpected message - no endpoint registered with connection: "" + + getConnectionId() + + "" - "" + + message); } } + catch (Exception ex) { + logger.error(""Exception sending message: "" + message, ex); + } } private void doRead() throws IOException { @@ -424,7 +422,7 @@ private void doRead() throws IOException { checkForAssembler(); if (logger.isTraceEnabled()) { - logger.trace(""Before read: "" + this.rawBuffer.position() + ""/"" + this.rawBuffer.limit()); + logger.trace(""Before read: "" + this.rawBuffer.position() + '/' + this.rawBuffer.limit()); } int len = this.socketChannel.read(this.rawBuffer); if (len < 0) { @@ -432,11 +430,11 @@ private void doRead() throws IOException { closeConnection(true); } if (logger.isTraceEnabled()) { - logger.trace(""After read: "" + this.rawBuffer.position() + ""/"" + this.rawBuffer.limit()); + logger.trace(""After read: "" + this.rawBuffer.position() + '/' + this.rawBuffer.limit()); } this.rawBuffer.flip(); if (logger.isTraceEnabled()) { - logger.trace(""After flip: "" + this.rawBuffer.position() + ""/"" + this.rawBuffer.limit()); + logger.trace(""After flip: "" + this.rawBuffer.position() + '/' + this.rawBuffer.limit()); } if (logger.isDebugEnabled()) { logger.debug(""Read "" + this.rawBuffer.limit() + "" into raw buffer""); @@ -475,10 +473,8 @@ private void checkForAssembler() { } catch (RejectedExecutionException e) { this.executionControl.decrementAndGet(); - if (logger.isInfoEnabled()) { - logger.info(""Insufficient threads in the assembler fixed thread pool; consider increasing "" + + logger.info(""Insufficient threads in the assembler fixed thread pool; consider increasing "" + ""this task executor pool size""); - } throw e; } } diff --git a/spring-integration-redis/src/main/java/org/springframework/integration/redis/inbound/ReactiveRedisStreamMessageProducer.java b/spring-integration-redis/src/main/java/org/springframework/integration/redis/inbound/ReactiveRedisStreamMessageProducer.java index a45968e10b2..3d925a4ec03 100644 --- a/spring-integration-redis/src/main/java/org/springframework/integration/redis/inbound/ReactiveRedisStreamMessageProducer.java +++ b/spring-integration-redis/src/main/java/org/springframework/integration/redis/inbound/ReactiveRedisStreamMessageProducer.java @@ -39,7 +39,6 @@ import org.springframework.integration.support.AbstractIntegrationMessageBuilder; import org.springframework.lang.Nullable; import org.springframework.messaging.Message; -import org.springframework.messaging.MessageChannel; import org.springframework.messaging.MessagingException; import org.springframework.messaging.converter.MessageConversionException; import org.springframework.util.Assert; @@ -209,7 +208,7 @@ public void setBatchSize(int recordsPerPoll) { * Configure a resume Function to resume the main sequence when polling the stream fails. * Mutually exclusive with {@link #setStreamReceiverOptions(StreamReceiver.StreamReceiverOptions)}. * By default this function extract the failed {@link Record} and sends an - * {@link org.springframework.messaging.support.ErrorMessage} to the provided {@link #setErrorChannel(MessageChannel)}. + * {@link org.springframework.messaging.support.ErrorMessage} to the provided {@link #setErrorChannel}. * The failed message for this record may have a {@link IntegrationMessageHeaderAccessor#ACKNOWLEDGMENT_CALLBACK} * header when manual acknowledgment is configured for this message producer. * @param resumeFunction must not be null. diff --git a/spring-integration-redis/src/test/java/org/springframework/integration/redis/leader/RedisLockRegistryLeaderInitiatorTests.java b/spring-integration-redis/src/test/java/org/springframework/integration/redis/leader/RedisLockRegistryLeaderInitiatorTests.java index 717ca886ba7..e82127ec9c3 100644 --- a/spring-integration-redis/src/test/java/org/springframework/integration/redis/leader/RedisLockRegistryLeaderInitiatorTests.java +++ b/spring-integration-redis/src/test/java/org/springframework/integration/redis/leader/RedisLockRegistryLeaderInitiatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2020 the original author or authors. + * Copyright 2016-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the ""License""); * you may not use this file except in compliance with the License. @@ -24,7 +24,6 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; @@ -54,7 +53,6 @@ @Test @RedisAvailable - @Ignore(""Intermittent failures"") public void testDistributedLeaderElection() throws Exception { RedisLockRegistry registry = new RedisLockRegistry(getConnectionFactoryForTest(), ""LeaderInitiator""); registry.expireUnusedOlderThan(-1); diff --git a/spring-integration-test-support/src/main/java/org/springframework/integration/test/util/TestUtils.java b/spring-integration-test-support/src/main/java/org/springframework/integration/test/util/TestUtils.java index 851a1ba6116..58e43a9e524 100644 --- a/spring-integration-test-support/src/main/java/org/springframework/integration/test/util/TestUtils.java +++ b/spring-integration-test-support/src/main/java/org/springframework/integration/test/util/TestUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the ""License""); * you may not use this file except in compliance with the License. @@ -119,7 +119,7 @@ else if (i == tokens.length - 1) { public static TestApplicationContext createTestApplicationContext() { TestApplicationContext context = new TestApplicationContext(); ErrorHandler errorHandler = new MessagePublishingErrorHandler(context); - ThreadPoolTaskScheduler scheduler = createTaskScheduler(10); + ThreadPoolTaskScheduler scheduler = createTaskScheduler(10); // NOSONAR scheduler.setErrorHandler(errorHandler); registerBean(""taskScheduler"", scheduler, context); registerBean(""integrationConversionService"", new DefaultFormattingConversionService(), context); @@ -255,15 +255,13 @@ public void handleError(Throwable throwable) { boolean sent = false; if (errorChannel != null) { try { - sent = errorChannel.send(new ErrorMessage(throwable), 10000); + sent = errorChannel.send(new ErrorMessage(throwable), 10000); // NOSONAR } catch (Throwable errorDeliveryError) { //NOSONAR // message will be logged only - if (logger.isWarnEnabled()) { - logger.warn(""Error message was not delivered."", errorDeliveryError); - } - if (errorDeliveryError instanceof Error) { - throw ((Error) errorDeliveryError); // NOSONAR + logger.warn(""Error message was not delivered."", errorDeliveryError); + if (errorDeliveryError instanceof Error) { // NOSONAR + throw ((Error) errorDeliveryError); } } } diff --git a/spring-integration-ws/src/main/java/org/springframework/integration/ws/AbstractWebServiceInboundGateway.java b/spring-integration-ws/src/main/java/org/springframework/integration/ws/AbstractWebServiceInboundGateway.java index b042e1782b6..64fbef299ed 100644 --- a/spring-integration-ws/src/main/java/org/springframework/integration/ws/AbstractWebServiceInboundGateway.java +++ b/spring-integration-ws/src/main/java/org/springframework/integration/ws/AbstractWebServiceInboundGateway.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the ""License""); * you may not use this file except in compliance with the License. @@ -72,7 +72,7 @@ public void invoke(MessageContext messageContext) throws Exception { // NOSONAR this.doInvoke(messageContext); } catch (Exception e) { - while ((e instanceof MessagingException || e instanceof ExpressionException) && + while ((e instanceof MessagingException || e instanceof ExpressionException) && // NOSONAR e.getCause() instanceof Exception) { e = (Exception) e.getCause(); } diff --git a/spring-integration-zeromq/src/main/java/org/springframework/integration/zeromq/ZeroMqProxy.java b/spring-integration-zeromq/src/main/java/org/springframework/integration/zeromq/ZeroMqProxy.java index 727c8f96509..f38f48eeb5c 100644 --- a/spring-integration-zeromq/src/main/java/org/springframework/integration/zeromq/ZeroMqProxy.java +++ b/spring-integration-zeromq/src/main/java/org/springframework/integration/zeromq/ZeroMqProxy.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the ""License""); * you may not use this file except in compliance with the License. @@ -273,9 +273,9 @@ public synchronized void start() { this.backendSocketConfigurer.accept(backendSocket); } - this.frontendPort.set(bindSocket(frontendSocket, this.frontendPort.get())); - this.backendPort.set(bindSocket(backendSocket, this.backendPort.get())); - boolean bound = controlSocket.bind(this.controlAddress); + this.frontendPort.set(bindSocket(frontendSocket, this.frontendPort.get())); // NOSONAR + this.backendPort.set(bindSocket(backendSocket, this.backendPort.get())); // NOSONAR + boolean bound = controlSocket.bind(this.controlAddress); // NOSONAR if (!bound) { throw new IllegalArgumentException(""Cannot bind ZeroMQ socket to address: "" + this.controlAddress); @@ -306,7 +306,7 @@ public synchronized void start() { public synchronized void stop() { if (this.running.getAndSet(false)) { try (ZMQ.Socket commandSocket = this.context.createSocket(SocketType.PAIR)) { - commandSocket.connect(this.controlAddress); + commandSocket.connect(this.controlAddress); // NOSONAR commandSocket.send(zmq.ZMQ.PROXY_TERMINATE); } } ",0 23edf22e1874f5b5e115524bf7ef81f4536f4d64,https://github.com/evanphx/json-patch/commit/23edf22e1874f5b5e115524bf7ef81f4536f4d64,Switch to passing ApplyOptions to low-level private methods; Update README,"diff --git a/README.md b/README.md index 121b039..0136169 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,22 @@ go get -u github.com/evanphx/json-patch/v5 which limits the total size increase in bytes caused by ""copy"" operations in a patch. It defaults to 0, which means there is no limit. +These global variables control the behavior of `jsonpatch.Apply`. + +An alternative to `jsonpatch.Apply` is `jsonpatch.ApplyWithOptions` whose behavior +is controlled by an `options` parameter of type `*jsonpatch.ApplyOptions`. + +Structure `jsonpatch.ApplyOptions` includes the configuration options above +and adds a new option: `AllowMissingPathOnRemove`. + +When `AllowMissingPathOnRemove` is set to `true`, `jsonpatch.ApplyWithOptions` will ignore +`remove` operations whose `path` points to a non-existent location in the JSON document. +`AllowMissingPathOnRemove` defaults to `false` which will lead to `jsonpatch.ApplyWithOptions` +returning an error when hitting a missing `path` on `remove`. + +Use `jsonpatch.NewApplyOptions` to create an instance of `jsonpatch.ApplyOptions` +whose values are populated from the global configuration variables. + ## Create and apply a merge patch Given both an original JSON document and a modified JSON document, you can create a [Merge Patch](https://tools.ietf.org/html/rfc7396) document. diff --git a/v5/patch.go b/v5/patch.go index 073141c..9933096 100644 --- a/v5/patch.go +++ b/v5/patch.go @@ -53,8 +53,8 @@ type partialArray []*lazyNode type container interface { get(key string) (*lazyNode, error) set(key string, val *lazyNode) error - add(key string, val *lazyNode, supportNegativeIndices bool) error - remove(key string, allowMissingPathOnRemove bool, supportNegativeIndices bool) error + add(key string, val *lazyNode, options *ApplyOptions) error + remove(key string, options *ApplyOptions) error } // ApplyOptions specifies options for calls to ApplyWithOptions. @@ -410,7 +410,7 @@ func (d *partialDoc) set(key string, val *lazyNode) error { return nil } -func (d *partialDoc) add(key string, val *lazyNode, supportNegativeIndices bool) error { +func (d *partialDoc) add(key string, val *lazyNode, options *ApplyOptions) error { (*d)[key] = val return nil } @@ -423,10 +423,10 @@ func (d *partialDoc) get(key string) (*lazyNode, error) { return v, nil } -func (d *partialDoc) remove(key string, allowMissingPathOnRemove bool, supportNegativeIndices bool) error { +func (d *partialDoc) remove(key string, options *ApplyOptions) error { _, ok := (*d)[key] if !ok { - if allowMissingPathOnRemove { + if options.AllowMissingPathOnRemove { return nil } return errors.Wrapf(ErrMissing, ""unable to remove nonexistent key: %s"", key) @@ -447,7 +447,7 @@ func (d *partialArray) set(key string, val *lazyNode) error { return nil } -func (d *partialArray) add(key string, val *lazyNode, supportNegativeIndices bool) error { +func (d *partialArray) add(key string, val *lazyNode, options *ApplyOptions) error { if key == ""-"" { *d = append(*d, val) return nil @@ -469,7 +469,7 @@ func (d *partialArray) add(key string, val *lazyNode, supportNegativeIndices boo } if idx < 0 { - if !supportNegativeIndices { + if !options.SupportNegativeIndices { return errors.Wrapf(ErrInvalidIndex, ""Unable to access invalid index: %d"", idx) } if idx < -len(ary) { @@ -500,7 +500,7 @@ func (d *partialArray) get(key string) (*lazyNode, error) { return (*d)[idx], nil } -func (d *partialArray) remove(key string, allowMissingPathOnRemove bool, supportNegativeIndices bool) error { +func (d *partialArray) remove(key string, options *ApplyOptions) error { idx, err := strconv.Atoi(key) if err != nil { return err @@ -509,18 +509,18 @@ func (d *partialArray) remove(key string, allowMissingPathOnRemove bool, support cur := *d if idx >= len(cur) { - if allowMissingPathOnRemove { + if options.AllowMissingPathOnRemove { return nil } return errors.Wrapf(ErrInvalidIndex, ""Unable to access invalid index: %d"", idx) } if idx < 0 { - if !supportNegativeIndices { + if !options.SupportNegativeIndices { return errors.Wrapf(ErrInvalidIndex, ""Unable to access invalid index: %d"", idx) } if idx < -len(cur) { - if allowMissingPathOnRemove { + if options.AllowMissingPathOnRemove { return nil } return errors.Wrapf(ErrInvalidIndex, ""Unable to access invalid index: %d"", idx) @@ -537,7 +537,7 @@ func (d *partialArray) remove(key string, allowMissingPathOnRemove bool, support return nil } -func (p Patch) add(doc *container, op Operation, supportNegativeIndices bool) error { +func (p Patch) add(doc *container, op Operation, options *ApplyOptions) error { path, err := op.Path() if err != nil { return errors.Wrapf(ErrMissing, ""add operation failed to decode path"") @@ -549,7 +549,7 @@ func (p Patch) add(doc *container, op Operation, supportNegativeIndices bool) er return errors.Wrapf(ErrMissing, ""add operation does not apply: doc is missing path: \""%s\"""", path) } - err = con.add(key, op.value(), supportNegativeIndices) + err = con.add(key, op.value(), options) if err != nil { return errors.Wrapf(err, ""error in add for path: '%s'"", path) } @@ -557,7 +557,7 @@ func (p Patch) add(doc *container, op Operation, supportNegativeIndices bool) er return nil } -func (p Patch) remove(doc *container, op Operation, allowMissingPathOnRemove bool, supportNegativeIndices bool) error { +func (p Patch) remove(doc *container, op Operation, options *ApplyOptions) error { path, err := op.Path() if err != nil { return errors.Wrapf(ErrMissing, ""remove operation failed to decode path"") @@ -566,13 +566,13 @@ func (p Patch) remove(doc *container, op Operation, allowMissingPathOnRemove boo con, key := findObject(doc, path) if con == nil { - if allowMissingPathOnRemove { + if options.AllowMissingPathOnRemove { return nil } return errors.Wrapf(ErrMissing, ""remove operation does not apply: doc is missing path: \""%s\"""", path) } - err = con.remove(key, allowMissingPathOnRemove, supportNegativeIndices) + err = con.remove(key, options) if err != nil { return errors.Wrapf(err, ""error in remove for path: '%s'"", path) } @@ -580,7 +580,7 @@ func (p Patch) remove(doc *container, op Operation, allowMissingPathOnRemove boo return nil } -func (p Patch) replace(doc *container, op Operation) error { +func (p Patch) replace(doc *container, op Operation, options *ApplyOptions) error { path, err := op.Path() if err != nil { return errors.Wrapf(err, ""replace operation failed to decode path"") @@ -605,7 +605,7 @@ func (p Patch) replace(doc *container, op Operation) error { return nil } -func (p Patch) move(doc *container, op Operation, allowMissingPathOnRemove bool, supportNegativeIndices bool) error { +func (p Patch) move(doc *container, op Operation, options *ApplyOptions) error { from, err := op.From() if err != nil { return errors.Wrapf(err, ""move operation failed to decode from"") @@ -622,7 +622,7 @@ func (p Patch) move(doc *container, op Operation, allowMissingPathOnRemove bool, return errors.Wrapf(err, ""error in move for path: '%s'"", key) } - err = con.remove(key, allowMissingPathOnRemove, supportNegativeIndices) + err = con.remove(key, options) if err != nil { return errors.Wrapf(err, ""error in move for path: '%s'"", key) } @@ -638,7 +638,7 @@ func (p Patch) move(doc *container, op Operation, allowMissingPathOnRemove bool, return errors.Wrapf(ErrMissing, ""move operation does not apply: doc is missing destination path: %s"", path) } - err = con.add(key, val, supportNegativeIndices) + err = con.add(key, val, options) if err != nil { return errors.Wrapf(err, ""error in move for path: '%s'"", path) } @@ -646,7 +646,7 @@ func (p Patch) move(doc *container, op Operation, allowMissingPathOnRemove bool, return nil } -func (p Patch) test(doc *container, op Operation) error { +func (p Patch) test(doc *container, op Operation, options *ApplyOptions) error { path, err := op.Path() if err != nil { return errors.Wrapf(err, ""test operation failed to decode path"") @@ -679,7 +679,7 @@ func (p Patch) test(doc *container, op Operation) error { return errors.Wrapf(ErrTestFailed, ""testing value %s failed"", path) } -func (p Patch) copy(doc *container, op Operation, accumulatedCopySize *int64, supportNegativeIndices bool, accumulatedCopySizeLimit int64) error { +func (p Patch) copy(doc *container, op Operation, accumulatedCopySize *int64, options *ApplyOptions) error { from, err := op.From() if err != nil { return errors.Wrapf(err, ""copy operation failed to decode from"") @@ -713,11 +713,11 @@ func (p Patch) copy(doc *container, op Operation, accumulatedCopySize *int64, su } (*accumulatedCopySize) += int64(sz) - if accumulatedCopySizeLimit > 0 && *accumulatedCopySize > accumulatedCopySizeLimit { - return NewAccumulatedCopySizeError(accumulatedCopySizeLimit, *accumulatedCopySize) + if options.AccumulatedCopySizeLimit > 0 && *accumulatedCopySize > options.AccumulatedCopySizeLimit { + return NewAccumulatedCopySizeError(options.AccumulatedCopySizeLimit, *accumulatedCopySize) } - err = con.add(key, valCopy, supportNegativeIndices) + err = con.add(key, valCopy, options) if err != nil { return errors.Wrapf(err, ""error while adding value during copy"") } @@ -792,17 +792,17 @@ func (p Patch) ApplyIndentWithOptions(doc []byte, indent string, options *ApplyO for _, op := range p { switch op.Kind() { case ""add"": - err = p.add(&pd, op, options.SupportNegativeIndices) + err = p.add(&pd, op, options) case ""remove"": - err = p.remove(&pd, op, options.AllowMissingPathOnRemove, options.SupportNegativeIndices) + err = p.remove(&pd, op, options) case ""replace"": - err = p.replace(&pd, op) + err = p.replace(&pd, op, options) case ""move"": - err = p.move(&pd, op, options.AllowMissingPathOnRemove, options.SupportNegativeIndices) + err = p.move(&pd, op, options) case ""test"": - err = p.test(&pd, op) + err = p.test(&pd, op, options) case ""copy"": - err = p.copy(&pd, op, &accumulatedCopySize, options.SupportNegativeIndices, options.AccumulatedCopySizeLimit) + err = p.copy(&pd, op, &accumulatedCopySize, options) default: err = fmt.Errorf(""Unexpected kind: %s"", op.Kind()) } diff --git a/v5/patch_test.go b/v5/patch_test.go index cac5e80..1851260 100644 --- a/v5/patch_test.go +++ b/v5/patch_test.go @@ -652,12 +652,16 @@ func TestAdd(t *testing.T) { err: ""Unable to access invalid index: -1: invalid index referenced"", }, } + + options := NewApplyOptions() + for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { key := tc.key arr := &tc.arr val := &tc.val - err := arr.add(key, val, !tc.rejectNegativeIndicies) + options.SupportNegativeIndices = !tc.rejectNegativeIndicies + err := arr.add(key, val, options) if err == nil && tc.err != """" { t.Errorf(""Expected error but got none! %v"", tc.err) } else if err != nil && tc.err == """" { ",0 5f9c372480619f84ccbe80293d38703e8a0fda74,https://github.com/avar/Plack/commit/5f9c372480619f84ccbe80293d38703e8a0fda74,"Path escaping regex supports RFC 3986 definition. * Updated the class of characters-to-not-escape passed to URI::Escape to support the proper definition as stipulated by RFC 3986 for URL Paths, namely:: safe = ""$"" | ""-"" | ""_"" | ""."" | ""+"" extra = ""!"" | ""*"" | ""'"" | ""("" | "")"" | "","" unreserved = alpha | digit | safe | extra escape = ""%"" hex hex uchar = unreserved | escape hpath = hsegment *[ ""/"" hsegment ] hsegment = *[ uchar | "";"" | "":"" | ""@"" | ""&"" | ""="" ] * Added unit test which verifies behavior by attempting to use path parameters.","diff --git a/lib/Plack/Request.pm b/lib/Plack/Request.pm index aabefeaa..080f0f17 100644 --- a/lib/Plack/Request.pm +++ b/lib/Plack/Request.pm @@ -185,8 +185,9 @@ sub uri { # This means when a request like /foo%2fbar comes in, we recognize # it as /foo/bar which is not ideal, but that's how the PSGI PATH_INFO # spec goes and we can't do anything about it. See PSGI::FAQ for details. - # http://github.com/plack/Plack/issues#issue/118 - my $path_escape_class = '^A-Za-z0-9\-\._~/'; + + # See RFC 3986 before modifying. + my $path_escape_class = q{^/;:@&=A-Za-z0-9$_.+!*'(),-}; my $path = URI::Escape::uri_escape($self->env->{PATH_INFO} || '', $path_escape_class); $path .= '?' . $self->env->{QUERY_STRING} diff --git a/t/Plack-Request/uri.t b/t/Plack-Request/uri.t index 3b37c486..4f9d61ef 100644 --- a/t/Plack-Request/uri.t +++ b/t/Plack-Request/uri.t @@ -37,6 +37,13 @@ my @tests = ( }, uri => 'http://example.com/test?dynamic=daikuma', parameters => { dynamic => 'daikuma' } }, + { add_env => { + HTTP_HOST => 'example.com', + SCRIPT_NAME => '/exec/' + }, + uri => 'http://example.com/exec/', + parameters => {} }, + { add_env => { HTTP_HOST => 'example.com', SCRIPT_NAME => '/exec/' @@ -85,7 +92,15 @@ my @tests = ( PATH_INFO => ""/baz quux"", }, uri => 'http://example.com/foo%20bar/baz%20quux', - parameters => {} } + parameters => {} }, + { add_env => { + HTTP_HOST => 'example.com', + SCRIPT_NAME => ""/path"", + PATH_INFO => ""/parameters;path=one,two"", + QUERY_STRING => ""query=foobar"", + }, + uri => 'http://example.com/path/parameters;path=one,two?query=foobar', + parameters => { query => ""foobar"" } }, ); plan tests => 2 * @tests; ",0 aad19cf4a803b67967d8cad683317cf9a68675bc,https://github.com/ClusterLabs/pcs/commit/aad19cf4a803b67967d8cad683317cf9a68675bc,"lib: test coverage for config_update(_local), get_corosync_conf_struct","diff --git a/pcs_test/tier0/lib/commands/cluster/test_config_update.py b/pcs_test/tier0/lib/commands/cluster/test_config_update.py new file mode 100644 index 000000000..7248c5d95 --- /dev/null +++ b/pcs_test/tier0/lib/commands/cluster/test_config_update.py @@ -0,0 +1,705 @@ +from textwrap import dedent +from unittest import TestCase + +from pcs_test.tools import fixture +from pcs_test.tools.command_env import get_env_tools + +from pcs.common.corosync_conf import ( + CorosyncConfDto, + CorosyncNodeAddressDto, + CorosyncNodeDto, + CorosyncQuorumDeviceSettingsDto, +) +from pcs.common.reports import codes as report_codes +from pcs.common.types import CorosyncTransportType +from pcs.lib.commands import cluster + +ALLOWED_COMPRESSION_OPTIONS = [""level"", ""model"", ""threshold""] + +ALLOWED_CRYPTO_OPTIONS = [""cipher"", ""hash"", ""model""] + +ALLOWED_TOTEM_OPTIONS = [ + ""consensus"", + ""downcheck"", + ""fail_recv_const"", + ""heartbeat_failures_allowed"", + ""hold"", + ""join"", + ""max_messages"", + ""max_network_delay"", + ""merge"", + ""miss_count_const"", + ""send_join"", + ""seqno_unchanged_const"", + ""token"", + ""token_coefficient"", + ""token_retransmit"", + ""token_retransmits_before_loss_const"", + ""window_size"", +] + +ALLOWED_KNET_TRANSPORT_OPTIONS = [ + ""ip_version"", + ""knet_pmtud_interval"", + ""link_mode"", +] + +TRANSPORT_OPTIONS = { + ""ip_version"": ""ipv4"", + ""knet_pmtud_interval"": ""1234"", + ""link_mode"": ""active"", +} + +COMPRESSION_OPTIONS = {""level"": ""5"", ""model"": ""zlib"", ""threshold"": ""1234""} + +CRYPTO_OPTIONS = {""cipher"": ""aes256"", ""hash"": ""sha256"", ""model"": ""nss""} + +TOTEM_OPTIONS = { + ""consensus"": ""0"", + ""downcheck"": ""1"", + ""fail_recv_const"": ""2"", + ""heartbeat_failures_allowed"": ""3"", + ""hold"": ""4"", + ""join"": ""5"", + ""max_messages"": ""6"", + ""max_network_delay"": ""7"", + ""merge"": ""8"", + ""miss_count_const"": ""9"", + ""send_join"": ""10"", + ""seqno_unchanged_const"": ""11"", + ""token"": ""12"", + ""token_coefficient"": ""13"", + ""token_retransmit"": ""14"", + ""token_retransmits_before_loss_const"": ""15"", + ""window_size"": ""16"", +} + +TOTEM_TEMPLATE = """"""\ +totem {{ + transport: {transport_type}\ +{totem_options}{transport_options}{compression_options}{crypto_options} +}} +"""""" + + +def fixture_totem( + transport_type=""knet"", + transport_options=None, + compression_options=None, + crypto_options=None, + totem_options=None, +): + def options_fixture(options, prefix=""""): + options = options or {} + template = ""\n {prefix}{option}: {value}"" + return """".join( + [ + template.format(prefix=prefix, option=o, value=v) + for o, v in sorted(options.items()) + ] + ) + + return TOTEM_TEMPLATE.format( + transport_type=transport_type, + transport_options=options_fixture(transport_options), + compression_options=options_fixture( + compression_options, prefix=""knet_compression_"" + ), + crypto_options=options_fixture(crypto_options, prefix=""crypto_""), + totem_options=options_fixture(totem_options), + ) + + +class CheckLiveMixin: + # pylint: disable=invalid-name + def setUp(self): + self.env_assist, self.config = get_env_tools(self) + + def get_lib_command(self): + raise NotImplementedError + + def assert_live_required(self, forbidden_options): + self.env_assist.assert_raise_library_error( + self.get_lib_command(), + [ + fixture.error( + report_codes.LIVE_ENVIRONMENT_REQUIRED, + forbidden_options=forbidden_options, + ) + ], + expected_in_processor=False, + ) + + def test_mock_corosync(self): + self.config.env.set_corosync_conf_data("""") + self.assert_live_required([""COROSYNC_CONF""]) + + def test_mock_cib(self): + self.config.env.set_cib_data("""") + self.assert_live_required([""CIB""]) + + def test_mock_cib_corosync(self): + self.config.env.set_corosync_conf_data("""") + self.config.env.set_cib_data("""") + self.assert_live_required([""CIB"", ""COROSYNC_CONF""]) + + +class CheckLiveUpdateConfig(CheckLiveMixin, TestCase): + def get_lib_command(self): + return lambda: cluster.config_update( + self.env_assist.get_env(), {}, {}, {}, {} + ) + + +class CheckLiveUpdateConfigLocal(CheckLiveMixin, TestCase): + def get_lib_command(self): + return lambda: cluster.config_update_local( + self.env_assist.get_env(), b"""", {}, {}, {}, {} + ) + + +class UpdateConfig(TestCase): + def setUp(self): + self.env_assist, self.config = get_env_tools(self) + + def test_no_changed_options(self): + self.config.corosync_conf.load_content(fixture_totem()) + self.config.env.push_corosync_conf(corosync_conf_text=fixture_totem()) + cluster.config_update(self.env_assist.get_env(), {}, {}, {}, {}) + self.env_assist.assert_reports([]) + + def test_add_all_options(self): + self.config.corosync_conf.load_content(fixture_totem()) + self.config.env.push_corosync_conf( + corosync_conf_text=fixture_totem( + transport_options=TRANSPORT_OPTIONS, + compression_options=COMPRESSION_OPTIONS, + crypto_options=CRYPTO_OPTIONS, + totem_options=TOTEM_OPTIONS, + ) + ) + cluster.config_update( + self.env_assist.get_env(), + TRANSPORT_OPTIONS, + COMPRESSION_OPTIONS, + CRYPTO_OPTIONS, + TOTEM_OPTIONS, + ) + self.env_assist.assert_reports([]) + + def test_modify_all_options(self): + self.config.corosync_conf.load_content( + fixture_totem( + transport_options=TRANSPORT_OPTIONS, + compression_options=COMPRESSION_OPTIONS, + crypto_options=CRYPTO_OPTIONS, + totem_options=TOTEM_OPTIONS, + ) + ) + modified_transport_options = { + ""ip_version"": ""ipv4-6"", + ""link_mode"": ""passive"", + ""knet_pmtud_interval"": ""1000"", + } + modified_compression_options = { + ""level"": ""9"", + ""model"": ""lz4"", + ""threshold"": ""100"", + } + modified_crypto_options = { + ""cipher"": ""aes128"", + ""hash"": ""sha512"", + ""model"": ""openssl"", + } + modified_totem_options = { + opt: val + ""0"" for opt, val in TOTEM_OPTIONS.items() + } + self.config.env.push_corosync_conf( + corosync_conf_text=fixture_totem( + transport_options=modified_transport_options, + compression_options=modified_compression_options, + crypto_options=modified_crypto_options, + totem_options=modified_totem_options, + ) + ) + cluster.config_update( + self.env_assist.get_env(), + modified_transport_options, + modified_compression_options, + modified_crypto_options, + modified_totem_options, + ) + self.env_assist.assert_reports([]) + + def test_remove_all_options(self): + self.config.corosync_conf.load_content( + fixture_totem( + transport_options=TRANSPORT_OPTIONS, + compression_options=COMPRESSION_OPTIONS, + crypto_options=CRYPTO_OPTIONS, + totem_options=TOTEM_OPTIONS, + ) + ) + self.config.env.push_corosync_conf(corosync_conf_text=fixture_totem()) + cluster.config_update( + self.env_assist.get_env(), + {option: """" for option in ALLOWED_KNET_TRANSPORT_OPTIONS}, + {option: """" for option in ALLOWED_COMPRESSION_OPTIONS}, + {option: """" for option in ALLOWED_CRYPTO_OPTIONS}, + {option: """" for option in ALLOWED_TOTEM_OPTIONS}, + ) + self.env_assist.assert_reports([]) + + def test_unknown_options_and_values(self): + self.config.corosync_conf.load_content(fixture_totem()) + self.env_assist.assert_raise_library_error( + lambda: cluster.config_update( + self.env_assist.get_env(), + {""unknown"": ""val"", ""ip_version"": ""4""}, + {""level"": ""high"", ""unknown"": ""val""}, + {""cipher"": ""strong"", ""unknown"": ""val""}, + {""unknown"": ""val"", ""downcheck"": ""check""}, + ) + ) + self.env_assist.assert_reports( + [ + fixture.error( + report_codes.INVALID_OPTIONS, + option_names=[""unknown""], + option_type=""totem"", + allowed=ALLOWED_TOTEM_OPTIONS, + allowed_patterns=[], + ), + fixture.error( + report_codes.INVALID_OPTION_VALUE, + option_name=""downcheck"", + option_value=""check"", + allowed_values=""a non-negative integer"", + cannot_be_empty=False, + forbidden_characters=None, + ), + fixture.error( + report_codes.INVALID_OPTIONS, + option_names=[""unknown""], + option_type=""knet transport"", + allowed=ALLOWED_KNET_TRANSPORT_OPTIONS, + allowed_patterns=[], + ), + fixture.error( + report_codes.INVALID_OPTION_VALUE, + option_name=""ip_version"", + option_value=""4"", + allowed_values=(""ipv4"", ""ipv6"", ""ipv4-6"", ""ipv6-4""), + cannot_be_empty=False, + forbidden_characters=None, + ), + fixture.error( + report_codes.INVALID_OPTIONS, + option_names=[""unknown""], + option_type=""compression"", + allowed=ALLOWED_COMPRESSION_OPTIONS, + allowed_patterns=[], + ), + fixture.error( + report_codes.INVALID_OPTION_VALUE, + option_name=""level"", + option_value=""high"", + allowed_values=""a non-negative integer"", + cannot_be_empty=False, + forbidden_characters=None, + ), + fixture.error( + report_codes.INVALID_OPTIONS, + option_names=[""unknown""], + option_type=""crypto"", + allowed=ALLOWED_CRYPTO_OPTIONS, + allowed_patterns=[], + ), + fixture.error( + report_codes.INVALID_OPTION_VALUE, + option_name=""cipher"", + option_value=""strong"", + allowed_values=(""none"", ""aes256"", ""aes192"", ""aes128""), + cannot_be_empty=False, + forbidden_characters=None, + ), + fixture.error( + report_codes.PREREQUISITE_OPTION_MUST_BE_ENABLED_AS_WELL, + option_name=""cipher"", + prerequisite_name=""hash"", + option_type=""crypto"", + prerequisite_type=""crypto"", + ), + ] + ) + + def test_unsupported_transport(self): + self.config.corosync_conf.load_content( + fixture_totem(transport_type=""keynet"") + ) + self.env_assist.assert_raise_library_error( + lambda: cluster.config_update( + self.env_assist.get_env(), + {""unknown"": ""val"", ""ip_version"": ""4""}, + {""level"": ""high"", ""unknown"": ""val""}, + {""cipher"": ""strong"", ""unknown"": ""val""}, + {""unknown"": ""val"", ""downcheck"": ""check""}, + ) + ) + self.env_assist.assert_reports( + [ + fixture.error( + report_codes.INVALID_OPTIONS, + option_names=[""unknown""], + option_type=""totem"", + allowed=ALLOWED_TOTEM_OPTIONS, + allowed_patterns=[], + ), + fixture.error( + report_codes.COROSYNC_CONFIG_UNSUPPORTED_TRANSPORT, + actual_transport=""keynet"", + supported_transport_types=[""knet"", ""udp"", ""udpu""], + ), + fixture.error( + report_codes.INVALID_OPTION_VALUE, + option_name=""downcheck"", + option_value=""check"", + allowed_values=""a non-negative integer"", + cannot_be_empty=False, + forbidden_characters=None, + ), + ] + ) + + def test_udp_transport_unsupported_options(self): + self.config.corosync_conf.load_content( + fixture_totem(transport_type=""udp"") + ) + self.env_assist.assert_raise_library_error( + lambda: cluster.config_update( + self.env_assist.get_env(), + {""knet_pmtud_interval"": ""interval""}, + {""level"": ""high"", ""unknown"": ""val""}, + {""cipher"": ""strong"", ""unknown"": ""val""}, + {""downcheck"": ""check""}, + ) + ) + self.env_assist.assert_reports( + [ + fixture.error( + report_codes.INVALID_OPTION_VALUE, + option_name=""downcheck"", + option_value=""check"", + allowed_values=""a non-negative integer"", + cannot_be_empty=False, + forbidden_characters=None, + ), + fixture.error( + report_codes.INVALID_OPTIONS, + option_names=[""knet_pmtud_interval""], + option_type=""udp/udpu transport"", + allowed=[""ip_version"", ""netmtu""], + allowed_patterns=[], + ), + fixture.error( + report_codes.COROSYNC_TRANSPORT_UNSUPPORTED_OPTIONS, + option_type=""compression"", + actual_transport=""udp/udpu"", + required_transports=[""knet""], + ), + fixture.error( + report_codes.COROSYNC_TRANSPORT_UNSUPPORTED_OPTIONS, + option_type=""crypto"", + actual_transport=""udp/udpu"", + required_transports=[""knet""], + ), + ] + ) + + +class UpdateConfigLocal(TestCase): + def setUp(self): + self.env_assist, self.config = get_env_tools(self) + + def test_empty_config_no_change(self): + self.assertEqual( + cluster.config_update_local( + self.env_assist.get_env(), b"""", {}, {}, {}, {} + ), + b"""", + ) + + def test_add_modify_remove_options(self): + before = fixture_totem( + transport_options={ + ""ip_version"": ""ipv4"", + ""knet_pmtud_interval"": ""10"", + }, + compression_options={""level"": ""9"", ""threshold"": ""100""}, + crypto_options={""cipher"": ""none"", ""model"": ""openssl""}, + totem_options={""token"": ""3000"", ""join"": ""50""}, + ) + after = dedent( + """"""\ + totem { + transport: knet + token: 1000 + ip_version: ipv6 + knet_compression_level: 5 + crypto_cipher: aes128 + downcheck: 5 + link_mode: active + knet_compression_model: zlib + crypto_hash: sha256 + } + """""" + ) + self.assertEqual( + cluster.config_update_local( + self.env_assist.get_env(), + before.encode(), + { + ""ip_version"": ""ipv6"", + ""link_mode"": ""active"", + ""knet_pmtud_interval"": """", + }, + {""level"": ""5"", ""model"": ""zlib"", ""threshold"": """"}, + {""cipher"": ""aes128"", ""hash"": ""sha256"", ""model"": """"}, + {""token"": ""1000"", ""downcheck"": ""5"", ""join"": """"}, + ), + after.encode(), + ) + + def test_some_validator_errors(self): + self.env_assist.assert_raise_library_error( + lambda: cluster.config_update_local( + self.env_assist.get_env(), + fixture_totem(transport_type=""udp"").encode(), + {""knet_pmtud_interval"": ""100""}, + {}, + {""cipher"": ""none"", ""hash"": ""none""}, + {""token"": ""notanumber""}, + ), + ) + self.env_assist.assert_reports( + [ + fixture.error( + report_codes.INVALID_OPTION_VALUE, + option_name=""token"", + option_value=""notanumber"", + allowed_values=""a non-negative integer"", + cannot_be_empty=False, + forbidden_characters=None, + ), + fixture.error( + report_codes.INVALID_OPTIONS, + option_names=[""knet_pmtud_interval""], + option_type=""udp/udpu transport"", + allowed=[""ip_version"", ""netmtu""], + allowed_patterns=[], + ), + fixture.error( + report_codes.COROSYNC_TRANSPORT_UNSUPPORTED_OPTIONS, + option_type=""crypto"", + actual_transport=""udp/udpu"", + required_transports=[""knet""], + ), + ] + ) + + +class GetCorosyncConfStruct(TestCase): + def setUp(self): + self.env_assist, self.config = get_env_tools(self) + + def test_unsupported_corosync_transport(self): + self.config.corosync_conf.load_content( + fixture_totem(transport_type=""unknown"") + ) + self.env_assist.assert_raise_library_error( + lambda: cluster.get_corosync_conf_struct(self.env_assist.get_env()), + [ + fixture.error( + report_codes.COROSYNC_CONFIG_UNSUPPORTED_TRANSPORT, + actual_transport=""unknown"", + supported_transport_types=[""knet"", ""udp"", ""udpu""], + ), + ], + expected_in_processor=False, + ) + + def test_empty_corosync_conf(self): + self.config.corosync_conf.load_content("""") + self.assertEqual( + CorosyncConfDto( + cluster_name="""", + transport=CorosyncTransportType.KNET, + totem_options={}, + transport_options={}, + compression_options={}, + crypto_options={}, + nodes=[], + links_options={}, + quorum_options={}, + quorum_device=None, + ), + cluster.get_corosync_conf_struct(self.env_assist.get_env()), + ) + + def test_corosync_conf_with_qdevice(self): + self.config.corosync_conf.load_content( + dedent( + """"""\ + totem { + version: 2 + cluster_name: HACluster + transport: knet + ip_version: ipv4-6 + link_mode: passive + knet_compression_level: 5 + knet_compression_model: zlib + knet_compression_threshold: 100 + crypto_cipher: aes256 + crypto_hash: sha256 + consensus: 3600 + join: 50 + token: 3000 + + interface { + linknumber: 0 + knet_link_priority: 100 + knet_ping_interval: 750 + knet_ping_timeout: 1500 + knet_transport: udp + } + + interface { + linknumber: 1 + knet_link_priority: 200 + knet_ping_interval: 750 + knet_ping_timeout: 1500 + knet_transport: sctp + } + } + + nodelist { + node { + ring0_addr: node1-addr + ring1_addr: 10.0.0.1 + name: node1 + nodeid: 1 + } + + node { + ring0_addr: node2-addr + ring1_addr: 10.0.0.2 + name: node2 + nodeid: 2 + } + } + + quorum { + provider: corosync_votequorum + two_node: 1 + wait_for_all: 1 + device { + model: net + sync_timeout: 5000 + timeout: 5000 + net { + algorithm: ffsplit + host: node-qdevice + } + heuristics { + mode: on + exec_ping: /usr/bin/ping -c 1 127.0.0.1 + } + } + } + + logging { + to_logfile: yes + logfile: /var/log/cluster/corosync.log + to_syslog: yes + timestamp: on + } + """""" + ) + ) + self.assertEqual( + CorosyncConfDto( + cluster_name=""HACluster"", + transport=CorosyncTransportType.KNET, + totem_options={ + ""consensus"": ""3600"", + ""join"": ""50"", + ""token"": ""3000"", + }, + transport_options={ + ""ip_version"": ""ipv4-6"", + ""link_mode"": ""passive"", + }, + crypto_options={""cipher"": ""aes256"", ""hash"": ""sha256""}, + compression_options={ + ""level"": ""5"", + ""model"": ""zlib"", + ""threshold"": ""100"", + }, + nodes=[ + CorosyncNodeDto( + name=""node1"", + nodeid=""1"", + addrs=[ + CorosyncNodeAddressDto( + addr=""node1-addr"", link=""0"", type=""FQDN"", + ), + CorosyncNodeAddressDto( + addr=""10.0.0.1"", link=""1"", type=""IPv4"", + ), + ], + ), + CorosyncNodeDto( + name=""node2"", + nodeid=""2"", + addrs=[ + CorosyncNodeAddressDto( + addr=""node2-addr"", link=""0"", type=""FQDN"", + ), + CorosyncNodeAddressDto( + addr=""10.0.0.2"", link=""1"", type=""IPv4"", + ), + ], + ), + ], + links_options={ + ""0"": { + ""linknumber"": ""0"", + ""link_priority"": ""100"", + ""ping_interval"": ""750"", + ""ping_timeout"": ""1500"", + ""transport"": ""udp"", + }, + ""1"": { + ""linknumber"": ""1"", + ""link_priority"": ""200"", + ""ping_interval"": ""750"", + ""ping_timeout"": ""1500"", + ""transport"": ""sctp"", + }, + }, + quorum_options={""wait_for_all"": ""1""}, + quorum_device=CorosyncQuorumDeviceSettingsDto( + model=""net"", + model_options={ + ""algorithm"": ""ffsplit"", + ""host"": ""node-qdevice"", + }, + generic_options={""sync_timeout"": ""5000"", ""timeout"": ""5000""}, + heuristics_options={ + ""mode"": ""on"", + ""exec_ping"": ""/usr/bin/ping -c 1 127.0.0.1"", + }, + ), + ), + cluster.get_corosync_conf_struct(self.env_assist.get_env()), + ) ",0 e5647554e6801a522c508a8eb457979a9af8c398,https://github.com/apache/activemq-apollo/commit/e5647554e6801a522c508a8eb457979a9af8c398,https://issues.apache.org/jira/browse/APLO-366 - make xpath parser features configurable,"diff --git a/apollo-selector/src/main/java/org/apache/activemq/apollo/filter/XalanXPathEvaluator.java b/apollo-selector/src/main/java/org/apache/activemq/apollo/filter/XalanXPathEvaluator.java index 249c2e2fd..32902f830 100644 --- a/apollo-selector/src/main/java/org/apache/activemq/apollo/filter/XalanXPathEvaluator.java +++ b/apollo-selector/src/main/java/org/apache/activemq/apollo/filter/XalanXPathEvaluator.java @@ -25,11 +25,16 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; import java.io.StringReader; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Properties; public class XalanXPathEvaluator implements XPathExpression.XPathEvaluator { - + public static final String DOCUMENT_BUILDER_FACTORY_FEATURE = ""org.apache.activemq.apollo.documentBuilderFactory.feature""; private final String xpath; public XalanXPathEvaluator(String xpath) { @@ -51,7 +56,13 @@ protected boolean evaluate(String text) { protected boolean evaluate(InputSource inputSource) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setFeature(""http://xml.org/sax/features/external-general-entities"", false); + factory.setFeature(""http://xml.org/sax/features/external-parameter-entities"", false); + factory.setFeature(""http://apache.org/xml/features/disallow-doctype-decl"", true); + setupFeatures(factory); factory.setNamespaceAware(true); + factory.setIgnoringElementContentWhitespace(true); + factory.setIgnoringComments(true); DocumentBuilder dbuilder = factory.newDocumentBuilder(); Document doc = dbuilder.parse(inputSource); @@ -73,4 +84,33 @@ protected boolean evaluate(InputSource inputSource) { return false; } } + + protected void setupFeatures(DocumentBuilderFactory factory) { + Properties properties = System.getProperties(); + List features = new ArrayList(); + for (Map.Entry prop : properties.entrySet()) { + String key = (String) prop.getKey(); + if (key.startsWith(DOCUMENT_BUILDER_FACTORY_FEATURE)) { + String uri = key.split(DOCUMENT_BUILDER_FACTORY_FEATURE + "":"")[1]; + Boolean value = Boolean.valueOf((String)prop.getValue()); + try { + factory.setFeature(uri, value); + features.add(""feature "" + uri + "" value "" + value); + } catch (ParserConfigurationException e) { + throw new RuntimeException(""DocumentBuilderFactory doesn't support the feature "" + uri + "" with value "" + value + "", due to "" + e); + } + } + } + if (features.size() > 0) { + StringBuffer featureString = new StringBuffer(); + // just log the configured feature + for (String feature : features) { + if (featureString.length() != 0) { + featureString.append("", ""); + } + featureString.append(feature); + } + } + + } } ",1 3f627e580acfdaf0595ae3b115b8bec677f203ee?w=1,https://github.com/php/php-src/commit/3f627e580acfdaf0595ae3b115b8bec677f203ee?w=1,Fixed ##72433: Use After Free Vulnerability in PHP's GC algorithm and unserialize,"diff --git a/Zend/tests/gc_024.phpt b/Zend/tests/gc_024.phpt index 9a2ceb88f5045..ca78da63d3b7f 100644 --- a/Zend/tests/gc_024.phpt +++ b/Zend/tests/gc_024.phpt @@ -13,5 +13,5 @@ var_dump(gc_collect_cycles()); echo ""ok\n""; ?> --EXPECT-- -int(1) +int(2) ok diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index c89cf4994b1cc..4e03c408c663f 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -831,6 +831,16 @@ static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp TSRMLS_DC) /* } /* }}} */ +static HashTable *spl_array_get_gc(zval *object, zval ***gc_data, int *gc_data_count TSRMLS_DC) /* {{{ */ +{ + spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); + + *gc_data = &intern->array; + *gc_data_count = 1; + return zend_std_get_properties(object); +} +/* }}} */ + static zval *spl_array_read_property(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC) /* {{{ */ { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); @@ -1961,6 +1971,7 @@ PHP_MINIT_FUNCTION(spl_array) spl_handler_ArrayObject.get_properties = spl_array_get_properties; spl_handler_ArrayObject.get_debug_info = spl_array_get_debug_info; + spl_handler_ArrayObject.get_gc = spl_array_get_gc; spl_handler_ArrayObject.read_property = spl_array_read_property; spl_handler_ArrayObject.write_property = spl_array_write_property; spl_handler_ArrayObject.get_property_ptr_ptr = spl_array_get_property_ptr_ptr; diff --git a/ext/standard/tests/strings/bug72433.phpt b/ext/standard/tests/strings/bug72433.phpt new file mode 100644 index 0000000000000..3a2c89701b12e --- /dev/null +++ b/ext/standard/tests/strings/bug72433.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #72433: Use After Free Vulnerability in PHP's GC algorithm and unserialize +--FILE-- + +--EXPECTF-- +array(3) { + [0]=> + *RECURSION* + [1]=> + *RECURSION* + [2]=> + object(ArrayObject)#%d (1) { + [""storage"":""ArrayObject"":private]=> + *RECURSION* + } +} ",1 7b168c142b09c3b03e39f1449211e7ddf026a14,https://github.com/apache/syncope/commit/7b168c142b09c3b03e39f1449211e7ddf026a14,Review fields usable for search and orderBy,"diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java b/common/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java index 5dbf149c40..77a7d134cb 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/search/SearchableFields.java @@ -36,7 +36,7 @@ public final class SearchableFields { private static final String[] ATTRIBUTES_NOTINCLUDED = { - ""serialVersionUID"", ""password"", ""type"", ""udynMembershipCond"" + ""serialVersionUID"", ""password"", ""type"", ""udynMembershipCond"", ""securityAnswer"", ""token"", ""tokenExpireTime"" }; private static final Set ANY_FIELDS = new HashSet<>(); diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnySearchDAO.java index c8b27d2af2..178fa004b1 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnySearchDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnySearchDAO.java @@ -30,6 +30,7 @@ import javax.validation.ValidationException; import javax.validation.constraints.Max; import javax.validation.constraints.Min; +import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ClassUtils; import org.apache.commons.lang3.SerializationUtils; import org.apache.commons.lang3.tuple.Pair; @@ -67,6 +68,10 @@ public abstract class AbstractAnySearchDAO extends AbstractDAO> implements AnySearchDAO { + private static final String[] ORDER_BY_NOT_ALLOWED = { + ""serialVersionUID"", ""password"", ""securityQuestion"", ""securityAnswer"", ""token"", ""tokenExpireTime"" + }; + @Autowired protected RealmDAO realmDAO; @@ -129,6 +134,12 @@ public int count(final Set adminRealms, final SearchCond cond, final Any return search(SyncopeConstants.FULL_ADMIN_REALMS, cond, -1, -1, orderBy, kind); } + protected List filterOrderBy(final List orderBy) { + return orderBy.stream(). + filter(clause -> !ArrayUtils.contains(ORDER_BY_NOT_ALLOWED, clause.getField())). + collect(Collectors.toList()); + } + protected abstract > List doSearch( Set adminRealms, SearchCond searchCondition, diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java index 0f0df60754..7ffd176be4 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java @@ -276,13 +276,13 @@ private StringBuilder buildOrderBy(final OrderBySupport obs) { } private OrderBySupport parseOrderBy( - final AnyTypeKind kind, final SearchSupport svs, final List orderByClauses) { + final AnyTypeKind kind, final SearchSupport svs, final List orderBy) { AnyUtils attrUtils = anyUtilsFactory.getInstance(kind); OrderBySupport obs = new OrderBySupport(); - for (OrderByClause clause : orderByClauses) { + for (OrderByClause clause : filterOrderBy(orderBy)) { OrderBySupport.Item item = new OrderBySupport.Item(); // Manage difference among external key attribute and internal JPA @Id diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java index 0677ad7af6..e159778a6d 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java @@ -25,6 +25,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import javax.ws.rs.core.Response; +import org.apache.commons.lang3.RandomStringUtils; import org.apache.syncope.client.lib.SyncopeClient; import org.apache.syncope.common.lib.SyncopeConstants; import org.apache.syncope.common.lib.patch.AnyObjectPatch; @@ -347,6 +348,24 @@ public void searchByRelationshipType() { anyMatch(user -> ""c9b2dec2-00a7-4855-97c0-d854842b4b24"".equals(user.getKey()))); } + @Test + public void searchBySecurityAnswer() { + String securityAnswer = RandomStringUtils.randomAlphanumeric(10); + UserTO userTO = UserITCase.getUniqueSampleTO(""securityAnswer@syncope.apache.org""); + userTO.setSecurityQuestion(""887028ea-66fc-41e7-b397-620d7ea6dfbb""); + userTO.setSecurityAnswer(securityAnswer); + + userTO = createUser(userTO).getEntity(); + assertNotNull(userTO.getSecurityQuestion()); + + PagedResult matchingUsers = userService.search( + new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM). + fiql(SyncopeClient.getUserSearchConditionBuilder(). + is(""securityAnswer"").equalTo(securityAnswer).query()).build()); + assertNotNull(matchingUsers); + assertTrue(matchingUsers.getResult().isEmpty()); + } + @Test public void assignable() { PagedResult groups = groupService.search(new AnyQuery.Builder().realm(""/even/two"").page(1).size(1000). ",1 7a747d82b80cd38d2c11a0d9cdedb71c722a2c75,https://github.com/vmware/xenon/commit/7a747d82b80cd38d2c11a0d9cdedb71c722a2c75,"Add auth to UtilityService Extend auth check to UtiliyService endpoints: stats, config, subscription Issue: VRXEN-5 Change-Id: I52a4b4a42731c244a97f97610dcaddb6837e67fb","diff --git a/xenon-common/src/main/java/com/vmware/xenon/common/UtilityService.java b/xenon-common/src/main/java/com/vmware/xenon/common/UtilityService.java index e819989d5..f12813dcd 100644 --- a/xenon-common/src/main/java/com/vmware/xenon/common/UtilityService.java +++ b/xenon-common/src/main/java/com/vmware/xenon/common/UtilityService.java @@ -67,7 +67,29 @@ public UtilityService setParent(Service parent) { @Override public void authorizeRequest(Operation op) { - op.complete(); + + String suffix = UriUtils.buildUriPath(UriUtils.URI_PATH_CHAR, UriUtils.getLastPathSegment(op.getUri())); + + // allow access to ui endpoint + if (ServiceHost.SERVICE_URI_SUFFIX_UI.equals(suffix)) { + op.complete(); + return; + } + + ServiceDocument doc = new ServiceDocument(); + if (this.parent.getOptions().contains(ServiceOption.FACTORY_ITEM)) { + doc.documentSelfLink = UriUtils.buildUriPath(UriUtils.getParentPath(this.parent.getSelfLink()), suffix); + } else { + doc.documentSelfLink = UriUtils.buildUriPath(this.parent.getSelfLink(), suffix); + } + + doc.documentKind = Utils.buildKind(this.parent.getStateType()); + if (getHost().isAuthorized(this.parent, doc, op)) { + op.complete(); + return; + } + + op.fail(Operation.STATUS_CODE_FORBIDDEN); } @Override diff --git a/xenon-common/src/test/java/com/vmware/xenon/common/TestAuthorization.java b/xenon-common/src/test/java/com/vmware/xenon/common/TestAuthorization.java index 1073f3516..48f69b938 100644 --- a/xenon-common/src/test/java/com/vmware/xenon/common/TestAuthorization.java +++ b/xenon-common/src/test/java/com/vmware/xenon/common/TestAuthorization.java @@ -686,6 +686,16 @@ public void statefulServiceAuthorization() throws Throwable { })); this.host.testWait(ctx2); + // do GET on factory /stats, we should get 403 + Operation statsGet = Operation.createGet(this.host, + ExampleService.FACTORY_LINK + ServiceHost.SERVICE_URI_SUFFIX_STATS); + this.host.sendAndWaitExpectFailure(statsGet, Operation.STATUS_CODE_FORBIDDEN); + + // do GET on factory /config, we should get 403 + Operation configGet = Operation.createGet(this.host, + ExampleService.FACTORY_LINK + ServiceHost.SERVICE_URI_SUFFIX_CONFIG); + this.host.sendAndWaitExpectFailure(configGet, Operation.STATUS_CODE_FORBIDDEN); + // Assume Jane's identity this.host.assumeIdentity(this.userServicePath); // add docs accessible by jane @@ -727,9 +737,27 @@ public void statefulServiceAuthorization() throws Throwable { // reset the auth context OperationContext.setAuthorizationContext(null); + // do GET on utility suffixes in example child services, we should get 403 + for (URI childUri : exampleServices.keySet()) { + statsGet = Operation.createGet(this.host, + childUri.getPath() + ServiceHost.SERVICE_URI_SUFFIX_STATS); + this.host.sendAndWaitExpectFailure(statsGet, Operation.STATUS_CODE_FORBIDDEN); + configGet = Operation.createGet(this.host, + childUri.getPath() + ServiceHost.SERVICE_URI_SUFFIX_CONFIG); + this.host.sendAndWaitExpectFailure(configGet, Operation.STATUS_CODE_FORBIDDEN); + } + // Assume Jane's identity through header auth token String authToken = generateAuthToken(this.userServicePath); + // do GET on utility suffixes in example child services, we should get 200 + for (URI childUri : exampleServices.keySet()) { + statsGet = Operation.createGet(this.host, + childUri.getPath() + ServiceHost.SERVICE_URI_SUFFIX_STATS); + statsGet.addRequestHeader(Operation.REQUEST_AUTH_TOKEN_HEADER, authToken); + this.host.sendAndWaitExpectSuccess(statsGet); + } + verifyJaneAccess(exampleServices, authToken); // test user impersonation diff --git a/xenon-common/src/test/java/com/vmware/xenon/common/TestExampleServiceHost.java b/xenon-common/src/test/java/com/vmware/xenon/common/TestExampleServiceHost.java index 07d2a39e9..17868c08e 100644 --- a/xenon-common/src/test/java/com/vmware/xenon/common/TestExampleServiceHost.java +++ b/xenon-common/src/test/java/com/vmware/xenon/common/TestExampleServiceHost.java @@ -85,7 +85,9 @@ public void createUsers() throws Throwable { private String loginUser(URI hostUri) throws Throwable { URI usersLink = UriUtils.buildUri(hostUri, UserService.FACTORY_LINK); // wait for factory availability + this.host.setSystemAuthorizationContext(); this.host.waitForReplicatedFactoryServiceAvailable(usersLink); + this.host.resetAuthorizationContext(); String basicAuth = constructBasicAuth(adminUser, adminUser); URI loginUri = UriUtils.buildUri(hostUri, ServiceUriPaths.CORE_AUTHN_BASIC); diff --git a/xenon-common/src/test/java/com/vmware/xenon/common/TestServiceHost.java b/xenon-common/src/test/java/com/vmware/xenon/common/TestServiceHost.java index 6e52c615f..d7adacd67 100644 --- a/xenon-common/src/test/java/com/vmware/xenon/common/TestServiceHost.java +++ b/xenon-common/src/test/java/com/vmware/xenon/common/TestServiceHost.java @@ -349,9 +349,13 @@ private void doRequestRateLimits() throws Throwable { ri.limit = limit; ri.options = EnumSet.of(RequestRateInfo.Option.PAUSE_PROCESSING); this.host.setRequestRateLimit(userPath, ri); - this.host.assumeIdentity(userPath); + this.host.setSystemAuthorizationContext(); ServiceStat rateLimitStatBefore = getRateLimitOpCountStat(); + this.host.resetSystemAuthorizationContext(); + + this.host.assumeIdentity(userPath); + if (rateLimitStatBefore == null) { rateLimitStatBefore = new ServiceStat(); rateLimitStatBefore.latestValue = 0.0; @@ -370,7 +374,10 @@ private void doRequestRateLimits() throws Throwable { } this.host.testWait(ctx2); ctx2.logAfter(); + + this.host.setSystemAuthorizationContext(); ServiceStat rateLimitStatAfter = getRateLimitOpCountStat(); + this.host.resetSystemAuthorizationContext(); assertTrue(rateLimitStatAfter.latestValue > rateLimitStatBefore.latestValue); this.host.setMaintenanceIntervalMicros( @@ -400,7 +407,9 @@ private void doRequestRateLimits() throws Throwable { ctx3.logAfter(); // verify rate limiting did not happen + this.host.setSystemAuthorizationContext(); ServiceStat rateLimitStatExpectSame = getRateLimitOpCountStat(); + this.host.resetSystemAuthorizationContext(); assertTrue(rateLimitStatAfter.latestValue == rateLimitStatExpectSame.latestValue); } @@ -2405,8 +2414,9 @@ private ServiceStat getODLStopCountStat() throws Throwable { private ServiceStat getRateLimitOpCountStat() throws Throwable { URI managementServiceUri = this.host.getManagementServiceUri(); - return this.host.getServiceStats(managementServiceUri) + ServiceStat stats = this.host.getServiceStats(managementServiceUri) .get(ServiceHostManagementService.STAT_NAME_RATE_LIMITED_OP_COUNT); + return stats; } @Test diff --git a/xenon-common/src/test/java/com/vmware/xenon/common/TestSubscriptions.java b/xenon-common/src/test/java/com/vmware/xenon/common/TestSubscriptions.java index 26688260e..b3b1c9d8a 100644 --- a/xenon-common/src/test/java/com/vmware/xenon/common/TestSubscriptions.java +++ b/xenon-common/src/test/java/com/vmware/xenon/common/TestSubscriptions.java @@ -301,11 +301,14 @@ public void subscriptionsWithAuth() throws Throwable { } }; + + hostWithAuth.setSystemAuthorizationContext(); Operation subscribe = Operation.createPost(UriUtils.buildUri(hostWithAuth, minimalServiceUUID)); subscribe.setReferer(hostWithAuth.getReferer()); ServiceSubscriber subscriber = new ServiceSubscriber(); subscriber.replayState = true; hostWithAuth.startSubscriptionService(subscribe, notifyC, subscriber); + hostWithAuth.resetAuthorizationContext(); hostWithAuth.testWait(notifyContext); } finally { if (hostWithAuth != null) { diff --git a/xenon-common/src/test/java/com/vmware/xenon/common/TestUtilityService.java b/xenon-common/src/test/java/com/vmware/xenon/common/TestUtilityService.java index 411ba4f74..15bbbcfdb 100644 --- a/xenon-common/src/test/java/com/vmware/xenon/common/TestUtilityService.java +++ b/xenon-common/src/test/java/com/vmware/xenon/common/TestUtilityService.java @@ -14,8 +14,12 @@ package com.vmware.xenon.common; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; +import static com.vmware.xenon.common.ServiceHost.SERVICE_URI_SUFFIX_TEMPLATE; +import static com.vmware.xenon.common.ServiceHost.SERVICE_URI_SUFFIX_UI; + import java.net.URI; import java.util.EnumSet; import java.util.List; @@ -33,10 +37,16 @@ import com.vmware.xenon.common.ServiceStats.TimeSeriesStats; import com.vmware.xenon.common.ServiceStats.TimeSeriesStats.AggregationType; import com.vmware.xenon.common.ServiceStats.TimeSeriesStats.TimeBin; +import com.vmware.xenon.common.test.AuthTestUtils; import com.vmware.xenon.common.test.TestContext; +import com.vmware.xenon.common.test.TestRequestSender; +import com.vmware.xenon.common.test.TestRequestSender.FailureResponse; +import com.vmware.xenon.common.test.VerificationHost; +import com.vmware.xenon.services.common.AuthorizationContextService; import com.vmware.xenon.services.common.ExampleService; import com.vmware.xenon.services.common.ExampleService.ExampleServiceState; import com.vmware.xenon.services.common.MinimalTestService; +import com.vmware.xenon.services.common.QueryTask.Query; public class TestUtilityService extends BasicReusableHostTestCase { @@ -790,4 +800,145 @@ public static void validateTimeSeriesStat(ServiceStat stat, long expectedBinDura assertTrue(maxCount >= 1); } } + + @Test + public void endpointAuthorization() throws Throwable { + VerificationHost host = VerificationHost.create(0); + host.setAuthorizationService(new AuthorizationContextService()); + host.setAuthorizationEnabled(true); + host.setMaintenanceIntervalMicros(TimeUnit.MILLISECONDS.toMicros(100)); + host.start(); + + TestRequestSender sender = host.getTestRequestSender(); + + host.setSystemAuthorizationContext(); + host.waitForReplicatedFactoryServiceAvailable(UriUtils.buildUri(host, ExampleService.FACTORY_LINK)); + + String exampleUser = ""example@vmware.com""; + String examplePass = ""password""; + TestContext authCtx = host.testCreate(1); + AuthorizationSetupHelper.create() + .setHost(host) + .setUserEmail(exampleUser) + .setUserPassword(examplePass) + .setResourceQuery(Query.Builder.create() + .addFieldClause(ServiceDocument.FIELD_NAME_KIND, Utils.buildKind(ExampleServiceState.class)) + .build()) + .setCompletion(authCtx.getCompletion()) + .start(); + authCtx.await(); + + // create a sample service + ExampleServiceState doc = new ExampleServiceState(); + doc.name = ""foo""; + doc.documentSelfLink = ""foo""; + + Operation post = Operation.createPost(host, ExampleService.FACTORY_LINK).setBody(doc); + ExampleServiceState postResult = sender.sendAndWait(post, ExampleServiceState.class); + + host.resetAuthorizationContext(); + + URI factoryAvailableUri = UriUtils.buildAvailableUri(host, ExampleService.FACTORY_LINK); + URI factoryStatsUri = UriUtils.buildStatsUri(host, ExampleService.FACTORY_LINK); + URI factoryConfigUri = UriUtils.buildConfigUri(host, ExampleService.FACTORY_LINK); + URI factorySubscriptionUri = UriUtils.buildSubscriptionUri(host, ExampleService.FACTORY_LINK); + URI factoryTemplateUri = UriUtils.buildUri(host, UriUtils.buildUriPath(ExampleService.FACTORY_LINK, SERVICE_URI_SUFFIX_TEMPLATE)); + URI factoryUiUri = UriUtils.buildUri(host, UriUtils.buildUriPath(ExampleService.FACTORY_LINK, SERVICE_URI_SUFFIX_UI)); + + URI serviceAvailableUri = UriUtils.buildAvailableUri(host, postResult.documentSelfLink); + URI serviceStatsUri = UriUtils.buildStatsUri(host, postResult.documentSelfLink); + URI serviceConfigUri = UriUtils.buildConfigUri(host, postResult.documentSelfLink); + URI serviceSubscriptionUri = UriUtils.buildSubscriptionUri(host, postResult.documentSelfLink); + URI serviceTemplateUri = UriUtils.buildUri(host, UriUtils.buildUriPath(postResult.documentSelfLink, SERVICE_URI_SUFFIX_TEMPLATE)); + URI serviceUiUri = UriUtils.buildUri(host, UriUtils.buildUriPath(postResult.documentSelfLink, SERVICE_URI_SUFFIX_UI)); + + // check non-authenticated user receives forbidden response + FailureResponse failureResponse; + Operation uiOpResult; + + // check factory endpoints + failureResponse = sender.sendAndWaitFailure(Operation.createGet(factoryAvailableUri)); + assertEquals(Operation.STATUS_CODE_FORBIDDEN, failureResponse.op.getStatusCode()); + + failureResponse = sender.sendAndWaitFailure(Operation.createGet(factoryStatsUri)); + assertEquals(Operation.STATUS_CODE_FORBIDDEN, failureResponse.op.getStatusCode()); + + failureResponse = sender.sendAndWaitFailure(Operation.createGet(factoryConfigUri)); + assertEquals(Operation.STATUS_CODE_FORBIDDEN, failureResponse.op.getStatusCode()); + + failureResponse = sender.sendAndWaitFailure(Operation.createGet(factorySubscriptionUri)); + assertEquals(Operation.STATUS_CODE_FORBIDDEN, failureResponse.op.getStatusCode()); + + failureResponse = sender.sendAndWaitFailure(Operation.createGet(factoryTemplateUri)); + assertEquals(Operation.STATUS_CODE_FORBIDDEN, failureResponse.op.getStatusCode()); + + uiOpResult = sender.sendAndWait(Operation.createGet(factoryUiUri)); + assertNotEquals(Operation.STATUS_CODE_FORBIDDEN, uiOpResult.getStatusCode()); + + // check service endpoints + failureResponse = sender.sendAndWaitFailure(Operation.createGet(serviceAvailableUri)); + assertEquals(Operation.STATUS_CODE_FORBIDDEN, failureResponse.op.getStatusCode()); + + failureResponse = sender.sendAndWaitFailure(Operation.createGet(serviceStatsUri)); + assertEquals(Operation.STATUS_CODE_FORBIDDEN, failureResponse.op.getStatusCode()); + + failureResponse = sender.sendAndWaitFailure(Operation.createGet(serviceConfigUri)); + assertEquals(Operation.STATUS_CODE_FORBIDDEN, failureResponse.op.getStatusCode()); + + failureResponse = sender.sendAndWaitFailure(Operation.createGet(serviceSubscriptionUri)); + assertEquals(Operation.STATUS_CODE_FORBIDDEN, failureResponse.op.getStatusCode()); + + failureResponse = sender.sendAndWaitFailure(Operation.createGet(serviceTemplateUri)); + assertEquals(Operation.STATUS_CODE_FORBIDDEN, failureResponse.op.getStatusCode()); + + uiOpResult = sender.sendAndWait(Operation.createGet(serviceUiUri)); + assertNotEquals(Operation.STATUS_CODE_FORBIDDEN, uiOpResult.getStatusCode()); + + + // check authenticated user does NOT receive forbidden response + AuthTestUtils.login(host, exampleUser, examplePass); + + Operation response; + + // check factory endpoints + response = sender.sendAndWait(Operation.createGet(factoryAvailableUri)); + assertNotEquals(Operation.STATUS_CODE_FORBIDDEN, response.getStatusCode()); + + response = sender.sendAndWait(Operation.createGet(factoryStatsUri)); + assertNotEquals(Operation.STATUS_CODE_FORBIDDEN, response.getStatusCode()); + + response = sender.sendAndWait(Operation.createGet(factoryConfigUri)); + assertNotEquals(Operation.STATUS_CODE_FORBIDDEN, response.getStatusCode()); + + response = sender.sendAndWait(Operation.createGet(factorySubscriptionUri)); + assertNotEquals(Operation.STATUS_CODE_FORBIDDEN, response.getStatusCode()); + + response = sender.sendAndWait(Operation.createGet(factoryTemplateUri)); + assertNotEquals(Operation.STATUS_CODE_FORBIDDEN, response.getStatusCode()); + + response = sender.sendAndWait(Operation.createGet(factoryUiUri)); + assertNotEquals(Operation.STATUS_CODE_FORBIDDEN, response.getStatusCode()); + + + // check service endpoints + response = sender.sendAndWait(Operation.createGet(serviceAvailableUri)); + assertNotEquals(Operation.STATUS_CODE_FORBIDDEN, response.getStatusCode()); + + response = sender.sendAndWait(Operation.createGet(serviceStatsUri)); + assertNotEquals(Operation.STATUS_CODE_FORBIDDEN, response.getStatusCode()); + + response = sender.sendAndWait(Operation.createGet(serviceConfigUri)); + assertNotEquals(Operation.STATUS_CODE_FORBIDDEN, response.getStatusCode()); + + response = sender.sendAndWait(Operation.createGet(serviceSubscriptionUri)); + assertNotEquals(Operation.STATUS_CODE_FORBIDDEN, response.getStatusCode()); + + response = sender.sendAndWait(Operation.createGet(serviceTemplateUri)); + assertNotEquals(Operation.STATUS_CODE_FORBIDDEN, response.getStatusCode()); + + response = sender.sendAndWait(Operation.createGet(serviceUiUri)); + assertNotEquals(Operation.STATUS_CODE_FORBIDDEN, response.getStatusCode()); + + } + } diff --git a/xenon-common/src/test/java/com/vmware/xenon/common/test/AuthorizationHelper.java b/xenon-common/src/test/java/com/vmware/xenon/common/test/AuthorizationHelper.java index e4902b02d..14fd14895 100644 --- a/xenon-common/src/test/java/com/vmware/xenon/common/test/AuthorizationHelper.java +++ b/xenon-common/src/test/java/com/vmware/xenon/common/test/AuthorizationHelper.java @@ -30,6 +30,7 @@ import com.vmware.xenon.common.ServiceHost; import com.vmware.xenon.common.UriUtils; import com.vmware.xenon.common.Utils; +import com.vmware.xenon.services.common.ExampleService; import com.vmware.xenon.services.common.ExampleService.ExampleServiceState; import com.vmware.xenon.services.common.QueryTask; import com.vmware.xenon.services.common.QueryTask.Query; @@ -249,6 +250,22 @@ public String getUserGroupName(String email) { UriUtils.buildUriPath(ServiceUriPaths.CORE_AUTHZ_USERS, email)) .build()); + // Create resource group to allow access on utility paths + String statsResourceGroupLink = createResourceGroup(target, ""stats-resource-group"", + Builder.create() + .addFieldClause( + ServiceDocument.FIELD_NAME_SELF_LINK, + ExampleService.FACTORY_LINK + ServiceHost.SERVICE_URI_SUFFIX_STATS) + .build()); + + String subscriptionsResourceGroupLink = createResourceGroup(target, ""subs-resource-group"", + Builder.create() + .addFieldClause( + ServiceDocument.FIELD_NAME_SELF_LINK, + ServiceUriPaths.CORE_LOCAL_QUERY_TASKS + + ServiceHost.SERVICE_URI_SUFFIX_SUBSCRIPTIONS) + .build()); + Collection paths = new HashSet<>(); // Create roles tying these together @@ -263,6 +280,16 @@ public String getUserGroupName(String email) { // Create role authorizing access to the user's own query tasks paths.add(createRole(target, userGroupLink, queryTaskResourceGroupLink, new HashSet<>(Arrays.asList(Action.GET, Action.POST, Action.PATCH, Action.DELETE)))); + + // Create role authorizing access to /stats + paths.add(createRole(target, userGroupLink, statsResourceGroupLink, + new HashSet<>( + Arrays.asList(Action.GET, Action.POST, Action.PATCH, Action.DELETE)))); + + // Create role authorizing access to /subscriptions of query tasks + paths.add(createRole(target, userGroupLink, subscriptionsResourceGroupLink, + new HashSet<>( + Arrays.asList(Action.GET, Action.POST, Action.PATCH, Action.DELETE)))); return paths; } diff --git a/xenon-common/src/test/java/com/vmware/xenon/common/test/VerificationHost.java b/xenon-common/src/test/java/com/vmware/xenon/common/test/VerificationHost.java index 6ea1bbbe1..abaee671c 100644 --- a/xenon-common/src/test/java/com/vmware/xenon/common/test/VerificationHost.java +++ b/xenon-common/src/test/java/com/vmware/xenon/common/test/VerificationHost.java @@ -80,6 +80,7 @@ import com.vmware.xenon.common.Operation; import com.vmware.xenon.common.Operation.AuthorizationContext; import com.vmware.xenon.common.Operation.CompletionHandler; +import com.vmware.xenon.common.OperationContext; import com.vmware.xenon.common.Service; import com.vmware.xenon.common.Service.Action; import com.vmware.xenon.common.Service.ServiceOption; @@ -1040,7 +1041,15 @@ public ServiceDocumentQueryResult getExpandedFactoryState(URI factoryUri) { } public Map getServiceStats(URI serviceUri) { + AuthorizationContext ctx = null; + if (this.isAuthorizationEnabled()) { + ctx = OperationContext.getAuthorizationContext(); + this.setSystemAuthorizationContext(); + } ServiceStats stats = this.sender.sendStatsGetAndWait(serviceUri); + if (this.isAuthorizationEnabled()) { + this.setAuthorizationContext(ctx); + } return stats.entries; } diff --git a/xenon-common/src/test/java/com/vmware/xenon/services/common/TestNodeGroupService.java b/xenon-common/src/test/java/com/vmware/xenon/services/common/TestNodeGroupService.java index b38fca989..4b24430c8 100644 --- a/xenon-common/src/test/java/com/vmware/xenon/services/common/TestNodeGroupService.java +++ b/xenon-common/src/test/java/com/vmware/xenon/services/common/TestNodeGroupService.java @@ -2933,6 +2933,7 @@ public void replicationWithAuthzCacheClear() throws Throwable { VerificationHost groupHost = this.host.getPeerHost(); + groupHost.setSystemAuthorizationContext(); // wait for auth related services to be stabilized groupHost.waitForReplicatedFactoryServiceAvailable( UriUtils.buildUri(groupHost, UserService.FACTORY_LINK)); @@ -2950,7 +2951,7 @@ public void replicationWithAuthzCacheClear() throws Throwable { String bazUserLink = UriUtils.buildUriPath(ServiceUriPaths.CORE_AUTHZ_USERS, ""baz@vmware.com""); - groupHost.setSystemAuthorizationContext(); + // create user, user-group, resource-group, role for foo@vmware.com // user: /core/authz/users/foo@vmware.com @@ -3161,7 +3162,7 @@ private void populateAuthCacheInAllPeers(AuthorizationContext authContext) throw // based on the role created in test, all users have access to ExampleService this.host.sendAndWaitExpectSuccess( - Operation.createGet(UriUtils.buildStatsUri(peer, ExampleService.FACTORY_LINK))); + Operation.createGet(UriUtils.buildUri(peer, ExampleService.FACTORY_LINK))); } this.host.waitFor(""Timeout waiting for correct auth cache state"", ",1 c1edae52c3c20943775322e50a8a5b75fac9f6c2,https://github.com/ellson/graphviz/commit/c1edae52c3c20943775322e50a8a5b75fac9f6c2,"Move type checks features/sfio to configure.ac The following type checks have been moved: - off64_t - struct stat64","diff --git a/configure.ac b/configure.ac index edb15ffbe..21c769b53 100644 --- a/configure.ac +++ b/configure.ac @@ -404,6 +404,11 @@ AC_TYPE_PID_T AC_TYPE_SSIZE_T AC_TYPE_UID_T +AC_CHECK_TYPES([ + off64_t, + struct stat64, +]) + dnl ----------------------------------- dnl Checks for header files diff --git a/lib/sfio/features/sfio b/lib/sfio/features/sfio index 0bfbefad1..6bc55d494 100644 --- a/lib/sfio/features/sfio +++ b/lib/sfio/features/sfio @@ -6,15 +6,6 @@ # Converted to sfio v10/01/94 by Giampiero Sierra (06/08/95). ################################################################## -typ off64_t -typ struct_stat64 compile{ - #include - #include - main() - { struct stat64 statb; - } -}end - ################################################## # file control checks ################################################## diff --git a/lib/sfio/sfhdr.h b/lib/sfio/sfhdr.h index a80eaeebf..d29b0cc8e 100644 --- a/lib/sfio/sfhdr.h +++ b/lib/sfio/sfhdr.h @@ -2,7 +2,7 @@ /* vim:set shiftwidth=4 ts=8: */ /************************************************************************* - * Copyright (c) 2011 AT&T Intellectual Property + * Copyright (c) 2011 AT&T Intellectual Property * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -37,8 +37,8 @@ extern ""C"" { #define _NO_LARGEFILE64_SOURCE 1 #endif #if !defined(_NO_LARGEFILE64_SOURCE) && \ - HAVE_LSEEK64 && HAVE_STAT64 && defined(_typ_off64_t) && \ - _typ_struct_stat64 + HAVE_LSEEK64 && HAVE_STAT64 && defined(HAVE_OFF64_T) && \ + HAVE_STRUCT_STAT64 # if !defined(_LARGEFILE64_SOURCE) # define _LARGEFILE64_SOURCE 1 # endif ",0 6279c0f4f26f76ad7d8909e4ee41914a6f6ef186,https://github.com/lxc/lxcfs/commit/6279c0f4f26f76ad7d8909e4ee41914a6f6ef186,"README: clarify SWAP Signed-off-by: Stéphane Graber ","diff --git a/README.md b/README.md index 5272a6c..3c638c3 100644 --- a/README.md +++ b/README.md @@ -104,3 +104,50 @@ docker run -it -m 256m --memory-swap 256m \ In a system with swap enabled, the parameter ""-u"" can be used to set all values in ""meminfo"" that refer to the swap to 0. sudo lxcfs -u /var/lib/lxcfs + +## Swap handling +If you noticed LXCFS not showing any SWAP in your container despite +having SWAP on your system, please read this section carefully and look +for instructions on how to enable SWAP accounting for your distribution. + +Swap cgroup handling on Linux is very confusing and there just isn't a +perfect way for LXCFS to handle it. + +Terminology used below: + - RAM refers to `memory.usage_in_bytes` and `memory.limit_in_bytes` + - RAM+SWAP refers to `memory.memsw.usage_in_bytes` and `memory.memsw.limit_in_bytes` + +The main issues are: + - SWAP accounting is often opt-in and, requiring a special kernel boot + time option (`swapaccount=1`) and/or special kernel build options + (`CONFIG_MEMCG_SWAP`). + + - Both a RAM limit and a RAM+SWAP limit can be set. The delta however + isn't the available SWAP space as the kernel is still free to SWAP as + much of the RAM as it feels like. This makes it impossible to render + a SWAP device size as using the delta between RAM and RAM+SWAP for that + wouldn't account for the kernel swapping more pages, leading to swap + usage exceeding swap total. + + - It's impossible to disable SWAP in a given container. The closest + that can be done is setting swappiness down to 0 which severly limits + the risk of swapping pages but doesn't eliminate it. + +As a result, LXCFS had to make some compromise which go as follow: + - When SWAP accounting isn't enabled, no SWAP space is reported at all. + This is simply because there is no way to know the SWAP consumption. + The container may very much be using some SWAP though, there's just + no way to know how much of it and showing a SWAP device would require + some kind of SWAP usage to be reported. Showing the host value would be + completely wrong, showing a 0 value would be equallty wrong. + + - Because SWAP usage for a given container can exceed the delta between + RAM and RAM+SWAP, the SWAP size is always reported to be the smaller of + the RAM+SWAP limit or the host SWAP device itself. This ensures that at no + point SWAP usage will be allowed to exceed the SWAP size. + + - If the swappiness is set to 0 and there is no SWAP usage, no SWAP is reported. + However if there is SWAP usage, then a SWAP device of the size of the + usage (100% full) is reported. This provides adequate reporting of + the memory consumption while preventing applications from assuming more + SWAP is available. ",0 ed5506e3c6f3e4f270bd9d7b7e54aea785f92ddb,https://github.com/fabpot/Twig/commit/ed5506e3c6f3e4f270bd9d7b7e54aea785f92ddb,fixed usage of deprecated features,"diff --git a/lib/Twig/Profiler/NodeVisitor/Profiler.php b/lib/Twig/Profiler/NodeVisitor/Profiler.php index 781b7909a3..d34532b2d6 100644 --- a/lib/Twig/Profiler/NodeVisitor/Profiler.php +++ b/lib/Twig/Profiler/NodeVisitor/Profiler.php @@ -36,19 +36,19 @@ protected function doLeaveNode(Twig_Node $node, Twig_Environment $env) { if ($node instanceof Twig_Node_Module) { $varName = $this->getVarName(); - $node->setNode('display_start', new Twig_Node(array(new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::TEMPLATE, $node->getAttribute('name'), $varName), $node->getNode('display_start')))); + $node->setNode('display_start', new Twig_Node(array(new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::TEMPLATE, $node->getName(), $varName), $node->getNode('display_start')))); $node->setNode('display_end', new Twig_Node(array(new Twig_Profiler_Node_LeaveProfile($varName), $node->getNode('display_end')))); } elseif ($node instanceof Twig_Node_Block) { $varName = $this->getVarName(); $node->setNode('body', new Twig_Node_Body(array( - new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::BLOCK, $node->getAttribute('name'), $varName), + new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::BLOCK, $node->getName(), $varName), $node->getNode('body'), new Twig_Profiler_Node_LeaveProfile($varName), ))); } elseif ($node instanceof Twig_Node_Macro) { $varName = $this->getVarName(); $node->setNode('body', new Twig_Node_Body(array( - new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::MACRO, $node->getAttribute('name'), $varName), + new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::MACRO, $node->getName(), $varName), $node->getNode('body'), new Twig_Profiler_Node_LeaveProfile($varName), ))); ",0 ebdebefb6725480270140d1d41511111eea4a8a3,https://github.com/Katello/katello-installer/commit/ebdebefb6725480270140d1d41511111eea4a8a3,"Fixes #25665 - Use the bash comparisons can function calls The use of == is a bash-only feature. Since we're using this already, we might as well go all the way and use the safer [[ ]] checks. Using $() instead of `` is also a better practice because it allows nesting and slightly easier to read.","diff --git a/bin/katello-certs-check b/bin/katello-certs-check index da6d5b1a..7cfaf39f 100755 --- a/bin/katello-certs-check +++ b/bin/katello-certs-check @@ -66,11 +66,11 @@ function warning () { function check-server-cert-encoding () { printf 'Checking server certificate encoding: ' openssl x509 -inform pem -in $CERT_FILE -noout -text &> /dev/null - if [ $? == ""0"" ]; then + if [[ $? == ""0"" ]]; then success else openssl x509 -inform der -in $CERT_FILE -noout -text &> /dev/null - if [ $? == ""0"" ]; then + if [[ $? == ""0"" ]]; then error 8 ""The server certificate is in DER encoding, which is incompatible.\n\n"" printf ""Run the following command to convert the certificate to PEM encoding,\n"" printf ""then test it again.\n"" @@ -87,17 +87,17 @@ function check-expiration () { DATE=$(date -u +""%b %-d %R:%S %Y"") CERT_EXP=$(openssl x509 -noout -enddate -in $CERT_FILE | sed -e 's/notAfter=//' | awk '{$NF="""";}1') CA_EXP=$(openssl x509 -noout -enddate -in $CA_BUNDLE_FILE | sed -e 's/notAfter=//' | awk '{$NF="""";}1') - DATE_TODAY=`date -d""${DATE}"" +%Y%m%d%H%M%S` - CERT_DATE=`date -d""${CERT_EXP}"" +%Y%m%d%H%M%S` - CA_DATE=`date -d""${CA_EXP}"" +%Y%m%d%H%M%S` + DATE_TODAY=$(date -d""${DATE}"" +%Y%m%d%H%M%S) + CERT_DATE=$(date -d""${CERT_EXP}"" +%Y%m%d%H%M%S) + CA_DATE=$(date -d""${CA_EXP}"" +%Y%m%d%H%M%S) printf ""Checking expiration of certificate: "" - if [ $DATE_TODAY -gt $CERT_DATE ]; then + if [[ $DATE_TODAY -gt $CERT_DATE ]]; then error 6 ""The certificate \""$CERT_FILE\"" has already expired on: $CERT_EXP"" else success fi printf ""Checking expiration of CA bundle: "" - if [ $DATE_TODAY -gt $CA_DATE ]; then + if [[ $DATE_TODAY -gt $CA_DATE ]]; then error 7 ""The CA bundle \""$CA_BUNDLE_FILE\"" has already expired on: $CA_EXP"" else success @@ -107,7 +107,7 @@ function check-expiration () { function check-cert-ca-flag () { printf ""Checking if server certificate has CA:TRUE flag "" openssl x509 -in $CERT_FILE -noout -text | grep -q CA:TRUE - if [ $? -ne 0 ]; then + if [[ $? -ne 0 ]]; then success else error 7 ""The server certificate is marked as a CA and can not be used."" @@ -118,7 +118,7 @@ function check-priv-key () { printf ""Checking to see if the private key matches the certificate: "" CERT_MOD=$(openssl x509 -noout -modulus -in $CERT_FILE) KEY_MOD=$(openssl rsa -noout -modulus -in $KEY_FILE) - if [ ""$CERT_MOD"" != ""$KEY_MOD"" ]; then + if [[ ""$CERT_MOD"" != ""$KEY_MOD"" ]]; then error 2 ""The $KEY_FILE does not match the $CERT_FILE"" else success @@ -128,7 +128,7 @@ function check-priv-key () { function check-ca-bundle () { printf ""Checking CA bundle against the certificate file: "" CHECK=$(openssl verify -CAfile $CA_BUNDLE_FILE -purpose sslserver -verbose $CERT_FILE 2>&1) - if [ $? == ""0"" ]; then + if [[ $? == ""0"" ]]; then success else error 4 ""The $CA_BUNDLE_FILE does not verify the $CERT_FILE"" @@ -139,7 +139,7 @@ function check-ca-bundle () { function check-cert-san () { printf ""Checking Subject Alt Name on certificate "" CHECK=$(openssl x509 -noout -text -in $CERT_FILE | grep DNS:) - if [ $? == ""0"" ]; then + if [[ $? == ""0"" ]]; then success else warning @@ -150,7 +150,7 @@ function check-cert-san () { function check-cert-usage-key-encipherment () { printf ""Checking Key Usage extension on certificate for Key Encipherment "" CHECK=$(openssl x509 -noout -text -in $CERT_FILE | grep -A1 'X509v3 Key Usage:' | grep 'Key Encipherment') - if [ $? == ""0"" ]; then + if [[ $? == ""0"" ]]; then success else error 4 ""The $CERT_FILE does not allow for the 'Digital Signature' key usage."" @@ -165,7 +165,7 @@ check-ca-bundle check-cert-san check-cert-usage-key-encipherment -if [ $EXIT_CODE == ""0"" -a $CERT_HOSTNAME == $HOSTNAME ]; then +if [[ $EXIT_CODE == ""0"" ]] && [[ $CERT_HOSTNAME == $HOSTNAME ]]; then echo -e ""${GREEN}Validation succeeded${RESET}\n"" cat <output_encoding = IWCMD_ENCODING_ASCII; + if(!strcmp(v,""auto"")) { + p->output_encoding_req = IWCMD_ENCODING_AUTO; } - else if(!strcmp(v,""utf8"")) { -#ifdef _UNICODE - // In Windows, if we set the output mode to UTF-8, we have to print - // using UTF-16, and let Windows do the conversion. - p->output_encoding = IWCMD_ENCODING_UTF16; - p->output_encoding_setmode = IWCMD_ENCODING_UTF8; -#else - p->output_encoding = IWCMD_ENCODING_UTF8; -#endif + else if(!strcmp(v,""ascii"")) { + p->output_encoding_req = IWCMD_ENCODING_ASCII; } - else if(!strcmp(v,""utf8raw"")) { - p->output_encoding = IWCMD_ENCODING_UTF8; + else if(!strcmp(v,""utf8"")) { + p->output_encoding_req = IWCMD_ENCODING_UTF8; } #ifdef _UNICODE else if(!strcmp(v,""utf16"")) { - p->output_encoding = IWCMD_ENCODING_UTF16; - p->output_encoding_setmode = IWCMD_ENCODING_UTF16; - } - else if(!strcmp(v,""utf16raw"")) { - p->output_encoding = IWCMD_ENCODING_UTF16; + p->output_encoding_req = IWCMD_ENCODING_UTF16; } #endif else { + iwcmd_error(p,""Unknown encoding \xe2\x80\x9c%s\xe2\x80\x9d\n"",v); return 0; } @@ -2494,25 +2484,50 @@ static int read_encoding_option(struct params_struct *p, const char *v) // Figure out what output character encoding to use, and do other // encoding-related setup as needed. -static void handle_encoding(struct params_struct *p, int argc, char* argv[]) +static int handle_encoding(struct params_struct *p, int argc, char* argv[]) { int i; +#ifdef IW_WINDOWS + int is_windows_console = 0; + BOOL b; + DWORD consolemode=0; +#endif // Pre-scan the arguments for an ""encoding"" option. // This has to be done before we process the other options, so that we // can correctly print messages while parsing the other options. for(i=1;ioutput_encoding = p->output_encoding_req; // Initial default + +#ifdef IW_WINDOWS + b=GetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE),&consolemode); + // According to the documentation of WriteConsole(), if GetConsoleMode() + // succeeds, we've got a real console. + if(b) is_windows_console = 1; +#endif + #if defined(_UNICODE) // If the user didn't set an encoding, and this is a Windows Unicode - // build, use UTF-16. - if(p->output_encoding==IWCMD_ENCODING_AUTO) { - p->output_encoding = IWCMD_ENCODING_UTF16; - p->output_encoding_setmode = IWCMD_ENCODING_UTF16; + // build, use UTF-16 if we're writing to a real Windows console, or UTF-8 + // otherwise (e.g. if we're redirected to a file). + // I think we could call _setmode(...,_O_U8TEXT) to do essentially the + // same thing as this. We avoid that because it would mean we'd have to + // convert our internal UTF-8 text to UTF-16, only to have it be + // immediately converted back to UTF-8. + if(p->output_encoding_req==IWCMD_ENCODING_AUTO) { + if(is_windows_console) { + p->output_encoding = IWCMD_ENCODING_UTF16; + } + else { + p->output_encoding = IWCMD_ENCODING_UTF8; + } } #elif !defined(IW_NO_LOCALE) @@ -2520,7 +2535,7 @@ static void handle_encoding(struct params_struct *p, int argc, char* argv[]) setlocale(LC_CTYPE,""""); // If the user didn't set an encoding, try to detect if we should use // UTF-8. - if(p->output_encoding==IWCMD_ENCODING_AUTO) { + if(p->output_encoding_req==IWCMD_ENCODING_AUTO) { if(strcmp(nl_langinfo(CODESET), ""UTF-8"") == 0) { p->output_encoding = IWCMD_ENCODING_UTF8; } @@ -2534,18 +2549,16 @@ static void handle_encoding(struct params_struct *p, int argc, char* argv[]) } #ifdef IW_WINDOWS - // In Windows, set the output mode, if appropriate. - if(p->output_encoding_setmode==IWCMD_ENCODING_UTF8) { - _setmode(_fileno(stdout),_O_U8TEXT); - } - // TODO: Not sure how much of this works in non-Unicode builds. Need to - // investigate that (or remove support for non-Unicode builds). #ifdef _UNICODE - if(p->output_encoding_setmode==IWCMD_ENCODING_UTF16) { + if(p->output_encoding==IWCMD_ENCODING_UTF16) { + // Tell the C library (e.g. fputws()) not not to translate our UTF-16 + // text to an ""ANSI"" encoding, or anything else. _setmode(_fileno(stdout),_O_U16TEXT); } #endif #endif + + return 1; } // Our ""schemes"" consist of 2-32 lowercase letters, digits, and {+,-,.}. @@ -2613,7 +2626,9 @@ static int iwcmd_read_commandline(struct params_struct *p, int argc, char* argv[ ps.printversion=0; ps.showhelp=0; - handle_encoding(p,argc,argv); + if(!handle_encoding(p,argc,argv)) { + return IWCMD_ACTION_EXIT_FAIL; + } for(i=1;iinfmt=IW_FORMAT_UNKNOWN; p->outfmt=IW_FORMAT_UNKNOWN; p->output_encoding=IWCMD_ENCODING_AUTO; - p->output_encoding_setmode=IWCMD_ENCODING_AUTO; + p->output_encoding_req=IWCMD_ENCODING_AUTO; p->resize_blur_x.blur = 1.0; p->resize_blur_y.blur = 1.0; p->webp_quality = -1.0; ",0 af2969dec58ca89150b84b5d57edcf63d4ce1302,https://github.com/apache/cordova-android/commit/af2969dec58ca89150b84b5d57edcf63d4ce1302,CB-8587 Don't allow webview navigations within showWebPage that are not whitelisted,"diff --git a/framework/src/org/apache/cordova/CordovaWebViewImpl.java b/framework/src/org/apache/cordova/CordovaWebViewImpl.java index d3f5ec9b9e..a7dd41a9b6 100644 --- a/framework/src/org/apache/cordova/CordovaWebViewImpl.java +++ b/framework/src/org/apache/cordova/CordovaWebViewImpl.java @@ -209,7 +209,7 @@ public void loadUrl(String url) { @Override public void showWebPage(String url, boolean openExternal, boolean clearHistory, Map params) { - LOG.d(TAG, ""showWebPage(%s, %b, %b, HashMap"", url, openExternal, clearHistory); + LOG.d(TAG, ""showWebPage(%s, %b, %b, HashMap)"", url, openExternal, clearHistory); // If clearing history if (clearHistory) { @@ -223,10 +223,13 @@ public void showWebPage(String url, boolean openExternal, boolean clearHistory, // TODO: What about params? // Load new URL loadUrlIntoView(url, true); - return; + } else { + LOG.w(TAG, ""showWebPage: Refusing to load URL into webview since it is not in the whitelist. URL="" + url); } - // Load in default viewer if not - LOG.w(TAG, ""showWebPage: Cannot load URL into webview since it is not in white list. Loading into browser instead. (URL="" + url + "")""); + } + if (!pluginManager.shouldOpenExternalUrl(url)) { + LOG.w(TAG, ""showWebPage: Refusing to send intent for URL since it is not in the whitelist. URL="" + url); + return; } try { // Omitting the MIME type for file: URLs causes ""No Activity found to handle Intent"". ",1 35a230d6e227e9cb7a00a8f99a27d65b7eeaef28,https://github.com/InstantUpdate/CMS/commit/35a230d6e227e9cb7a00a8f99a27d65b7eeaef28,fix(core): Disabled plugins (temporarily),"diff --git a/index.php b/index.php index 33dcd85..4b6f10f 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,6 @@ load->library('pluginmanager'); //bootstrap plugins - $this->pluginmanager->bootstrapActivePlugins(); +// $this->pluginmanager->bootstrapActivePlugins(); //hack for datamapper prefix DataMapper::$config['prefix'] = $this->db->dbprefix; ",0 e6e05853d061846c17d13d0ea1dd219492f9af8d,https://github.com/jupyter/notebook/commit/e6e05853d061846c17d13d0ea1dd219492f9af8d,Update notebook.js (#5733),"diff --git a/notebook/static/notebook/js/notebook.js b/notebook/static/notebook/js/notebook.js index 291842fc02..ba037c4310 100644 --- a/notebook/static/notebook/js/notebook.js +++ b/notebook/static/notebook/js/notebook.js @@ -2920,6 +2920,14 @@ define([ click: function() { var nb_path = d.find('input').val(); var nb_name = nb_path.split('/').slice(-1).pop(); + if (!nb_name) { + $("".save-message"").html( + $("""") + .attr(""style"", ""color:red;"") + .text($("".save-message"").text()) + ); + return false; + } // If notebook name does not contain extension '.ipynb' add it var ext = utils.splitext(nb_name)[1]; if (ext === '') { ",0 cd4663dc80323ba64989d0c103d51ad3ee0e9c2f,https://github.com/libav/libav/commit/cd4663dc80323ba64989d0c103d51ad3ee0e9c2f,"smacker: add sanity check for length in smacker_decode_tree() Signed-off-by: Michael Niedermayer Bug-Id: 1098 Cc: libav-stable@libav.org Signed-off-by: Sean McGovern ","diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index 0e057a1c2a..7deccffa54 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -43,7 +43,7 @@ #define SMKTREE_BITS 9 #define SMK_NODE 0x80000000 - +#define SMKTREE_DECODE_MAX_RECURSION 32 typedef struct SmackVContext { AVCodecContext *avctx; @@ -97,6 +97,11 @@ enum SmkBlockTypes { static int smacker_decode_tree(BitstreamContext *bc, HuffContext *hc, uint32_t prefix, int length) { + if (length > SMKTREE_DECODE_MAX_RECURSION) { + av_log(NULL, AV_LOG_ERROR, ""Maximum tree recursion level exceeded.\n""); + return AVERROR_INVALIDDATA; + } + if (!bitstream_read_bit(bc)) { // Leaf if(hc->current >= 256){ av_log(NULL, AV_LOG_ERROR, ""Tree size exceeded!\n""); ",1 b101a6bbd4f2181c360bd38e7683df4a03cba83e,https://github.com/php/php-src/commit/b101a6bbd4f2181c360bd38e7683df4a03cba83e,Use format string,"diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 9979aac2560f9..fdffed34b2757 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -218,7 +218,7 @@ static void zend_throw_or_error(int fetch_type, zend_class_entry *exception_ce, zend_vspprintf(&message, 0, format, va); if (fetch_type & ZEND_FETCH_CLASS_EXCEPTION) { - zend_throw_error(exception_ce, message); + zend_throw_error(exception_ce, ""%s"", message); } else { zend_error(E_ERROR, ""%s"", message); } ",1 eef532aa668d656b9d61d9c6edf7c2505f3f43c7,https://github.com/theforeman/smart-proxy/commit/eef532aa668d656b9d61d9c6edf7c2505f3f43c7,Fixes #14931 - TFTP class instantiating fixed,"diff --git a/modules/tftp/tftp_api.rb b/modules/tftp/tftp_api.rb index 9218e8d63..e2ff7f398 100644 --- a/modules/tftp/tftp_api.rb +++ b/modules/tftp/tftp_api.rb @@ -8,13 +8,14 @@ class Api < ::Sinatra::Base helpers ::Proxy::Helpers authorize_with_trusted_hosts authorize_with_ssl_client + VARIANTS = [""Syslinux"", ""Pxegrub"", ""Pxegrub2"", ""Ztp"", ""Poap""].freeze helpers do def instantiate variant, mac=nil # Filenames must end in a hex representation of a mac address but only if mac is not empty log_halt 403, ""Invalid MAC address: #{mac}"" unless valid_mac?(mac) || mac.nil? - log_halt 403, ""Unrecognized pxeboot config type: #{variant}"" unless defined? variant.capitalize - eval ""Proxy::TFTP::#{variant.capitalize}.new"" + log_halt 403, ""Unrecognized pxeboot config type: #{variant}"" unless VARIANTS.include?(variant.capitalize) + Object.const_get(""Proxy"").const_get('TFTP').const_get(variant.capitalize).new end def create variant, mac diff --git a/test/tftp/tftp_api_test.rb b/test/tftp/tftp_api_test.rb index 1dd5a16da..2a0ff55c6 100644 --- a/test/tftp/tftp_api_test.rb +++ b/test/tftp/tftp_api_test.rb @@ -17,6 +17,17 @@ def setup @args = { :pxeconfig => ""foo"" } end + def test_instantiate_syslinux + obj = app.helpers.instantiate ""syslinux"", ""AA:BB:CC:DD:EE:FF"" + assert_equal ""Proxy::TFTP::Syslinux"", obj.class.name + end + + def test_instantiate_nonexisting + subject = app + subject.helpers.expects(:log_halt).with(403, ""Unrecognized pxeboot config type: Server"").at_least(1) + subject.helpers.instantiate ""Server"", ""AA:BB:CC:DD:EE:FF"" + end + def test_api_can_fetch_boot_file Proxy::Util::CommandTask.stubs(:new).returns(true) FileUtils.stubs(:mkdir_p).returns(true) ",1 156f7e12b215bddbaf3df4514c399d683e6cdadc,https://github.com/ua-parser/uap-core/commit/156f7e12b215bddbaf3df4514c399d683e6cdadc,"Merge pull request #363 from commenthol/safe-regex regexes update","diff --git a/.travis.yml b/.travis.yml index ba58f19..b7017f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,13 @@ sudo: false language: node_js node_js: - - 4 - - 6 - 8 + - 10 - node script: - ""npm test"" - + notifications: irc: ""chat.freenode.net#ua-parser"" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 30bcf3b..5fbfb41 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,9 +10,10 @@ Contributing to the project, especially `regexes.yaml`, is both welcomed and enc * `tests/test_device.yaml` * `tests/test_os.yaml` * `tests/test_ua.yaml` -5. Push your branch to GitHub and submit a pull request -6. Monitor the pull request to make sure the Travis build succeeds. If it fails simply make the necessary changes to your branch and push it. Travis will re-test the changes. +5. Check that your regex is not vulnerable to [ReDoS](https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS) using the test in `tests/regexes.js` +6. Push your branch to GitHub and submit a pull request +7. Monitor the pull request to make sure the Travis build succeeds. If it fails simply make the necessary changes to your branch and push it. Travis will re-test the changes. That's it. If you don't feel comfortable forking the project or modifying the YAML you can also [submit an issue](https://github.com/ua-parser/uap-core/issues) that includes the appropriate user agent string and the expected results of parsing. -Thanks! \ No newline at end of file +Thanks! diff --git a/package.json b/package.json index 0c66938..b2e8616 100644 --- a/package.json +++ b/package.json @@ -25,11 +25,12 @@ } ], ""devDependencies"": { - ""yamlparser"": "">=0.0.2"", ""mocha"": ""*"", - ""uap-ref-impl"": ""ua-parser/uap-ref-impl"" + ""safe-regex"": ""^2.0.1"", + ""uap-ref-impl"": ""git+https://github.com/ua-parser/uap-ref-impl#master"", + ""yamlparser"": "">=0.0.2"" }, ""scripts"": { - ""test"": ""mocha -u tdd -R min ./tests/test.js"" + ""test"": ""mocha --opts ./tests/mocha.opts ./tests"" } } diff --git a/regexes.yaml b/regexes.yaml index 7a97ab0..7a14798 100644 --- a/regexes.yaml +++ b/regexes.yaml @@ -7,9 +7,9 @@ user_agent_parsers: family_replacement: 'AntennaPod' - regex: '(TopPodcasts)Pro/(\d+) CFNetwork' - regex: '(MusicDownloader)Lite/(\d+)\.(\d+)\.(\d+) CFNetwork' - - regex: '^(.*)-iPad/(\d+)\.?(\d+)?.?(\d+)?.?(\d+)? CFNetwork' - - regex: '^(.*)-iPhone/(\d+)\.?(\d+)?.?(\d+)?.?(\d+)? CFNetwork' - - regex: '^(.*)/(\d+)\.?(\d+)?.?(\d+)?.?(\d+)? CFNetwork' + - regex: '^(.*)-iPad\/(\d+)(?:\.(\d+)|)(?:\.(\d+)|)(?:\.(\d+)|) CFNetwork' + - regex: '^(.*)-iPhone/(\d+)(?:\.(\d+)|)(?:\.(\d+)|)(?:\.(\d+)|) CFNetwork' + - regex: '^(.*)/(\d+)(?:\.(\d+)|)(?:\.(\d+)|)(?:\.(\d+)|) CFNetwork' # Podcast catchers - regex: '(espn\.go)' @@ -23,7 +23,7 @@ user_agent_parsers: - regex: ' (Rivo) RHYTHM' # @note: iOS / OSX Applications - - regex: '(CFNetwork)(?:/(\d+)\.(\d+)\.?(\d+)?)?' + - regex: '(CFNetwork)(?:/(\d+)\.(\d+)(?:\.(\d+)|)|)' family_replacement: 'CFNetwork' # Pingdom @@ -69,37 +69,37 @@ user_agent_parsers: family_replacement: 'TwitterBot' # Bots Pattern '/name-0.0' - - regex: '/((?:Ant-)?Nutch|[A-z]+[Bb]ot|[A-z]+[Ss]pider|Axtaris|fetchurl|Isara|ShopSalad|Tailsweep)[ \-](\d+)(?:\.(\d+)(?:\.(\d+))?)?' + - regex: '/((?:Ant-|)Nutch|[A-z]+[Bb]ot|[A-z]+[Ss]pider|Axtaris|fetchurl|Isara|ShopSalad|Tailsweep)[ \-](\d+)(?:\.(\d+)|)(?:\.(\d+)|)' # Bots Pattern 'name/0.0' - - regex: '\b(008|Altresium|Argus|BaiduMobaider|BoardReader|DNSGroup|DataparkSearch|EDI|Goodzer|Grub|INGRID|Infohelfer|LinkedInBot|LOOQ|Nutch|PathDefender|Peew|PostPost|Steeler|Twitterbot|VSE|WebCrunch|WebZIP|Y!J-BR[A-Z]|YahooSeeker|envolk|sproose|wminer)/(\d+)(?:\.(\d+)(?:\.(\d+))?)?' + - regex: '\b(008|Altresium|Argus|BaiduMobaider|BoardReader|DNSGroup|DataparkSearch|EDI|Goodzer|Grub|INGRID|Infohelfer|LinkedInBot|LOOQ|Nutch|PathDefender|Peew|PostPost|Steeler|Twitterbot|VSE|WebCrunch|WebZIP|Y!J-BR[A-Z]|YahooSeeker|envolk|sproose|wminer)/(\d+)(?:\.(\d+)|)(?:\.(\d+)|)' # MSIECrawler - - regex: '(MSIE) (\d+)\.(\d+)([a-z]\d?)?;.* MSIECrawler' + - regex: '(MSIE) (\d+)\.(\d+)([a-z]\d|[a-z]|);.* MSIECrawler' family_replacement: 'MSIECrawler' # DAVdroid - - regex: '(DAVdroid)/(\d+)\.(\d+)(?:\.(\d+))?' + - regex: '(DAVdroid)/(\d+)\.(\d+)(?:\.(\d+)|)' # Downloader ... - - regex: '(Google-HTTP-Java-Client|Apache-HttpClient|Go-http-client|scalaj-http|http%20client|Python-urllib|HttpMonitor|TLSProber|WinHTTP|JNLP|okhttp|aihttp|reqwest)(?:[ /](\d+)(?:\.(\d+)(?:\.(\d+))?)?)?' + - regex: '(Google-HTTP-Java-Client|Apache-HttpClient|Go-http-client|scalaj-http|http%20client|Python-urllib|HttpMonitor|TLSProber|WinHTTP|JNLP|okhttp|aihttp|reqwest)(?:[ /](\d+)(?:\.(\d+)|)(?:\.(\d+)|)|)' # Pinterestbot - - regex: '(Pinterest(?:bot)?)/(\d+)(?:\.(\d+)(?:\.(\d+))?)?[;\s\(]+\+https://www.pinterest.com/bot.html' + - regex: '(Pinterest(?:bot|))/(\d+)(?:\.(\d+)|)(?:\.(\d+)|)[;\s(]+\+https://www.pinterest.com/bot.html' family_replacement: 'Pinterestbot' # Bots - - regex: '(1470\.net crawler|50\.nu|8bo Crawler Bot|Aboundex|Accoona-[A-z]+-Agent|AdsBot-Google(?:-[a-z]+)?|altavista|AppEngine-Google|archive.*?\.org_bot|archiver|Ask Jeeves|[Bb]ai[Dd]u[Ss]pider(?:-[A-Za-z]+)*|bingbot|BingPreview|blitzbot|BlogBridge|Bloglovin|BoardReader(?: [A-Za-z]+)*|boitho.com-dc|BotSeer|BUbiNG|\b\w*favicon\w*\b|\bYeti(?:-[a-z]+)?|Catchpoint(?: bot)?|[Cc]harlotte|Checklinks|clumboot|Comodo HTTP\(S\) Crawler|Comodo-Webinspector-Crawler|ConveraCrawler|CRAWL-E|CrawlConvera|Daumoa(?:-feedfetcher)?|Feed Seeker Bot|Feedbin|findlinks|Flamingo_SearchEngine|FollowSite Bot|furlbot|Genieo|gigabot|GomezAgent|gonzo1|(?:[a-zA-Z]+-)?Googlebot(?:-[a-zA-Z]+)?|Google SketchUp|grub-client|gsa-crawler|heritrix|HiddenMarket|holmes|HooWWWer|htdig|ia_archiver|ICC-Crawler|Icarus6j|ichiro(?:/mobile)?|IconSurf|IlTrovatore(?:-Setaccio)?|InfuzApp|Innovazion Crawler|InternetArchive|IP2[a-z]+Bot|jbot\b|KaloogaBot|Kraken|Kurzor|larbin|LEIA|LesnikBot|Linguee Bot|LinkAider|LinkedInBot|Lite Bot|Llaut|lycos|Mail\.RU_Bot|masscan|masidani_bot|Mediapartners-Google|Microsoft .*? Bot|mogimogi|mozDex|MJ12bot|msnbot(?:-media *)?|msrbot|Mtps Feed Aggregation System|netresearch|Netvibes|NewsGator[^/]*|^NING|Nutch[^/]*|Nymesis|ObjectsSearch|Orbiter|OOZBOT|PagePeeker|PagesInventory|PaxleFramework|Peeplo Screenshot Bot|PlantyNet_WebRobot|Pompos|Qwantify|Read%20Later|Reaper|RedCarpet|Retreiver|Riddler|Rival IQ|scooter|Scrapy|Scrubby|searchsight|seekbot|semanticdiscovery|SemrushBot|Simpy|SimplePie|SEOstats|SimpleRSS|SiteCon|Slackbot-LinkExpanding|Slack-ImgProxy|Slurp|snappy|Speedy Spider|Squrl Java|Stringer|TheUsefulbot|ThumbShotsBot|Thumbshots\.ru|Tiny Tiny RSS|TwitterBot|WhatsApp|URL2PNG|Vagabondo|VoilaBot|^vortex|Votay bot|^voyager|WASALive.Bot|Web-sniffer|WebThumb|WeSEE:[A-z]+|WhatWeb|WIRE|WordPress|Wotbox|www\.almaden\.ibm\.com|Xenu(?:.s)? Link Sleuth|Xerka [A-z]+Bot|yacy(?:bot)?|Yahoo[a-z]*Seeker|Yahoo! Slurp|Yandex\w+|YodaoBot(?:-[A-z]+)?|YottaaMonitor|Yowedo|^Zao|^Zao-Crawler|ZeBot_www\.ze\.bz|ZooShot|ZyBorg)(?:[ /]v?(\d+)(?:\.(\d+)(?:\.(\d+))?)?)?' + - regex: '(1470\.net crawler|50\.nu|8bo Crawler Bot|Aboundex|Accoona-[A-z]{1,30}-Agent|AdsBot-Google(?:-[a-z]{1,30}|)|altavista|AppEngine-Google|archive.{0,30}\.org_bot|archiver|Ask Jeeves|[Bb]ai[Dd]u[Ss]pider(?:-[A-Za-z]{1,30})(?:-[A-Za-z]{1,30}|)|bingbot|BingPreview|blitzbot|BlogBridge|Bloglovin|BoardReader Blog Indexer|BoardReader Favicon Fetcher|boitho.com-dc|BotSeer|BUbiNG|\b\w{0,30}favicon\w{0,30}\b|\bYeti(?:-[a-z]{1,30}|)|Catchpoint(?: bot|)|[Cc]harlotte|Checklinks|clumboot|Comodo HTTP\(S\) Crawler|Comodo-Webinspector-Crawler|ConveraCrawler|CRAWL-E|CrawlConvera|Daumoa(?:-feedfetcher|)|Feed Seeker Bot|Feedbin|findlinks|Flamingo_SearchEngine|FollowSite Bot|furlbot|Genieo|gigabot|GomezAgent|gonzo1|(?:[a-zA-Z]{1,30}-|)Googlebot(?:-[a-zA-Z]{1,30}|)|Google SketchUp|grub-client|gsa-crawler|heritrix|HiddenMarket|holmes|HooWWWer|htdig|ia_archiver|ICC-Crawler|Icarus6j|ichiro(?:/mobile|)|IconSurf|IlTrovatore(?:-Setaccio|)|InfuzApp|Innovazion Crawler|InternetArchive|IP2[a-z]{1,30}Bot|jbot\b|KaloogaBot|Kraken|Kurzor|larbin|LEIA|LesnikBot|Linguee Bot|LinkAider|LinkedInBot|Lite Bot|Llaut|lycos|Mail\.RU_Bot|masscan|masidani_bot|Mediapartners-Google|Microsoft .{0,30} Bot|mogimogi|mozDex|MJ12bot|msnbot(?:-media {0,2}|)|msrbot|Mtps Feed Aggregation System|netresearch|Netvibes|NewsGator[^/]{0,30}|^NING|Nutch[^/]{0,30}|Nymesis|ObjectsSearch|Orbiter|OOZBOT|PagePeeker|PagesInventory|PaxleFramework|Peeplo Screenshot Bot|PlantyNet_WebRobot|Pompos|Qwantify|Read%20Later|Reaper|RedCarpet|Retreiver|Riddler|Rival IQ|scooter|Scrapy|Scrubby|searchsight|seekbot|semanticdiscovery|SemrushBot|Simpy|SimplePie|SEOstats|SimpleRSS|SiteCon|Slackbot-LinkExpanding|Slack-ImgProxy|Slurp|snappy|Speedy Spider|Squrl Java|Stringer|TheUsefulbot|ThumbShotsBot|Thumbshots\.ru|Tiny Tiny RSS|TwitterBot|WhatsApp|URL2PNG|Vagabondo|VoilaBot|^vortex|Votay bot|^voyager|WASALive.Bot|Web-sniffer|WebThumb|WeSEE:[A-z]{1,30}|WhatWeb|WIRE|WordPress|Wotbox|www\.almaden\.ibm\.com|Xenu(?:.s|) Link Sleuth|Xerka [A-z]{1,30}Bot|yacy(?:bot|)|YahooSeeker|Yahoo! Slurp|Yandex\w{1,30}|YodaoBot(?:-[A-z]{1,30}|)|YottaaMonitor|Yowedo|^Zao|^Zao-Crawler|ZeBot_www\.ze\.bz|ZooShot|ZyBorg)(?:[ /]v?(\d+)(?:\.(\d+)(?:\.(\d+)|)|)|)' # AWS S3 Clients # must come before ""Bots General matcher"" to catch ""boto""/""boto3"" before ""bot"" - - regex: '\b(Boto3?|JetS3t|aws-(?:cli|sdk-(?:cpp|go|java|nodejs|ruby2?))|s3fs)/(\d+)\.(\d+)(?:\.(\d+))?' + - regex: '\b(Boto3?|JetS3t|aws-(?:cli|sdk-(?:cpp|go|java|nodejs|ruby2?))|s3fs)/(\d+)\.(\d+)(?:\.(\d+)|)' # Bots General matcher 'name/0.0' - - regex: '(?:\/[A-Za-z0-9\.]+)? *([A-Za-z0-9 \-_\!\[\]:]*(?:[Aa]rchiver|[Ii]ndexer|[Ss]craper|[Bb]ot|[Ss]pider|[Cc]rawl[a-z]*))/(\d+)(?:\.(\d+)(?:\.(\d+))?)?' + - regex: '(?:\/[A-Za-z0-9\.]+|) *([A-Za-z0-9 \-_\!\[\]:]*(?:[Aa]rchiver|[Ii]ndexer|[Ss]craper|[Bb]ot|[Ss]pider|[Cc]rawl[a-z]*))/(\d+)(?:\.(\d+)(?:\.(\d+)|)|)' # Bots General matcher 'name 0.0' - - regex: '(?:\/[A-Za-z0-9\.]+)? *([A-Za-z0-9 _\!\[\]:]*(?:[Aa]rchiver|[Ii]ndexer|[Ss]craper|[Bb]ot|[Ss]pider|[Cc]rawl[a-z]*)) (\d+)(?:\.(\d+)(?:\.(\d+))?)?' + - regex: '(?:\/[A-Za-z0-9\.]+|) *([A-Za-z0-9 _\!\[\]:]*(?:[Aa]rchiver|[Ii]ndexer|[Ss]craper|[Bb]ot|[Ss]pider|[Cc]rawl[a-z]*)) (\d+)(?:\.(\d+)(?:\.(\d+)|)|)' # Bots containing spider|scrape|bot(but not CUBOT)|Crawl - - regex: '((?:[A-z0-9]+|[A-z\-]+ ?)?(?: the )?(?:[Ss][Pp][Ii][Dd][Ee][Rr]|[Ss]crape|[A-Za-z0-9-]*(?:[^C][^Uu])[Bb]ot|[Cc][Rr][Aa][Ww][Ll])[A-z0-9]*)(?:(?:[ /]| v)(\d+)(?:\.(\d+)(?:\.(\d+))?)?)?' + - regex: '((?:[A-z0-9]+|[A-z\-]+ ?|)(?: the |)(?:[Ss][Pp][Ii][Dd][Ee][Rr]|[Ss]crape|[A-Za-z0-9-]*(?:[^C][^Uu])[Bb]ot|[Cc][Rr][Aa][Ww][Ll])[A-z0-9]*)(?:(?:[ /]| v)(\d+)(?:\.(\d+)|)(?:\.(\d+)|)|)' # HbbTV standard defines what features the browser should understand. # but it's like targeting ""HTML5 browsers"", effective browser support depends on the model @@ -107,21 +107,21 @@ user_agent_parsers: - regex: '(HbbTV)/(\d+)\.(\d+)\.(\d+) \(' # must go before Firefox to catch Chimera/SeaMonkey/Camino/Waterfox - - regex: '(Chimera|SeaMonkey|Camino|Waterfox)/(\d+)\.(\d+)\.?([ab]?\d+[a-z]*)?' + - regex: '(Chimera|SeaMonkey|Camino|Waterfox)/(\d+)\.(\d+)\.?([ab]?\d+[a-z]*|)' # Social Networks # Facebook Messenger must go before Facebook - - regex: '\[(FBAN/MessengerForiOS|FB_IAB/MESSENGER);FBAV/(\d+)(?:\.(\d+)(?:\.(\d+))?)?' + - regex: '\[(FBAN/MessengerForiOS|FB_IAB/MESSENGER);FBAV/(\d+)(?:\.(\d+)(?:\.(\d+)|)|)' family_replacement: 'Facebook Messenger' # Facebook - - regex: '\[FB.*;(FBAV)/(\d+)(?:\.(\d+)(?:\.(\d+))?)?' + - regex: '\[FB.*;(FBAV)/(\d+)(?:\.(\d+)|)(?:\.(\d+)|)' family_replacement: 'Facebook' # Sometimes Facebook does not specify a version (FBAV) - regex: '\[FB.*;' family_replacement: 'Facebook' # Pinterest - regex: '\[(Pinterest)/[^\]]+\]' - - regex: '(Pinterest)(?: for Android(?: Tablet)?)?/(\d+)(?:\.(\d+)(?:\.(\d+))?)?' + - regex: '(Pinterest)(?: for Android(?: Tablet|)|)/(\d+)(?:\.(\d+)|)(?:\.(\d+)|)' # Instagram app - regex: 'Mozilla.*Mobile.*(Instagram).(\d+)\.(\d+)\.(\d+)' # Flipboard app @@ -138,7 +138,7 @@ user_agent_parsers: family_replacement: 'Basilisk' # Pale Moon - - regex: '(PaleMoon)/(\d+)\.(\d+)\.?(\d+)?' + - regex: '(PaleMoon)/(\d+)\.(\d+)(?:\.(\d+)|)' family_replacement: 'Pale Moon' # Firefox @@ -150,22 +150,22 @@ user_agent_parsers: family_replacement: 'Firefox Mobile' - regex: '(?:Mobile|Tablet);.*(Firefox)/(\d+)\.(\d+)' family_replacement: 'Firefox Mobile' - - regex: '(Namoroka|Shiretoko|Minefield)/(\d+)\.(\d+)\.(\d+(?:pre)?)' + - regex: '(Namoroka|Shiretoko|Minefield)/(\d+)\.(\d+)\.(\d+(?:pre|))' family_replacement: 'Firefox ($1)' - regex: '(Firefox)/(\d+)\.(\d+)(a\d+[a-z]*)' family_replacement: 'Firefox Alpha' - regex: '(Firefox)/(\d+)\.(\d+)(b\d+[a-z]*)' family_replacement: 'Firefox Beta' - - regex: '(Firefox)-(?:\d+\.\d+)?/(\d+)\.(\d+)(a\d+[a-z]*)' + - regex: '(Firefox)-(?:\d+\.\d+|)/(\d+)\.(\d+)(a\d+[a-z]*)' family_replacement: 'Firefox Alpha' - - regex: '(Firefox)-(?:\d+\.\d+)?/(\d+)\.(\d+)(b\d+[a-z]*)' + - regex: '(Firefox)-(?:\d+\.\d+|)/(\d+)\.(\d+)(b\d+[a-z]*)' family_replacement: 'Firefox Beta' - - regex: '(Namoroka|Shiretoko|Minefield)/(\d+)\.(\d+)([ab]\d+[a-z]*)?' + - regex: '(Namoroka|Shiretoko|Minefield)/(\d+)\.(\d+)([ab]\d+[a-z]*|)' family_replacement: 'Firefox ($1)' - regex: '(Firefox).*Tablet browser (\d+)\.(\d+)\.(\d+)' family_replacement: 'MicroB' - - regex: '(MozillaDeveloperPreview)/(\d+)\.(\d+)([ab]\d+[a-z]*)?' - - regex: '(FxiOS)/(\d+)\.(\d+)(\.(\d+))?(\.(\d+))?' + - regex: '(MozillaDeveloperPreview)/(\d+)\.(\d+)([ab]\d+[a-z]*|)' + - regex: '(FxiOS)/(\d+)\.(\d+)(\.(\d+)|)(\.(\d+)|)' family_replacement: 'Firefox iOS' # e.g.: Flock/2.0b2 @@ -181,7 +181,7 @@ user_agent_parsers: - regex: '(Navigator)/(\d+)\.(\d+)([ab]\d+)' family_replacement: 'Netscape' - - regex: '(Netscape6)/(\d+)\.(\d+)\.?([ab]?\d+)?' + - regex: '(Netscape6)/(\d+)\.(\d+)\.?([ab]?\d+|)' family_replacement: 'Netscape' - regex: '(MyIBrow)/(\d+)\.(\d+)' @@ -194,8 +194,8 @@ user_agent_parsers: # Opera will stop at 9.80 and hide the real version in the Version string. # see: http://dev.opera.com/articles/view/opera-ua-string-changes/ - - regex: '(Opera Tablet).*Version/(\d+)\.(\d+)(?:\.(\d+))?' - - regex: '(Opera Mini)(?:/att)?/?(\d+)?(?:\.(\d+))?(?:\.(\d+))?' + - regex: '(Opera Tablet).*Version/(\d+)\.(\d+)(?:\.(\d+)|)' + - regex: '(Opera Mini)(?:/att|)/?(\d+|)(?:\.(\d+)|)(?:\.(\d+)|)' - regex: '(Opera)/.+Opera Mobi.+Version/(\d+)\.(\d+)' family_replacement: 'Opera Mobile' - regex: '(Opera)/(\d+)\.(\d+).+Opera Mobi' @@ -204,7 +204,7 @@ user_agent_parsers: family_replacement: 'Opera Mobile' - regex: 'Opera Mobi' family_replacement: 'Opera Mobile' - - regex: '(Opera)/9.80.*Version/(\d+)\.(\d+)(?:\.(\d+))?' + - regex: '(Opera)/9.80.*Version/(\d+)\.(\d+)(?:\.(\d+)|)' # Opera 14 for Android uses a WebKit render engine. - regex: '(?:Mobile Safari).*(OPR)/(\d+)\.(\d+)\.(\d+)' @@ -227,7 +227,7 @@ user_agent_parsers: family_replacement: 'Opera Neon' # Palm WebOS looks a lot like Safari. - - regex: '(hpw|web)OS/(\d+)\.(\d+)(?:\.(\d+))?' + - regex: '(hpw|web)OS/(\d+)\.(\d+)(?:\.(\d+)|)' family_replacement: 'webOS Browser' # LuaKit has no version info. @@ -243,20 +243,20 @@ user_agent_parsers: - regex: 'Gecko/\d+ (Lightning)/(\d+)\.(\d+)\.?((?:[ab]?\d+[a-z]*)|(?:\d*))' # Swiftfox - - regex: '(Firefox)/(\d+)\.(\d+)\.(\d+(?:pre)?) \(Swiftfox\)' + - regex: '(Firefox)/(\d+)\.(\d+)\.(\d+(?:pre|)) \(Swiftfox\)' family_replacement: 'Swiftfox' - - regex: '(Firefox)/(\d+)\.(\d+)([ab]\d+[a-z]*)? \(Swiftfox\)' + - regex: '(Firefox)/(\d+)\.(\d+)([ab]\d+[a-z]*|) \(Swiftfox\)' family_replacement: 'Swiftfox' # Rekonq - - regex: '(rekonq)/(\d+)\.(\d+)\.?(\d+)? Safari' + - regex: '(rekonq)/(\d+)\.(\d+)(?:\.(\d+)|) Safari' family_replacement: 'Rekonq' - regex: 'rekonq' family_replacement: 'Rekonq' # Conkeror lowercase/uppercase # http://conkeror.org/ - - regex: '(conkeror|Conkeror)/(\d+)\.(\d+)\.?(\d+)?' + - regex: '(conkeror|Conkeror)/(\d+)\.(\d+)(?:\.(\d+)|)' family_replacement: 'Conkeror' # catches lower case konqueror @@ -285,11 +285,11 @@ user_agent_parsers: family_replacement: 'NetFront NX' # Amazon Silk, should go before Safari and Chrome Mobile - - regex: '(Silk)/(\d+)\.(\d+)(?:\.([0-9\-]+))?' + - regex: '(Silk)/(\d+)\.(\d+)(?:\.([0-9\-]+)|)' family_replacement: 'Amazon Silk' # @ref: http://www.puffinbrowser.com - - regex: '(Puffin)/(\d+)\.(\d+)(?:\.(\d+))?' + - regex: '(Puffin)/(\d+)\.(\d+)(?:\.(\d+)|)' # Edge Mobile - regex: 'Windows Phone .*(Edge)/(\d+)\.(\d+)' @@ -300,21 +300,21 @@ user_agent_parsers: family_replacement: 'Samsung Internet' # Seznam.cz browser (based on WebKit) - - regex: '(SznProhlizec)/(\d+)\.(\d+)(?:\.(\d+))?' + - regex: '(SznProhlizec)/(\d+)\.(\d+)(?:\.(\d+)|)' family_replacement: 'Seznam prohlížeč' # Coc Coc browser, based on Chrome (used in Vietnam) - - regex: '(coc_coc_browser)/(\d+)\.(\d+)(?:\.(\d+))?' + - regex: '(coc_coc_browser)/(\d+)\.(\d+)(?:\.(\d+)|)' family_replacement: 'Coc Coc' # Baidu Browsers (desktop spoofs chrome & IE, explorer is mobile) - - regex: '(baidubrowser)[/\s](\d+)(?:\.(\d+)(?:\.(\d+))?)?' + - regex: '(baidubrowser)[/\s](\d+)(?:\.(\d+)|)(?:\.(\d+)|)' family_replacement: 'Baidu Browser' - regex: '(FlyFlow)/(\d+)\.(\d+)' family_replacement: 'Baidu Explorer' # MxBrowser is Maxthon. Must go before Mobile Chrome for Android - - regex: '(MxBrowser)/(\d+)\.(\d+)(?:\.(\d+))?' + - regex: '(MxBrowser)/(\d+)\.(\d+)(?:\.(\d+)|)' family_replacement: 'Maxthon' # Crosswalk must go before Mobile Chrome for Android @@ -347,11 +347,11 @@ user_agent_parsers: family_replacement: 'Sogou Explorer' # QQ Browsers - - regex: '(MQQBrowser/Mini)(?:(\d+)(?:\.(\d+)(?:\.(\d+))?)?)?' + - regex: '(MQQBrowser/Mini)(?:(\d+)(?:\.(\d+)|)(?:\.(\d+)|)|)' family_replacement: 'QQ Browser Mini' - - regex: '(MQQBrowser)(?:/(\d+)(?:\.(\d+)(?:\.(\d+))?)?)?' + - regex: '(MQQBrowser)(?:/(\d+)(?:\.(\d+)|)(?:\.(\d+)|)|)' family_replacement: 'QQ Browser Mobile' - - regex: '(QQBrowser)(?:/(\d+)(?:\.(\d+)\.(\d+)(?:\.(\d+))?)?)?' + - regex: '(QQBrowser)(?:/(\d+)(?:\.(\d+)\.(\d+)(?:\.(\d+)|)|)|)' family_replacement: 'QQ Browser' # Rackspace Monitoring @@ -373,7 +373,7 @@ user_agent_parsers: - regex: '(AOL) (\d+)\.(\d+); AOLBuild (\d+)' # Podcast catcher Applications using iTunes - - regex: '(PodCruncher|Downcast)[ /]?(\d+)\.?(\d+)?\.?(\d+)?\.?(\d+)?' + - regex: '(PodCruncher|Downcast)[ /]?(\d+)(?:\.(\d+)|)(?:\.(\d+)|)(?:\.(\d+)|)' # Box Notes https://www.box.com/resources/downloads # Must be before Electron @@ -397,7 +397,7 @@ user_agent_parsers: # HipChat provides a version on Mac, but not on Windows. # Needs to be before Chrome on Windows, and AppleMail on Mac. - - regex: '(HipChat)/?(\d+)?' + - regex: '(HipChat)/?(\d+|)' family_replacement: 'HipChat Desktop Client' # Browser/major_version.minor_version.beta_version @@ -428,10 +428,10 @@ user_agent_parsers: family_replacement: 'Windows Live Mail' # Apple Air Mail - - regex: '(Airmail) (\d+)\.(\d+)(?:\.(\d+))?' + - regex: '(Airmail) (\d+)\.(\d+)(?:\.(\d+)|)' # Thunderbird - - regex: '(Thunderbird)/(\d+)\.(\d+)(?:\.(\d+(?:pre)?))?' + - regex: '(Thunderbird)/(\d+)\.(\d+)(?:\.(\d+(?:pre|))|)' family_replacement: 'Thunderbird' # Postbox @@ -439,18 +439,18 @@ user_agent_parsers: family_replacement: 'Postbox' # Barca - - regex: '(Barca(?:Pro)?)/(\d+)\.(\d+)(?:\.(\d+))?' + - regex: '(Barca(?:Pro)?)/(\d+)\.(\d+)(?:\.(\d+)|)' family_replacement: 'Barca' # Lotus Notes - - regex: '(Lotus-Notes)/(\d+)\.(\d+)(?:\.(\d+))?' + - regex: '(Lotus-Notes)/(\d+)\.(\d+)(?:\.(\d+)|)' family_replacement: 'Lotus Notes' # Vivaldi uses ""Vivaldi"" - regex: '(Vivaldi)/(\d+)\.(\d+)\.(\d+)' # Edge/major_version.minor_version - - regex: '(Edge)/(\d+)(?:\.(\d+))?' + - regex: '(Edge)/(\d+)(?:\.(\d+)|)' # Brave Browser https://brave.com/ - regex: '(brave)/(\d+)\.(\d+)\.(\d+) Chrome' @@ -462,23 +462,23 @@ user_agent_parsers: # Dolphin Browser # @ref: http://www.dolphin.com - - regex: '\b(Dolphin)(?: |HDCN/|/INT\-)(\d+)\.(\d+)\.?(\d+)?' + - regex: '\b(Dolphin)(?: |HDCN/|/INT\-)(\d+)\.(\d+)(?:\.(\d+)|)' # Headless Chrome # https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md - - regex: '(HeadlessChrome)(?:/(\d+)\.(\d+)\.(\d+))?' + - regex: '(HeadlessChrome)(?:/(\d+)\.(\d+)\.(\d+)|)' # Evolution Mail CardDav/CalDav integration - regex: '(Evolution)/(\d+)\.(\d+)\.(\d+\.\d+)' # Roundcube Mail CardDav plugin - - regex: '(RCM CardDAV plugin)/(\d+)\.(\d+)\.(\d+(?:-dev)?)' + - regex: '(RCM CardDAV plugin)/(\d+)\.(\d+)\.(\d+(?:-dev|))' # Browser/major_version.minor_version - - regex: '(bingbot|Bolt|AdobeAIR|Jasmine|IceCat|Skyfire|Midori|Maxthon|Lynx|Arora|IBrowse|Dillo|Camino|Shiira|Fennec|Phoenix|Flock|Netscape|Lunascape|Epiphany|WebPilot|Opera Mini|Opera|NetFront|Netfront|Konqueror|Googlebot|SeaMonkey|Kazehakase|Vienna|Iceape|Iceweasel|IceWeasel|Iron|K-Meleon|Sleipnir|Galeon|GranParadiso|iCab|iTunes|MacAppStore|NetNewsWire|Space Bison|Stainless|Orca|Dolfin|BOLT|Minimo|Tizen Browser|Polaris|Abrowser|Planetweb|ICE Browser|mDolphin|qutebrowser|Otter|QupZilla|MailBar|kmail2|YahooMobileMail|ExchangeWebServices|ExchangeServicesClient|Dragon|Outlook-iOS-Android)/(\d+)\.(\d+)(?:\.(\d+))?' + - regex: '(bingbot|Bolt|AdobeAIR|Jasmine|IceCat|Skyfire|Midori|Maxthon|Lynx|Arora|IBrowse|Dillo|Camino|Shiira|Fennec|Phoenix|Flock|Netscape|Lunascape|Epiphany|WebPilot|Opera Mini|Opera|NetFront|Netfront|Konqueror|Googlebot|SeaMonkey|Kazehakase|Vienna|Iceape|Iceweasel|IceWeasel|Iron|K-Meleon|Sleipnir|Galeon|GranParadiso|iCab|iTunes|MacAppStore|NetNewsWire|Space Bison|Stainless|Orca|Dolfin|BOLT|Minimo|Tizen Browser|Polaris|Abrowser|Planetweb|ICE Browser|mDolphin|qutebrowser|Otter|QupZilla|MailBar|kmail2|YahooMobileMail|ExchangeWebServices|ExchangeServicesClient|Dragon|Outlook-iOS-Android)/(\d+)\.(\d+)(?:\.(\d+)|)' # Chrome/Chromium/major_version.minor_version - - regex: '(Chromium|Chrome)/(\d+)\.(\d+)(?:\.(\d+))?(?:\.(\d+))?' + - regex: '(Chromium|Chrome)/(\d+)\.(\d+)(?:\.(\d+)|)(?:\.(\d+)|)' ########## # IE Mobile needs to happen before Android to catch cases such as: @@ -498,8 +498,8 @@ user_agent_parsers: # Podcast catchers - regex: '^(bPod|Pocket Casts|Player FM)$' - regex: '^(AlexaMediaPlayer|VLC)/(\d+)\.(\d+)\.([^.\s]+)' - - regex: '^(AntennaPod|WMPlayer|Zune|Podkicker|Radio|ExoPlayerDemo|Overcast|PocketTunes|NSPlayer|okhttp|DoggCatcher|QuickNews|QuickTime|Peapod|Podcasts|GoldenPod|VLC|Spotify|Miro|MediaGo|Juice|iPodder|gPodder|Banshee)/(\d+)\.(\d+)\.?(\d+)?\.?(\d+)?' - - regex: '^(Peapod|Liferea)/([^.\s]+)\.([^.\s]+)?\.?([^.\s]+)?' + - regex: '^(AntennaPod|WMPlayer|Zune|Podkicker|Radio|ExoPlayerDemo|Overcast|PocketTunes|NSPlayer|okhttp|DoggCatcher|QuickNews|QuickTime|Peapod|Podcasts|GoldenPod|VLC|Spotify|Miro|MediaGo|Juice|iPodder|gPodder|Banshee)/(\d+)\.(\d+)(?:\.(\d+)|)(?:\.(\d+)|)' + - regex: '^(Peapod|Liferea)/([^.\s]+)\.([^.\s]+|)\.?([^.\s]+|)' - regex: '^(bPod|Player FM) BMID/(\S+)' - regex: '^(Podcast ?Addict)/v(\d+) ' - regex: '^(Podcast ?Addict) ' @@ -509,8 +509,8 @@ user_agent_parsers: - regex: '(CITA) RSS Aggregator/(\d+)\.(\d+)' - regex: '(Pocket Casts)$' - regex: '(Player FM)$' - - regex: '(LG Player|Doppler|FancyMusic|MediaMonkey|Clementine) (\d+)\.(\d+)\.?([^.\s]+)?\.?([^.\s]+)?' - - regex: '(philpodder)/(\d+)\.(\d+)\.?([^.\s]+)?\.?([^.\s]+)?' + - regex: '(LG Player|Doppler|FancyMusic|MediaMonkey|Clementine) (\d+)\.(\d+)\.?([^.\s]+|)\.?([^.\s]+|)' + - regex: '(philpodder)/(\d+)\.(\d+)\.?([^.\s]+|)\.?([^.\s]+|)' - regex: '(Player FM|Pocket Casts|DoggCatcher|Spotify|MediaMonkey|MediaGo|BashPodder)' - regex: '(QuickTime)\.(\d+)\.(\d+)\.(\d+)' - regex: '(Kinoma)(\d+)' @@ -518,35 +518,35 @@ user_agent_parsers: family_replacement: 'FancyMusic' - regex: 'EspnDownloadManager' family_replacement: 'ESPN' - - regex: '(ESPN) Radio (\d+)\.(\d+)\.?(\d+)? ?(?:rv:(\d+))? ' - - regex: '(podracer|jPodder) v ?(\d+)\.(\d+)\.?(\d+)?' + - regex: '(ESPN) Radio (\d+)\.(\d+)(?:\.(\d+)|) ?(?:rv:(\d+)|) ' + - regex: '(podracer|jPodder) v ?(\d+)\.(\d+)(?:\.(\d+)|)' - regex: '(ZDM)/(\d+)\.(\d+)[; ]?' - - regex: '(Zune|BeyondPod) (\d+)\.?(\d+)?[\);]' + - regex: '(Zune|BeyondPod) (\d+)(?:\.(\d+)|)[\);]' - regex: '(WMPlayer)/(\d+)\.(\d+)\.(\d+)\.(\d+)' - regex: '^(Lavf)' family_replacement: 'WMPlayer' - - regex: '^(RSSRadio)[ /]?(\d+)?' + - regex: '^(RSSRadio)[ /]?(\d+|)' - regex: '(RSS_Radio) (\d+)\.(\d+)' family_replacement: 'RSSRadio' - regex: '(Podkicker) \S+/(\d+)\.(\d+)\.(\d+)' family_replacement: 'Podkicker' - - regex: '^(HTC) Streaming Player \S+ / \S+ / \S+ / (\d+)\.(\d+)\.?(\d+)?' + - regex: '^(HTC) Streaming Player \S+ / \S+ / \S+ / (\d+)\.(\d+)(?:\.(\d+)|)' - regex: '^(Stitcher)/iOS' - regex: '^(Stitcher)/Android' - regex: '^(VLC) .*version (\d+)\.(\d+)\.(\d+)' - regex: ' (VLC) for' - regex: '(vlc)/(\d+)\.(\d+)\.(\d+)' family_replacement: 'VLC' - - regex: '^(foobar)\S+/([^.\s]+)\.([^.\s]+)?\.?([^.\s]+)?' - - regex: '^(Clementine)\S+ ([^.\s]+)\.([^.\s]+)?\.?([^.\s]+)?' - - regex: '(amarok)/([^.\s]+)\.([^.\s]+)?\.?([^.\s]+)?' + - regex: '^(foobar)\S+/([^.\s]+)\.([^.\s]+|)\.?([^.\s]+|)' + - regex: '^(Clementine)\S+ ([^.\s]+)\.([^.\s]+|)\.?([^.\s]+|)' + - regex: '(amarok)/([^.\s]+)\.([^.\s]+|)\.?([^.\s]+|)' family_replacement: 'Amarok' - regex: '(Custom)-Feed Reader' # Browser major_version.minor_version.beta_version (space instead of slash) - regex: '(iRider|Crazy Browser|SkipStone|iCab|Lunascape|Sleipnir|Maemo Browser) (\d+)\.(\d+)\.(\d+)' # Browser major_version.minor_version (space instead of slash) - - regex: '(iCab|Lunascape|Opera|Android|Jasmine|Polaris|Microsoft SkyDriveSync|The Bat!) (\d+)\.(\d+)\.?(\d+)?' + - regex: '(iCab|Lunascape|Opera|Android|Jasmine|Polaris|Microsoft SkyDriveSync|The Bat!) (\d+)\.(\d+)(?:\.(\d+)|)' # Kindle WebKit - regex: '(Kindle)/(\d+)\.(\d+)' @@ -591,7 +591,7 @@ user_agent_parsers: #### SPECIAL CASES #### - regex: '(Obigo)InternetBrowser' - regex: '(Obigo)\-Browser' - - regex: '(Obigo|OBIGO)[^\d]*(\d+)(?:.(\d+))?' + - regex: '(Obigo|OBIGO)[^\d]*(\d+)(?:.(\d+)|)' family_replacement: 'Obigo' - regex: '(MAXTHON|Maxthon) (\d+)\.(\d+)' @@ -610,21 +610,21 @@ user_agent_parsers: - regex: '(Embider)/(\d+)\.(\d+)' family_replacement: 'Polaris' - - regex: '(BonEcho)/(\d+)\.(\d+)\.?([ab]?\d+)?' + - regex: '(BonEcho)/(\d+)\.(\d+)\.?([ab]?\d+|)' family_replacement: 'Bon Echo' # @note: iOS / OSX Applications - regex: '(iPod|iPhone|iPad).+GSA/(\d+)\.(\d+)\.(\d+) Mobile' family_replacement: 'Google' - - regex: '(iPod|iPhone|iPad).+Version/(\d+)\.(\d+)(?:\.(\d+))?.*[ +]Safari' + - regex: '(iPod|iPhone|iPad).+Version/(\d+)\.(\d+)(?:\.(\d+)|).*[ +]Safari' family_replacement: 'Mobile Safari' - - regex: '(iPod|iPod touch|iPhone|iPad);.*CPU.*OS[ +](\d+)_(\d+)(?:_(\d+))?.* AppleNews\/\d+\.\d+\.\d+?' + - regex: '(iPod|iPod touch|iPhone|iPad);.*CPU.*OS[ +](\d+)_(\d+)(?:_(\d+)|).* AppleNews\/\d+\.\d+\.\d+?' family_replacement: 'Mobile Safari UI/WKWebView' - - regex: '(iPod|iPhone|iPad).+Version/(\d+)\.(\d+)(?:\.(\d+))?' + - regex: '(iPod|iPhone|iPad).+Version/(\d+)\.(\d+)(?:\.(\d+)|)' family_replacement: 'Mobile Safari UI/WKWebView' - - regex: '(iPod|iPod touch|iPhone|iPad);.*CPU.*OS[ +](\d+)_(\d+)(?:_(\d+))?.*Mobile.*[ +]Safari' + - regex: '(iPod|iPod touch|iPhone|iPad);.*CPU.*OS[ +](\d+)_(\d+)(?:_(\d+)|).*Mobile.*[ +]Safari' family_replacement: 'Mobile Safari' - - regex: '(iPod|iPod touch|iPhone|iPad);.*CPU.*OS[ +](\d+)_(\d+)(?:_(\d+))?.*Mobile' + - regex: '(iPod|iPod touch|iPhone|iPad);.*CPU.*OS[ +](\d+)_(\d+)(?:_(\d+)|).*Mobile' family_replacement: 'Mobile Safari UI/WKWebView' - regex: '(iPod|iPhone|iPad).* Safari' family_replacement: 'Mobile Safari' @@ -697,18 +697,18 @@ user_agent_parsers: - regex: '(QtWeb) Internet Browser/(\d+)\.(\d+)' - #- regex: '\(iPad;.+(Version)/(\d+)\.(\d+)(?:\.(\d+))?.*Safari/' + #- regex: '\(iPad;.+(Version)/(\d+)\.(\d+)(?:\.(\d+)|).*Safari/' # family_replacement: 'iPad' # Phantomjs, should go before Safari - regex: '(PhantomJS)/(\d+)\.(\d+)\.(\d+)' # WebKit Nightly - - regex: '(AppleWebKit)/(\d+)\.?(\d+)?\+ .* Safari' + - regex: '(AppleWebKit)/(\d+)(?:\.(\d+)|)\+ .* Safari' family_replacement: 'WebKit Nightly' # Safari - - regex: '(Version)/(\d+)\.(\d+)(?:\.(\d+))?.*Safari/' + - regex: '(Version)/(\d+)\.(\d+)(?:\.(\d+)|).*Safari/' family_replacement: 'Safari' # Safari didn't provide ""Version/d.d.d"" prior to 3.0 - regex: '(Safari)/\d+' @@ -743,7 +743,7 @@ user_agent_parsers: v1_replacement: '8' # Espial - - regex: '(Espial)/(\d+)(?:\.(\d+))?(?:\.(\d+))?' + - regex: '(Espial)/(\d+)(?:\.(\d+)|)(?:\.(\d+)|)' # Apple Mail @@ -755,7 +755,7 @@ user_agent_parsers: # AFTER IE11 # BEFORE all other IE - regex: '(Firefox)/(\d+)\.(\d+)\.(\d+)' - - regex: '(Firefox)/(\d+)\.(\d+)(pre|[ab]\d+[a-z]*)?' + - regex: '(Firefox)/(\d+)\.(\d+)(pre|[ab]\d+[a-z]*|)' - regex: '([MS]?IE) (\d+)\.(\d+)' family_replacement: 'IE' @@ -764,13 +764,13 @@ user_agent_parsers: family_replacement: 'Python Requests' # headless user-agents - - regex: '\b(Windows-Update-Agent|Microsoft-CryptoAPI|SophosUpdateManager|SophosAgent|Debian APT-HTTP|Ubuntu APT-HTTP|libcurl-agent|libwww-perl|urlgrabber|curl|PycURL|Wget|aria2|Axel|OpenBSD ftp|lftp|jupdate|insomnia)(?:[ /](\d+)(?:\.(\d+)(?:\.(\d+))?)?)?' + - regex: '\b(Windows-Update-Agent|Microsoft-CryptoAPI|SophosUpdateManager|SophosAgent|Debian APT-HTTP|Ubuntu APT-HTTP|libcurl-agent|libwww-perl|urlgrabber|curl|PycURL|Wget|aria2|Axel|OpenBSD ftp|lftp|jupdate|insomnia)(?:[ /](\d+)(?:\.(\d+)|)(?:\.(\d+)|)|)' - - regex: '(Java)[/ ]{0,1}\d+\.(\d+)\.(\d+)[_-]*([a-zA-Z0-9]+)*' + - regex: '(Java)[/ ]{0,1}\d+\.(\d+)\.(\d+)[_-]*([a-zA-Z0-9]+|)' # Cloud Storage Clients - - regex: '^(Cyberduck)/(\d+)\.(\d+)\.(\d+)(?:\.\d+)?' - - regex: '^(S3 Browser) (\d+)-(\d+)-(\d+)(?:\s*http://s3browser\.com)?' + - regex: '^(Cyberduck)/(\d+)\.(\d+)\.(\d+)(?:\.\d+|)' + - regex: '^(S3 Browser) (\d+)-(\d+)-(\d+)(?:\s*http://s3browser\.com|)' # rclone - rsync for cloud storage - https://rclone.org/ - regex: '^(rclone)/v(\d+)\.(\d+)' @@ -854,14 +854,14 @@ os_parsers: - regex: '(Windows Phone) (?:OS[ /])?(\d+)\.(\d+)' # Again a MS-special one: iPhone.*Outlook-iOS-Android/x.x is erroneously detected as Android - - regex: '(CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone)[ +]+(\d+)[_\.](\d+)(?:[_\.](\d+))?.*Outlook-iOS-Android' + - regex: '(CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone)[ +]+(\d+)[_\.](\d+)(?:[_\.](\d+)|).*Outlook-iOS-Android' os_replacement: 'iOS' ########## # Android # can actually detect rooted android os. do we care? ########## - - regex: '(Android)[ \-/](\d+)\.?(\d+)?(?:[.\-]([a-z0-9]+))?' + - regex: '(Android)[ \-/](\d+)(?:\.(\d+)|)(?:[.\-]([a-z0-9]+)|)' - regex: '(Android) Donut' os_v1_replacement: '1' @@ -883,18 +883,18 @@ os_parsers: os_v1_replacement: '3' # UCWEB - - regex: '^UCWEB.*; (Adr) (\d+)\.(\d+)(?:[.\-]([a-z0-9]+))?;' + - regex: '^UCWEB.*; (Adr) (\d+)\.(\d+)(?:[.\-]([a-z0-9]+)|);' os_replacement: 'Android' - - regex: '^UCWEB.*; (iPad|iPh|iPd) OS (\d+)_(\d+)(?:_(\d+))?;' + - regex: '^UCWEB.*; (iPad|iPh|iPd) OS (\d+)_(\d+)(?:_(\d+)|);' os_replacement: 'iOS' - - regex: '^UCWEB.*; (wds) (\d+)\.(\d+)(?:\.(\d+))?;' + - regex: '^UCWEB.*; (wds) (\d+)\.(\d+)(?:\.(\d+)|);' os_replacement: 'Windows Phone' # JUC - - regex: '^(JUC).*; ?U; ?(?:Android)?(\d+)\.(\d+)(?:[\.\-]([a-z0-9]+))?' + - regex: '^(JUC).*; ?U; ?(?:Android|)(\d+)\.(\d+)(?:[\.\-]([a-z0-9]+)|)' os_replacement: 'Android' # Salesforce - - regex: '(android)\s(?:mobile\/)(\d+)(?:\.?(\d+))?(?:\.?(\d+))?' + - regex: '(android)\s(?:mobile\/)(\d+)(?:\.(\d+)(?:\.(\d+)|)|)' os_replacement: 'Android' ########## @@ -908,7 +908,7 @@ os_parsers: # properly identify as Chrome OS # # ex: Mozilla/5.0 (X11; Windows aarch64 10718.88.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.118 Safari/537.36 CitrixChromeApp - - regex: '(x86_64|aarch64)\ (\d+)+\.(\d+)+\.(\d+)+.*Chrome.*(?:CitrixChromeApp)$' + - regex: '(x86_64|aarch64)\ (\d+)\.(\d+)\.(\d+).*Chrome.*(?:CitrixChromeApp)$' os_replacement: 'Chrome OS' ########## @@ -1017,13 +1017,13 @@ os_parsers: # @ref: http://en.wikipedia.org/wiki/Mac_OS_X#Versions # @ref: http://www.puredarwin.org/curious/versions ########## - - regex: '((?:Mac[ +]?|; )OS[ +]X)[\s+/](?:(\d+)[_.](\d+)(?:[_.](\d+))?|Mach-O)' + - regex: '((?:Mac[ +]?|; )OS[ +]X)[\s+/](?:(\d+)[_.](\d+)(?:[_.](\d+)|)|Mach-O)' os_replacement: 'Mac OS X' - - regex: '(\w+\s+Mac OS X\s+\w+\s+(\d+).(\d+).(\d+).*)' + - regex: '\w+\s+Mac OS X\s+\w+\s+(\d+).(\d+).(\d+).*' os_replacement: 'Mac OS X' - os_v1_replacement: '$2' - os_v2_replacement: '$3' - os_v3_replacement: '$4' + os_v1_replacement: '$1' + os_v2_replacement: '$2' + os_v3_replacement: '$3' # Leopard - regex: ' (Dar)(win)/(9).(\d+).*\((?:i386|x86_64|Power Macintosh)\)' os_replacement: 'Mac OS X' @@ -1062,7 +1062,7 @@ os_parsers: - regex: '(?:PPC|Intel) (Mac OS X)' # Box Drive and Box Sync on Mac OS X use OSX version numbers, not Darwin - - regex: '^Box.*;(Darwin)/(10)\.(1\d)(?:\.(\d+))?' + - regex: '^Box.*;(Darwin)/(10)\.(1\d)(?:\.(\d+)|)' os_replacement: 'Mac OS X' ########## @@ -1070,10 +1070,10 @@ os_parsers: # http://en.wikipedia.org/wiki/IOS_version_history ########## # keep this above generic iOS, since AppleTV UAs contain 'CPU OS' - - regex: '(Apple\s?TV)(?:/(\d+)\.(\d+))?' + - regex: '(Apple\s?TV)(?:/(\d+)\.(\d+)|)' os_replacement: 'ATV OS X' - - regex: '(CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS)[ +]+(\d+)[_\.](\d+)(?:[_\.](\d+))?' + - regex: '(CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS)[ +]+(\d+)[_\.](\d+)(?:[_\.](\d+)|)' os_replacement: 'iOS' # remaining cases are mostly only opera uas, so catch opera as to not catch iphone spoofs @@ -1255,7 +1255,7 @@ os_parsers: os_replacement: 'iOS' # iOS Apps - - regex: '\b(iOS[ /]|iOS; |iPhone(?:/| v|[ _]OS[/,]|; | OS : |\d,\d/|\d,\d; )|iPad/)(\d{1,2})[_\.](\d{1,2})(?:[_\.](\d+))?' + - regex: '\b(iOS[ /]|iOS; |iPhone(?:/| v|[ _]OS[/,]|; | OS : |\d,\d/|\d,\d; )|iPad/)(\d{1,2})[_\.](\d{1,2})(?:[_\.](\d+)|)' os_replacement: 'iOS' - regex: '\((iOS);' @@ -1276,7 +1276,7 @@ os_parsers: # http://code.google.com/p/chromium-os/issues/detail?id=11573 # http://code.google.com/p/chromium-os/issues/detail?id=13790 ########## - - regex: '(CrOS) [a-z0-9_]+ (\d+)\.(\d+)(?:\.(\d+))?' + - regex: '(CrOS) [a-z0-9_]+ (\d+)\.(\d+)(?:\.(\d+)|)' os_replacement: 'Chrome OS' ########## @@ -1284,8 +1284,8 @@ os_parsers: ########## - regex: '([Dd]ebian)' os_replacement: 'Debian' - - regex: '(Linux Mint)(?:/(\d+))?' - - regex: '(Mandriva)(?: Linux)?/(?:[\d.-]+m[a-z]{2}(\d+).(\d))?' + - regex: '(Linux Mint)(?:/(\d+)|)' + - regex: '(Mandriva)(?: Linux|)/(?:[\d.-]+m[a-z]{2}(\d+).(\d)|)' ########## # Symbian + Symbian OS @@ -1314,9 +1314,9 @@ os_parsers: ########## - regex: '(BB10);.+Version/(\d+)\.(\d+)\.(\d+)' os_replacement: 'BlackBerry OS' - - regex: '(Black[Bb]erry)[0-9a-z]+/(\d+)\.(\d+)\.(\d+)(?:\.(\d+))?' + - regex: '(Black[Bb]erry)[0-9a-z]+/(\d+)\.(\d+)\.(\d+)(?:\.(\d+)|)' os_replacement: 'BlackBerry OS' - - regex: '(Black[Bb]erry).+Version/(\d+)\.(\d+)\.(\d+)(?:\.(\d+))?' + - regex: '(Black[Bb]erry).+Version/(\d+)\.(\d+)\.(\d+)(?:\.(\d+)|)' os_replacement: 'BlackBerry OS' - regex: '(RIM Tablet OS) (\d+)\.(\d+)\.(\d+)' os_replacement: 'BlackBerry Tablet OS' @@ -1383,20 +1383,20 @@ os_parsers: ########## # Google TV ########## - - regex: '(GoogleTV)(?: (\d+)\.(\d+)(?:\.(\d+))?|/[\da-z]+)' + - regex: '(GoogleTV)(?: (\d+)\.(\d+)(?:\.(\d+)|)|/[\da-z]+)' - regex: '(WebTV)/(\d+).(\d+)' ########## # Chromecast ########## - - regex: '(CrKey)(?:[/](\d+)\.(\d+)(?:\.(\d+))?)?' + - regex: '(CrKey)(?:[/](\d+)\.(\d+)(?:\.(\d+)|)|)' os_replacement: 'Chromecast' ########## # Misc mobile ########## - - regex: '(hpw|web)OS/(\d+)\.(\d+)(?:\.(\d+))?' + - regex: '(hpw|web)OS/(\d+)\.(\d+)(?:\.(\d+)|)' os_replacement: 'webOS' - regex: '(VRE);' @@ -1404,10 +1404,10 @@ os_parsers: # Generic patterns # since the majority of os cases are very specific, these go last ########## - - regex: '(Fedora|Red Hat|PCLinuxOS|Puppy|Ubuntu|Kindle|Bada|Lubuntu|BackTrack|Slackware|(?:Free|Open|Net|\b)BSD)[/ ](\d+)\.(\d+)(?:\.(\d+)(?:\.(\d+))?)?' + - regex: '(Fedora|Red Hat|PCLinuxOS|Puppy|Ubuntu|Kindle|Bada|Lubuntu|BackTrack|Slackware|(?:Free|Open|Net|\b)BSD)[/ ](\d+)\.(\d+)(?:\.(\d+)|)(?:\.(\d+)|)' # Gentoo Linux + Kernel Version - - regex: '(Linux)[ /](\d+)\.(\d+)(?:\.(\d+))?.*gentoo' + - regex: '(Linux)[ /](\d+)\.(\d+)(?:\.(\d+)|).*gentoo' os_replacement: 'Gentoo' # Opera Mini Bada @@ -1417,7 +1417,7 @@ os_parsers: - regex: '(Windows|Android|WeTab|Maemo|Web0S)' - regex: '(Ubuntu|Kubuntu|Arch Linux|CentOS|Slackware|Gentoo|openSUSE|SUSE|Red Hat|Fedora|PCLinuxOS|Mageia|(?:Free|Open|Net|\b)BSD)' # Linux + Kernel Version - - regex: '(Linux)(?:[ /](\d+)\.(\d+)(?:\.(\d+))?)?' + - regex: '(Linux)(?:[ /](\d+)\.(\d+)(?:\.(\d+)|)|)' - regex: 'SunOS' os_replacement: 'Solaris' # Wget/x.x.x (linux-gnu) @@ -1464,7 +1464,7 @@ device_parsers: ###################################################################### # Android Application - - regex: 'Android Application[^\-]+ - (Sony) ?(Ericsson)? (.+) \w+ - ' + - regex: 'Android Application[^\-]+ - (Sony) ?(Ericsson|) (.+) \w+ - ' device_replacement: '$1 $2' brand_replacement: '$1$2' model_replacement: '$3' @@ -1495,7 +1495,7 @@ device_parsers: # Acer # @ref: http://us.acer.com/ac/en/US/content/group/tablets ######### - - regex: 'Android [34].*; *(A100|A101|A110|A200|A210|A211|A500|A501|A510|A511|A700(?: Lite| 3G)?|A701|B1-A71|A1-\d{3}|B1-\d{3}|V360|V370|W500|W500P|W501|W501P|W510|W511|W700|Slider SL101|DA22[^;/]+) Build' + - regex: 'Android [34].*; *(A100|A101|A110|A200|A210|A211|A500|A501|A510|A511|A700(?: Lite| 3G|)|A701|B1-A71|A1-\d{3}|B1-\d{3}|V360|V370|W500|W500P|W501|W501P|W510|W511|W700|Slider SL101|DA22[^;/]+) Build' device_replacement: '$1' brand_replacement: 'Acer' model_replacement: '$1' @@ -1518,7 +1518,7 @@ device_parsers: # @note: VegaBean and VegaComb (names derived from jellybean, honeycomb) are # custom ROM builds for Vega ######### - - regex: '; *(Advent )?(Vega(?:Bean|Comb)?).* Build' + - regex: '; *(Advent |)(Vega(?:Bean|Comb|)).* Build' device_replacement: '$1$2' brand_replacement: 'Advent' model_replacement: '$2' @@ -1527,7 +1527,7 @@ device_parsers: # Ainol # @ref: http://www.ainol.com/plugin.php?identifier=ainol&module=product ######### - - regex: '; *(Ainol )?((?:NOVO|[Nn]ovo)[^;/]+) Build' + - regex: '; *(Ainol |)((?:NOVO|[Nn]ovo)[^;/]+) Build' device_replacement: '$1$2' brand_replacement: 'Ainol' model_replacement: '$2' @@ -1564,7 +1564,7 @@ device_parsers: device_replacement: 'Alcatel One Touch $2' brand_replacement: 'Alcatel' model_replacement: 'One Touch $2' - - regex: '; *(?:alcatel[ _])?(?:(?:one[ _]?touch[ _])|ot[ \-])([^;/]+);? Build' + - regex: '; *(?:alcatel[ _]|)(?:(?:one[ _]?touch[ _])|ot[ \-])([^;/]+);? Build' regex_flag: 'i' device_replacement: 'Alcatel One Touch $1' brand_replacement: 'Alcatel' @@ -1604,7 +1604,7 @@ device_parsers: device_replacement: '$1$2' brand_replacement: 'Allview' model_replacement: '$2' - - regex: '; *(ALLVIEW[ _]?|Allview[ _]?)?(AX1_Shine|AX2_Frenzy) Build' + - regex: '; *(ALLVIEW[ _]?|Allview[ _]?|)(AX1_Shine|AX2_Frenzy) Build' device_replacement: '$1$2' brand_replacement: 'Allview' model_replacement: '$2' @@ -1664,7 +1664,7 @@ device_parsers: # @ref: http://www.luckystar.com.cn/en/mobiletel.aspx?page=1 # @note: brand owned by luckystar ######### - - regex: '; *(G7|M1013|M1015G|M11[CG]?|M-?12[B]?|M15|M19[G]?|M30[ACQ]?|M31[GQ]|M32|M33[GQ]|M36|M37|M38|M701T|M710|M712B|M713|M715G|M716G|M71(?:G|GS|T)?|M72[T]?|M73[T]?|M75[GT]?|M77G|M79T|M7L|M7LN|M81|M810|M81T|M82|M92|M92KS|M92S|M717G|M721|M722G|M723|M725G|M739|M785|M791|M92SK|M93D) Build' + - regex: '; *(G7|M1013|M1015G|M11[CG]?|M-?12[B]?|M15|M19[G]?|M30[ACQ]?|M31[GQ]|M32|M33[GQ]|M36|M37|M38|M701T|M710|M712B|M713|M715G|M716G|M71(?:G|GS|T|)|M72[T]?|M73[T]?|M75[GT]?|M77G|M79T|M7L|M7LN|M81|M810|M81T|M82|M92|M92KS|M92S|M717G|M721|M722G|M723|M725G|M739|M785|M791|M92SK|M93D) Build' device_replacement: 'Aoson $1' brand_replacement: 'Aoson' model_replacement: '$1' @@ -1739,7 +1739,7 @@ device_parsers: # Assistant # @ref: http://www.assistant.ua ######### - - regex: '; *(?:ASSISTANT )?(AP)-?([1789]\d{2}[A-Z]{0,2}|80104) Build' + - regex: '; *(?:ASSISTANT |)(AP)-?([1789]\d{2}[A-Z]{0,2}|80104) Build' device_replacement: 'Assistant $1-$2' brand_replacement: 'Assistant' model_replacement: '$1-$2' @@ -1748,7 +1748,7 @@ device_parsers: # Asus # @ref: http://www.asus.com/uk/Tablets_Mobile/ ######### - - regex: '; *(ME17\d[^;/]*|ME3\d{2}[^;/]+|K00[A-Z]|Nexus 10|Nexus 7(?: 2013)?|PadFone[^;/]*|Transformer[^;/]*|TF\d{3}[^;/]*|eeepc) Build' + - regex: '; *(ME17\d[^;/]*|ME3\d{2}[^;/]+|K00[A-Z]|Nexus 10|Nexus 7(?: 2013|)|PadFone[^;/]*|Transformer[^;/]*|TF\d{3}[^;/]*|eeepc) Build' device_replacement: 'Asus $1' brand_replacement: 'Asus' model_replacement: '$1' @@ -2296,7 +2296,7 @@ device_parsers: # Gionee # @ref: http://www.gionee.com/ ######### - - regex: '; *(Gionee)[ _\-]([^;/]+)(?:/[^;/]+)? Build' + - regex: '; *(Gionee)[ _\-]([^;/]+)(?:/[^;/]+|) Build' regex_flag: 'i' device_replacement: '$1 $2' brand_replacement: 'Gionee' @@ -2460,7 +2460,7 @@ device_parsers: # @ref: http://www.huaweidevice.com # @note: Needs to be before HTC due to Desire HD Build on U8815 ######### - - regex: '; *(HUAWEI |Huawei-)?([UY][^;/]+) Build/(?:Huawei|HUAWEI)([UY][^\);]+)\)' + - regex: '; *(HUAWEI |Huawei-|)([UY][^;/]+) Build/(?:Huawei|HUAWEI)([UY][^\);]+)\)' device_replacement: '$1$2' brand_replacement: 'Huawei' model_replacement: '$2' @@ -2476,7 +2476,7 @@ device_parsers: device_replacement: '$1$2' brand_replacement: 'Huawei' model_replacement: '$2' - - regex: '; *((?:HUAWEI[ _]?|Huawei[ _])?Ascend[ _])([^;/]+) Build' + - regex: '; *((?:HUAWEI[ _]?|Huawei[ _]|)Ascend[ _])([^;/]+) Build' device_replacement: '$1$2' brand_replacement: 'Huawei' model_replacement: '$2' @@ -2531,33 +2531,33 @@ device_parsers: device_replacement: 'HTC $1' brand_replacement: 'HTC' model_replacement: '$1' - - regex: '; *(?:HTC[ _/])+([^ _/]+)(?:[ _/]([^ _/]+))?(?:[/\\]1\.0 | V|/| +)\d+\.\d[\d\.]*(?: *Build|\))' + - regex: '; *(?:HTC[ _/])+([^ _/]+)(?:[ _/]([^ _/]+)|)(?:[/\\]1\.0 | V|/| +)\d+\.\d[\d\.]*(?: *Build|\))' device_replacement: 'HTC $1 $2' brand_replacement: 'HTC' model_replacement: '$1 $2' - - regex: '; *(?:HTC[ _/])+([^ _/]+)(?:[ _/]([^ _/]+)(?:[ _/]([^ _/]+))?)?(?:[/\\]1\.0 | V|/| +)\d+\.\d[\d\.]*(?: *Build|\))' + - regex: '; *(?:HTC[ _/])+([^ _/]+)(?:[ _/]([^ _/]+)(?:[ _/]([^ _/]+)|)|)(?:[/\\]1\.0 | V|/| +)\d+\.\d[\d\.]*(?: *Build|\))' device_replacement: 'HTC $1 $2 $3' brand_replacement: 'HTC' model_replacement: '$1 $2 $3' - - regex: '; *(?:HTC[ _/])+([^ _/]+)(?:[ _/]([^ _/]+)(?:[ _/]([^ _/]+)(?:[ _/]([^ _/]+))?)?)?(?:[/\\]1\.0 | V|/| +)\d+\.\d[\d\.]*(?: *Build|\))' + - regex: '; *(?:HTC[ _/])+([^ _/]+)(?:[ _/]([^ _/]+)(?:[ _/]([^ _/]+)(?:[ _/]([^ _/]+)|)|)|)(?:[/\\]1\.0 | V|/| +)\d+\.\d[\d\.]*(?: *Build|\))' device_replacement: 'HTC $1 $2 $3 $4' brand_replacement: 'HTC' model_replacement: '$1 $2 $3 $4' # Android HTC without Version Number matcher - - regex: '; *(?:(?:HTC|htc)(?:_blocked)*[ _/])+([^ _/;]+)(?: *Build|[;\)]| - )' + - regex: '; *(?:(?:HTC|htc)(?:_blocked|)[ _/])+([^ _/;]+)(?: *Build|[;\)]| - )' device_replacement: 'HTC $1' brand_replacement: 'HTC' model_replacement: '$1' - - regex: '; *(?:(?:HTC|htc)(?:_blocked)*[ _/])+([^ _/]+)(?:[ _/]([^ _/;\)]+))?(?: *Build|[;\)]| - )' + - regex: '; *(?:(?:HTC|htc)(?:_blocked|)[ _/])+([^ _/]+)(?:[ _/]([^ _/;\)]+)|)(?: *Build|[;\)]| - )' device_replacement: 'HTC $1 $2' brand_replacement: 'HTC' model_replacement: '$1 $2' - - regex: '; *(?:(?:HTC|htc)(?:_blocked)*[ _/])+([^ _/]+)(?:[ _/]([^ _/]+)(?:[ _/]([^ _/;\)]+))?)?(?: *Build|[;\)]| - )' + - regex: '; *(?:(?:HTC|htc)(?:_blocked|)[ _/])+([^ _/]+)(?:[ _/]([^ _/]+)(?:[ _/]([^ _/;\)]+)|)|)(?: *Build|[;\)]| - )' device_replacement: 'HTC $1 $2 $3' brand_replacement: 'HTC' model_replacement: '$1 $2 $3' - - regex: '; *(?:(?:HTC|htc)(?:_blocked)*[ _/])+([^ _/]+)(?:[ _/]([^ _/]+)(?:[ _/]([^ _/]+)(?:[ _/]([^ /;]+))?)?)?(?: *Build|[;\)]| - )' + - regex: '; *(?:(?:HTC|htc)(?:_blocked|)[ _/])+([^ _/]+)(?:[ _/]([^ _/]+)(?:[ _/]([^ _/]+)(?:[ _/]([^ /;]+)|)|)|)(?: *Build|[;\)]| - )' device_replacement: 'HTC $1 $2 $3 $4' brand_replacement: 'HTC' model_replacement: '$1 $2 $3 $4' @@ -2568,7 +2568,7 @@ device_parsers: brand_replacement: 'HTC' model_replacement: '$1' # general matcher for anything else - - regex: '(?:[;,] *|^)(?:htccn_chs-)?HTC[ _-]?([^;]+?)(?: *Build|clay|Android|-?Mozilla| Opera| Profile| UNTRUSTED|[;/\(\)]|$)' + - regex: '(?:[;,] *|^)(?:htccn_chs-|)HTC[ _-]?([^;]+?)(?: *Build|clay|Android|-?Mozilla| Opera| Profile| UNTRUSTED|[;/\(\)]|$)' regex_flag: 'i' device_replacement: 'HTC $1' brand_replacement: 'HTC' @@ -2607,12 +2607,12 @@ device_parsers: # iBall # @ref: http://www.iball.co.in/Category/Mobiles/22 ######### - - regex: '; *(?:iBall[ _\-])?(Andi)[ _]?(\d[^;/]*) Build' + - regex: '; *(?:iBall[ _\-]|)(Andi)[ _]?(\d[^;/]*) Build' regex_flag: 'i' device_replacement: '$1 $2' brand_replacement: 'iBall' model_replacement: '$1 $2' - - regex: '; *(IBall)(?:[ _]([^;/]+))? Build' + - regex: '; *(IBall)(?:[ _]([^;/]+)|) Build' regex_flag: 'i' device_replacement: '$1 $2' brand_replacement: 'iBall' @@ -2622,7 +2622,7 @@ device_parsers: # IconBIT # @ref: http://www.iconbit.com/catalog/tablets/ ######### - - regex: '; *(NT-\d+[^ ;/]*|Net[Tt]AB [^;/]+|Mercury [A-Z]+|iconBIT)(?: S/N:[^;/]+)? Build' + - regex: '; *(NT-\d+[^ ;/]*|Net[Tt]AB [^;/]+|Mercury [A-Z]+|iconBIT)(?: S/N:[^;/]+|) Build' device_replacement: '$1' brand_replacement: 'IconBIT' model_replacement: '$1' @@ -2695,17 +2695,17 @@ device_parsers: # @note: Zync also offers a ""Cloud Z5"" device ######### # smartphones - - regex: '; *(?:Intex[ _])?(AQUA|Aqua)([ _\.\-])([^;/]+) *(?:Build|;)' + - regex: '; *(?:Intex[ _]|)(AQUA|Aqua)([ _\.\-])([^;/]+) *(?:Build|;)' device_replacement: '$1$2$3' brand_replacement: 'Intex' model_replacement: '$1 $3' # matches ""INTEX CLOUD X1"" - - regex: '; *(?:INTEX|Intex)(?:[_ ]([^\ _;/]+))(?:[_ ]([^\ _;/]+))? *(?:Build|;)' + - regex: '; *(?:INTEX|Intex)(?:[_ ]([^\ _;/]+))(?:[_ ]([^\ _;/]+)|) *(?:Build|;)' device_replacement: '$1 $2' brand_replacement: 'Intex' model_replacement: '$1 $2' # tablets - - regex: '; *([iI]Buddy)[ _]?(Connect)(?:_|\?_| )?([^;/]*) *(?:Build|;)' + - regex: '; *([iI]Buddy)[ _]?(Connect)(?:_|\?_| |)([^;/]*) *(?:Build|;)' device_replacement: '$1 $2 $3' brand_replacement: 'Intex' model_replacement: 'iBuddy $2 $3' @@ -2728,7 +2728,7 @@ device_parsers: # i.onik # @ref: http://www.i-onik.de/ ######### - - regex: '; *(TP\d+(?:\.\d+)?\-\d[^;/]+) Build' + - regex: '; *(TP\d+(?:\.\d+|)\-\d[^;/]+) Build' device_replacement: 'ionik $1' brand_replacement: 'ionik' model_replacement: '$1' @@ -2944,7 +2944,7 @@ device_parsers: # Lava # @ref: http://www.lavamobiles.com/ ######### - - regex: '; *(?:LAVA[ _])?IRIS[ _\-]?([^/;\)]+) *(?:;|\)|Build)' + - regex: '; *(?:LAVA[ _]|)IRIS[ _\-]?([^/;\)]+) *(?:;|\)|Build)' regex_flag: 'i' device_replacement: 'Iris $1' brand_replacement: 'Lava' @@ -2996,15 +2996,15 @@ device_parsers: device_replacement: 'Lenovo $1 $2' brand_replacement: 'Lenovo' model_replacement: '$1 $2' - - regex: '; *(?:LNV-)?(?:=?[Ll]enovo[ _\-]?|LENOVO[ _])+(.+?)(?:Build|[;/\)])' + - regex: '; *(?:LNV-|)(?:=?[Ll]enovo[ _\-]?|LENOVO[ _])(.+?)(?:Build|[;/\)])' device_replacement: 'Lenovo $1' brand_replacement: 'Lenovo' model_replacement: '$1' - - regex: '[;,] (?:Vodafone )?(SmartTab) ?(II) ?(\d+) Build/' + - regex: '[;,] (?:Vodafone |)(SmartTab) ?(II) ?(\d+) Build/' device_replacement: 'Lenovo $1 $2 $3' brand_replacement: 'Lenovo' model_replacement: '$1 $2 $3' - - regex: '; *(?:Ideapad )?K1 Build/' + - regex: '; *(?:Ideapad |)K1 Build/' device_replacement: 'Lenovo Ideapad K1' brand_replacement: 'Lenovo' model_replacement: 'Ideapad K1' @@ -3034,7 +3034,7 @@ device_parsers: device_replacement: '$1' brand_replacement: 'LG' model_replacement: '$1' - - regex: '[;:] *(L-\d+[A-Z]|LGL\d+[A-Z]?)(?:/V\d+)? *(?:Build|[;\)])' + - regex: '[;:] *(L-\d+[A-Z]|LGL\d+[A-Z]?)(?:/V\d+|) *(?:Build|[;\)])' device_replacement: '$1' brand_replacement: 'LG' model_replacement: '$1' @@ -3117,7 +3117,7 @@ device_parsers: # Medion # @ref: http://www.medion.com/en/ ######### - - regex: '; *(?:MD_)?LIFETAB[ _]([^;/]+) Build' + - regex: '; *(?:MD_|)LIFETAB[ _]([^;/]+) Build' regex_flag: 'i' device_replacement: 'Medion Lifetab $1' brand_replacement: 'Medion' @@ -3195,7 +3195,7 @@ device_parsers: # Modecom # @ref: http://www.modecom.eu/tablets/portal/ ######### - - regex: '; *(MODECOM )?(FreeTab) ?([^;/]+) Build' + - regex: '; *(MODECOM |)(FreeTab) ?([^;/]+) Build' regex_flag: 'i' device_replacement: '$1$2 $3' brand_replacement: 'Modecom' @@ -3253,7 +3253,7 @@ device_parsers: # MSI # @ref: http://www.msi.com/product/windpad/ ######### - - regex: '; *(?:MSI[ _])?(Primo\d+|Enjoy[ _\-][^;/]+) Build' + - regex: '; *(?:MSI[ _]|)(Primo\d+|Enjoy[ _\-][^;/]+) Build' regex_flag: 'i' device_replacement: '$1' brand_replacement: 'Msi' @@ -3280,7 +3280,7 @@ device_parsers: device_replacement: '$1$2 $3' brand_replacement: 'MyPhone' model_replacement: '$3' - - regex: '; *(A\d+)[ _](Duo)? Build' + - regex: '; *(A\d+)[ _](Duo|) Build' regex_flag: 'i' device_replacement: '$1 $2' brand_replacement: 'MyPhone' @@ -3349,7 +3349,7 @@ device_parsers: device_replacement: '$1$2' brand_replacement: 'Nook' model_replacement: '$2' - - regex: '; *(NOOK )?(BNRV200|BNRV200A|BNTV250|BNTV250A|BNTV400|BNTV600|LogicPD Zoom2) Build' + - regex: '; *(NOOK |)(BNRV200|BNRV200A|BNTV250|BNTV250A|BNTV400|BNTV600|LogicPD Zoom2) Build' device_replacement: '$1$2' brand_replacement: 'Nook' model_replacement: '$2' @@ -3484,11 +3484,11 @@ device_parsers: # @href: http://www.pantech.co.kr/en/prod/prodList.do?gbrand=VEGA # @models: ADR8995, ADR910L, ADR930VW, C790, CDM8992, CDM8999, IS06, IS11PT, P2000, P2020, P2030, P4100, P5000, P6010, P6020, P6030, P7000, P7040, P8000, P8010, P9020, P9050, P9060, P9070, P9090, PT001, PT002, PT003, TXT8040, TXT8045, VEGA PTL21 ######### - - regex: '; *(SKY[ _])?(IM\-[AT]\d{3}[^;/]+).* Build/' + - regex: '; *(SKY[ _]|)(IM\-[AT]\d{3}[^;/]+).* Build/' device_replacement: 'Pantech $1$2' brand_replacement: 'Pantech' model_replacement: '$1$2' - - regex: '; *((?:ADR8995|ADR910L|ADR930L|ADR930VW|PTL21|P8000)(?: 4G)?) Build/' + - regex: '; *((?:ADR8995|ADR910L|ADR930L|ADR930VW|PTL21|P8000)(?: 4G|)) Build/' device_replacement: '$1' brand_replacement: 'Pantech' model_replacement: '$1' @@ -3571,7 +3571,7 @@ device_parsers: # Polaroid/ Acho # @ref: http://polaroidstore.com/store/start.asp?category_id=382&category_id2=0&order=title&filter1=&filter2=&filter3=&view=all ######### - - regex: '; *(?:Polaroid[ _])?((?:MIDC\d{3,}|PMID\d{2,}|PTAB\d{3,})[^;/]*)(\/[^;/]*)? Build/' + - regex: '; *(?:Polaroid[ _]|)((?:MIDC\d{3,}|PMID\d{2,}|PTAB\d{3,})[^;/]*)(\/[^;/]*|) Build/' device_replacement: '$1' brand_replacement: 'Polaroid' model_replacement: '$1' @@ -3598,7 +3598,7 @@ device_parsers: device_replacement: '$1' brand_replacement: 'Positivo' model_replacement: '$1' - - regex: '; *(?:Positivo )?((?:YPY|Ypy)[^;/]+) Build/' + - regex: '; *(?:Positivo |)((?:YPY|Ypy)[^;/]+) Build/' device_replacement: '$1' brand_replacement: 'Positivo' model_replacement: '$1' @@ -3626,7 +3626,7 @@ device_parsers: # @ref: http://www.prestigio.com/catalogue/MultiPhones # @ref: http://www.prestigio.com/catalogue/MultiPads ######### - - regex: '; *(?:Prestigio )?((?:PAP|PMP)\d[^;/]+) Build/' + - regex: '; *(?:Prestigio |)((?:PAP|PMP)\d[^;/]+) Build/' device_replacement: 'Prestigio $1' brand_replacement: 'Prestigio' model_replacement: '$1' @@ -3644,7 +3644,7 @@ device_parsers: # QMobile # @ref: http://www.qmobile.com.pk/ ######### - - regex: '; *(A2|A5|A8|A900)_?(Classic)? Build' + - regex: '; *(A2|A5|A8|A900)_?(Classic|) Build' device_replacement: '$1 $2' brand_replacement: 'Qmobile' model_replacement: '$1 $2' @@ -3710,11 +3710,11 @@ device_parsers: # Samsung Android Devices # @ref: http://www.samsung.com/us/mobile/cell-phones/all-products ######### - - regex: '; *(SAMSUNG |Samsung )?((?:Galaxy (?:Note II|S\d)|GT-I9082|GT-I9205|GT-N7\d{3}|SM-N9005)[^;/]*)\/?[^;/]* Build/' + - regex: '; *(SAMSUNG |Samsung |)((?:Galaxy (?:Note II|S\d)|GT-I9082|GT-I9205|GT-N7\d{3}|SM-N9005)[^;/]*)\/?[^;/]* Build/' device_replacement: 'Samsung $1$2' brand_replacement: 'Samsung' model_replacement: '$2' - - regex: '; *(Google )?(Nexus [Ss](?: 4G)?) Build/' + - regex: '; *(Google |)(Nexus [Ss](?: 4G|)) Build/' device_replacement: 'Samsung $1$2' brand_replacement: 'Samsung' model_replacement: '$2' @@ -3722,15 +3722,15 @@ device_parsers: device_replacement: 'Samsung $2' brand_replacement: 'Samsung' model_replacement: '$2' - - regex: '; *(Galaxy(?: Ace| Nexus| S ?II+|Nexus S| with MCR 1.2| Mini Plus 4G)?) Build/' + - regex: '; *(Galaxy(?: Ace| Nexus| S ?II+|Nexus S| with MCR 1.2| Mini Plus 4G|)) Build/' device_replacement: 'Samsung $1' brand_replacement: 'Samsung' model_replacement: '$1' - - regex: '; *(SAMSUNG[ _\-] *)+([^;/]+) Build' + - regex: '; *(SAMSUNG[ _\-]|)(?:SAMSUNG[ _\-])([^;/]+) Build' device_replacement: 'Samsung $2' brand_replacement: 'Samsung' model_replacement: '$2' - - regex: '; *(SAMSUNG-)?(GT\-[BINPS]\d{4}[^\/]*)(\/[^ ]*) Build' + - regex: '; *(SAMSUNG-|)(GT\-[BINPS]\d{4}[^\/]*)(\/[^ ]*) Build' device_replacement: 'Samsung $1$2$3' brand_replacement: 'Samsung' model_replacement: '$2' @@ -3742,11 +3742,11 @@ device_parsers: device_replacement: 'Samsung $1$2' brand_replacement: 'Samsung' model_replacement: '$2' - - regex: '; *((?:SCH|SGH|SHV|SHW|SPH|SC|SM)\-[A-Za-z0-9 ]+)(/?[^ ]*)? Build' + - regex: '; *((?:SCH|SGH|SHV|SHW|SPH|SC|SM)\-[A-Za-z0-9 ]+)(/?[^ ]*|) Build' device_replacement: 'Samsung $1' brand_replacement: 'Samsung' model_replacement: '$1' - - regex: ' ((?:SCH)\-[A-Za-z0-9 ]+)(/?[^ ]*)? Build' + - regex: ' ((?:SCH)\-[A-Za-z0-9 ]+)(/?[^ ]*|) Build' device_replacement: 'Samsung $1' brand_replacement: 'Samsung' model_replacement: '$1' @@ -3883,7 +3883,7 @@ device_parsers: device_replacement: '$1$2' brand_replacement: 'SonyEricsson' model_replacement: '$2' - - regex: '; *((?:SK|ST|E|X|LT|MK|MT|WT)\d{2}[a-z0-9]*(?:-o)?|R800i|U20i) Build' + - regex: '; *((?:SK|ST|E|X|LT|MK|MT|WT)\d{2}[a-z0-9]*(?:-o|)|R800i|U20i) Build' device_replacement: '$1' brand_replacement: 'SonyEricsson' model_replacement: '$1' @@ -3947,7 +3947,7 @@ device_parsers: # Spice # @ref: http://www.spicemobilephones.co.in/ ######### - - regex: '; *((?:CSL_Spice|Spice|SPICE|CSL)[ _\-]?)?([Mm][Ii])([ _\-])?(\d{3}[^;/]*) Build/' + - regex: '; *((?:CSL_Spice|Spice|SPICE|CSL)[ _\-]?|)([Mm][Ii])([ _\-]|)(\d{3}[^;/]*) Build/' device_replacement: '$1$2$3$4' brand_replacement: 'Spice' model_replacement: 'Mi$4' @@ -4086,7 +4086,7 @@ device_parsers: device_replacement: '$1' brand_replacement: 'HTC' model_replacement: 'Dream' - - regex: '\b(T-Mobile ?)?(myTouch)[ _]?([34]G)[ _]?([^\/]*) (?:Mozilla|Build)' + - regex: '\b(T-Mobile ?|)(myTouch)[ _]?([34]G)[ _]?([^\/]*) (?:Mozilla|Build)' device_replacement: '$1$2 $3 $4' brand_replacement: 'HTC' model_replacement: '$2 $3 $4' @@ -4131,7 +4131,7 @@ device_parsers: device_replacement: '$1' brand_replacement: 'Toshiba' model_replacement: 'Folio 100' - - regex: '; *(AT[0-9]{2,3}(?:\-A|LE\-A|PE\-A|SE|a)?|AT7-A|AT1S0|Hikari-iFrame/WDPF-[^;/]+|THRiVE|Thrive) Build/' + - regex: '; *(AT[0-9]{2,3}(?:\-A|LE\-A|PE\-A|SE|a|)|AT7-A|AT1S0|Hikari-iFrame/WDPF-[^;/]+|THRiVE|Thrive) Build/' device_replacement: 'Toshiba $1' brand_replacement: 'Toshiba' model_replacement: '$1' @@ -4251,7 +4251,7 @@ device_parsers: # Walton # @ref: http://www.waltonbd.com/ ######### - - regex: '; *(?:Walton[ _\-])?(Primo[ _\-][^;/]+) Build' + - regex: '; *(?:Walton[ _\-]|)(Primo[ _\-][^;/]+) Build' regex_flag: 'i' device_replacement: 'Walton $1' brand_replacement: 'Walton' @@ -4261,7 +4261,7 @@ device_parsers: # Wiko # @ref: http://fr.wikomobile.com/collection.php?s=Smartphones ######### - - regex: '; *(?:WIKO[ \-])?(CINK\+?|BARRY|BLOOM|DARKFULL|DARKMOON|DARKNIGHT|DARKSIDE|FIZZ|HIGHWAY|IGGY|OZZY|RAINBOW|STAIRWAY|SUBLIM|WAX|CINK [^;/]+) Build/' + - regex: '; *(?:WIKO[ \-]|)(CINK\+?|BARRY|BLOOM|DARKFULL|DARKMOON|DARKNIGHT|DARKSIDE|FIZZ|HIGHWAY|IGGY|OZZY|RAINBOW|STAIRWAY|SUBLIM|WAX|CINK [^;/]+) Build/' regex_flag: 'i' device_replacement: 'Wiko $1' brand_replacement: 'Wiko' @@ -4307,7 +4307,7 @@ device_parsers: # Yarvik Zania # @ref: http://yarvik.com ######### - - regex: '; *(?:Xenta |Luna )?(TAB[234][0-9]{2}|TAB0[78]-\d{3}|TAB0?9-\d{3}|TAB1[03]-\d{3}|SMP\d{2}-\d{3}) Build/' + - regex: '; *(?:Xenta |Luna |)(TAB[234][0-9]{2}|TAB0[78]-\d{3}|TAB0?9-\d{3}|TAB1[03]-\d{3}|SMP\d{2}-\d{3}) Build/' device_replacement: 'Yarvik $1' brand_replacement: 'Yarvik' model_replacement: '$1' @@ -4330,7 +4330,7 @@ device_parsers: # XiaoMi # @ref: http://www.xiaomi.com/event/buyphone ######### - - regex: '; *((Mi|MI|HM|MI-ONE|Redmi)[ -](NOTE |Note )?[^;/]*) (Build|MIUI)/' + - regex: '; *((Mi|MI|HM|MI-ONE|Redmi)[ -](NOTE |Note |)[^;/]*) (Build|MIUI)/' device_replacement: 'XiaoMi $1' brand_replacement: 'XiaoMi' model_replacement: '$1' @@ -4496,7 +4496,7 @@ device_parsers: device_replacement: 'Kindle' brand_replacement: 'Amazon' model_replacement: 'Kindle' - - regex: '; ?(Silk)/(\d+)\.(\d+)(?:\.([0-9\-]+))? Build\b' + - regex: '; ?(Silk)/(\d+)\.(\d+)(?:\.([0-9\-]+)|) Build\b' device_replacement: 'Kindle Fire' brand_replacement: 'Amazon' model_replacement: 'Kindle Fire$2' @@ -4548,7 +4548,7 @@ device_parsers: ######### # Alcatel Windows Phones ######### - - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?)?(?:ALCATEL)[^;]*; *([^;,\)]+)' + - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?|)(?:ALCATEL)[^;]*; *([^;,\)]+)' device_replacement: 'Alcatel $1' brand_replacement: 'Alcatel' model_replacement: '$1' @@ -4556,8 +4556,8 @@ device_parsers: ######### # Asus Windows Phones ######### - #~ - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?|WpsLondonTest; ?)?(?:ASUS|Asus)[^;]*; *([^;,\)]+)' - - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?|WpsLondonTest; ?)?(?:ASUS|Asus)[^;]*; *([^;,\)]+)' + #~ - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?|WpsLondonTest; ?|)(?:ASUS|Asus)[^;]*; *([^;,\)]+)' + - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?|WpsLondonTest; ?|)(?:ASUS|Asus)[^;]*; *([^;,\)]+)' device_replacement: 'Asus $1' brand_replacement: 'Asus' model_replacement: '$1' @@ -4565,7 +4565,7 @@ device_parsers: ######### # Dell Windows Phones ######### - - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?)?(?:DELL|Dell)[^;]*; *([^;,\)]+)' + - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?|)(?:DELL|Dell)[^;]*; *([^;,\)]+)' device_replacement: 'Dell $1' brand_replacement: 'Dell' model_replacement: '$1' @@ -4573,7 +4573,7 @@ device_parsers: ######### # HTC Windows Phones ######### - - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?|WpsLondonTest; ?)?(?:HTC|Htc|HTC_blocked[^;]*)[^;]*; *(?:HTC)?([^;,\)]+)' + - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?|WpsLondonTest; ?|)(?:HTC|Htc|HTC_blocked[^;]*)[^;]*; *(?:HTC|)([^;,\)]+)' device_replacement: 'HTC $1' brand_replacement: 'HTC' model_replacement: '$1' @@ -4581,7 +4581,7 @@ device_parsers: ######### # Huawei Windows Phones ######### - - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?)?(?:HUAWEI)[^;]*; *(?:HUAWEI )?([^;,\)]+)' + - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?|)(?:HUAWEI)[^;]*; *(?:HUAWEI |)([^;,\)]+)' device_replacement: 'Huawei $1' brand_replacement: 'Huawei' model_replacement: '$1' @@ -4589,7 +4589,7 @@ device_parsers: ######### # LG Windows Phones ######### - - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?)?(?:LG|Lg)[^;]*; *(?:LG[ \-])?([^;,\)]+)' + - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?|)(?:LG|Lg)[^;]*; *(?:LG[ \-]|)([^;,\)]+)' device_replacement: 'LG $1' brand_replacement: 'LG' model_replacement: '$1' @@ -4597,15 +4597,15 @@ device_parsers: ######### # Noka Windows Phones ######### - - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?)?(?:rv:11; )?(?:NOKIA|Nokia)[^;]*; *(?:NOKIA ?|Nokia ?|LUMIA ?|[Ll]umia ?)*(\d{3,}[^;\)]*)' + - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?|)(?:rv:11; |)(?:NOKIA|Nokia)[^;]*; *(?:NOKIA ?|Nokia ?|LUMIA ?|[Ll]umia ?|)(\d{3,10}[^;\)]*)' device_replacement: 'Lumia $1' brand_replacement: 'Nokia' model_replacement: 'Lumia $1' - - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?)?(?:NOKIA|Nokia)[^;]*; *(RM-\d{3,})' + - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?|)(?:NOKIA|Nokia)[^;]*; *(RM-\d{3,})' device_replacement: 'Nokia $1' brand_replacement: 'Nokia' model_replacement: '$1' - - regex: '(?:Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)]|WPDesktop;) ?(?:ARM; ?Touch; ?|Touch; ?)?(?:NOKIA|Nokia)[^;]*; *(?:NOKIA ?|Nokia ?|LUMIA ?|[Ll]umia ?)*([^;\)]+)' + - regex: '(?:Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)]|WPDesktop;) ?(?:ARM; ?Touch; ?|Touch; ?|)(?:NOKIA|Nokia)[^;]*; *(?:NOKIA ?|Nokia ?|LUMIA ?|[Ll]umia ?|)([^;\)]+)' device_replacement: 'Nokia $1' brand_replacement: 'Nokia' model_replacement: '$1' @@ -4613,7 +4613,7 @@ device_parsers: ######### # Microsoft Windows Phones ######### - - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?)?(?:Microsoft(?: Corporation)?)[^;]*; *([^;,\)]+)' + - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?|)(?:Microsoft(?: Corporation|))[^;]*; *([^;,\)]+)' device_replacement: 'Microsoft $1' brand_replacement: 'Microsoft' model_replacement: '$1' @@ -4621,7 +4621,7 @@ device_parsers: ######### # Samsung Windows Phones ######### - - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?|WpsLondonTest; ?)?(?:SAMSUNG)[^;]*; *(?:SAMSUNG )?([^;,\.\)]+)' + - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?|WpsLondonTest; ?|)(?:SAMSUNG)[^;]*; *(?:SAMSUNG |)([^;,\.\)]+)' device_replacement: 'Samsung $1' brand_replacement: 'Samsung' model_replacement: '$1' @@ -4629,7 +4629,7 @@ device_parsers: ######### # Toshiba Windows Phones ######### - - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?|WpsLondonTest; ?)?(?:TOSHIBA|FujitsuToshibaMobileCommun)[^;]*; *([^;,\)]+)' + - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?|WpsLondonTest; ?|)(?:TOSHIBA|FujitsuToshibaMobileCommun)[^;]*; *([^;,\)]+)' device_replacement: 'Toshiba $1' brand_replacement: 'Toshiba' model_replacement: '$1' @@ -4637,7 +4637,7 @@ device_parsers: ######### # Generic Windows Phones ######### - - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?|WpsLondonTest; ?)?([^;]+); *([^;,\)]+)' + - regex: 'Windows Phone [^;]+; .*?IEMobile/[^;\)]+[;\)] ?(?:ARM; ?Touch; ?|Touch; ?|WpsLondonTest; ?|)([^;]+); *([^;,\)]+)' device_replacement: '$1 $2' brand_replacement: '$1' model_replacement: '$2' @@ -4657,7 +4657,7 @@ device_parsers: ######### # Firefox OS ######### - - regex: '\(Mobile; ALCATEL ?(One|ONE) ?(Touch|TOUCH) ?([^;/]+)(?:/[^;]+)?; rv:[^\)]+\) Gecko/[^\/]+ Firefox/' + - regex: '\(Mobile; ALCATEL ?(One|ONE) ?(Touch|TOUCH) ?([^;/]+)(?:/[^;]+|); rv:[^\)]+\) Gecko/[^\/]+ Firefox/' device_replacement: 'Alcatel $1 $2 $3' brand_replacement: 'Alcatel' model_replacement: 'One Touch $3' @@ -4688,7 +4688,7 @@ device_parsers: brand_replacement: '$1' model_replacement: '$2' # Nokia Symbian - - regex: '\(Symbian(?:/3)?; U; ([^;]+);' + - regex: '\(Symbian(?:/3|); U; ([^;]+);' device_replacement: 'Nokia $1' brand_replacement: 'Nokia' model_replacement: '$1' @@ -4733,7 +4733,7 @@ device_parsers: device_replacement: 'Palm Treo $1' brand_replacement: 'Palm' model_replacement: 'Treo $1' - - regex: 'webOS.*(P160U(?:NA)?)/(\d+).(\d+)' + - regex: 'webOS.*(P160U(?:NA|))/(\d+).(\d+)' device_replacement: 'HP Veer' brand_replacement: 'HP' model_replacement: 'Veer' @@ -4860,7 +4860,7 @@ device_parsers: device_replacement: 'Asus $1' brand_replacement: 'Asus' model_replacement: '$1' - - regex: '(?:asus.*?ASUS|Asus|ASUS|asus)[\- ;]*((?:Transformer (?:Pad|Prime) |Transformer |Padfone |Nexus[ _])?[A-Za-z0-9]+)' + - regex: '(?:asus.*?ASUS|Asus|ASUS|asus)[\- ;]*((?:Transformer (?:Pad|Prime) |Transformer |Padfone |Nexus[ _]|)[A-Za-z0-9]+)' device_replacement: 'Asus $1' brand_replacement: 'Asus' model_replacement: '$1' @@ -4901,7 +4901,7 @@ device_parsers: ########## # htc ########## - - regex: '\b(?:HTC/|HTC/[a-z0-9]+/)?HTC[ _\-;]? *(.*?)(?:-?Mozilla|fingerPrint|[;/\(\)]|$)' + - regex: '\b(?:HTC/|HTC/[a-z0-9]+/|)HTC[ _\-;]? *(.*?)(?:-?Mozilla|fingerPrint|[;/\(\)]|$)' device_replacement: 'HTC $1' brand_replacement: 'HTC' model_replacement: '$1' @@ -4958,11 +4958,11 @@ device_parsers: device_replacement: '$1' brand_replacement: '$2' model_replacement: '$3' - - regex: '(HbbTV)/1\.1\.1.*CE-HTML/1\.\d;(Vendor/)*(THOM[^;]*?)[;\s](?:.*SW-Version/.*)*(LF[^;]+);?' + - regex: '(HbbTV)/1\.1\.1.*CE-HTML/1\.\d;(Vendor/|)(THOM[^;]*?)[;\s].{0,30}(LF[^;]+);?' device_replacement: '$1' brand_replacement: 'Thomson' model_replacement: '$4' - - regex: '(HbbTV)(?:/1\.1\.1)?(?: ?\(;;;;;\))?; *CE-HTML(?:/1\.\d)?; *([^ ]+) ([^;]+);' + - regex: '(HbbTV)(?:/1\.1\.1|) ?(?: \(;;;;;\)|); *CE-HTML(?:/1\.\d|); *([^ ]+) ([^;]+);' device_replacement: '$1' brand_replacement: '$2' model_replacement: '$3' @@ -4979,7 +4979,7 @@ device_parsers: ########## # LGE NetCast TV ########## - - regex: 'LGE; (?:Media\/)?([^;]*);[^;]*;[^;]*;?\); ""?LG NetCast(\.TV|\.Media)?-\d+' + - regex: 'LGE; (?:Media\/|)([^;]*);[^;]*;[^;]*;?\); ""?LG NetCast(\.TV|\.Media|)-\d+' device_replacement: 'NetCast$2' brand_replacement: 'LG' model_replacement: '$1' @@ -5008,7 +5008,7 @@ device_parsers: brand_replacement: '$1' model_replacement: '$2' # other LG phones - - regex: '\b(?:LGE[ \-]LG\-(?:AX)?|LGE |LGE?-LG|LGE?[ \-]|LG[ /\-]|lg[\-])([A-Za-z0-9]+)\b' + - regex: '\b(?:LGE[ \-]LG\-(?:AX|)|LGE |LGE?-LG|LGE?[ \-]|LG[ /\-]|lg[\-])([A-Za-z0-9]+)\b' device_replacement: 'LG $1' brand_replacement: 'LG' model_replacement: '$1' @@ -5153,7 +5153,7 @@ device_parsers: device_replacement: '$2 $1' brand_replacement: '$2' model_replacement: '$1' - - regex: '(Sony)(?:BDP\/|\/)?([^ /;\)]+)[ /;\)]' + - regex: '(Sony)(?:BDP\/|\/|)([^ /;\)]+)[ /;\)]' device_replacement: '$1 $2' brand_replacement: '$1' model_replacement: '$2' @@ -5189,21 +5189,21 @@ device_parsers: - regex: 'Android[\- ][\d]+\.[\d]+\-update1; [A-Za-z]{2}\-[A-Za-z]{0,2} *; *(.+?) Build[/ ]' brand_replacement: 'Generic_Android' model_replacement: '$1' - - regex: 'Android[\- ][\d]+(?:\.[\d]+){1,2}; *[A-Za-z]{2}[_\-][A-Za-z]{0,2}\-? *; *(.+?) Build[/ ]' + - regex: 'Android[\- ][\d]+(?:\.[\d]+)(?:\.[\d]+|); *[A-Za-z]{2}[_\-][A-Za-z]{0,2}\-? *; *(.+?) Build[/ ]' brand_replacement: 'Generic_Android' model_replacement: '$1' - - regex: 'Android[\- ][\d]+(?:\.[\d]+){1,2}; *[A-Za-z]{0,2}\- *; *(.+?) Build[/ ]' + - regex: 'Android[\- ][\d]+(?:\.[\d]+)(?:\.[\d]+|); *[A-Za-z]{0,2}\- *; *(.+?) Build[/ ]' brand_replacement: 'Generic_Android' model_replacement: '$1' # No build info at all - ""Build"" follows locale immediately - - regex: 'Android[\- ][\d]+(?:\.[\d]+){1,2}; *[a-z]{0,2}[_\-]?[A-Za-z]{0,2};? Build[/ ]' + - regex: 'Android[\- ][\d]+(?:\.[\d]+)(?:\.[\d]+|); *[a-z]{0,2}[_\-]?[A-Za-z]{0,2};? Build[/ ]' device_replacement: 'Generic Smartphone' brand_replacement: 'Generic' model_replacement: 'Smartphone' - - regex: 'Android[\- ][\d]+(?:\.[\d]+){1,2}; *\-?[A-Za-z]{2}; *(.+?) Build[/ ]' + - regex: 'Android[\- ][\d]+(?:\.[\d]+)(?:\.[\d]+|); *\-?[A-Za-z]{2}; *(.+?) Build[/ ]' brand_replacement: 'Generic_Android' model_replacement: '$1' - - regex: 'Android[\- ][\d]+(?:\.[\d]+){1,2}(?:;.*)?; *(.+?) Build[/ ]' + - regex: 'Android[\- ][\d]+(?:\.[\d]+)(?:\.[\d]+|)(?:;.*|); *(.+?) Build[/ ]' brand_replacement: 'Generic_Android' model_replacement: '$1' diff --git a/tests/mocha.opts b/tests/mocha.opts new file mode 100644 index 0000000..700bbc4 --- /dev/null +++ b/tests/mocha.opts @@ -0,0 +1,3 @@ +--ui tdd +--reporter min +--check-leaks diff --git a/tests/regexes.js b/tests/regexes.js new file mode 100644 index 0000000..fb2635c --- /dev/null +++ b/tests/regexes.js @@ -0,0 +1,27 @@ +'use strict' + +var assert = require('assert') +var path = require('path') +var fs = require('fs') +var yaml = require('yamlparser') +var regexes = readYAML('../regexes.yaml') +var safe = require('safe-regex') + +function readYAML (fileName) { + var file = path.join(__dirname, fileName) + var data = fs.readFileSync(file, 'utf8') + return yaml.eval(data) +} + +suite('regexes', function () { + Object.keys(regexes).forEach(function (parser) { + suite(parser, function () { + regexes[parser].forEach(function(item) { + test(item.regex, function () { + // console.log(item.regex) + assert.ok(safe(item.regex)) + }) + }) + }) + }) +}) ",1 5241e4d7b177d0b6f073cfc9ed5444bf51ec89d6,https://github.com/acassen/keepalived/commit/5241e4d7b177d0b6f073cfc9ed5444bf51ec89d6,"Fix compile warning introduced in commit c6247a9 Commit c6247a9 - ""Add command line and configuration option to set umask"" introduced a compile warning, although the code would have worked OK. Signed-off-by: Quentin Armitage ","diff --git a/keepalived/core/main.c b/keepalived/core/main.c index 6670ada28..03757f6f6 100644 --- a/keepalived/core/main.c +++ b/keepalived/core/main.c @@ -882,7 +882,7 @@ set_umask(const char *optarg) if (*endptr || umask_long < 0 || umask_long & ~0777L) { fprintf(stderr, ""Invalid --umask option %s"", optarg); - return; + return 0; } umask_val = umask_long & 0777; ",1 b0dc999e0b45355314616321dbb6cb71e729fc9d,https://github.com/GNOME/gnome-session/commit/b0dc999e0b45355314616321dbb6cb71e729fc9d,"[gsm] Delay the creation of the GsmXSMPClient until it really exists We used to create the GsmXSMPClient before the XSMP connection is really accepted. This can lead to some issues, though. An example is: https://bugzilla.gnome.org/show_bug.cgi?id=598211#c19. Quoting: ""What is happening is that a new client (probably metacity in your case) is opening an ICE connection in the GSM_MANAGER_PHASE_END_SESSION phase, which causes a new GsmXSMPClient to be added to the client store. The GSM_MANAGER_PHASE_EXIT phase then begins before the client has had a chance to establish a xsmp connection, which means that client->priv->conn will not be initialized at the point that xsmp_stop is called on the new unregistered client."" The fix is to create the GsmXSMPClient object when there's a real XSMP connection. This implies moving the timeout that makes sure we don't have an empty client to the XSMP server. https://bugzilla.gnome.org/show_bug.cgi?id=598211","diff --git a/gnome-session/gsm-xsmp-client.c b/gnome-session/gsm-xsmp-client.c index 8ba1eb7b..9da5fdc0 100644 --- a/gnome-session/gsm-xsmp-client.c +++ b/gnome-session/gsm-xsmp-client.c @@ -51,7 +51,6 @@ struct GsmXSMPClientPrivate IceConn ice_connection; guint watch_id; - guint protocol_timeout; char *description; GPtrArray *props; @@ -115,22 +114,6 @@ client_iochannel_watch (GIOChannel *channel, return keep_going; } -/* Called if too much time passes between the initial connection and - * the XSMP protocol setup. - */ -static gboolean -_client_protocol_timeout (GsmXSMPClient *client) -{ - g_debug (""GsmXSMPClient: client_protocol_timeout for client '%s' in ICE status %d"", - client->priv->description, - IceConnectionStatus (client->priv->ice_connection)); - - gsm_client_set_status (GSM_CLIENT (client), GSM_CLIENT_FAILED); - gsm_client_disconnected (GSM_CLIENT (client)); - - return FALSE; -} - static SmProp * find_property (GsmXSMPClient *client, const char *name, @@ -193,10 +176,6 @@ setup_connection (GsmXSMPClient *client) client); g_io_channel_unref (channel); - client->priv->protocol_timeout = g_timeout_add_seconds (5, - (GSourceFunc)_client_protocol_timeout, - client); - set_description (client); g_debug (""GsmXSMPClient: New client '%s'"", client->priv->description); @@ -869,10 +848,6 @@ gsm_xsmp_client_disconnect (GsmXSMPClient *client) IceSetShutdownNegotiation (client->priv->ice_connection, FALSE); IceCloseConnection (client->priv->ice_connection); } - - if (client->priv->protocol_timeout > 0) { - g_source_remove (client->priv->protocol_timeout); - } } static void @@ -1305,11 +1280,6 @@ gsm_xsmp_client_connect (GsmXSMPClient *client, { client->priv->conn = conn; - if (client->priv->protocol_timeout) { - g_source_remove (client->priv->protocol_timeout); - client->priv->protocol_timeout = 0; - } - g_debug (""GsmXSMPClient: Initializing client %s"", client->priv->description); *mask_ret = 0; diff --git a/gnome-session/gsm-xsmp-server.c b/gnome-session/gsm-xsmp-server.c index 991c895f..1f0e0455 100644 --- a/gnome-session/gsm-xsmp-server.c +++ b/gnome-session/gsm-xsmp-server.c @@ -91,44 +91,134 @@ typedef struct { IceListenObj listener; } GsmIceConnectionData; +typedef struct { + guint watch_id; + guint protocol_timeout; +} GsmIceConnectionWatch; + +static void +disconnect_ice_connection (IceConn ice_conn) +{ + IceSetShutdownNegotiation (ice_conn, FALSE); + IceCloseConnection (ice_conn); +} + +static void +free_ice_connection_watch (GsmIceConnectionWatch *data) +{ + if (data->watch_id) { + g_source_remove (data->watch_id); + data->watch_id = 0; + } + + if (data->protocol_timeout) { + g_source_remove (data->protocol_timeout); + data->protocol_timeout = 0; + } + + g_free (data); +} + +static gboolean +ice_protocol_timeout (IceConn ice_conn) +{ + GsmIceConnectionWatch *data; + + g_debug (""GsmXsmpServer: ice_protocol_timeout for IceConn %p with status %d"", + ice_conn, IceConnectionStatus (ice_conn)); + + data = ice_conn->context; + + free_ice_connection_watch (data); + disconnect_ice_connection (ice_conn); + + return FALSE; +} + +static gboolean +auth_iochannel_watch (GIOChannel *source, + GIOCondition condition, + IceConn ice_conn) +{ + + GsmIceConnectionWatch *data; + gboolean keep_going; + + data = ice_conn->context; + + switch (IceProcessMessages (ice_conn, NULL, NULL)) { + case IceProcessMessagesSuccess: + keep_going = TRUE; + break; + case IceProcessMessagesIOError: + g_debug (""GsmXsmpServer: IceProcessMessages returned IceProcessMessagesIOError""); + free_ice_connection_watch (data); + disconnect_ice_connection (ice_conn); + keep_going = FALSE; + break; + case IceProcessMessagesConnectionClosed: + g_debug (""GsmXsmpServer: IceProcessMessages returned IceProcessMessagesConnectionClosed""); + free_ice_connection_watch (data); + keep_going = FALSE; + break; + default: + g_assert_not_reached (); + } + + return keep_going; +} + +/* IceAcceptConnection returns a new ICE connection that is in a ""pending"" state, + * this is because authentification may be necessary. + * So we've to authenticate it, before accept_xsmp_connection() is called. + * Then each GsmXSMPClient will have its own IceConn watcher + */ +static void +auth_ice_connection (IceConn ice_conn) +{ + GIOChannel *channel; + GsmIceConnectionWatch *data; + int fd; + + g_debug (""GsmXsmpServer: auth_ice_connection()""); + + fd = IceConnectionNumber (ice_conn); + fcntl (fd, F_SETFD, fcntl (fd, F_GETFD, 0) | FD_CLOEXEC); + channel = g_io_channel_unix_new (fd); + + data = g_new0 (GsmIceConnectionWatch, 1); + ice_conn->context = data; + + data->protocol_timeout = g_timeout_add_seconds (5, + (GSourceFunc)ice_protocol_timeout, + ice_conn); + data->watch_id = g_io_add_watch (channel, + G_IO_IN | G_IO_ERR, + (GIOFunc)auth_iochannel_watch, + ice_conn); + g_io_channel_unref (channel); +} + /* This is called (by glib via xsmp->ice_connection_watch) when a - * connection is first received on the ICE listening socket. (We - * expect that the client will then initiate XSMP on the connection; - * if it does not, GsmXSMPClient will eventually time out and close - * the connection.) - * - * FIXME: it would probably make more sense to not create a - * GsmXSMPClient object until accept_xsmp_connection, below (and to do - * the timing-out here in xsmp.c). + * connection is first received on the ICE listening socket. */ static gboolean accept_ice_connection (GIOChannel *source, GIOCondition condition, GsmIceConnectionData *data) { - IceListenObj listener; IceConn ice_conn; IceAcceptStatus status; - GsmClient *client; - GsmXsmpServer *server; - - listener = data->listener; - server = data->server; g_debug (""GsmXsmpServer: accept_ice_connection()""); - ice_conn = IceAcceptConnection (listener, &status); + ice_conn = IceAcceptConnection (data->listener, &status); if (status != IceAcceptSuccess) { g_debug (""GsmXsmpServer: IceAcceptConnection returned %d"", status); return TRUE; } - client = gsm_xsmp_client_new (ice_conn); - ice_conn->context = client; - - gsm_store_add (server->priv->client_store, gsm_client_peek_id (client), G_OBJECT (client)); - /* the store will own the ref */ - g_object_unref (client); + auth_ice_connection (ice_conn); return TRUE; } @@ -224,8 +314,9 @@ accept_xsmp_connection (SmsConn sms_conn, SmsCallbacks *callbacks_ret, char **failure_reason_ret) { - IceConn ice_conn; - GsmXSMPClient *client; + IceConn ice_conn; + GsmClient *client; + GsmIceConnectionWatch *data; /* FIXME: what about during shutdown but before gsm_xsmp_shutdown? */ if (server->priv->xsmp_sockets == NULL) { @@ -236,11 +327,18 @@ accept_xsmp_connection (SmsConn sms_conn, } ice_conn = SmsGetIceConnection (sms_conn); - client = ice_conn->context; + data = ice_conn->context; - g_return_val_if_fail (client != NULL, TRUE); + /* Each GsmXSMPClient has its own IceConn watcher */ + free_ice_connection_watch (data); + + client = gsm_xsmp_client_new (ice_conn); + + gsm_store_add (server->priv->client_store, gsm_client_peek_id (client), G_OBJECT (client)); + /* the store will own the ref */ + g_object_unref (client); - gsm_xsmp_client_connect (client, sms_conn, mask_ret, callbacks_ret); + gsm_xsmp_client_connect (GSM_XSMP_CLIENT (client), sms_conn, mask_ret, callbacks_ret); return TRUE; } ",1 9112a71f78ca9b28ed23101964f7a3481b9b0ad2,https://github.com/openSUSE/open-build-service/commit/9112a71f78ca9b28ed23101964f7a3481b9b0ad2,"Merge pull request #10667 from danidoni/remove-fake-login-endpoint-in-person-controller Remove fake login endpoint in Person controller","diff --git a/src/api/app/controllers/person_controller.rb b/src/api/app/controllers/person_controller.rb index 8d26663575e..4f959c01769 100644 --- a/src/api/app/controllers/person_controller.rb +++ b/src/api/app/controllers/person_controller.rb @@ -20,10 +20,6 @@ def show end end - def login - render_ok # just a dummy check for the webui to call (for now) - end - def command if params[:cmd] == 'register' internal_register diff --git a/src/api/config/routes/api_routes.rb b/src/api/config/routes/api_routes.rb index 6b01c2717a0..65b2121fde9 100644 --- a/src/api/config/routes/api_routes.rb +++ b/src/api/config/routes/api_routes.rb @@ -13,7 +13,6 @@ ### /person post 'person' => 'person#command' get 'person' => 'person#show' - post 'person/:login/login' => 'person#login', constraints: cons # temporary hack for webui, do not use, to be removed get 'person/:login/token' => 'person/token#index', constraints: cons post 'person/:login/token' => 'person/token#create', constraints: cons delete 'person/:login/token/:id' => 'person/token#delete', constraints: cons diff --git a/src/api/test/functional/person_controller_test.rb b/src/api/test/functional/person_controller_test.rb index 531f7be679c..dc4bafa60bd 100644 --- a/src/api/test/functional/person_controller_test.rb +++ b/src/api/test/functional/person_controller_test.rb @@ -71,15 +71,6 @@ def test_userinfo_with_broken_auth_header assert_response 401 end - def test_webui_login - post '/person/tom/login', headers: { 'username' => 'tom' } - assert_response 401 - - prepare_request_valid_user - post '/person/tom/login', headers: { 'username' => 'tom' } - assert_response :success - end - def test_watchlist_privacy prepare_request_valid_user ",0 c752181dd1b77de262dd84d8ed53fb51f7325790,https://github.com/mrash/fwsnort/commit/c752181dd1b77de262dd84d8ed53fb51f7325790,bump version to 1.5,"diff --git a/Changes b/Changes index 85ca18e..2e5d218 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,6 @@ Revision history for Perl extension IPTables::Parse. -1.5 Sun Sep 06 20:18:16 2015 +1.5 Mon Sep 07 20:18:16 2015 - Bug fix to support additional characters in iptables chain names such as dashes and special characters. Stuart Schneider reported this bug and submitted a patch. Closes github issue #1. diff --git a/META.json b/META.json index 9be141d..b00b1e8 100644 --- a/META.json +++ b/META.json @@ -35,5 +35,5 @@ } }, ""release_status"" : ""stable"", - ""version"" : ""1.4"" + ""version"" : ""1.5"" } diff --git a/META.yml b/META.yml index 99b805d..f87d776 100644 --- a/META.yml +++ b/META.yml @@ -1,6 +1,6 @@ --- #YAML:1.1 name: IPTables-Parse -version: 1.4 +version: 1.5 abstract: Perl extension for parsing iptables and ip6tables firewall rulesets author: - Michael Rash @@ -18,4 +18,4 @@ no_index: generated_by: ExtUtils::MakeMaker version 6.55_02 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: 1.4 + version: 1.5 diff --git a/VERSION b/VERSION index c068b24..c239c60 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.4 +1.5 diff --git a/lib/IPTables/Parse.pm b/lib/IPTables/Parse.pm index 1e2b25e..7c27b8b 100644 --- a/lib/IPTables/Parse.pm +++ b/lib/IPTables/Parse.pm @@ -7,7 +7,7 @@ # # Author: Michael Rash (mbr@cipherdyne.org) # -# Version: 1.4 +# Version: 1.5 # ################################################################## # @@ -21,7 +21,7 @@ use strict; use warnings; use vars qw($VERSION); -$VERSION = '1.4'; +$VERSION = '1.5'; sub new() { my $class = shift; @@ -1177,6 +1177,7 @@ Source control is provided by git: Thanks to the following people: Franck Joncourt + Stuart Schneider Grant Ferley Fabien Mazieres @@ -1188,7 +1189,7 @@ this address if there are any questions, comments, or bug reports. =head1 VERSION -Version 1.4 (February, 2015) +Version 1.5 (Septebmer, 2015) =head1 COPYRIGHT AND LICENSE ",0 4a60c6a655006b2882331844664fac5cf67c5f34,https://github.com/openstack/nova/commit/4a60c6a655006b2882331844664fac5cf67c5f34,"Avoid possible timing attack in metadata api Introduce a constant time comparison function to nova utils for comparing authentication tokens. Change-Id: I7374f2edc6f03c7da59cf73ae91a87147e53d0de Closes-bug: #1325128","diff --git a/nova/api/metadata/handler.py b/nova/api/metadata/handler.py index ba711b210739..29c0443b29e5 100644 --- a/nova/api/metadata/handler.py +++ b/nova/api/metadata/handler.py @@ -30,6 +30,7 @@ from nova.openstack.common.gettextutils import _ from nova.openstack.common import log as logging from nova.openstack.common import memorycache +from nova import utils from nova import wsgi CACHE_EXPIRATION = 15 # in seconds @@ -175,7 +176,7 @@ def _handle_instance_id_request(self, req): instance_id, hashlib.sha256).hexdigest() - if expected_signature != signature: + if not utils.constant_time_compare(expected_signature, signature): if instance_id: LOG.warn(_('X-Instance-ID-Signature: %(signature)s does not ' 'match the expected value: %(expected_signature)s ' diff --git a/nova/tests/test_utils.py b/nova/tests/test_utils.py index d83c086a4a89..c3e96fd9662a 100644 --- a/nova/tests/test_utils.py +++ b/nova/tests/test_utils.py @@ -962,3 +962,10 @@ def test_convert_version_to_string(self): def test_convert_version_to_tuple(self): self.assertEqual(utils.convert_version_to_tuple('6.7.0'), (6, 7, 0)) + + +class ConstantTimeCompareTestCase(test.NoDBTestCase): + def test_constant_time_compare(self): + self.assertTrue(utils.constant_time_compare(""abcd1234"", ""abcd1234"")) + self.assertFalse(utils.constant_time_compare(""abcd1234"", ""a"")) + self.assertFalse(utils.constant_time_compare(""abcd1234"", ""ABCD234"")) diff --git a/nova/utils.py b/nova/utils.py index bf5a522926aa..a02ba078925f 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -21,6 +21,7 @@ import datetime import functools import hashlib +import hmac import inspect import os import pyclbr @@ -1144,3 +1145,20 @@ def get_image_from_system_metadata(system_meta): def get_hash_str(base_str): """"""returns string that represents hash of base_str (in hex format)."""""" return hashlib.md5(base_str).hexdigest() + +if hasattr(hmac, 'compare_digest'): + constant_time_compare = hmac.compare_digest +else: + def constant_time_compare(first, second): + """"""Returns True if both string inputs are equal, otherwise False. + + This function should take a constant amount of time regardless of + how many characters in the strings match. + + """""" + if len(first) != len(second): + return False + result = 0 + for x, y in zip(first, second): + result |= ord(x) ^ ord(y) + return result == 0 ",1 8763c6090d627d8bb0ee1d030c30e58f406be9ce?w=1,https://github.com/php/php-src/commit/8763c6090d627d8bb0ee1d030c30e58f406be9ce?w=1,Fix bug #72681 - consume data even if we're not storing them,"diff --git a/ext/session/session.c b/ext/session/session.c index c668bb7b2a27c..b2d02361dfd13 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -924,11 +924,13 @@ PS_SERIALIZER_DECODE_FUNC(php_binary) /* {{{ */ int namelen; int has_value; php_unserialize_data_t var_hash; + int skip = 0; PHP_VAR_UNSERIALIZE_INIT(var_hash); for (p = val; p < endptr; ) { zval **tmp; + skip = 0; namelen = ((unsigned char)(*p)) & (~PS_BIN_UNDEF); if (namelen < 0 || namelen > PS_BIN_MAX || (p + namelen) >= endptr) { @@ -944,22 +946,25 @@ PS_SERIALIZER_DECODE_FUNC(php_binary) /* {{{ */ if (zend_hash_find(&EG(symbol_table), name, namelen + 1, (void **) &tmp) == SUCCESS) { if ((Z_TYPE_PP(tmp) == IS_ARRAY && Z_ARRVAL_PP(tmp) == &EG(symbol_table)) || *tmp == PS(http_session_vars)) { - efree(name); - continue; + skip = 1; } } if (has_value) { ALLOC_INIT_ZVAL(current); if (php_var_unserialize(¤t, (const unsigned char **) &p, (const unsigned char *) endptr, &var_hash TSRMLS_CC)) { - php_set_session_var(name, namelen, current, &var_hash TSRMLS_CC); + if (!skip) { + php_set_session_var(name, namelen, current, &var_hash TSRMLS_CC); + } } else { PHP_VAR_UNSERIALIZE_DESTROY(var_hash); return FAILURE; } var_push_dtor_no_addref(&var_hash, ¤t); } - PS_ADD_VARL(name, namelen); + if (!skip) { + PS_ADD_VARL(name, namelen); + } efree(name); } @@ -1016,6 +1021,7 @@ PS_SERIALIZER_DECODE_FUNC(php) /* {{{ */ int namelen; int has_value; php_unserialize_data_t var_hash; + int skip = 0; PHP_VAR_UNSERIALIZE_INIT(var_hash); @@ -1024,6 +1030,7 @@ PS_SERIALIZER_DECODE_FUNC(php) /* {{{ */ while (p < endptr) { zval **tmp; q = p; + skip = 0; while (*q != PS_DELIMITER) { if (++q >= endptr) goto break_outer_loop; } @@ -1040,14 +1047,16 @@ PS_SERIALIZER_DECODE_FUNC(php) /* {{{ */ if (zend_hash_find(&EG(symbol_table), name, namelen + 1, (void **) &tmp) == SUCCESS) { if ((Z_TYPE_PP(tmp) == IS_ARRAY && Z_ARRVAL_PP(tmp) == &EG(symbol_table)) || *tmp == PS(http_session_vars)) { - goto skip; + skip = 1; } } if (has_value) { ALLOC_INIT_ZVAL(current); if (php_var_unserialize(¤t, (const unsigned char **) &q, (const unsigned char *) endptr, &var_hash TSRMLS_CC)) { - php_set_session_var(name, namelen, current, &var_hash TSRMLS_CC); + if (!skip) { + php_set_session_var(name, namelen, current, &var_hash TSRMLS_CC); + } } else { var_push_dtor_no_addref(&var_hash, ¤t); efree(name); @@ -1056,7 +1065,9 @@ PS_SERIALIZER_DECODE_FUNC(php) /* {{{ */ } var_push_dtor_no_addref(&var_hash, ¤t); } - PS_ADD_VARL(name, namelen); + if (!skip) { + PS_ADD_VARL(name, namelen); + } skip: efree(name); diff --git a/ext/session/tests/bug72681.phpt b/ext/session/tests/bug72681.phpt new file mode 100644 index 0000000000000..ca38b07fc909e --- /dev/null +++ b/ext/session/tests/bug72681.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #72681: PHP Session Data Injection Vulnerability +--SKIPIF-- + +--FILE-- + +--EXPECT-- +array(0) { +} ",1 c3a2523e0e270b308041550f10f366830aac7026,https://github.com/videolan/vlc-ios/commit/c3a2523e0e270b308041550f10f366830aac7026,"l10n: Malayalam update Localizable.strings: 83% translated InfoPlist.strings: 100% translated Settings.bundle: 78% translated Signed-off-by: Michał Trzebiatowski ","diff --git a/Apple-TV/Settings.bundle/ml.lproj/Root.strings b/Apple-TV/Settings.bundle/ml.lproj/Root.strings new file mode 100644 index 000000000..e4f20bc7c --- /dev/null +++ b/Apple-TV/Settings.bundle/ml.lproj/Root.strings @@ -0,0 +1,108 @@ +/* A single strings file, whose title is specified in your preferences schema. The strings files provide the localized content to display to the user for each of your preferences. */ + +""SETTINGS_PRIVACY_TITLE"" = ""സ്വകാര്യത""; +""SETTINGS_VIDEO_TITLE"" = ""വീഡിയോ""; +""SETTINGS_AUDIO_TITLE"" = ""ഓഡിയോ""; + +""SETTINGS_THEME_BRIGHT"" = ""Bright theme""; +""SETTINGS_THEME_DARK"" = ""Dark theme""; +""SETTINGS_THEME_SYSTEM"" = ""ഓട്ടോമാറ്റിക്""; +""SETTINGS_PRIVACY_SUBTITLE"" = ""ക്രമീകരണങ്ങളിൽ തുറക്കുക""; +""SETTINGS_PASSCODE_LOCK_SUBTITLE"" = ""Secure access to your content""; +""SETTINGS_HIDE_LIBRARY_IN_FILES_APP_SUBTITLE"" = ""Your media will be hidden in the Files app""; + +""SETTINGS_DARKTHEME"" = ""Appearance""; +""SETTINGS_TIME_STRETCH_AUDIO"" = ""Time-stretching audio""; +""SETTINGS_BACKGROUND_AUDIO"" = ""Audio playback in background""; +""SETTINGS_GENERIC_TITLE"" = ""Generic""; +""SETTINGS_PASSCODE_LOCK"" = ""പാസ്‌കോഡ് ലോക്ക്""; +""SETTINGS_PASSCODE_LOCK_ALLOWTOUCHID"" = ""അൺലോക്കുചെയ്യാൻ Touch ID അനുവദിക്കുക""; +""SETTINGS_PASSCODE_LOCK_ALLOWFACEID"" = ""അൺലോക്കുചെയ്യാൻ Face ID അനുവദിക്കുക""; +""SETTINGS_HIDE_LIBRARY_IN_FILES_APP"" = ""Hide the media library in Files""; +""SETTINGS_VIDEO_FULLSCREEN"" = ""പൂർണ്ണസ്‌ക്രീനിൽ വീഡിയോ പ്ലേ ചെയ്യുക""; +""SETTINGS_CONTINUE_VIDEO_PLAYBACK"" = ""വീഡിയോ പ്ലേബാക്ക് തുടരുക""; +""SETTINGS_CONTINUE_AUDIO_PLAYBACK"" = ""ഓഡിയോ പ്ലേബാക്ക് തുടരുക""; +""SETTINGS_CONTINUE_PLAYBACK_NEVER"" = ""Never""; +""SETTINGS_CONTINUE_PLAYBACK_ASK"" = ""ചോദിക്കുക""; +""SETTINGS_CONTINUE_PLAYBACK_ALWAYS"" = ""എല്ലായ്പ്പോഴും""; +""SETTINGS_NETWORK_PLAY_ALL"" = ""അടുത്ത ഇനം യാന്ത്രികമായി പ്ലേ ചെയ്യുക""; +""SETTINGS_ENABLE_MEDIA_CELL_TEXT_SCROLLING"" = ""Enable text scrolling in media list""; + +""SETTINGS_SKIP_LOOP_FILTER"" = ""ഡീബ്ലോക്കിങ് ഫിൽറ്റർ""; +""SETTINGS_SKIP_LOOP_FILTER_NONE"" = ""ഡീബ്ലോക്കിങ് ഇല്ല (വേഗതയേറിയത്)""; +""SETTINGS_SKIP_LOOP_FILTER_NONREF"" = ""മീഡിയം ഡീബ്ലോക്കിംഗ്""; +""SETTINGS_SKIP_LOOP_FILTER_NONKEY"" = ""കുറഞ്ഞ ഡീബ്ലോക്കിംഗ്""; + +""SETTINGS_NETWORK_CACHING_TITLE"" = ""നെറ്റ്‌വർക്ക് കാഷിംഗ് ലെവൽ""; +""SETTINGS_NETWORK_CACHING_LEVEL_LOWEST"" = ""ഏറ്റവും കുറഞ്ഞ ലേറ്റൻസി""; +""SETTINGS_NETWORK_CACHING_LEVEL_LOW"" = ""കുറഞ്ഞ ലേറ്റൻസി""; +""SETTINGS_NETWORK_CACHING_LEVEL_NORMAL"" = ""സാധാരണ""; +""SETTINGS_NETWORK_CACHING_LEVEL_HIGH"" = ""ഉയർന്ന ലേറ്റൻസി""; +""SETTINGS_NETWORK_CACHING_LEVEL_HIGHEST"" = ""ഏറ്റവും ഉയർന്ന ലേറ്റൻസി""; + +""SETTINGS_PLAYBACK_SPEED_DEFAULT"" = ""സ്ഥിരസ്ഥിതി പ്ലേബാക്ക് വേഗത""; + +""SETTINGS_GESTURES"" = ""ആംഗ്യങ്ങൾ ഉപയോഗിച്ച് പ്ലേബാക്ക് നിയന്ത്രിക്കുക""; +""SETTINGS_GESTURES_VOLUME"" = ""വോളിയത്തിനായി മുകളിലേക്കോ താഴേക്കോ സ്വൈപ്പുചെയ്യുക""; +""SETTINGS_GESTURES_PLAYPAUSE"" = ""പ്ലേ / താൽക്കാലികമായി നിർത്താൻ രണ്ട് ഫിംഗർ ടാപ്പ്""; +""SETTINGS_GESTURES_BRIGHTNESS"" = ""തെളിച്ചത്തിനായി മുകളിലേക്കോ താഴേക്കോ സ്വൈപ്പുചെയ്യുക""; +""SETTINGS_GESTURES_SEEK"" = ""സീക് ചെയ്യാൻ വലത്തേക്ക് / ഇടത്തേക്ക് സ്വൈപ്പുചെയ്യുക""; +""SETTINGS_GESTURES_CLOSE"" = ""Pinch to close""; +""SETTINGS_GESTURE_JUMP_DURATION"" = ""Variable jump duration""; + +""SETTINGS_SUBTITLES_TITLE"" = ""സബ്‌ടൈറ്റിലുകൾ""; +""SETTINGS_SUBTITLES_FONT"" = ""ഫോണ്ട്""; +""SETTINGS_SUBTITLES_TEXT_ENCODING"" = ""ടെക്സ്റ്റ് എൻ‌കോഡിംഗ്""; +""SETTINGS_SUBTITLES_FONTSIZE"" = ""Relative font size""; +""SETTINGS_SUBTITLES_FONTSIZE_SMALLEST"" = ""ഏറ്റവും ചെറുത്""; +""SETTINGS_SUBTITLES_FONTSIZE_SMALL"" = ""ചെറുത്""; +""SETTINGS_SUBTITLES_FONTSIZE_NORMAL"" = ""സാധാരണ""; +""SETTINGS_SUBTITLES_FONTSIZE_LARGE"" = ""വലുത്""; +""SETTINGS_SUBTITLES_FONTSIZE_LARGEST"" = ""ഏറ്റവും വലുത്""; +""SETTINGS_SUBTITLES_BOLDFONT"" = ""Use Bold font""; +""SETTINGS_SUBTITLES_FONTCOLOR"" = ""അക്ഷരത്തിന്റെ നിറം""; +""SETTINGS_SUBTITLES_FONTCOLOR_WHITE"" = ""വെള്ള""; +""SETTINGS_SUBTITLES_FONTCOLOR_BLACK"" = ""കറുപ്പ്""; +""SETTINGS_SUBTITLES_FONTCOLOR_GRAY"" = ""ചാരനിറം""; +""SETTINGS_SUBTITLES_FONTCOLOR_SILVER"" = ""വെള്ളി""; +""SETTINGS_SUBTITLES_FONTCOLOR_RED"" = ""ചുവപ്പ്""; +""SETTINGS_SUBTITLES_FONTCOLOR_FUCHSIA"" = ""ഫ്യൂഷിയ""; +""SETTINGS_SUBTITLES_FONTCOLOR_YELLOW"" = ""മഞ്ഞ""; +""SETTINGS_SUBTITLES_FONTCOLOR_GREEN"" = ""പച്ച""; +""SETTINGS_SUBTITLES_FONTCOLOR_NAVY"" = ""നേവി""; +""SETTINGS_SUBTITLES_OUTLINE_THICKNESS"" = ""രൂപരേഖ കനം""; +""SETTINGS_SUBTITLES_OUTLINE_THICKNESS_NONE"" = ""ഒന്നുമില്ല""; +""SETTINGS_SUBTITLES_OUTLINE_THICKNESS_THIN"" = ""നേർത്ത""; +""SETTINGS_SUBTITLES_OUTLINE_THICKNESS_NORMAL"" = ""സാധാരണ""; +""SETTINGS_SUBTITLES_OUTLINE_THICKNESS_THICK"" = ""കട്ടിയുള്ളത്""; + +""SETTINGS_DEINTERLACE"" = ""ഡിഇന്റെർലസ്""; +""SETTINGS_DEINTERLACE_ON"" = ""ഓണ്""; +""SETTINGS_DEINTERLACE_OFF"" = ""ഓഫ്""; +""SETTINGS_DEINTERLACE_AUTO"" = ""ഓട്ടോമാറ്റിക്""; + +""SETTINGS_HWDECODING"" = ""ഹാർഡ്‌വെയർ ഡീകോഡിംഗ്""; +""SETTINGS_HWDECODING_ON"" = ""ഓൺ""; +""SETTINGS_HWDECODING_OFF"" = ""ഓഫ്""; +""SETTINGS_CASTING"" = ""Casting""; +""SETTINGS_PTCASTING"" = ""Audio Passthrough""; +""SETTINGS_PTCASTINGLONG"" = ""Let your TV manage audio rendering""; + +""SETTINGS_FEEDBACK"" = ""ഫീഡ്‌ബാക്ക്""; +""SETTINGS_SEND_FEEDBACK"" = ""ഫീഡ്‌ബാക്ക് അയയ്‌ക്കുക""; +""SETTINGS_SEND_RATING"" = ""IOS-നായുള്ള VLC റേറ്റുചെയ്യുക""; + +""SETTINGS_MEDIA_LIBRARY"" = ""മീഡിയ ലൈബ്രറി""; +""SETTINGS_MEDIA_LIBRARY_RESCAN"" = ""മീഡിയ ലൈബ്രറി വീണ്ടെടുക്കാൻ VLCയെ നിർബന്ധിക്കുക""; +""SETTINGS_DECRAPIFY"" = ""Optimize item names for display""; +""SETTINGS_SHOW_THUMBNAILS"" = ""വീഡിയോ ലഘുചിത്രങ്ങൾ കാണിക്കുക""; +""SETTINGS_SHOW_ARTWORKS"" = ""ഓഡിയോ കലാസൃഷ്‌ടികൾ കാണിക്കുക""; +""SETTINGS_BACKUP_MEDIA_LIBRARY"" = ""ഉപകരണ ബാക്കപ്പിൽ മീഡിയ ലൈബ്രറി ഉൾപ്പെടുത്തുക""; + +""SETTINGS_FILE_SYNC"" = ""ഫയൽ സമന്വയം""; +""SETTINGS_WIFISHARING_IPv6"" = ""IPv6 support for Wi-Fi Sharing""; + +""SETTINGS_ARTWORK"" = ""കലാസൃഷ്‌ടി""; +""SETTINGS_DOWNLOAD_ARTWORK"" = ""കലാസൃഷ്‌ടി ഡൗൺലോഡുചെയ്യുക""; + +""ABOUT_APP_TV"" = ""tvOS-നായുള്ള VLC-യെക്കുറിച്ച്""; diff --git a/Resources/Settings.bundle/ml.lproj/Root.strings b/Resources/Settings.bundle/ml.lproj/Root.strings new file mode 100644 index 000000000..e4f20bc7c --- /dev/null +++ b/Resources/Settings.bundle/ml.lproj/Root.strings @@ -0,0 +1,108 @@ +/* A single strings file, whose title is specified in your preferences schema. The strings files provide the localized content to display to the user for each of your preferences. */ + +""SETTINGS_PRIVACY_TITLE"" = ""സ്വകാര്യത""; +""SETTINGS_VIDEO_TITLE"" = ""വീഡിയോ""; +""SETTINGS_AUDIO_TITLE"" = ""ഓഡിയോ""; + +""SETTINGS_THEME_BRIGHT"" = ""Bright theme""; +""SETTINGS_THEME_DARK"" = ""Dark theme""; +""SETTINGS_THEME_SYSTEM"" = ""ഓട്ടോമാറ്റിക്""; +""SETTINGS_PRIVACY_SUBTITLE"" = ""ക്രമീകരണങ്ങളിൽ തുറക്കുക""; +""SETTINGS_PASSCODE_LOCK_SUBTITLE"" = ""Secure access to your content""; +""SETTINGS_HIDE_LIBRARY_IN_FILES_APP_SUBTITLE"" = ""Your media will be hidden in the Files app""; + +""SETTINGS_DARKTHEME"" = ""Appearance""; +""SETTINGS_TIME_STRETCH_AUDIO"" = ""Time-stretching audio""; +""SETTINGS_BACKGROUND_AUDIO"" = ""Audio playback in background""; +""SETTINGS_GENERIC_TITLE"" = ""Generic""; +""SETTINGS_PASSCODE_LOCK"" = ""പാസ്‌കോഡ് ലോക്ക്""; +""SETTINGS_PASSCODE_LOCK_ALLOWTOUCHID"" = ""അൺലോക്കുചെയ്യാൻ Touch ID അനുവദിക്കുക""; +""SETTINGS_PASSCODE_LOCK_ALLOWFACEID"" = ""അൺലോക്കുചെയ്യാൻ Face ID അനുവദിക്കുക""; +""SETTINGS_HIDE_LIBRARY_IN_FILES_APP"" = ""Hide the media library in Files""; +""SETTINGS_VIDEO_FULLSCREEN"" = ""പൂർണ്ണസ്‌ക്രീനിൽ വീഡിയോ പ്ലേ ചെയ്യുക""; +""SETTINGS_CONTINUE_VIDEO_PLAYBACK"" = ""വീഡിയോ പ്ലേബാക്ക് തുടരുക""; +""SETTINGS_CONTINUE_AUDIO_PLAYBACK"" = ""ഓഡിയോ പ്ലേബാക്ക് തുടരുക""; +""SETTINGS_CONTINUE_PLAYBACK_NEVER"" = ""Never""; +""SETTINGS_CONTINUE_PLAYBACK_ASK"" = ""ചോദിക്കുക""; +""SETTINGS_CONTINUE_PLAYBACK_ALWAYS"" = ""എല്ലായ്പ്പോഴും""; +""SETTINGS_NETWORK_PLAY_ALL"" = ""അടുത്ത ഇനം യാന്ത്രികമായി പ്ലേ ചെയ്യുക""; +""SETTINGS_ENABLE_MEDIA_CELL_TEXT_SCROLLING"" = ""Enable text scrolling in media list""; + +""SETTINGS_SKIP_LOOP_FILTER"" = ""ഡീബ്ലോക്കിങ് ഫിൽറ്റർ""; +""SETTINGS_SKIP_LOOP_FILTER_NONE"" = ""ഡീബ്ലോക്കിങ് ഇല്ല (വേഗതയേറിയത്)""; +""SETTINGS_SKIP_LOOP_FILTER_NONREF"" = ""മീഡിയം ഡീബ്ലോക്കിംഗ്""; +""SETTINGS_SKIP_LOOP_FILTER_NONKEY"" = ""കുറഞ്ഞ ഡീബ്ലോക്കിംഗ്""; + +""SETTINGS_NETWORK_CACHING_TITLE"" = ""നെറ്റ്‌വർക്ക് കാഷിംഗ് ലെവൽ""; +""SETTINGS_NETWORK_CACHING_LEVEL_LOWEST"" = ""ഏറ്റവും കുറഞ്ഞ ലേറ്റൻസി""; +""SETTINGS_NETWORK_CACHING_LEVEL_LOW"" = ""കുറഞ്ഞ ലേറ്റൻസി""; +""SETTINGS_NETWORK_CACHING_LEVEL_NORMAL"" = ""സാധാരണ""; +""SETTINGS_NETWORK_CACHING_LEVEL_HIGH"" = ""ഉയർന്ന ലേറ്റൻസി""; +""SETTINGS_NETWORK_CACHING_LEVEL_HIGHEST"" = ""ഏറ്റവും ഉയർന്ന ലേറ്റൻസി""; + +""SETTINGS_PLAYBACK_SPEED_DEFAULT"" = ""സ്ഥിരസ്ഥിതി പ്ലേബാക്ക് വേഗത""; + +""SETTINGS_GESTURES"" = ""ആംഗ്യങ്ങൾ ഉപയോഗിച്ച് പ്ലേബാക്ക് നിയന്ത്രിക്കുക""; +""SETTINGS_GESTURES_VOLUME"" = ""വോളിയത്തിനായി മുകളിലേക്കോ താഴേക്കോ സ്വൈപ്പുചെയ്യുക""; +""SETTINGS_GESTURES_PLAYPAUSE"" = ""പ്ലേ / താൽക്കാലികമായി നിർത്താൻ രണ്ട് ഫിംഗർ ടാപ്പ്""; +""SETTINGS_GESTURES_BRIGHTNESS"" = ""തെളിച്ചത്തിനായി മുകളിലേക്കോ താഴേക്കോ സ്വൈപ്പുചെയ്യുക""; +""SETTINGS_GESTURES_SEEK"" = ""സീക് ചെയ്യാൻ വലത്തേക്ക് / ഇടത്തേക്ക് സ്വൈപ്പുചെയ്യുക""; +""SETTINGS_GESTURES_CLOSE"" = ""Pinch to close""; +""SETTINGS_GESTURE_JUMP_DURATION"" = ""Variable jump duration""; + +""SETTINGS_SUBTITLES_TITLE"" = ""സബ്‌ടൈറ്റിലുകൾ""; +""SETTINGS_SUBTITLES_FONT"" = ""ഫോണ്ട്""; +""SETTINGS_SUBTITLES_TEXT_ENCODING"" = ""ടെക്സ്റ്റ് എൻ‌കോഡിംഗ്""; +""SETTINGS_SUBTITLES_FONTSIZE"" = ""Relative font size""; +""SETTINGS_SUBTITLES_FONTSIZE_SMALLEST"" = ""ഏറ്റവും ചെറുത്""; +""SETTINGS_SUBTITLES_FONTSIZE_SMALL"" = ""ചെറുത്""; +""SETTINGS_SUBTITLES_FONTSIZE_NORMAL"" = ""സാധാരണ""; +""SETTINGS_SUBTITLES_FONTSIZE_LARGE"" = ""വലുത്""; +""SETTINGS_SUBTITLES_FONTSIZE_LARGEST"" = ""ഏറ്റവും വലുത്""; +""SETTINGS_SUBTITLES_BOLDFONT"" = ""Use Bold font""; +""SETTINGS_SUBTITLES_FONTCOLOR"" = ""അക്ഷരത്തിന്റെ നിറം""; +""SETTINGS_SUBTITLES_FONTCOLOR_WHITE"" = ""വെള്ള""; +""SETTINGS_SUBTITLES_FONTCOLOR_BLACK"" = ""കറുപ്പ്""; +""SETTINGS_SUBTITLES_FONTCOLOR_GRAY"" = ""ചാരനിറം""; +""SETTINGS_SUBTITLES_FONTCOLOR_SILVER"" = ""വെള്ളി""; +""SETTINGS_SUBTITLES_FONTCOLOR_RED"" = ""ചുവപ്പ്""; +""SETTINGS_SUBTITLES_FONTCOLOR_FUCHSIA"" = ""ഫ്യൂഷിയ""; +""SETTINGS_SUBTITLES_FONTCOLOR_YELLOW"" = ""മഞ്ഞ""; +""SETTINGS_SUBTITLES_FONTCOLOR_GREEN"" = ""പച്ച""; +""SETTINGS_SUBTITLES_FONTCOLOR_NAVY"" = ""നേവി""; +""SETTINGS_SUBTITLES_OUTLINE_THICKNESS"" = ""രൂപരേഖ കനം""; +""SETTINGS_SUBTITLES_OUTLINE_THICKNESS_NONE"" = ""ഒന്നുമില്ല""; +""SETTINGS_SUBTITLES_OUTLINE_THICKNESS_THIN"" = ""നേർത്ത""; +""SETTINGS_SUBTITLES_OUTLINE_THICKNESS_NORMAL"" = ""സാധാരണ""; +""SETTINGS_SUBTITLES_OUTLINE_THICKNESS_THICK"" = ""കട്ടിയുള്ളത്""; + +""SETTINGS_DEINTERLACE"" = ""ഡിഇന്റെർലസ്""; +""SETTINGS_DEINTERLACE_ON"" = ""ഓണ്""; +""SETTINGS_DEINTERLACE_OFF"" = ""ഓഫ്""; +""SETTINGS_DEINTERLACE_AUTO"" = ""ഓട്ടോമാറ്റിക്""; + +""SETTINGS_HWDECODING"" = ""ഹാർഡ്‌വെയർ ഡീകോഡിംഗ്""; +""SETTINGS_HWDECODING_ON"" = ""ഓൺ""; +""SETTINGS_HWDECODING_OFF"" = ""ഓഫ്""; +""SETTINGS_CASTING"" = ""Casting""; +""SETTINGS_PTCASTING"" = ""Audio Passthrough""; +""SETTINGS_PTCASTINGLONG"" = ""Let your TV manage audio rendering""; + +""SETTINGS_FEEDBACK"" = ""ഫീഡ്‌ബാക്ക്""; +""SETTINGS_SEND_FEEDBACK"" = ""ഫീഡ്‌ബാക്ക് അയയ്‌ക്കുക""; +""SETTINGS_SEND_RATING"" = ""IOS-നായുള്ള VLC റേറ്റുചെയ്യുക""; + +""SETTINGS_MEDIA_LIBRARY"" = ""മീഡിയ ലൈബ്രറി""; +""SETTINGS_MEDIA_LIBRARY_RESCAN"" = ""മീഡിയ ലൈബ്രറി വീണ്ടെടുക്കാൻ VLCയെ നിർബന്ധിക്കുക""; +""SETTINGS_DECRAPIFY"" = ""Optimize item names for display""; +""SETTINGS_SHOW_THUMBNAILS"" = ""വീഡിയോ ലഘുചിത്രങ്ങൾ കാണിക്കുക""; +""SETTINGS_SHOW_ARTWORKS"" = ""ഓഡിയോ കലാസൃഷ്‌ടികൾ കാണിക്കുക""; +""SETTINGS_BACKUP_MEDIA_LIBRARY"" = ""ഉപകരണ ബാക്കപ്പിൽ മീഡിയ ലൈബ്രറി ഉൾപ്പെടുത്തുക""; + +""SETTINGS_FILE_SYNC"" = ""ഫയൽ സമന്വയം""; +""SETTINGS_WIFISHARING_IPv6"" = ""IPv6 support for Wi-Fi Sharing""; + +""SETTINGS_ARTWORK"" = ""കലാസൃഷ്‌ടി""; +""SETTINGS_DOWNLOAD_ARTWORK"" = ""കലാസൃഷ്‌ടി ഡൗൺലോഡുചെയ്യുക""; + +""ABOUT_APP_TV"" = ""tvOS-നായുള്ള VLC-യെക്കുറിച്ച്""; diff --git a/Resources/ml.lproj/InfoPlist.strings b/Resources/ml.lproj/InfoPlist.strings new file mode 100644 index 000000000..30ed5fc6b --- /dev/null +++ b/Resources/ml.lproj/InfoPlist.strings @@ -0,0 +1,3 @@ +""NSPhotoLibraryUsageDescription"" = ""വീഡിയോ സേവ് ചെയ്യാന്‍ നിങ്ങളുടെ കാമറ റോളിലേക്ക് പ്രവേശനം ആവശ്യമാണ്.""; +""NSPhotoLibraryAddUsageDescription"" = ""വീഡിയോ സേവ് ചെയ്യാന്‍ നിങ്ങളുടെ കാമറ റോളിലേക്ക് പ്രവേശനം ആവശ്യമാണ്.""; +""NSFaceIDUsageDescription"" = ""VLC അൺ‌ലോക്ക് ചെയ്യുന്നതിന് ഫെയ്സ് ഐഡിയിലേക്ക് ആക്സസ് പ്രാപ്തമാക്കുക""; diff --git a/Resources/ml.lproj/Localizable.strings b/Resources/ml.lproj/Localizable.strings new file mode 100644 index 000000000..e6f2b3088 --- /dev/null +++ b/Resources/ml.lproj/Localizable.strings @@ -0,0 +1,460 @@ +""STORE_DESCRIPTION"" = ""VLC for iOS is a port of the free VLC media player to iPad, iPhone and iPod touch.\nIt can play all your movies, shows and music in most formats directly without conversion.\nIt allows file synchronization with Dropbox, GDrive, OneDrive, Box, iCloud Drive, iTunes, direct downloads and through Wi-Fi sharing as well as streaming from SMB, FTP, UPnP/DLNA media servers and the web.\nVLC offers support for advanced subtitles including full SSA compatibility, multi-track audio, and playback speed control.\n\nVLC for iOS is completely free and open source.""; + +""STORE_DESCRIPTION_TV"" = ""VLC മീഡിയ പ്ലെയർ ഒരു സൗജന്യ ഓപ്പൺ സോഴ്‌സ് ക്രോസ്-പ്ലാറ്റ്ഫോം മൾട്ടിമീഡിയ പ്ലെയറാണ്.\nഫോർമാറ്റുകൾ ഇല്ലാതെ ഇതിന് നിങ്ങളുടെ എല്ലാ സിനിമകളും ഷോകളും സംഗീതവും നേരിട്ട് പ്ലേ ചെയ്യാൻ കഴിയും.\nക്ലൗഡ് സേവനങ്ങളിൽ നിന്ന് (Dropbox, OneDrive, Box) സ്ട്രീമിംഗ്, വെബ് യുഐ വഴി നിങ്ങളുടെ മാക്കിൽ നിന്നോ പിസിയിൽ നിന്നോ വിദൂര പ്ലേബാക്ക്, ഒപ്പം SMB, FTP, UPnP / DLNA മീഡിയ സെർവറുകളിൽ നിന്നും വെബിൽ നിന്നും സ്ട്രീമിംഗ് അനുവദിക്കും.\nപ്ലേബാക്ക് വേഗത നിയന്ത്രണം എന്നിവയുൾപ്പെടെ വിപുലമായ സബ്ടൈറ്റിലുകൾക്ക് VLC പിന്തുണ നൽകുന്നു.\n\niOS- നായുള്ള VLC പൂർണ്ണമായും സൗജന്യവും ഓപ്പൺ സോഴ്‌സുമാണ്.\n\nകമ്മ്യൂണിറ്റി പരിപാലിക്കുന്ന മൂവി, മ്യൂസിക് ഡാറ്റാബേസുകളായ TMDB-യും Hatchet-റ്റും മെറ്റാഡാറ്റയും കലാസൃഷ്ടികളും നൽകുന്നു.""; + +""CHOOSE_AUDIO_TRACK"" = ""ഓഡിയോ ട്രാക്ക് തെരെഞ്ഞെടുക്കുക""; +""CHOOSE_SUBTITLE_TRACK"" = ""ഉപശീര്‍ഷകങ്ങള്‍ തെരെഞ്ഞെടുക്കുക""; +""OPEN_TRACK_PANEL"" = ""ട്രാക്ക് തിരഞ്ഞെടുക്കൽ തുറക്കുക""; +""CHOOSE_TITLE"" = ""തലകെട്ട് സെലെക്ട്ട് ചെയ്യുക""; +""CHOOSE_CHAPTER"" = ""ചാപ്ട്ടെർ സെലെക്ട്ട് ചെയ്യുക""; +""CHAPTER_SELECTION_TITLE"" = ""അധ്യായങ്ങൾ""; +""TITLE"" = ""തലക്കെട്ട്""; +""CHAPTER"" = ""അധ്യായം""; +""MINIMIZE_PLAYBACK_VIEW"" = ""പ്ലേബാക്ക് ചെറുതാക്കുക""; +""TRACK_SELECTION"" = ""ട്രാക്ക്‌ സെലെക്ട്ട് ചെയ്യുക""; +""AUDIO"" = ""ശബ്ദം""; +""SUBTITLES"" = ""ഉപശീര്‍ഷകങ്ങള്‍""; +""LANGUAGE"" = ""ഭാഷ""; +""MEDIA_INFO"" = ""മീഡിയ വിവരങ്ങൾ""; +""VIDEO_DIMENSIONS"" = ""വീഡിയോ അളവുകൾ""; +""FORMAT_VIDEO_DIMENSIONS"" = ""%ix%i പിക്സൽ""; +""FORMAT_AUDIO_TRACKS"" = ""%i ഓഡിയോ ട്രാക്ക്""; +""ONE_AUDIO_TRACK"" = ""ഒരു ഓഡിയോ ട്രാക്ക്""; +""FORMAT_SPU_TRACKS"" = ""%i സബ്റ്റൈറ്റൽ ട്രാക്കുകൾ""; +""ONE_SPU_TRACK"" = ""ഒരു സബ്ടൈറ്റിൽ ട്രാക്ക്""; +""TRACKS"" = ""%i ട്രാക്കുകൾ""; +""TRACK"" = ""%i ട്രാക്ക്""; + +""PLAYING_EXTERNALLY_TITLE"" = ""ടി.വി ബന്ധപ്പെടുത്തി""; +""PLAYING_EXTERNALLY_DESC"" = ""ഈ വീ‍‍ഡിയോ ടി.വിയില്‍ കാണിക്കുന്നു""; +""PLAYING_EXTERNALLY_ADDITION"" = ""\n Now playing on:""; /* \n should stay in every translation */ + +""VFILTER_HUE"" = ""ഹ്യു""; +""VFILTER_CONTRAST"" = ""വ്യതിരിക്തത""; +""VFILTER_BRIGHTNESS"" = ""തെളിച്ചം""; +""VFILTER_SATURATION"" = ""പൂര്‍ണത""; +""VFILTER_GAMMA"" = ""ഗാമ്മ""; + +""PREAMP"" = ""പ്രീആംപ്""; +""DB_FORMAT"" = ""%i dB""; +""CHOOSE_EQUALIZER_PROFILES"" = ""ഈക്വാളിസിർ പ്രൊഫൈൽ തിരഞ്ഞെടുക്കുക""; + +""PLAYBACK_FAILED"" = ""പ്ലേബാക്ക് പരാജയപ്പെട്ടു""; +""PLEASE_WAIT"" = ""ദയവായി കാത്തിരിക്കുക""; +""AR_CHANGED"" = ""ആകാരഅനുപാതം:%@""; +""DEFAULT"" = ""സ്വതം""; +""FILL_TO_SCREEN"" = ""പൂര്‍ണ സ്ക്രീനിനായി മുറിക്കുക""; +""PLAYBACK_SPEED"" = ""പ്ലേബാക്ക് വേഗത""; +""SPU_DELAY"" = ""Subtitles delay""; +""AUDIO_DELAY"" = ""Audio delay""; +""BUTTON_SLEEP_TIMER"" = ""Sleep Timer""; +""SLEEP_TIMER_UPDATED"" = ""Sleep Timer Updated""; +""CONTINUE_PLAYBACK"" = ""പ്ലേബാക്ക് തുടരുക?""; +""CONTINUE_PLAYBACK_LONG"" = ""നിങ്ങൾ നിർത്തിയിടത്ത് \""%@\"" പ്ലേബാക്ക് തുടരാൻ ആഗ്രഹിക്കുന്നുണ്ടോ?""; + +""BUTTON_ABOUT"" = ""കുറിച്ച്""; +""BUTTON_BACK"" = ""പിറകോട്ട്""; +""BUTTON_DONE"" = ""പൂര്‍ണം""; +""BUTTON_CANCEL"" = ""ഒഴിവാക്കുക""; +""BUTTON_SAVE"" = ""സൂക്ഷിക്കുക""; +""BUTTON_DOWNLOAD"" = ""ഡൌണ്‍ലോ‍ഡ്""; +""BUTTON_DELETE"" = ""കളയുക""; +""BUTTON_OK"" = ""ശരി""; +""BUTTON_CONTRIBUTE"" = ""സംഭാവന ചെയ്യുക""; +""BUTTON_CONNECT"" = ""ബന്ധപ്പെടുത്തുക""; +""BUTTON_RENAME"" = ""പുനര്‍നാമകരണം""; +""BUTTON_LEARN_MORE"" = ""കൂടുതല്‍ മനസ്സിലാക്കൂ""; +""BUTTON_LOGOUT"" = ""പുറത്തെക്ക്""; +""BUTTON_CONTINUE"" = ""തുടരുക""; +""BUTTON_SET"" = ""Set""; +""BUTTON_RESET"" = ""Reset""; +""BUTTON_RESCAN"" = ""വീണ്ടും സ്കാൻ ചെയ്യുക""; +""PRIVATE_PLAYBACK_TOGGLE"" = ""സ്വകാര്യ പ്ലേബാക്ക്""; +""SCAN_SUBTITLE_TOGGLE"" = ""ശീര്‍ഷകങ്ങള്‍ക്കായി പരതുക (എച്ച് ടി ടി പി -മാത്രം)""; + +""BUTTON_RENDERER"" = ""Casting devices""; +""BUTTON_RENDERER_HINT"" = ""ലഭ്യമായ കാസ്റ്റിംഗ് ഉപകരണങ്ങളുടെ മെനു കാണിക്കുക""; + + +""BUTTON_PLAY_QUEUE"" = ""Play queue""; +""BUTTON_PLAY_QUEUE_HINT"" = ""Show the play queue view""; + +""UPGRADING_LIBRARY"" = ""മീഡിയ ലൈബ്രറി പുതുക്കുന്നു""; + +""OPEN_NETWORK"" = ""നെറ്റ്‍വര്‍ക്ക് അരുവി തുറക്കുക""; +""NETWORK_TITLE"" = ""നെറ്റ്‍വര്‍ക്ക് അരുവികള്‍""; +""OPEN_NETWORK_HELP"" = ""ഒഴുക്ക് നേരിട്ട് തുറക്കാന്‍ ഏതെങ്കിലും എ.ച്.ടി.ടി.പി, ആര്‍.ടി.എസ്.പി, ആര്‍.ടി.എം.പി, എം.എം.എസ്, എഫ്.ടി.പി അല്ലെങ്കില്‍ യു.ഡി.പി/ആര്‍.ടി.പി വിലാസം നല്‍കുക""; +""HTTP_UPLOAD_SERVER_OFF"" = ""പ്രവര്‍ത്തന സജ്ജമല്ലാത്ത സര്‍വര്‍""; +""HTTP_UPLOAD_NO_CONNECTIVITY"" = ""No active Wi-Fi connection""; +""OPEN_STREAM_OR_DOWNLOAD"" = ""ഈ യു ര്‍ ല്‍ ഡൌണ്‍ലോഡ് ചെയ്യന്നോ പ്ലേ ചെയ്യന്നോ ആഗ്രഹികുന്നോ?""; +""SHARED_VLC_IOS_LIBRARY"" = ""Shared VLC for iOS Library""; +""SMB_CIFS_FILE_SERVERS"" = ""ഫയൽ സെർവറുകൾ (SMB)""; + +""SMB_CIFS_FILE_SERVERS_SHORT"" = ""SMB""; + + +""HTTP_DOWNLOAD_CANCELLED"" = ""ഉപയോക്താവ് ഡൌണ്‍ലോഡിംഗ് ഒഴിവാക്കി""; + +""DOWNLOAD_FROM_HTTP_HELP"" = ""ഫയല്‍ നിങ്ങളുടെ %@ ലേക്ക് ഡൌണ്‍ലോ‍ഡ് ചെയ്യാന്‍ ഒരു വിലാസം നല്‍കുക""; +""DOWNLOAD_FROM_HTTP"" = ""ഡൌണ്‍ലോ‍ഡുകള്‍""; +""ERROR_NUMBER"" = ""%iാം പ്രശ്നം സംഭവിച്ചു""; +""DOWNLOAD_FAILED"" = ""ഡൌണ്‍ലോ‍ഡ് പരാജയപ്പെട്ടു""; +""FILE_NOT_SUPPORTED"" = ""ഫയല്‍ ഫോര്‍മാറ്റ് പിന്തുണക്കുന്നതല്ല""; +""FILE_NOT_SUPPORTED_LONG"" = ""The file format used by %@ is not supported by this version of VLC for iOS.""; +""SCHEME_NOT_SUPPORTED"" = ""വിലാസ രീതി പിന്തുണക്കുന്നതല്ല""; +""SCHEME_NOT_SUPPORTED_LONG"" = ""ഈ അഡ്രസ്‌ (%@)പിന്തുണക്കുനില്ല. ദയവായി എച് ടി ടി പി, എച് ടി ടി പി എസ് അല്ലെങ്കില്‍ എഫ്‌ ടി പി ഉപയോഗിക്കുക ""; +""RENAME_MEDIA_TO"" = ""%@ വേണ്ടി പുതിയ പേരു ചേര്‍ക്കുക ""; + +""FOLDER_EMPTY"" = ""ശൂന്യമായ ഫോൾഡർ""; + +""SHARING_ACTION_SHEET_TITLE_CHOOSE_FILE"" = ""ഒന്നോ അതിലധികമോ ഫയല്‍ തുറക്കുക""; +""SHARING_ACTIVITY_OPEN_IN_TITLE"" = ""ഫയല്‍ തുറക്കുക""; +""SHARING_ERROR_NO_FILES"" = ""പങ്കിടാന്‍ ഫയലുകള്‍ ഒന്നും കിട്ടുന്നില്ല ""; +""SHARING_ERROR_NO_APPLICATIONS"" = ""ഇത്തരത്തിലുള്ള ഫയൽ തുറക്കുന്നതിന് അപ്ലിക്കേഷനുകളൊന്നും കണ്ടെത്താൻ കഴിഞ്ഞില്ല""; +""SHARING_SUCCESS_CAMERA_ROLL"" = ""File was successfully saved to the Camera Roll""; + +""STREAMVC_DETAILTEXT"" = ""Play streams directly without downloading""; +""DOWNLOADVC_DETAILTEXT"" = ""Download files directly to your device""; +""HEADER_TITLE_RENDERER"" = ""Select a casting device""; + +""NETWORK"" = ""നെറ്റ്‌വർക്ക്""; +""LOCAL_NETWORK"" = ""പ്രാദേശിക നെറ്റ്‍വര്‍ക്ക്""; +""CONNECT_TO_SERVER"" = ""സര്‍വറുമായി ബന്ധപ്പെടുക""; +""FILE_SERVER"" = ""ഫയൽ സെർവറുകൾ""; +""USER_LABEL"" = ""ഉപയോക്താവ്""; +""PASSWORD_LABEL"" = ""അടയാള വാക്യം""; +""DISABLE_LABEL"" = ""നിര്‍ജ്ജീവമാക്കുക""; +""BUTTON_ANONYMOUS_LOGIN"" = ""അജ്ഞാത ലോഗിൻ""; + +""LOCAL_SERVER_REFRESH"" = ""പുതുക്കുക""; +""LOCAL_SERVER_LAST_UPDATE"" = ""അവസാനമായി പുതുക്കിയത് %@""; +""LOCAL_SERVER_CONNECTION_FAILED_TITLE"" = ""സര്‍വര്‍ ബന്ധം പരാജയപ്പെട്ടു""; +""LOCAL_SERVER_CONNECTION_FAILED_MESSAGE"" = ""സര്‍വര്‍ വിലാസവും മറ്റു വിവരങ്ങളും പരിശോധിക്കുക""; + +""CLOUD_SERVICES"" = ""ക്ലൗഡ് സേവനങ്ങൾ""; +""LOGIN"" = ""പ്രവേശിക്കുക""; +""LOGGED_IN"" = ""ലോഗ്ഗിങ്ങ്""; +""LOGGED_IN_SERVICES"" = ""%d logged in services""; +""LOGGED_IN_SERVICE"" = ""1 logged in service""; + +""DROPBOX_DOWNLOAD"" = ""ഡൌണ്‍ലോ‍ഡ് ചെയ്യണോ?""; +""DROPBOX_DL_LONG"" = ""നിങ്ങള്‍ \""%@\"" നിങ്ങളുടെ %@ ലേക്ക് ഡൌണ്‍ലോഡ് ചെയ്യാന്‍ ആഗ്രഹിക്കുന്നുവോ?""; +""DROPBOX_LOGIN"" = ""പ്രവേശിക്കുക""; + +""GDRIVE_ERROR_FETCHING_FILES"" = ""ഫയലുകള്‍ എടുക്കുന്നതിനിടെ പരാജയം""; +""GDRIVE_DOWNLOAD_SUCCESSFUL"" = ""നിങ്ങളുടെ ഫയല്‍ വിജയകരമായി ഡൌണ്‍ലോഡ് ചെയ്തിരിക്കുന്നു""; +""GDRIVE_DOWNLOAD_SUCCESSFUL_TITLE"" = ""വിജയകരം""; +""GDRIVE_ERROR_DOWNLOADING_FILE"" = ""ഡൌണ്‍ലോഡ് ചെയ്യുന്നതിനിടെ ഒരു പ്രശ്നം സംഭവിച്ചു""; +""GDRIVE_ERROR_DOWNLOADING_FILE_TITLE"" = ""പ്രശ്നം""; + +""ONEDRIVE_MEDIA_WITHOUT_URL"" = ""The selected Media doesn't have a playable url""; + +""DISK_FULL"" = ""സംഭരണ പരിധി ആയി""; +""DISK_FULL_FORMAT"" = ""%@ cannot be stored on your %@, because you don't have enough free space left.""; + +""NUM_OF_FILES"" = ""%i ഫയലുകള്‍""; +""ONE_FILE"" = ""ഒരു ഫയല്‍""; +""NO_FILES"" = ""പിന്തുണക്കുന്ന ഫയലുകള്‍ ഇല്ല""; +""DOWNLOADING"" = ""ഡൌണ്‍ലോ‍ഡ് ചെയ്യുന്നു....""; +""REMAINING_TIME"" = ""ബാക്കിയുള്ള സമയം :%@""; +""BIOMETRIC_UNLOCK"" = ""Unlock Media Library\nCancel to enter Passcode""; + +//PAPasscode Strings that we need to localize for them +""%d Failed Passcode Attempts"" = ""%d Failed Passcode Attempts""; +""1 Failed Passcode Attempt"" = ""1 Failed Passcode Attempt""; +""Change Passcode"" = ""പാസ്‌കോഡ് മാറ്റുക""; +""Enter Passcode"" = ""പാസ്‌കോഡ് നൽകുക""; +""Enter a passcode"" = ""ഒരു പാസ്‌കോഡ് നൽകുക""; +""Enter your new passcode"" = ""നിങ്ങളുടെ പുതിയ പാസ്‌കോഡ് നൽകുക""; +""Enter your old passcode"" = ""നിങ്ങളുടെ പഴയ പാസ്‌കോഡ് നൽകുക""; +""Enter your passcode"" = ""നിങ്ങളുടെ പാസ്‌കോഡ് നൽകുക""; +""Next"" = ""അടുത്തത്""; +""Passcodes did not match. Try again."" = ""പാസ്‌കോഡുകൾ പൊരുത്തപ്പെടുന്നില്ല. വീണ്ടും ശ്രമിക്കുക.""; +""Re-enter your new passcode"" = ""നിങ്ങളുടെ പുതിയ പാസ്‌കോഡ് വീണ്ടും നൽകുക""; +""Re-enter your passcode"" = ""നിങ്ങളുടെ പാസ്‌കോഡ് വീണ്ടും നൽകുക""; +""Set Passcode"" = ""പാസ്‌കോഡ് സൃഷ്‌ടിക്കുക""; + +""Settings"" = ""ക്രമീകരണങ്ങള്‍""; // plain text key to keep compatibility with InAppSettingsKit's upstream +""ON"" = ""ഓണ്‍""; +""OFF"" = ""ഓഫ്""; + +""EMPTY_LIBRARY"" = ""മീഡിയ ലൈബ്രറി കാലിയാണ്""; +""EMPTY_LIBRARY_LONG"" = ""For playback, you can stream media from a server on your local network, from the cloud or synchronize media to your device using iTunes, Wi-Fi Upload or Cloud services.""; + +""EMPTY_PLAYLIST"" = ""ശൂന്യമായ പ്ലേലിസ്റ്റ്""; +""EMPTY_PLAYLIST_DESCRIPTION"" = ""Add media while editing in the respective categories.""; + +""PLAYBACK_SCRUB_HELP"" = ""സ്ക്രബ്ബിംഗ് റേറ്റ് ക്രമീകരിക്കാന്‍ നിങ്ങളുടെ വിരലുകള്‍ താഴേക്ക് നീക്കുക""; +""PLAYBACK_SCRUB_HIGH"" = ""വേഗതയേറിയ സ്ക്രബ്ബിഗ്""; +""PLAYBACK_SCRUB_HALF"" = ""അര്‍ദ്ധവേഗതാ സ്ക്രബ്ബിംഗ്""; +""PLAYBACK_SCRUB_QUARTER"" = ""പാദവേഗതാ സ്ക്രബ്ബിംഗ്""; +""PLAYBACK_SCRUB_FINE"" = ""ശരിയായ സ്ക്രബ്ബിംഗ്""; +""PLAYBACK_POSITION"" = ""പ്ലേബാക്ക് സ്ഥാനം""; +""VIDEO_FILTER"" = ""വീഡിയോ ഫില്‍ട്ടറുകള്‍""; +""VIDEO_FILTER_RESET_BUTTON"" = ""വീഡിയോ ഫില്‍റ്ററുകള്‍ പുനക്രമീകരിക്കുക""; +""VIDEO_ASPECT_RATIO_BUTTON"" = ""വീഡിയോ അസ്പെക്റ്റ് അനുപാതം മാറ്റുക""; +""PLAY_PAUSE_BUTTON"" = ""ഇപ്പോഴത്തെ ഫയല്‍ നിര്‍ത്തുകയോ പ്ലേ ചെയ്യുകയോ ചെയ്യുക""; +""BWD_BUTTON"" = ""പിന്നിലേക്ക്‌ ചാടുക""; +""FWD_BUTTON"" = ""മുന്നിലേക്ക്‌ ചാടുക""; +""PLAY_BUTTON"" = ""പ്ലേ""; +""NEXT_BUTTON"" = ""അടുത്തത്""; +""PREV_BUTTON"" = ""മുമ്പത്തെ""; +""PLAY_ALL_BUTTON"" = ""എല്ലാം പ്ലേ ചെയ്യുക""; + +""VERSION_FORMAT"" = ""വെര്‍ഷന്‍: %@""; +""BASED_ON_FORMAT"" = ""അടിസ്ഥാനം:
    %@""; + +""NEW"" = ""പുതിയത്""; + +""BUG_REPORT_TITLE"" = ""ഒരു പ്രശ്നം ശ്രദ്ധയില്‍ പെടുത്തൂ""; +""BUG_REPORT_MESSAGE"" = ""നിങ്ങള്‍ ഒരു പ്രശ്നം ശ്രദ്ധയില്‍ പെടുത്താന്‍ ആഗ്രഹിക്കുന്നുവോ?""; +""BUG_REPORT_BUTTON"" = ""സഫാരി തുറക്കുക""; + +""VO_VIDEOPLAYER_TITLE"" = ""വീഡിയോ പ്ലെയര്‍""; +""VO_VIDEOPLAYER_DOUBLETAP"" = ""പ്ലേബാക്ക് നിയന്ത്രകങ്ങള്‍ ഒളിപ്പിക്കാനും കാണിക്കാനും ഇരട്ട ടാപിംഗ് ചെയ്യുക""; + +""FIRST_STEPS_ITUNES"" = ""ഐ ട്യുന്‍സുമായി മാധ്യമം സിങ്ക് ചെയ്യുക""; +""FIRST_STEPS_ITUNES_TITLE"" = ""നിങ്ങളുടെ കമ്പ്യൂട്ടറുമായി സമന്വയിപ്പിക്കുക""; +""FIRST_STEPS_ITUNES_DETAILS"" = ""നിങ്ങളുടെ ഉപകരണം ഐട്യൂൺസിലേക്ക് കണക്റ്റുചെയ്‌ത് നിങ്ങളുടെ ഉപകരണം തിരഞ്ഞെടുക്കുക. ഐട്യൂൺസിന്റെ ഇടതുവശത്തുള്ള മെനുവിൽ \""ഫയൽ പങ്കിടൽ\"" തിരഞ്ഞെടുത്ത് ഫയൽ കൈമാറാൻ വി‌എൽ‌സി തിരയുക""; +""FIRST_STEPS_WIFI_TITLE"" = ""Share via Wi-Fi""; +""FIRST_STEPS_WIFI_DETAILS"" = ""നിങ്ങളുടെ ഫോണിന്റെ അതേ നെറ്റ്‌വർക്കിലേക്ക് കണക്റ്റുചെയ്‌തിരിക്കുമ്പോൾ ജനറേറ്റുചെയ്‌ത URL നിങ്ങളുടെ പ്രിയപ്പെട്ട വെബ് ബ്രൗസറിൽ നൽകുക""; +""FIRST_STEPS_CLOUDS"" = ""മേഘങ്ങള്‍""; +""FIRST_STEPS_CLOUD_TITLE"" = ""ക്ലൗഡ്""; +""FIRST_STEPS_CLOUD_DETAILS"" = ""വിദൂരമായി ഡൗൻലോഡ് ചെയ്യുന്നതിനോ സ്ട്രീം ചെയ്യുന്നതിനോ നിങ്ങളുടെ മീഡിയ ഗൂഗിൾ ഡ്രൈവ് അല്ലെങ്കിൽ ഡ്രോപ്പ്ബോക്സ് പോലുള്ള ഒരു ക്ലൗഡ് സേവനത്തിലേക്ക് അപ്‌ലോഡ് ചെയ്യുക.""; + + +""PLEX_CHECK_ACCOUNT"" = ""Check your Plex account in settings""; +""PLEX_ERROR_ACCOUNT"" = ""Plex login Error""; + +""UNAUTHORIZED"" = ""അനധികൃത""; + +""SERVER"" = ""സര്‍വ്വര്‍""; +""SERVER_PORT"" = ""പോര്‍ട്ട്""; +""NO_SERVER_FOUND"" = ""സര്‍വ്വര്‍ ഒന്നും കണ്ടെത്തിയിട്ടില്ല""; +""NO_RECENT_STREAMS"" = ""അടുത്തിടെ ഒരു സ്ട്രീമും പ്ലേ ചെയ്‌തില്ല""; + +""WEBINTF_TITLE"" = ""Sharing via Wi-Fi""; +""WEBINTF_DROPFILES"" = ""ഫയലുകള്‍ വലിച്ചിടുക ""; +""WEBINTF_DROPFILES_LONG"" = ""Drop files in the window to add them to your %@.
    Or click on the \""+\"" button to use the file picker dialog.""; +""WEBINTF_DOWNLOADFILES"" = ""ഡൌണ്‍ലോ‍ഡ് ചെയ്ത ഫയലുകള്‍ ""; +""WEBINTF_DOWNLOADFILES_LONG"" = ""നിങ്ങളുടെ %@-നിന്ന് ഡൌൺലോഡ് ചെയ്യാൻ ആഗ്രഹിക്കുന്ന ഫയലിൽ ക്ലിക്കുചെയ്യുക.""; +""WEBINTF_TITLE_ATV"" = ""വിധൂര പ്ലേബാക്ക്""; +""WEBINTF_DROPFILES_LONG_ATV"" = ""Drop files in the window to play them on your %@.
    Or click on the \""+\"" button to use the file picker dialog.""; +""WEBINTF_URL_SENT"" = ""URL അയച്ചു.""; +""WEBINTF_URL_EMPTY"" = ""URL ശൂന്യമായിരിക്കരുത്.""; +""WEBINTF_URL_INVALID"" = ""സാധുവായ ഒരു URL അല്ല.""; +""WEBINTF_AUTH_REQUIRED"" = ""VLC iOS-ൽ നിങ്ങൾ സജ്ജമാക്കിയ പാസ്‌കോഡ് നൽകുക:""; +""WEBINTF_AUTH_WRONG_PASSCODE"" = ""തെറ്റായ പാസ്‌കോഡ്.
    അവശേഷിക്കുന്ന ശ്രമങ്ങൾ:""; +""WEBINTF_AUTH_BANNED"" = ""നിങ്ങൾ വളരെയധികം തെറ്റായ പാസ്‌കോഡുകൾ നൽകി.
    ദയവായി VLC iOS പുനരാരംഭിച്ച് വീണ്ടും ശ്രമിക്കുക.""; + + + +""DURATION"" = ""കാലയളവ്""; +""TITLE"" = ""തലക്കെട്ട്""; + +// strings from VLCKit + +// accessibility labels for the playlist + + +""LONGPRESS_TO_STOP"" = ""പ്ലേബാക്ക് നിർത്താൻ ദീർഘനേരം അമർത്തുക.""; + +// ATV specific +""AUDIO_INFO_VC_TITLE"" = ""ഓഡിയോ വിവരം""; +""CLOUD_LOGIN_LONG"" = ""To access Cloud Services, sign-in to iCloud on both this Apple TV and an iOS device with the same Apple ID and enable Keychain Sharing in System Settings.\nAfterwards, login to the cloud provider of your choice using the VLC app on your iOS device. Finally, select it on this screen.""; +""ENTER_URL"" = ""പ്ലേ ചെയ്യാൻ URL നൽകുക""; +""HTTP_SERVER_ON"" = ""വിദൂര പ്ലേബാക്ക് അപ്രാപ്‌തമാക്കുക""; +""HTTP_SERVER_OFF"" = ""വിദൂര പ്ലേബാക്ക് പ്രവർത്തനക്ഷമമാക്കുക""; +""CACHED_MEDIA"" = ""കാഷെ ചെയ്‌ത മീഡിയ""; +""CACHED_MEDIA_LONG"" = ""Media shown here is stored locally on your Apple TV. Note that contents can be removed by the operating system without prior notice anytime when VLC is not running in case your device runs out of storage.""; +""DOWNLOAD_SUBS_FROM_OSO"" = ""OpenSubtitles.org ൽ നിന്ന് സബ്ടൈറ്റിലുകൾ ഡൺലോഡ് ചെയ്യുക ...""; +""FOUND_SUBS"" = ""ഉപശീര്‍ഷകങ്ങള്‍ കണ്ടെത്തി""; +""USE_SPDIF"" = ""പാസ്-ത്രൂ (S/PDIF) ഉപയോഗിക്കുക""; + +""PLAYBACK"" = ""പ്ലേബാക്ക്""; +""REPEAT_MODE"" = ""ആവർത്തിക്കുക""; +""REPEAT_DISABLED"" = ""അപ്രാപ്‌തമാക്കി""; +""REPEAT_SINGLE"" = ""Single""; +""REPEAT_FOLDER"" = ""ഫോൾഡർ""; + +// Local Network Service Names +""UPNP_LONG"" = ""യൂണിവേഴ്സൽ പ്ലഗ് 'എൻ' പ്ലേ (UPnP)""; +""UPNP_SHORT"" = ""UPnP""; + +""PLEX_LONG"" = ""പ്ലെക്സ് മീഡിയ സെർവർ (ബോൺജോർ വഴി)""; +""PLEX_SHORT"" = ""പ്ലെക്സ്""; + +""FTP_SHORT"" = ""FTP""; +""SFTP_SHORT"" = ""SFTP""; + +""NFS_LONG"" = ""നെറ്റ്‌വർക്ക് ഫയൽ സിസ്റ്റം (NFS)""; +""NFS_SHORT"" = ""NFS""; + +""BONJOUR_FILE_SERVERS"" = ""ബോഞ്ചൂർ ഫയൽ സെർവർ""; +""DSM_WORKGROUP"" = ""വർക്ക് ഗ്രൂപ്പ്""; + +""URL_NOT_SUPPORTED"" = ""URL തുറക്കാൻ കഴിയില്ല""; + +// Insert %@ where play-pause-glyph should be placed +""DELETE_ITEM_HINT"" = ""ഇല്ലാതാക്കാൻ %@ അമർത്തുക""; /* Insert %@ where play-pause-glyph should be placed */ + +""DELETE_MESSAGE"" = ""Confirm the deletion of the selection""; +""DELETE_MESSAGE_PLAYLIST"" = ""തിരഞ്ഞെടുത്ത പ്ലേലിസ്റ്റ് ഇല്ലാതാക്കുമെന്ന് നിങ്ങൾക്ക് ഉറപ്പാണോ?\nബന്ധപ്പെട്ട മീഡിയ ഫയലുകൾ ഇല്ലാതാക്കില്ല.""; +""DELETE_MESSAGE_PLAYLIST_CONTENT"" = ""തിരഞ്ഞെടുത്ത മീഡിയ പ്ലേലിസ്റ്റിൽ നിന്ന് നീക്കംചെയ്യുമെന്ന് നിങ്ങൾക്ക് ഉറപ്പാണോ?\nഅവ ഡിസ്കിൽ നിന്ന് ഇല്ലാതാക്കില്ല.""; +""DELETE_TITLE"" = ""തിരഞ്ഞെടുക്കൽ ഇല്ലാതാക്കുക""; + +//Drag and Drop +""THIS_FILE"" = ""ഈ ഫയൽ""; +""NOT_SUPPORTED_FILETYPE"" = ""%@ is not a supported filetype by VLC""; +""FILE_EXISTS"" = ""%@ ഇതിനകം ലഭ്യമാണ്""; + +""PROTOCOL_NOT_SELECTED"" = ""പ്രോട്ടോക്കോൾ തിരഞ്ഞെടുത്തിട്ടില്ല""; +""Settings"" = ""ക്രമീകരണങ്ങള്‍""; + +""ERROR"" = ""പിശക്""; +""OK"" = ""ശരി""; +""SORT"" = ""അടുക്കുക""; +""SORT_BY"" = ""അടുക്കുക""; +""SEARCH"" = ""തിരയുക""; +""VIDEO"" = ""വീഡിയോ""; + +// MediaViewController Swipable Header +""ALBUMS"" = ""ആൽബങ്ങൾ""; +""ARTISTS"" = ""കലാകാരന്മാർ""; +""EPISODES"" = ""എപ്പിസോഡുകൾ""; +""GENRES"" = ""തരങ്ങൾ""; +""ALL_VIDEOS"" = ""എല്ലാ വീഡിയോകളും""; +""SONGS"" = ""ഗാനങ്ങൾ""; +""PLAYLISTS"" = ""പ്ലേലിസ്റ്റുകൾ""; +""VIDEO_GROUPS"" = ""വീഡിയോ ഗ്രൂപ്പുകൾ""; + +""MODIFIED_DATE"" = ""പരിഷ്‌ക്കരിച്ച തീയതി""; +""NAME"" = ""പേര്""; + +//EDIT + +""BUTTON_EDIT"" = ""എഡിറ്റുചെയ്യുക""; +""BUTTON_EDIT_HINT"" = ""എഡിറ്റ് മോഡ്""; + +""ADD_TO_PLAYLIST"" = ""പ്ലേലിസ്റ്റിൽ ആഡ് ചെയ്യുക""; +""ADD_TO_PLAYLIST_HINT"" = ""Open the add to playlist menu""; + +""PLAYLIST_PLACEHOLDER"" = ""പ്ലേലിസ്റ്റ് ശീർഷകം""; +""PLAYLIST_DESCRIPTION"" = ""നിങ്ങളുടെ പുതിയ പ്ലേലിസ്റ്റിനായി ഒരു ശീർഷകം തിരഞ്ഞെടുക്കുക""; +""PLAYLIST_CREATION"" = ""ഒരു പുതിയ പ്ലേലിസ്റ്റ് സൃഷ്ടിക്കുക""; +""PLAYLIST_CREATION_HINT"" = ""Show an interactive action to create a playlist""; +""ERROR_PLAYLIST_CREATION"" = ""ഒരു പ്ലേലിസ്റ്റ് സൃഷ്‌ടിക്കുന്നതിൽ പരാജയപ്പെട്ടു""; +""ERROR_PLAYLIST_TRACKS"" = ""ട്രാക്കുകൾ വീണ്ടെടുക്കുന്നതിൽ പരാജയപ്പെട്ടു""; + +""ERROR_RENAME_FAILED"" = ""പേരുമാറ്റുന്നത് പരാജയപ്പെട്ടു""; +""ERROR_EMPTY_NAME"" = ""ശീർഷകം ശൂന്യമായിരിക്കരുത്""; + +""SHARE_LABEL"" = ""പങ്കിടുക""; +""SHARE_HINT"" = ""തിരഞ്ഞെടുത്ത ഫയലുകൾ പങ്കിടുക""; +""RENAME_HINT"" = ""തിരഞ്ഞെടുത്ത ഫയലുകളുടെ പേരുമാറ്റുക""; +""DELETE_HINT"" = ""തിരഞ്ഞെടുത്ത ഫയലുകൾ ഇല്ലാതാക്കുക""; + +// Sort + +""BUTTON_SORT"" = ""അടുക്കുക""; +""BUTTON_SORT_HINT"" = ""സോർട്ട് ആക്ഷൻ ഷീറ്റ് പ്രദർശിപ്പിക്കുക""; +""HEADER_TITLE_SORT"" = ""അടുക്കുന്ന രീതി""; +""DESCENDING_LABEL"" = ""അവരോഹണ ക്രമം""; +""DESCENDING_SWITCH_LABEL"" = ""ആരോഹണം അല്ലെങ്കിൽ അവരോഹണ ക്രമം""; +""DESCENDING_SWITCH_HINT"" = ""ആരോഹണക്രമത്തിലോ അവരോഹണ ക്രമത്തിലോ സന്ദർഭം അടുക്കുക""; +""GRID_LAYOUT"" = ""Grid Layout""; + +// VLCMediaLibraryKit - Sorting Criteria + +""ALPHA"" = ""Alphanumerically""; +""DURATION"" = ""കാലയളവ്""; +""INSERTION_DATE"" = ""ഉൾപ്പെടുത്തൽ തീയതി""; +""LAST_MODIFICATION_DATE"" = ""അവസാന പരിഷ്‌ക്കരണ തീയതി""; +""RELEASE_DATE"" = ""റിലീസ് തീയതി""; +""FILE_SIZE"" = ""ഫയൽ വലുപ്പം""; +""ARTIST"" = ""ആർട്ടിസ്റ്റ്""; +""PLAY_COUNT"" = ""പ്ലേ എണ്ണം""; +""ALBUM"" = ""ആൽബം""; +""FILENAME"" = ""ഫയലിന്റെ പേര്""; +""TRACK_NUMBER"" = ""ട്രാക്ക് നമ്പർ""; +""NB_AUDIO"" = ""ഓഡിയോയുടെ എണ്ണം""; +""NB_MEDIA"" = ""മീഡിയയുടെ എണ്ണം""; +""NB_VIDEO"" = ""വീഡിയോയുടെ എണ്ണം""; + +// VLCNetworkLoginTVViewController + +""NO_SAVING_DATA"" = ""ഒന്നും കണ്ടെത്തിയില്ല""; + +// MediaCollectionViewCell + +""UNKNOWN_ARTIST"" = ""അജ്ഞാത ആർട്ടിസ്റ്റ്""; +""VARIOUS_ARTIST"" = ""വിവിധ കലാകാരന്മാർ""; +""UNKNOWN_ALBUM"" = ""അജ്ഞാത ആൽബം""; + +/* VideoSubControl */ +""INTERFACE_LOCK_BUTTON"" = ""ഇന്റർഫേസ് ലോക്ക് ചെയ്യുക""; +""INTERFACE_LOCK_HINT"" = ""ഇന്റർഫേസ് നിയന്ത്രണങ്ങൾ പ്രവർത്തനരഹിതമാക്കുക""; +""MORE_OPTIONS_BUTTON"" = ""കൂടുതൽ""; +""MORE_OPTIONS_HINT"" = ""കൂടുതൽ ഓപ്ഷൻ നിയന്ത്രണങ്ങൾ കാണുക""; +""REPEAT_MODE_HINT"" = ""നിലവിലെ ഇനത്തിന്റെ ആവർത്തന മോഡ് മാറ്റുക""; +""VIDEO_ASPECT_RATIO_HINT"" = ""നിലവിലെ വീഡിയോയുടെ വീക്ഷണാനുപാതം മാറ്റുക""; + +/* MediaMoreOptionsActionSheet */ +""EQUALIZER_CELL_TITLE"" = ""ഈക്വലൈസർ""; +""MORE_OPTIONS_HEADER_TITLE"" = ""വീഡിയോ ഓപ്ഷനുകൾ""; + +/* Settings - Force rescan alert */ +""FORCE_RESCAN_TITLE"" = ""മീഡിയ ലൈബ്രറി വീണ്ടും സ്കാൻ ചെയ്യാൻ നിർബന്ധിക്കുക""; +""FORCE_RESCAN_MESSAGE"" = ""നിങ്ങളുടെ മീഡിയ ലൈബ്രറി വീണ്ടെടുക്കാൻ VLC-യെ നിർബന്ധിക്കാൻ നിങ്ങൾ ആഗ്രഹിക്കുന്നുണ്ടോ?\nഇതിന് കുറച്ച് സമയമെടുക്കും.""; + +// Local Network + +""SMBV1_WARN_TITLE"" = ""SMBv1 കണക്ഷൻ മുന്നറിയിപ്പ്""; +""SMBV1_WARN_DESCRIPTION"" = ""ഞങ്ങൾ ഒരു പഴയ പ്രോട്ടോക്കോൾ (SMBv1) കണ്ടെത്തി.\nSMBv1- ൽ തുടരുമെന്ന് നിങ്ങൾക്ക് ഉറപ്പാണോ?\nനിങ്ങളുടെ സെർവർ ക്രമീകരണങ്ങൾ നവീകരിക്കാനോ മാറ്റാനോ ഞങ്ങൾ ഉപദേശിക്കുന്നു.""; +""SMBV1_CONTINUE"" = ""SMBv1 ഉപയോഗിച്ച് തുടരുക""; +""SMBV1_NEXT_PROTOCOL"" = ""SMBv2/v3 പരീക്ഷിക്കുക""; + +/* Preview labels */ + +""ENCODING"" = ""എൻകോഡിംഗ്""; + +/* Media groups */ + +""ADD_TO_MEDIA_GROUP"" = ""മീഡിയ ഗ്രൂപ്പിലേക്ക് ചേർക്കുക""; +""ADD_TO_MEDIA_GROUP_HINT"" = ""മീഡിയ ഗ്രൂപ്പ് മെനുവിലേക്ക് ചേർക്കുക തുറക്കുക""; + +""MEDIA_GROUPS"" = ""മീഡിയ ഗ്രൂപ്പുകൾ""; +""MEDIA_GROUPS_DESCRIPTION"" = ""നിങ്ങളുടെ പുതിയ മീഡിയ ഗ്രൂപ്പിനായി ഒരു ശീർഷകം തിരഞ്ഞെടുക്കുക""; +""MEDIA_GROUPS_PLACEHOLDER"" = ""മീഡിയ ഗ്രൂപ്പ് ശീർഷകം""; + +""REMOVE_FROM_MEDIA_GROUP"" = ""മീഡിയ ഗ്രൂപ്പിൽ നിന്ന് നീക്കംചെയ്യുക""; +""REMOVE_FROM_MEDIA_GROUP_HINT"" = ""മീഡിയ ഗ്രൂപ്പിൽ നിന്ന് തിരഞ്ഞെടുക്കൽ നീക്കംചെയ്യുക""; + +""MEDIA_GROUP_CREATION"" = ""പുതിയ മീഡിയ ഗ്രൂപ്പ്""; +""MEDIA_GROUP_CREATION_HINT"" = ""Show alert to create a playlist""; +""MEDIA_GROUP_MOVE_TO_ROOT"" = ""Move content to top level""; +""MEDIA_GROUP_MOVE_TO_ROOT_HINT"" = ""Moves the content of the selection to the top level""; + +""BUTTON_REGROUP"" = ""വീണ്ടും ഗ്രൂപ്പുചെയ്യുക""; +""BUTTON_REGROUP_TITLE"" = ""തിരഞ്ഞെടുത്തവ വീണ്ടും സംഘടിപ്പിക്കുക""; +""BUTTON_REGROUP_HINT"" = ""Attempt to regroup automatically single media.""; +""BUTTON_REGROUP_DESCRIPTION"" = ""Are you sure to attempt to regroup automatically single media?\nThis can take some time.""; + +/* Files.app persistence file */ +""MEDIALIBRARY_FILES_PLACEHOLDER"" = ""മീഡിയ ചേർക്കാൻ അവ ഇവിടെ വയ്ക്കുക""; +""MEDIALIBRARY_ADDING_PLACEHOLDER"" = ""ചേർക്കുന്നു...""; + +/* tip jar */ +""GIVE_TIP"" = ""Give a Tip""; +""CANNOT_MAKE_PAYMENTS"" = ""You are not allowed to make payments on this device.""; +""PURCHASE_FAILED"" = ""Purchase Failed""; +""SEND_GIFT"" = ""Send your gift""; + +// MARK: - QueueViewController + +""PLAY_HINT"" = ""Play""; +""PLAY_LABEL"" = ""Play""; +""PLAY_NEXT_IN_QUEUE_HINT"" = ""Play next in queue""; +""PLAY_NEXT_IN_QUEUE_LABEL"" = ""Play next in queue""; +""APPEND_TO_QUEUE_HINT"" = ""Append to queue""; +""APPEND_TO_QUEUE_LABEL"" = ""Append to queue""; ",0 ce04b1f29a137198182f60bbb628d5ceb8171765,https://github.com/troglobit/ssdp-responder/commit/ce04b1f29a137198182f60bbb628d5ceb8171765,"Fix #1: Ensure recv buf is always NUL terminated Signed-off-by: Joachim Nilsson ","diff --git a/ssdpd.c b/ssdpd.c index 7fe5cab..f6a1297 100644 --- a/ssdpd.c +++ b/ssdpd.c @@ -432,13 +432,11 @@ static void ssdp_recv(int sd) ssize_t len; struct sockaddr sa; socklen_t salen; - char buf[MAX_PKT_SIZE]; + char buf[MAX_PKT_SIZE + 1]; memset(buf, 0, sizeof(buf)); - len = recvfrom(sd, buf, sizeof(buf), MSG_DONTWAIT, &sa, &salen); + len = recvfrom(sd, buf, sizeof(buf) - 1, MSG_DONTWAIT, &sa, &salen); if (len > 0) { - buf[len] = 0; - if (sa.sa_family != AF_INET) return; ",1 7cf638a20b7af935aea89a6932e4b077a9385fde,https://github.com/sidhpurwala-huzaifa/FreeRDP/commit/7cf638a20b7af935aea89a6932e4b077a9385fde,"Merge pull request #1624 from bmiklautz/ios iOS: Removed unused code","diff --git a/client/Android/FreeRDPCore/jni/android_jni_callback.h b/client/Android/FreeRDPCore/jni/android_jni_callback.h index fd90da3333f..cd91e709b1e 100644 --- a/client/Android/FreeRDPCore/jni/android_jni_callback.h +++ b/client/Android/FreeRDPCore/jni/android_jni_callback.h @@ -21,7 +21,6 @@ jboolean jni_attach_thread(JNIEnv** env); void jni_detach_thread(void); void freerdp_callback(const char * callback, const char * signature, ...); jboolean freerdp_callback_bool_result(const char * callback, const char * signature, ...); -void tsxconnect_callback(const char * callback, const char * signature, ...); #endif /* FREERDP_ANDROID_JNI_CALLBACK_H */ diff --git a/client/iOS/Controllers/BookmarkEditorController.m b/client/iOS/Controllers/BookmarkEditorController.m index 71d8734212e..20ef7fef39c 100644 --- a/client/iOS/Controllers/BookmarkEditorController.m +++ b/client/iOS/Controllers/BookmarkEditorController.m @@ -39,11 +39,7 @@ - (id)initWithBookmark:(ComputerBookmark*)bookmark _bookmark = [bookmark copyWithUUID]; _params = [_bookmark params]; - // if this is a TSX Connect bookmark - disable server settings - if([_bookmark isKindOfClass:NSClassFromString(@""TSXConnectComputerBookmark"")]) - _display_server_settings = NO; - else - _display_server_settings = YES; + _display_server_settings = YES; } return self; } @@ -348,20 +344,17 @@ - (void)handleSave:(id)sender [[self view] endEditing:NO]; // verify that bookmark is complete (only for manual bookmarks) - if (![_bookmark isKindOfClass:NSClassFromString(@""TSXConnectComputerBookmark"")]) + if ([[_bookmark label] length] == 0 || [[_params StringForKey:@""hostname""] length] == 0 || [_params intForKey:@""port""] == 0) { - if ([[_bookmark label] length] == 0 || [[_params StringForKey:@""hostname""] length] == 0 || [_params intForKey:@""port""] == 0) - { - BlockAlertView* alertView = [BlockAlertView alertWithTitle:NSLocalizedString(@""Cancel without saving?"", @""Incomplete bookmark error title"") message:NSLocalizedString(@""Press 'Cancel' to abort!\nPress 'Continue' to specify the required fields!"", @""Incomplete bookmark error message"")]; - [alertView setCancelButtonWithTitle:NSLocalizedString(@""Cancel"", @""Cancel Button"") block:^{ - // cancel bookmark editing and return to previous view controller - [[self navigationController] popViewControllerAnimated:YES]; - }]; - [alertView addButtonWithTitle:NSLocalizedString(@""Continue"", @""Continue Button"") block:nil]; - [alertView show]; - return; - } - } + BlockAlertView* alertView = [BlockAlertView alertWithTitle:NSLocalizedString(@""Cancel without saving?"", @""Incomplete bookmark error title"") message:NSLocalizedString(@""Press 'Cancel' to abort!\nPress 'Continue' to specify the required fields!"", @""Incomplete bookmark error message"")]; + [alertView setCancelButtonWithTitle:NSLocalizedString(@""Cancel"", @""Cancel Button"") block:^{ + // cancel bookmark editing and return to previous view controller + [[self navigationController] popViewControllerAnimated:YES]; + }]; + [alertView addButtonWithTitle:NSLocalizedString(@""Continue"", @""Continue Button"") block:nil]; + [alertView show]; + return; + } // commit bookmark if ([[self delegate] respondsToSelector:@selector(commitBookmark:)]) diff --git a/client/iOS/Controllers/BookmarkListController.h b/client/iOS/Controllers/BookmarkListController.h index 03958829e85..d67325f5a61 100644 --- a/client/iOS/Controllers/BookmarkListController.h +++ b/client/iOS/Controllers/BookmarkListController.h @@ -26,12 +26,10 @@ // array with search results (or nil if no search active) NSMutableArray* _manual_search_result; - NSMutableArray* _tsxconnect_search_result; NSMutableArray* _history_search_result; // bookmark arrays NSMutableArray* _manual_bookmarks; - NSMutableArray* _tsxconnect_bookmarks; // bookmark star images UIImage* _star_on_img; @@ -45,9 +43,6 @@ // temporary bookmark when asking if the user wants to store a bookmark for a session initiated by a quick connect ComputerBookmark* _temporary_bookmark; - - // reachability notification helper for tsx connect - Reachability* _tsxconnect_reachability; } @property (nonatomic, retain) IBOutlet UISearchBar* searchBar; diff --git a/client/iOS/Controllers/BookmarkListController.m b/client/iOS/Controllers/BookmarkListController.m index 1c869d4dcc7..e3497df9167 100644 --- a/client/iOS/Controllers/BookmarkListController.m +++ b/client/iOS/Controllers/BookmarkListController.m @@ -87,11 +87,6 @@ - (void)viewDidLoad { // set edit button to allow bookmark list editing [[self navigationItem] setRightBarButtonItem:[self editButtonItem]]; - -/* - if (![[InAppPurchaseManager sharedInAppPurchaseManager] isProVersion]) - [[self navigationItem] setLeftBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:@""Go Pro"" style:UIBarButtonItemStyleDone target:self action:@selector(goProButtonPressed:)]]; -*/ } @@ -139,19 +134,14 @@ - (void)viewDidUnload { - (void)dealloc -{ - [_tsxconnect_reachability stopNotifier]; - [_tsxconnect_reachability release]; - +{ [[NSNotificationCenter defaultCenter] removeObserver:self]; [_temporary_bookmark release]; [_connection_history release]; [_active_sessions release]; - [_tsxconnect_search_result release]; [_manual_search_result release]; [_manual_bookmarks release]; - [_tsxconnect_bookmarks release]; [_star_on_img release]; [_star_off_img release]; @@ -242,8 +232,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N RDPSession* session = [_active_sessions objectAtIndex:[indexPath row]]; [[cell title] setText:[session sessionName]]; [[cell server] setText:[[session params] StringForKey:@""hostname""]]; - if([[[cell server] text] length] == 0) - [[cell server] setText:@""TSX Connect""]; [[cell username] setText:[[session params] StringForKey:@""username""]]; [[cell screenshot] setImage:[session getScreenshotWithSize:[[cell screenshot] bounds].size]]; [[cell disconnectButton] setTag:[indexPath row]]; @@ -390,7 +378,7 @@ -(NSIndexPath*)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowA // - the quick connect/quick create bookmark cell // - any item while a search is applied if([proposedDestinationIndexPath row] == 0 || ([sourceIndexPath section] != [proposedDestinationIndexPath section]) || - _manual_search_result != nil || _tsxconnect_search_result != nil) + _manual_search_result != nil) { return sourceIndexPath; } @@ -579,8 +567,6 @@ - (BOOL)searchBarShouldBeginEditing:(UISearchBar*)searchBar - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar { // clear search result - [_tsxconnect_search_result release]; - _tsxconnect_search_result = nil; [_manual_search_result release]; _manual_search_result = nil; @@ -619,14 +605,13 @@ - (void)sessionDisconnected:(NSNotification*)notification RDPSession* session = (RDPSession*)[notification object]; [_active_sessions removeObject:session]; - // if this view is currently active refresh tsxconnect entries + // if this view is currently active refresh entries if([[self navigationController] visibleViewController] == self) [_tableView reloadSections:[NSIndexSet indexSetWithIndex:SECTION_SESSIONS] withRowAnimation:UITableViewRowAnimationNone]; // if session's bookmark is not in the bookmark list ask the user if he wants to add it // (this happens if the session is created using the quick connect feature) - if (![[session bookmark] isKindOfClass:NSClassFromString(@""TSXConnectComputerBookmark"")] && - ![_manual_bookmarks containsObject:[session bookmark]]) + if (![_manual_bookmarks containsObject:[session bookmark]]) { // retain the bookmark in case we want to save it later _temporary_bookmark = [[session bookmark] retain]; @@ -711,7 +696,7 @@ - (IBAction)disconnectButtonPressed:(id)sender - (BOOL)hasNoBookmarks { - return ([_manual_bookmarks count] == 0 && [_tsxconnect_bookmarks count] == 0); + return ([_manual_bookmarks count] == 0); } - (UIButton*)disclosureButtonWithImage:(UIImage*)image @@ -728,18 +713,15 @@ - (UIButton*)disclosureButtonWithImage:(UIImage*)image - (void)performSearch:(NSString*)searchText { [_manual_search_result autorelease]; - [_tsxconnect_search_result autorelease]; if([searchText length] > 0) { _manual_search_result = [FilterBookmarks(_manual_bookmarks, [searchText componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]) retain]; - _tsxconnect_search_result = [FilterBookmarks(_tsxconnect_bookmarks, [searchText componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]) retain]; _history_search_result = [FilterHistory(_connection_history, searchText) retain]; } else { _history_search_result = nil; - _tsxconnect_search_result = nil; _manual_search_result = nil; } } diff --git a/client/iOS/Models/RDPSession.h b/client/iOS/Models/RDPSession.h index 519e0a250c1..67e04eaa490 100644 --- a/client/iOS/Models/RDPSession.h +++ b/client/iOS/Models/RDPSession.h @@ -33,7 +33,6 @@ extern NSString* TSXSessionDidFailToConnectNotification; - (void)sessionBitmapContextDidChange:(RDPSession*)session; - (void)session:(RDPSession*)session needsRedrawInRect:(CGRect)rect; - (CGSize)sizeForFitScreenForSession:(RDPSession*)session; -- (void)showGoProScreen:(RDPSession*)session; - (void)session:(RDPSession*)session requestsAuthenticationWithParams:(NSMutableDictionary*)params; - (void)session:(RDPSession*)session verifyCertificateWithParams:(NSMutableDictionary*)params; diff --git a/client/iOS/Models/RDPSession.m b/client/iOS/Models/RDPSession.m index 87b8a447e95..8cb045754b7 100644 --- a/client/iOS/Models/RDPSession.m +++ b/client/iOS/Models/RDPSession.m @@ -430,12 +430,6 @@ - (void)sessionBitmapContextDidChange [[self delegate] sessionBitmapContextDidChange:self]; } -- (void)showGoProScreen -{ - if ([[self delegate] respondsToSelector:@selector(showGoProScreen:)]) - [[self delegate] showGoProScreen:self]; -} - - (void)sessionRequestsAuthenticationWithParams:(NSMutableDictionary*)params { if ([[self delegate] respondsToSelector:@selector(session:requestsAuthenticationWithParams:)]) ",0 3716fcea14041196a0f9dcdd80035aeb307e3f97,https://github.com/libyal/libevt/commit/3716fcea14041196a0f9dcdd80035aeb307e3f97,Worked on tests,"diff --git a/.gitignore b/.gitignore index 2386a38..eceb0b9 100644 --- a/.gitignore +++ b/.gitignore @@ -127,6 +127,7 @@ stamp-h[1-9] /tests/*.exe /tests/evt_test_end_of_file_record /tests/evt_test_error +/tests/evt_test_event_record /tests/evt_test_file /tests/evt_test_file_header /tests/evt_test_io_handle diff --git a/configure.ac b/configure.ac index dc6e6d1..6d8f98e 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ( 2.59 ) AC_INIT( [libevt], - [20190801], + [20190802], [joachim.metz@gmail.com]) AC_CONFIG_SRCDIR( diff --git a/libevt/libevt_event_record.c b/libevt/libevt_event_record.c index 1d028bf..d510a74 100644 --- a/libevt/libevt_event_record.c +++ b/libevt/libevt_event_record.c @@ -26,7 +26,6 @@ #include ""libevt_debug.h"" #include ""libevt_event_record.h"" -#include ""libevt_libbfio.h"" #include ""libevt_libcerror.h"" #include ""libevt_libcnotify.h"" #include ""libevt_libfdatetime.h"" @@ -688,7 +687,7 @@ int libevt_event_record_read_data( { if( libevt_debug_print_security_identifier_value( function, - ""user security identifier\t\t"", + ""user security identifier\t\t\t"", user_security_identifier, user_security_identifier_size, error ) != 1 ) @@ -941,86 +940,6 @@ int libevt_event_record_read_data( return( -1 ); } -/* Reads the event record from a Basic File IO (bfio) handle - * Returns 1 if successful or -1 on error - */ -int libevt_event_record_read_file_io_handle( - libevt_event_record_t *event_record, - libbfio_handle_t *file_io_handle, - off64_t file_offset, - libcerror_error_t **error ) -{ - uint8_t data[ sizeof( evt_event_record_t ) ]; - - static char *function = ""libevt_event_record_read_file_io_handle""; - ssize_t read_count = 0; - -#if defined( HAVE_DEBUG_OUTPUT ) - if( libcnotify_verbose != 0 ) - { - libcnotify_printf( - ""%s: reading event record at offset: %"" PRIi64 "" (0x%08"" PRIx64 "")\n"", - function, - file_offset, - file_offset ); - } -#endif - if( libbfio_handle_seek_offset( - file_io_handle, - file_offset, - SEEK_SET, - error ) == -1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_IO, - LIBCERROR_IO_ERROR_SEEK_FAILED, - ""%s: unable to seek event record offset: %"" PRIi64 "" (0x%08"" PRIx64 "")."", - function, - file_offset, - file_offset ); - - return( -1 ); - } - read_count = libbfio_handle_read_buffer( - file_io_handle, - data, - sizeof( evt_event_record_t ), - error ); - - if( read_count != (ssize_t) sizeof( evt_event_record_t ) ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_IO, - LIBCERROR_IO_ERROR_READ_FAILED, - ""%s: unable to read event record at offset: %"" PRIi64 "" (0x%08"" PRIx64 "")."", - function, - file_offset, - file_offset ); - - return( -1 ); - } - if( libevt_event_record_read_data( - event_record, - data, - sizeof( evt_event_record_t ), - error ) != 1 ) - { - libcerror_error_set( - error, - LIBCERROR_ERROR_DOMAIN_IO, - LIBCERROR_IO_ERROR_READ_FAILED, - ""%s: unable to read event record at offset: %"" PRIi64 "" (0x%08"" PRIx64 "")."", - function, - file_offset, - file_offset ); - - return( -1 ); - } - return( 1 ); -} - /* Retrieves the record number * Returns 1 if successful or -1 on error */ diff --git a/libevt/libevt_event_record.h b/libevt/libevt_event_record.h index 083a1e8..db18768 100644 --- a/libevt/libevt_event_record.h +++ b/libevt/libevt_event_record.h @@ -25,7 +25,6 @@ #include #include -#include ""libevt_libbfio.h"" #include ""libevt_libcerror.h"" #include ""libevt_libfwnt.h"" #include ""libevt_strings_array.h"" @@ -117,12 +116,6 @@ int libevt_event_record_read_data( size_t data_size, libcerror_error_t **error ); -int libevt_event_record_read_file_io_handle( - libevt_event_record_t *event_record, - libbfio_handle_t *file_io_handle, - off64_t file_offset, - libcerror_error_t **error ); - int libevt_event_record_get_record_number( libevt_event_record_t *event_record, uint32_t *record_number, diff --git a/libevt/libevt_strings_array.c b/libevt/libevt_strings_array.c index 960ee64..d3a4dfc 100644 --- a/libevt/libevt_strings_array.c +++ b/libevt/libevt_strings_array.c @@ -194,13 +194,25 @@ int libevt_strings_array_read_data( return( -1 ); } - if( data_size > (size_t) SSIZE_MAX ) + if( ( data_size < 2 ) + || ( data_size > (size_t) SSIZE_MAX ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, - LIBCERROR_RUNTIME_ERROR_VALUE_EXCEEDS_MAXIMUM, - ""%s: invalid data size value exceeds maximum."", + LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, + ""%s: invalid data size value out of bounds."", + function ); + + return( -1 ); + } + if( ( data_size % 2 ) != 0 ) + { + libcerror_error_set( + error, + LIBCERROR_ERROR_DOMAIN_RUNTIME, + LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, + ""%s: invalid data size - value must be a multitude of 2."", function ); return( -1 ); diff --git a/msvscpp/Makefile.am b/msvscpp/Makefile.am index b6a9174..f5b1e7b 100644 --- a/msvscpp/Makefile.am +++ b/msvscpp/Makefile.am @@ -1,6 +1,7 @@ MSVSCPP_FILES = \ evt_test_end_of_file_record/evt_test_end_of_file_record.vcproj \ evt_test_error/evt_test_error.vcproj \ + evt_test_event_record/evt_test_event_record.vcproj \ evt_test_file/evt_test_file.vcproj \ evt_test_file_header/evt_test_file_header.vcproj \ evt_test_io_handle/evt_test_io_handle.vcproj \ diff --git a/msvscpp/evt_test_event_record/evt_test_event_record.vcproj b/msvscpp/evt_test_event_record/evt_test_event_record.vcproj new file mode 100644 index 0000000..11aaea7 --- /dev/null +++ b/msvscpp/evt_test_event_record/evt_test_event_record.vcproj @@ -0,0 +1,222 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/msvscpp/libevt.sln b/msvscpp/libevt.sln index ebc8489..c99c05a 100644 --- a/msvscpp/libevt.sln +++ b/msvscpp/libevt.sln @@ -66,6 +66,13 @@ Project(""{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"") = ""evt_test_error"", ""evt_test_ {66425C2B-EF0C-481D-8170-AAF9663519CA} = {66425C2B-EF0C-481D-8170-AAF9663519CA} EndProjectSection EndProject +Project(""{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"") = ""evt_test_event_record"", ""evt_test_event_record\evt_test_event_record.vcproj"", ""{C967C0DC-7EAB-4857-994B-8F131DB9B07E}"" + ProjectSection(ProjectDependencies) = postProject + {9D37639F-1694-47DF-84BF-336D98E0639F} = {9D37639F-1694-47DF-84BF-336D98E0639F} + {66425C2B-EF0C-481D-8170-AAF9663519CA} = {66425C2B-EF0C-481D-8170-AAF9663519CA} + {BD3A95FA-A3DE-4B79-A889-A7E5ECA4B69C} = {BD3A95FA-A3DE-4B79-A889-A7E5ECA4B69C} + EndProjectSection +EndProject Project(""{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"") = ""evt_test_file"", ""evt_test_file\evt_test_file.vcproj"", ""{9D76992F-770E-42E5-B692-E03116831E42}"" ProjectSection(ProjectDependencies) = postProject {41CFAFBF-A1C8-4704-AFEF-31979E6452B9} = {41CFAFBF-A1C8-4704-AFEF-31979E6452B9} @@ -370,6 +377,10 @@ Global {3D7BB8D8-66D7-4A8E-A8F5-C269BA658D25}.Release|Win32.Build.0 = Release|Win32 {3D7BB8D8-66D7-4A8E-A8F5-C269BA658D25}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {3D7BB8D8-66D7-4A8E-A8F5-C269BA658D25}.VSDebug|Win32.Build.0 = VSDebug|Win32 + {C967C0DC-7EAB-4857-994B-8F131DB9B07E}.Release|Win32.ActiveCfg = Release|Win32 + {C967C0DC-7EAB-4857-994B-8F131DB9B07E}.Release|Win32.Build.0 = Release|Win32 + {C967C0DC-7EAB-4857-994B-8F131DB9B07E}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 + {C967C0DC-7EAB-4857-994B-8F131DB9B07E}.VSDebug|Win32.Build.0 = VSDebug|Win32 {9D76992F-770E-42E5-B692-E03116831E42}.Release|Win32.ActiveCfg = Release|Win32 {9D76992F-770E-42E5-B692-E03116831E42}.Release|Win32.Build.0 = Release|Win32 {9D76992F-770E-42E5-B692-E03116831E42}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 diff --git a/tests/Makefile.am b/tests/Makefile.am index 9d420c7..5f848e3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -47,6 +47,7 @@ EXTRA_DIST = \ check_PROGRAMS = \ evt_test_end_of_file_record \ evt_test_error \ + evt_test_event_record \ evt_test_file \ evt_test_file_header \ evt_test_io_handle \ @@ -77,6 +78,19 @@ evt_test_error_SOURCES = \ evt_test_error_LDADD = \ ../libevt/libevt.la +evt_test_event_record_SOURCES = \ + evt_test_event_record.c \ + evt_test_libcerror.h \ + evt_test_libevt.h \ + evt_test_macros.h \ + evt_test_memory.c evt_test_memory.h \ + evt_test_unused.h + +evt_test_event_record_LDADD = \ + @LIBFWNT_LIBADD@ \ + ../libevt/libevt.la \ + @LIBCERROR_LIBADD@ + evt_test_file_SOURCES = \ evt_test_file.c \ evt_test_functions.c evt_test_functions.h \ diff --git a/tests/data/event_record.1 b/tests/data/event_record.1 new file mode 100644 index 0000000..5eb1fe0 Binary files /dev/null and b/tests/data/event_record.1 differ diff --git a/tests/evt_test_end_of_file_record.c b/tests/evt_test_end_of_file_record.c index 78b648d..3a1c220 100644 --- a/tests/evt_test_end_of_file_record.c +++ b/tests/evt_test_end_of_file_record.c @@ -20,6 +20,7 @@ */ #include +#include #include #include @@ -395,6 +396,182 @@ int evt_test_end_of_file_record_read_data( libcerror_error_free( &error ); + /* Test error case where signature1 is invalid + */ + byte_stream_copy_from_uint32_little_endian( + &( evt_test_end_of_file_record_data1[ 4 ] ), + 0xffffffffUL ); + + result = libevt_end_of_file_record_read_data( + end_of_file_record, + evt_test_end_of_file_record_data1, + 40, + &error ); + + byte_stream_copy_from_uint32_little_endian( + &( evt_test_end_of_file_record_data1[ 4 ] ), + 0x11111111UL ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + /* Test error case where signature2 is invalid + */ + byte_stream_copy_from_uint32_little_endian( + &( evt_test_end_of_file_record_data1[ 8 ] ), + 0xffffffffUL ); + + result = libevt_end_of_file_record_read_data( + end_of_file_record, + evt_test_end_of_file_record_data1, + 40, + &error ); + + byte_stream_copy_from_uint32_little_endian( + &( evt_test_end_of_file_record_data1[ 8 ] ), + 0x22222222UL ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + /* Test error case where signature3 is invalid + */ + byte_stream_copy_from_uint32_little_endian( + &( evt_test_end_of_file_record_data1[ 12 ] ), + 0xffffffffUL ); + + result = libevt_end_of_file_record_read_data( + end_of_file_record, + evt_test_end_of_file_record_data1, + 40, + &error ); + + byte_stream_copy_from_uint32_little_endian( + &( evt_test_end_of_file_record_data1[ 12 ] ), + 0x33333333UL ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + /* Test error case where signature4 is invalid + */ + byte_stream_copy_from_uint32_little_endian( + &( evt_test_end_of_file_record_data1[ 16 ] ), + 0xffffffffUL ); + + result = libevt_end_of_file_record_read_data( + end_of_file_record, + evt_test_end_of_file_record_data1, + 40, + &error ); + + byte_stream_copy_from_uint32_little_endian( + &( evt_test_end_of_file_record_data1[ 16 ] ), + 0x44444444UL ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + /* Test error case where size and copy of size mismatch + */ + byte_stream_copy_from_uint32_little_endian( + &( evt_test_end_of_file_record_data1[ 36 ] ), + 0xffffffffUL ); + + result = libevt_end_of_file_record_read_data( + end_of_file_record, + evt_test_end_of_file_record_data1, + 40, + &error ); + + byte_stream_copy_from_uint32_little_endian( + &( evt_test_end_of_file_record_data1[ 36 ] ), + 0x00000028UL ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + /* Test error case where size and copy of size contain an unsupport value + */ + byte_stream_copy_from_uint32_little_endian( + &( evt_test_end_of_file_record_data1[ 0 ] ), + 0x00000030UL ); + + byte_stream_copy_from_uint32_little_endian( + &( evt_test_end_of_file_record_data1[ 36 ] ), + 0x00000030UL ); + + result = libevt_end_of_file_record_read_data( + end_of_file_record, + evt_test_end_of_file_record_data1, + 40, + &error ); + + byte_stream_copy_from_uint32_little_endian( + &( evt_test_end_of_file_record_data1[ 0 ] ), + 0x00000028UL ); + + byte_stream_copy_from_uint32_little_endian( + &( evt_test_end_of_file_record_data1[ 36 ] ), + 0x00000028UL ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + /* Clean up */ result = libevt_end_of_file_record_free( diff --git a/tests/evt_test_event_record.c b/tests/evt_test_event_record.c new file mode 100644 index 0000000..532d171 --- /dev/null +++ b/tests/evt_test_event_record.c @@ -0,0 +1,3150 @@ +/* + * Library event_record type test program + * + * Copyright (C) 2011-2019, Joachim Metz + * + * Refer to AUTHORS for acknowledgements. + * + * This software is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this software. If not, see . + */ + +#include +#include +#include +#include +#include + +#if defined( HAVE_STDLIB_H ) || defined( WINAPI ) +#include +#endif + +#include ""evt_test_libcerror.h"" +#include ""evt_test_libevt.h"" +#include ""evt_test_macros.h"" +#include ""evt_test_memory.h"" +#include ""evt_test_unused.h"" + +#include ""../libevt/libevt_event_record.h"" + +uint8_t evt_test_event_record_data1[ 144 ] = { + 0x90, 0x00, 0x00, 0x00, 0x4c, 0x66, 0x4c, 0x65, 0x01, 0x00, 0x00, 0x00, 0x79, 0x42, 0xdb, 0x4c, + 0x79, 0x42, 0xdb, 0x4c, 0xe8, 0x03, 0x00, 0x40, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x6f, 0x00, 0x61, 0x00, 0x64, 0x00, + 0x50, 0x00, 0x65, 0x00, 0x72, 0x00, 0x66, 0x00, 0x00, 0x00, 0x57, 0x00, 0x4b, 0x00, 0x53, 0x00, + 0x2d, 0x00, 0x57, 0x00, 0x49, 0x00, 0x4e, 0x00, 0x58, 0x00, 0x50, 0x00, 0x33, 0x00, 0x32, 0x00, + 0x42, 0x00, 0x49, 0x00, 0x54, 0x00, 0x00, 0x00, 0x52, 0x00, 0x53, 0x00, 0x56, 0x00, 0x50, 0x00, + 0x00, 0x00, 0x51, 0x00, 0x6f, 0x00, 0x53, 0x00, 0x20, 0x00, 0x52, 0x00, 0x53, 0x00, 0x56, 0x00, + 0x50, 0x00, 0x00, 0x00, 0x0c, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00 }; + +#if defined( __GNUC__ ) && !defined( LIBEVT_DLL_IMPORT ) + +/* Tests the libevt_event_record_initialize function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_initialize( + void ) +{ + libcerror_error_t *error = NULL; + libevt_event_record_t *event_record = NULL; + int result = 0; + +#if defined( HAVE_EVT_TEST_MEMORY ) + int number_of_malloc_fail_tests = 1; + int number_of_memset_fail_tests = 1; + int test_number = 0; +#endif + + /* Test regular cases + */ + result = libevt_event_record_initialize( + &event_record, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""event_record"", + event_record ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + result = libevt_event_record_free( + &event_record, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_IS_NULL( + ""event_record"", + event_record ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Test error cases + */ + result = libevt_event_record_initialize( + NULL, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + event_record = (libevt_event_record_t *) 0x12345678UL; + + result = libevt_event_record_initialize( + &event_record, + &error ); + + event_record = NULL; + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + +#if defined( HAVE_EVT_TEST_MEMORY ) + + for( test_number = 0; + test_number < number_of_malloc_fail_tests; + test_number++ ) + { + /* Test libevt_event_record_initialize with malloc failing + */ + evt_test_malloc_attempts_before_fail = test_number; + + result = libevt_event_record_initialize( + &event_record, + &error ); + + if( evt_test_malloc_attempts_before_fail != -1 ) + { + evt_test_malloc_attempts_before_fail = -1; + + if( event_record != NULL ) + { + libevt_event_record_free( + &event_record, + NULL ); + } + } + else + { + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NULL( + ""event_record"", + event_record ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + } + } + for( test_number = 0; + test_number < number_of_memset_fail_tests; + test_number++ ) + { + /* Test libevt_event_record_initialize with memset failing + */ + evt_test_memset_attempts_before_fail = test_number; + + result = libevt_event_record_initialize( + &event_record, + &error ); + + if( evt_test_memset_attempts_before_fail != -1 ) + { + evt_test_memset_attempts_before_fail = -1; + + if( event_record != NULL ) + { + libevt_event_record_free( + &event_record, + NULL ); + } + } + else + { + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NULL( + ""event_record"", + event_record ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + } + } +#endif /* defined( HAVE_EVT_TEST_MEMORY ) */ + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + if( event_record != NULL ) + { + libevt_event_record_free( + &event_record, + NULL ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_free function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_free( + void ) +{ + libcerror_error_t *error = NULL; + int result = 0; + + /* Test error cases + */ + result = libevt_event_record_free( + NULL, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_read_data function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_read_data( + void ) +{ + libcerror_error_t *error = NULL; + libevt_event_record_t *event_record = NULL; + int result = 0; + +#if defined( HAVE_EVT_TEST_MEMORY ) +#if defined( OPTIMIZATION_DISABLED ) + int number_of_memcpy_fail_tests = 2; +#endif + int number_of_malloc_fail_tests = 2; + int test_number = 0; +#endif + + /* Initialize test + */ + result = libevt_event_record_initialize( + &event_record, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""event_record"", + event_record ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Test regular cases + */ + result = libevt_event_record_read_data( + event_record, + evt_test_event_record_data1, + 144, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Test error cases + */ + result = libevt_event_record_read_data( + event_record, + evt_test_event_record_data1, + 144, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + /* Clean up + */ + result = libevt_event_record_free( + &event_record, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_IS_NULL( + ""event_record"", + event_record ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Initialize test + */ + result = libevt_event_record_initialize( + &event_record, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""event_record"", + event_record ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Test error cases + */ + result = libevt_event_record_read_data( + NULL, + evt_test_event_record_data1, + 144, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_read_data( + event_record, + NULL, + 144, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_read_data( + event_record, + evt_test_event_record_data1, + (size_t) SSIZE_MAX + 1, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_read_data( + event_record, + evt_test_event_record_data1, + 0, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + +#if defined( HAVE_EVT_TEST_MEMORY ) + + for( test_number = 0; + test_number < number_of_malloc_fail_tests; + test_number++ ) + { + /* Test libevt_event_record_initialize with malloc failing + */ + evt_test_malloc_attempts_before_fail = test_number; + + result = libevt_event_record_read_data( + event_record, + evt_test_event_record_data1, + 144, + &error ); + + if( evt_test_malloc_attempts_before_fail != -1 ) + { + evt_test_malloc_attempts_before_fail = -1; + } + else + { + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + } + } +#if defined( OPTIMIZATION_DISABLED ) + for( test_number = 0; + test_number < number_of_memcpy_fail_tests; + test_number++ ) + { + /* Test libevt_event_record_initialize with memcpy failing + */ + evt_test_memcpy_attempts_before_fail = test_number; + + result = libevt_event_record_read_data( + event_record, + evt_test_event_record_data1, + 144, + &error ); + + if( evt_test_memcpy_attempts_before_fail != -1 ) + { + evt_test_memcpy_attempts_before_fail = -1; + } + else + { + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + } + } +#endif /* defined( OPTIMIZATION_DISABLED ) */ +#endif /* defined( HAVE_EVT_TEST_MEMORY ) */ + + /* Test error case where signature is invalid + */ + byte_stream_copy_from_uint32_little_endian( + &( evt_test_event_record_data1[ 4 ] ), + 0xffffffffUL ); + + result = libevt_event_record_read_data( + event_record, + evt_test_event_record_data1, + 144, + &error ); + + byte_stream_copy_from_uint32_little_endian( + &( evt_test_event_record_data1[ 4 ] ), + 0x654c664cUL ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + /* TODO test error case where user security identifier offset and size are out of bounds */ + + /* TODO test error case where strings offset and size are out of bounds */ + + /* TODO test error case where data offset and size are out of bounds */ + + /* Clean up + */ + result = libevt_event_record_free( + &event_record, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_IS_NULL( + ""event_record"", + event_record ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + if( event_record != NULL ) + { + libevt_event_record_free( + &event_record, + NULL ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_record_number function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_record_number( + libevt_event_record_t *event_record ) +{ + libcerror_error_t *error = NULL; + uint32_t record_number = 0; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_record_number( + event_record, + &record_number, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_EQUAL_UINT32( + ""record_number"", + record_number, + 1 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Test error cases + */ + result = libevt_event_record_get_record_number( + NULL, + &record_number, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_record_number( + event_record, + NULL, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_creation_time function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_creation_time( + libevt_event_record_t *event_record ) +{ + libcerror_error_t *error = NULL; + uint32_t posix_time = 0; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_creation_time( + event_record, + &posix_time, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_EQUAL_UINT32( + ""posix_time"", + posix_time, + 1289437817 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Test error cases + */ + result = libevt_event_record_get_creation_time( + NULL, + &posix_time, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_creation_time( + event_record, + NULL, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_last_written_time function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_last_written_time( + libevt_event_record_t *event_record ) +{ + libcerror_error_t *error = NULL; + uint32_t posix_time = 0; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_last_written_time( + event_record, + &posix_time, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_EQUAL_UINT32( + ""posix_time"", + posix_time, + 1289437817 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Test error cases + */ + result = libevt_event_record_get_last_written_time( + NULL, + &posix_time, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_last_written_time( + event_record, + NULL, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_event_identifier function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_event_identifier( + libevt_event_record_t *event_record ) +{ + libcerror_error_t *error = NULL; + uint32_t event_identifier = 0; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_event_identifier( + event_record, + &event_identifier, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_EQUAL_UINT32( + ""event_identifier"", + event_identifier, + 1073742824 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Test error cases + */ + result = libevt_event_record_get_event_identifier( + NULL, + &event_identifier, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_event_identifier( + event_record, + NULL, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_event_type function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_event_type( + libevt_event_record_t *event_record ) +{ + libcerror_error_t *error = NULL; + uint16_t event_type = 0; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_event_type( + event_record, + &event_type, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_EQUAL_UINT16( + ""event_type"", + event_type, + 4 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Test error cases + */ + result = libevt_event_record_get_event_type( + NULL, + &event_type, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_event_type( + event_record, + NULL, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_event_category function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_event_category( + libevt_event_record_t *event_record ) +{ + libcerror_error_t *error = NULL; + uint16_t event_category = 0; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_event_category( + event_record, + &event_category, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_EQUAL_UINT16( + ""event_category"", + event_category, + 0 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Test error cases + */ + result = libevt_event_record_get_event_category( + NULL, + &event_category, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_event_category( + event_record, + NULL, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_utf8_source_name_size function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_utf8_source_name_size( + libevt_event_record_t *event_record ) +{ + libcerror_error_t *error = NULL; + size_t utf8_string_size = 0; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_utf8_source_name_size( + event_record, + &utf8_string_size, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_EQUAL_SIZE( + ""utf8_string_size"", + utf8_string_size, + (size_t) 9 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Test error cases + */ + result = libevt_event_record_get_utf8_source_name_size( + NULL, + &utf8_string_size, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf8_source_name_size( + event_record, + NULL, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_utf8_source_name function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_utf8_source_name( + libevt_event_record_t *event_record ) +{ + uint8_t utf8_string[ 32 ]; + + uint8_t expected_utf8_string[ 9 ] = { + 'L', 'o', 'a', 'd', 'P', 'e', 'r', 'f', 0 }; + + libcerror_error_t *error = NULL; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_utf8_source_name( + event_record, + utf8_string, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + result = memory_compare( + utf8_string, + expected_utf8_string, + 9 ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 0 ); + + /* Test error cases + */ + result = libevt_event_record_get_utf8_source_name( + NULL, + utf8_string, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf8_source_name( + event_record, + NULL, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf8_source_name( + event_record, + utf8_string, + (size_t) SSIZE_MAX + 1, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf8_source_name( + event_record, + utf8_string, + 0, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_utf16_source_name_size function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_utf16_source_name_size( + libevt_event_record_t *event_record ) +{ + libcerror_error_t *error = NULL; + size_t utf16_string_size = 0; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_utf16_source_name_size( + event_record, + &utf16_string_size, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_EQUAL_SIZE( + ""utf16_string_size"", + utf16_string_size, + (size_t) 9 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Test error cases + */ + result = libevt_event_record_get_utf16_source_name_size( + NULL, + &utf16_string_size, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf16_source_name_size( + event_record, + NULL, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_utf16_source_name function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_utf16_source_name( + libevt_event_record_t *event_record ) +{ + uint16_t utf16_string[ 32 ]; + + uint16_t expected_utf16_string[ 9 ] = { + 'L', 'o', 'a', 'd', 'P', 'e', 'r', 'f', 0 }; + + libcerror_error_t *error = NULL; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_utf16_source_name( + event_record, + utf16_string, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + result = memory_compare( + utf16_string, + expected_utf16_string, + 9 ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 0 ); + + /* Test error cases + */ + result = libevt_event_record_get_utf16_source_name( + NULL, + utf16_string, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf16_source_name( + event_record, + NULL, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf16_source_name( + event_record, + utf16_string, + (size_t) SSIZE_MAX + 1, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf16_source_name( + event_record, + utf16_string, + 0, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_utf8_computer_name_size function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_utf8_computer_name_size( + libevt_event_record_t *event_record ) +{ + libcerror_error_t *error = NULL; + size_t utf8_string_size = 0; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_utf8_computer_name_size( + event_record, + &utf8_string_size, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_EQUAL_SIZE( + ""utf8_string_size"", + utf8_string_size, + (size_t) 15 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Test error cases + */ + result = libevt_event_record_get_utf8_computer_name_size( + NULL, + &utf8_string_size, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf8_computer_name_size( + event_record, + NULL, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_utf8_computer_name function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_utf8_computer_name( + libevt_event_record_t *event_record ) +{ + uint8_t utf8_string[ 32 ]; + + uint8_t expected_utf8_string[ 15 ] = { + 'W', 'K', 'S', '-', 'W', 'I', 'N', 'X', 'P', '3', '2', 'B', 'I', 'T', 0 }; + + libcerror_error_t *error = NULL; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_utf8_computer_name( + event_record, + utf8_string, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + result = memory_compare( + utf8_string, + expected_utf8_string, + 15 ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 0 ); + + /* Test error cases + */ + result = libevt_event_record_get_utf8_computer_name( + NULL, + utf8_string, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf8_computer_name( + event_record, + NULL, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf8_computer_name( + event_record, + utf8_string, + (size_t) SSIZE_MAX + 1, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf8_computer_name( + event_record, + utf8_string, + 0, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_utf16_computer_name_size function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_utf16_computer_name_size( + libevt_event_record_t *event_record ) +{ + libcerror_error_t *error = NULL; + size_t utf16_string_size = 0; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_utf16_computer_name_size( + event_record, + &utf16_string_size, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_EQUAL_SIZE( + ""utf16_string_size"", + utf16_string_size, + (size_t) 15 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Test error cases + */ + result = libevt_event_record_get_utf16_computer_name_size( + NULL, + &utf16_string_size, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf16_computer_name_size( + event_record, + NULL, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_utf16_computer_name function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_utf16_computer_name( + libevt_event_record_t *event_record ) +{ + uint16_t utf16_string[ 32 ]; + + uint16_t expected_utf16_string[ 15 ] = { + 'W', 'K', 'S', '-', 'W', 'I', 'N', 'X', 'P', '3', '2', 'B', 'I', 'T', 0 }; + + libcerror_error_t *error = NULL; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_utf16_computer_name( + event_record, + utf16_string, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + result = memory_compare( + utf16_string, + expected_utf16_string, + 15 ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 0 ); + + /* Test error cases + */ + result = libevt_event_record_get_utf16_computer_name( + NULL, + utf16_string, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf16_computer_name( + event_record, + NULL, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf16_computer_name( + event_record, + utf16_string, + (size_t) SSIZE_MAX + 1, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf16_computer_name( + event_record, + utf16_string, + 0, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_utf8_user_security_identifier_size function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_utf8_user_security_identifier_size( + libevt_event_record_t *event_record ) +{ + libcerror_error_t *error = NULL; + size_t utf8_string_size = 0; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_utf8_user_security_identifier_size( + event_record, + &utf8_string_size, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 0 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Test error cases + */ + result = libevt_event_record_get_utf8_user_security_identifier_size( + NULL, + &utf8_string_size, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_utf8_user_security_identifier function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_utf8_user_security_identifier( + libevt_event_record_t *event_record ) +{ + uint8_t utf8_string[ 32 ]; + + libcerror_error_t *error = NULL; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_utf8_user_security_identifier( + event_record, + utf8_string, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 0 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Test error cases + */ + result = libevt_event_record_get_utf8_user_security_identifier( + NULL, + utf8_string, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_utf16_user_security_identifier_size function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_utf16_user_security_identifier_size( + libevt_event_record_t *event_record ) +{ + libcerror_error_t *error = NULL; + size_t utf16_string_size = 0; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_utf16_user_security_identifier_size( + event_record, + &utf16_string_size, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 0 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Test error cases + */ + result = libevt_event_record_get_utf16_user_security_identifier_size( + NULL, + &utf16_string_size, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_utf16_user_security_identifier function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_utf16_user_security_identifier( + libevt_event_record_t *event_record ) +{ + uint16_t utf16_string[ 32 ]; + + libcerror_error_t *error = NULL; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_utf16_user_security_identifier( + event_record, + utf16_string, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 0 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Test error cases + */ + result = libevt_event_record_get_utf16_user_security_identifier( + NULL, + utf16_string, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_number_of_strings function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_number_of_strings( + libevt_event_record_t *event_record ) +{ + libcerror_error_t *error = NULL; + int number_of_strings = 0; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_number_of_strings( + event_record, + &number_of_strings, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_EQUAL_UINT16( + ""number_of_strings"", + number_of_strings, + 2 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Test error cases + */ + result = libevt_event_record_get_number_of_strings( + NULL, + &number_of_strings, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_number_of_strings( + event_record, + NULL, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_utf8_string_size function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_utf8_string_size( + libevt_event_record_t *event_record ) +{ + libcerror_error_t *error = NULL; + size_t utf8_string_size = 0; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_utf8_string_size( + event_record, + 0, + &utf8_string_size, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_EQUAL_SIZE( + ""utf8_string_size"", + utf8_string_size, + (size_t) 5 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Test error cases + */ + result = libevt_event_record_get_utf8_string_size( + NULL, + 0, + &utf8_string_size, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf8_string_size( + event_record, + -1, + &utf8_string_size, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf8_string_size( + event_record, + 0, + NULL, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_utf8_string function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_utf8_string( + libevt_event_record_t *event_record ) +{ + uint8_t utf8_string[ 32 ]; + + uint8_t expected_utf8_string[ 5 ] = { + 'R', 'S', 'V', 'P', 0 }; + + libcerror_error_t *error = NULL; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_utf8_string( + event_record, + 0, + utf8_string, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + result = memory_compare( + utf8_string, + expected_utf8_string, + 5 ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 0 ); + + /* Test error cases + */ + result = libevt_event_record_get_utf8_string( + NULL, + 0, + utf8_string, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf8_string( + event_record, + -1, + utf8_string, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf8_string( + event_record, + 0, + NULL, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf8_string( + event_record, + 0, + utf8_string, + (size_t) SSIZE_MAX + 1, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf8_string( + event_record, + 0, + utf8_string, + 0, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_utf16_string_size function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_utf16_string_size( + libevt_event_record_t *event_record ) +{ + libcerror_error_t *error = NULL; + size_t utf16_string_size = 0; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_utf16_string_size( + event_record, + 0, + &utf16_string_size, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_EQUAL_SIZE( + ""utf16_string_size"", + utf16_string_size, + (size_t) 5 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Test error cases + */ + result = libevt_event_record_get_utf16_string_size( + NULL, + 0, + &utf16_string_size, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf16_string_size( + event_record, + -1, + &utf16_string_size, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf16_string_size( + event_record, + 0, + NULL, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_utf16_string function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_utf16_string( + libevt_event_record_t *event_record ) +{ + uint16_t utf16_string[ 32 ]; + + uint16_t expected_utf16_string[ 5 ] = { + 'R', 'S', 'V', 'P', 0 }; + + libcerror_error_t *error = NULL; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_utf16_string( + event_record, + 0, + utf16_string, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + result = memory_compare( + utf16_string, + expected_utf16_string, + 5 ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 0 ); + + /* Test error cases + */ + result = libevt_event_record_get_utf16_string( + NULL, + 0, + utf16_string, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf16_string( + event_record, + -1, + utf16_string, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf16_string( + event_record, + 0, + NULL, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf16_string( + event_record, + 0, + utf16_string, + (size_t) SSIZE_MAX + 1, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_utf16_string( + event_record, + 0, + utf16_string, + 0, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_data_size function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_data_size( + libevt_event_record_t *event_record ) +{ + libcerror_error_t *error = NULL; + size_t data_size = 0; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_data_size( + event_record, + &data_size, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_EQUAL_SIZE( + ""data_size"", + data_size, + (size_t) 4 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Test error cases + */ + result = libevt_event_record_get_data_size( + NULL, + &data_size, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_data_size( + event_record, + NULL, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +/* Tests the libevt_event_record_get_data function + * Returns 1 if successful or 0 if not + */ +int evt_test_event_record_get_data( + libevt_event_record_t *event_record ) +{ + uint8_t data[ 32 ]; + + uint8_t expected_data[ 4 ] = { + 0x0c, 0x14, 0x00, 0x00 }; + + libcerror_error_t *error = NULL; + int result = 0; + + /* Test regular cases + */ + result = libevt_event_record_get_data( + event_record, + data, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + result = memory_compare( + data, + expected_data, + 4 ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 0 ); + + /* Test error cases + */ + result = libevt_event_record_get_data( + NULL, + data, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_data( + event_record, + NULL, + 32, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_data( + event_record, + data, + (size_t) SSIZE_MAX + 1, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + result = libevt_event_record_get_data( + event_record, + data, + 0, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + return( 1 ); + +on_error: + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + return( 0 ); +} + +#endif /* defined( __GNUC__ ) && !defined( LIBEVT_DLL_IMPORT ) */ + +/* The main program + */ +#if defined( HAVE_WIDE_SYSTEM_CHARACTER ) +int wmain( + int argc EVT_TEST_ATTRIBUTE_UNUSED, + wchar_t * const argv[] EVT_TEST_ATTRIBUTE_UNUSED ) +#else +int main( + int argc EVT_TEST_ATTRIBUTE_UNUSED, + char * const argv[] EVT_TEST_ATTRIBUTE_UNUSED ) +#endif +{ +#if defined( __GNUC__ ) && !defined( LIBEVT_DLL_IMPORT ) + + libcerror_error_t *error = NULL; + libevt_event_record_t *event_record = NULL; + int result = 0; + +#endif /* defined( __GNUC__ ) && !defined( LIBEVT_DLL_IMPORT ) */ + + EVT_TEST_UNREFERENCED_PARAMETER( argc ) + EVT_TEST_UNREFERENCED_PARAMETER( argv ) + +#if defined( __GNUC__ ) && !defined( LIBEVT_DLL_IMPORT ) + + EVT_TEST_RUN( + ""libevt_event_record_initialize"", + evt_test_event_record_initialize ); + + EVT_TEST_RUN( + ""libevt_event_record_free"", + evt_test_event_record_free ); + + EVT_TEST_RUN( + ""libevt_event_record_read_data"", + evt_test_event_record_read_data ); + +#if !defined( __BORLANDC__ ) || ( __BORLANDC__ >= 0x0560 ) + + /* Initialize test + */ + result = libevt_event_record_initialize( + &event_record, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""event_record"", + event_record ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + result = libevt_event_record_read_data( + event_record, + evt_test_event_record_data1, + 144, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_record_number"", + evt_test_event_record_get_record_number, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_creation_time"", + evt_test_event_record_get_creation_time, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_last_written_time"", + evt_test_event_record_get_last_written_time, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_event_identifier"", + evt_test_event_record_get_event_identifier, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_event_type"", + evt_test_event_record_get_event_type, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_event_category"", + evt_test_event_record_get_event_category, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_utf8_source_name_size"", + evt_test_event_record_get_utf8_source_name_size, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_utf8_source_name"", + evt_test_event_record_get_utf8_source_name, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_utf16_source_name_size"", + evt_test_event_record_get_utf16_source_name_size, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_utf16_source_name"", + evt_test_event_record_get_utf16_source_name, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_utf8_computer_name_size"", + evt_test_event_record_get_utf8_computer_name_size, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_utf8_computer_name"", + evt_test_event_record_get_utf8_computer_name, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_utf16_computer_name_size"", + evt_test_event_record_get_utf16_computer_name_size, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_utf16_computer_name"", + evt_test_event_record_get_utf16_computer_name, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_utf8_user_security_identifier_size"", + evt_test_event_record_get_utf8_user_security_identifier_size, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_utf8_user_security_identifier"", + evt_test_event_record_get_utf8_user_security_identifier, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_utf16_user_security_identifier_size"", + evt_test_event_record_get_utf16_user_security_identifier_size, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_utf16_user_security_identifier"", + evt_test_event_record_get_utf16_user_security_identifier, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_number_of_strings"", + evt_test_event_record_get_number_of_strings, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_utf8_string_size"", + evt_test_event_record_get_utf8_string_size, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_utf8_string"", + evt_test_event_record_get_utf8_string, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_utf16_string_size"", + evt_test_event_record_get_utf16_string_size, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_utf16_string"", + evt_test_event_record_get_utf16_string, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_data_size"", + evt_test_event_record_get_data_size, + event_record ); + + EVT_TEST_RUN_WITH_ARGS( + ""libevt_event_record_get_data"", + evt_test_event_record_get_data, + event_record ); + + /* Clean up + */ + result = libevt_event_record_free( + &event_record, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_IS_NULL( + ""event_record"", + event_record ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + +#endif /* !defined( __BORLANDC__ ) || ( __BORLANDC__ >= 0x0560 ) */ +#endif /* defined( __GNUC__ ) && !defined( LIBEVT_DLL_IMPORT ) */ + + return( EXIT_SUCCESS ); + +on_error: +#if defined( __GNUC__ ) && !defined( LIBEVT_DLL_IMPORT ) + + if( error != NULL ) + { + libcerror_error_free( + &error ); + } + if( event_record != NULL ) + { + libevt_event_record_free( + &event_record, + NULL ); + } +#endif /* defined( __GNUC__ ) && !defined( LIBEVT_DLL_IMPORT ) */ + + return( EXIT_FAILURE ); +} + diff --git a/tests/evt_test_file_header.c b/tests/evt_test_file_header.c index 937f7da..e3ca341 100644 --- a/tests/evt_test_file_header.c +++ b/tests/evt_test_file_header.c @@ -398,6 +398,34 @@ int evt_test_file_header_read_data( libcerror_error_free( &error ); + /* Test error case where signature is invalid + */ + byte_stream_copy_from_uint32_little_endian( + &( evt_test_file_header_data1[ 4 ] ), + 0xffffffffUL ); + + result = libevt_file_header_read_data( + file_header, + evt_test_file_header_data1, + 0, + &error ); + + byte_stream_copy_from_uint32_little_endian( + &( evt_test_file_header_data1[ 4 ] ), + 0x654c664cUL ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + /* Clean up */ result = libevt_file_header_free( diff --git a/tests/evt_test_strings_array.c b/tests/evt_test_strings_array.c index efd5a3a..f502319 100644 --- a/tests/evt_test_strings_array.c +++ b/tests/evt_test_strings_array.c @@ -320,6 +320,64 @@ int evt_test_strings_array_read_data( ""error"", error ); + /* Test error cases + */ + result = libevt_strings_array_read_data( + strings_array, + evt_test_strings_array_data1, + 28, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + + /* Clean up + */ + result = libevt_strings_array_free( + &strings_array, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_IS_NULL( + ""strings_array"", + strings_array ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + + /* Initialize test + */ + result = libevt_strings_array_initialize( + &strings_array, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + 1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""strings_array"", + strings_array ); + + EVT_TEST_ASSERT_IS_NULL( + ""error"", + error ); + /* Test error cases */ result = libevt_strings_array_read_data( @@ -394,6 +452,24 @@ int evt_test_strings_array_read_data( libcerror_error_free( &error ); + result = libevt_strings_array_read_data( + strings_array, + evt_test_strings_array_data1, + 27, + &error ); + + EVT_TEST_ASSERT_EQUAL_INT( + ""result"", + result, + -1 ); + + EVT_TEST_ASSERT_IS_NOT_NULL( + ""error"", + error ); + + libcerror_error_free( + &error ); + /* Clean up */ result = libevt_strings_array_free( diff --git a/tests/test_library.ps1 b/tests/test_library.ps1 index b6a27be..c3bf12d 100644 --- a/tests/test_library.ps1 +++ b/tests/test_library.ps1 @@ -6,7 +6,7 @@ $ExitSuccess = 0 $ExitFailure = 1 $ExitIgnore = 77 -$LibraryTests = ""end_of_file_record error file_header io_handle notify record record_values strings_array"" +$LibraryTests = ""end_of_file_record error event_record file_header io_handle notify record record_values strings_array"" $LibraryTestsWithInput = ""file support"" $InputGlob = ""*"" diff --git a/tests/test_library.sh b/tests/test_library.sh index 8a3fbf9..8e0afe2 100755 --- a/tests/test_library.sh +++ b/tests/test_library.sh @@ -7,7 +7,7 @@ EXIT_SUCCESS=0; EXIT_FAILURE=1; EXIT_IGNORE=77; -LIBRARY_TESTS=""end_of_file_record error file_header io_handle notify record record_values strings_array""; +LIBRARY_TESTS=""end_of_file_record error event_record file_header io_handle notify record record_values strings_array""; LIBRARY_TESTS_WITH_INPUT=""file support""; OPTION_SETS=""""; ",0 71e60997257dac1720b71c104d2ccc4b7055545c,https://github.com/fosnola/libstaroffice/commit/71e60997257dac1720b71c104d2ccc4b7055545c,ofz#5528 fix signed integer overflow,"diff --git a/src/lib/STOFFOLEParser.cxx b/src/lib/STOFFOLEParser.cxx index 0c8f32a..d0db3f4 100644 --- a/src/lib/STOFFOLEParser.cxx +++ b/src/lib/STOFFOLEParser.cxx @@ -496,7 +496,7 @@ bool STOFFOLEParser::readSummaryInformation(STOFFInputStreamPtr input, std::stri auto depl=int(input->readULong(4)); if (depl==0) continue; f << std::hex << depl << std::dec << "":"" << type << "",""; - if (depl<8+8*N || depl+4>pSetSize || posToTypeMap.find(pos+depl)!=posToTypeMap.end()) { + if (depl<8+8*N || depl>pSetSize-4 || posToTypeMap.find(pos+depl)!=posToTypeMap.end()) { f << ""###""; continue; } ",0 8be25e611a75c758ad05d36f30e1bebb296f78a9,https://github.com/InvoicePlane/InvoicePlane/commit/8be25e611a75c758ad05d36f30e1bebb296f78a9,"Add logo as .svg, update the readme","diff --git a/README.md b/README.md index 7f6142e67..47ed5d5ee 100755 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@

    - +

     

    - - + +

    InvoicePlane is a self-hosted open source application for managing your invoices, clients and payments.
    @@ -55,7 +55,6 @@ Please notice that InvoicePlane is **not** a commercial software but a small ope [![Community Forums](https://img.shields.io/badge/Help%3A-Community%20Forums-429ae1.svg)](https://community.invoiceplane.com/) [![Slack Chat](https://img.shields.io/badge/Development%3A-Slack%20Chat-429ae1.svg)](https://invoiceplane-slack.herokuapp.com/) [![Issue Tracker](https://img.shields.io/badge/Development%3A-Issue%20Tracker-429ae1.svg)](https://development.invoiceplane.com/) -[![Roadmap](https://img.shields.io/badge/Development%3A-Roadmap-429ae1.svg)](https://go.invoiceplane.com/roadmapv1) [![Contribution Guide](https://img.shields.io/badge/Development%3A-Contribution%20Guide-429ae1.svg)](CONTRIBUTING.md) --- diff --git a/assets/core/img/logo.svg b/assets/core/img/logo.svg new file mode 100644 index 000000000..9ce27e1f9 --- /dev/null +++ b/assets/core/img/logo.svg @@ -0,0 +1,12 @@ + + + InvoicePlane + + + + + + + + + \ No newline at end of file ",0 ff7c1d8aaa3afb64dc720c354f154770fd617e03,https://github.com/tikiorg/tiki/commit/ff7c1d8aaa3afb64dc720c354f154770fd617e03,"[REF] Add FIXME for homepage creation with feature_wysiwyg enabled git-svn-id: https://svn.code.sf.net/p/tikiwiki/code/trunk@64714 b456876b-0849-0410-b77d-98878d47e9d5","diff --git a/lib/setup/wiki.php b/lib/setup/wiki.php index 815a108928..5ab1ceb4da 100644 --- a/lib/setup/wiki.php +++ b/lib/setup/wiki.php @@ -69,6 +69,7 @@ if (($prefs['feature_wysiwyg'] === 'y') && $prefs['wysiwyg_htmltowiki'] !== 'y') { $is_html = true; + // FIXME: Still relies on wiki syntax not parsed, in particular if wysiwyg_wiki_parsed is disabled $homePageContent .= '

    ' . tr('Congratulations') . ""

    \n""; $homePageContent .= tr('This is the default homepage for your Tiki. If you are seeing this page, your installation was successful.') . ""\n\n
    ""; $homePageContent .= tr('You can change this page after logging in. Please review the [http://doc.tiki.org/wiki+syntax|wiki syntax] for editing details.') . ""\n\n\n
    ""; ",0 bb9195f1dd30f51ed973024cbed8e087205749fc,https://github.com/pulp/pulp/commit/bb9195f1dd30f51ed973024cbed8e087205749fc,"Merge pull request #3968 from nathanegillett/non-fastforward-for-new-repos If repository hasn't been published before, publish without fast-foward","diff --git a/devel/pulp/devel/mock_distributor.py b/devel/pulp/devel/mock_distributor.py index 9b62795e36..9e31c04e0f 100644 --- a/devel/pulp/devel/mock_distributor.py +++ b/devel/pulp/devel/mock_distributor.py @@ -6,7 +6,7 @@ def get_publish_conduit(type_id=None, existing_units=None, pkg_dir=None, checksum_type=""sha"", - repodata=None): + repodata=None, last_published=None): def build_success_report(summary, details): return PublishReport(True, summary, details) @@ -58,6 +58,7 @@ def get_scratchpad(): publish_conduit.build_success_report = build_success_report publish_conduit.get_repo_scratchpad.side_effect = get_repo_scratchpad publish_conduit.get_scratchpad.side_effect = get_scratchpad + publish_conduit.last_published = last_published return publish_conduit diff --git a/server/pulp/plugins/file/distributor.py b/server/pulp/plugins/file/distributor.py index 2479938aa1..25f8bd14ca 100644 --- a/server/pulp/plugins/file/distributor.py +++ b/server/pulp/plugins/file/distributor.py @@ -71,7 +71,7 @@ def publish_repo(self, repo, publish_conduit, config): :rtype: pulp.plugins.model.PublishReport """""" _logger.info(_('Beginning publish for repository <%(repo)s>') % {'repo': repo.id}) - if not config.get(""force_full"", False): + if not config.get(""force_full"", False) and publish_conduit.last_published: try: return self.publish_repo_fast_forward(repo, publish_conduit, config) except FastForwardUnavailable: diff --git a/server/test/unit/plugins/file/test_distributor.py b/server/test/unit/plugins/file/test_distributor.py index 2ae1245301..59ed810971 100644 --- a/server/test/unit/plugins/file/test_distributor.py +++ b/server/test/unit/plugins/file/test_distributor.py @@ -234,7 +234,10 @@ def test_publish_repo_bson_doc_too_large(self, mock_get_working, force_full=Fals cloned_unit.unit_key['name'] = ""foo%d.rpm"" % (i) cloned_unit.unit_key['checksum'] = ""sum%s"" % (1000000000 + i) units.append(cloned_unit) - new_conduit = get_publish_conduit(existing_units=units) + new_conduit = get_publish_conduit( + existing_units=units, + last_published=""2019-12-05 19:40:26.284627"" + ) distributor.publish_repo(self.repo, new_conduit, PluginCallConfiguration({}, {}, {})) # Verify if do publish with force full after trying with fast forward self.assertEqual(distributor.get_hosting_locations.call_count, 3) @@ -245,7 +248,10 @@ def test_publish_repo_bson_doc_too_large(self, mock_get_working, force_full=Fals cloned_unit.unit_key['name'] = ""fooa%d.rpm"" % (i) cloned_unit.unit_key['checksum'] = ""suma%s"" % (1000000000 + i) units.append(cloned_unit) - new_conduit = get_publish_conduit(existing_units=units) + new_conduit = get_publish_conduit( + existing_units=units, + last_published=""2019-12-05 19:40:26.284627"" + ) distributor.publish_repo(self.repo, new_conduit, PluginCallConfiguration({}, {}, {})) # Verify if do publish with fast forward self.assertEqual(distributor.get_hosting_locations.call_count, 4) @@ -266,7 +272,10 @@ def test_publish_repo_way_by_conditions(self, mock_get_working): cloned_unit.unit_key['name'] = ""foo%d.rpm"" % (i) cloned_unit.unit_key['checksum'] = ""sum%s"" % (1000000000 + i) units.append(cloned_unit) - new_conduit = get_publish_conduit(existing_units=units) + new_conduit = get_publish_conduit( + existing_units=units, + last_published=""2019-12-05 19:40:26.284627"" + ) distributor.publish_repo(self.repo, new_conduit, PluginCallConfiguration({}, {}, {})) # Verify if do publish with force full finally after trying with fast forward self.assertEqual(distributor.get_hosting_locations.call_count, 3) @@ -277,7 +286,10 @@ def test_publish_repo_way_by_conditions(self, mock_get_working): cloned_unit.unit_key['name'] = ""food%d.rpm"" % (i) cloned_unit.unit_key['checksum'] = ""sumd%s"" % (1000000000 + i) units.append(cloned_unit) - new_conduit = get_publish_conduit(existing_units=units) + new_conduit = get_publish_conduit( + existing_units=units, + last_published=""2019-12-05 19:40:26.284627"" + ) distributor.publish_repo(self.repo, new_conduit, PluginCallConfiguration({}, {}, {})) # Verify if do publish with fast forward self.assertEqual(distributor.get_hosting_locations.call_count, 4) ",0 0a75334fad443e3406b82c5a3cea54e082549440,https://github.com/undertow-io/undertow/commit/0a75334fad443e3406b82c5a3cea54e082549440,[UNDERTOW-1817] Enhance error page handling to be spec compliant,"diff --git a/servlet/src/main/java/io/undertow/servlet/spec/RequestDispatcherImpl.java b/servlet/src/main/java/io/undertow/servlet/spec/RequestDispatcherImpl.java index 232bcc6a11..8bbbbf0790 100644 --- a/servlet/src/main/java/io/undertow/servlet/spec/RequestDispatcherImpl.java +++ b/servlet/src/main/java/io/undertow/servlet/spec/RequestDispatcherImpl.java @@ -467,8 +467,13 @@ private void error(ServletRequestContext servletRequestContext, final ServletReq requestImpl.setAttribute(ERROR_REQUEST_URI, requestImpl.getRequestURI()); requestImpl.setAttribute(ERROR_SERVLET_NAME, servletName); if (exception != null) { - requestImpl.setAttribute(ERROR_EXCEPTION, exception); - requestImpl.setAttribute(ERROR_EXCEPTION_TYPE, exception.getClass()); + if (exception instanceof ServletException && ((ServletException)exception).getRootCause() != null) { + requestImpl.setAttribute(ERROR_EXCEPTION, ((ServletException) exception).getRootCause()); + requestImpl.setAttribute(ERROR_EXCEPTION_TYPE, ((ServletException) exception).getRootCause().getClass()); + } else { + requestImpl.setAttribute(ERROR_EXCEPTION, exception); + requestImpl.setAttribute(ERROR_EXCEPTION_TYPE, exception.getClass()); + } } requestImpl.setAttribute(ERROR_MESSAGE, message); requestImpl.setAttribute(ERROR_STATUS_CODE, responseImpl.getStatus()); diff --git a/servlet/src/test/java/io/undertow/servlet/test/errorpage/ErrorPageTestCase.java b/servlet/src/test/java/io/undertow/servlet/test/errorpage/ErrorPageTestCase.java index 2f81b8ad15..e0f30f232b 100644 --- a/servlet/src/test/java/io/undertow/servlet/test/errorpage/ErrorPageTestCase.java +++ b/servlet/src/test/java/io/undertow/servlet/test/errorpage/ErrorPageTestCase.java @@ -239,8 +239,8 @@ private void runTest(int deploymentNo, final TestHttpClient client, Integer stat // RequestDispatcher.ERROR_MESSAGE is null Assert.assertThat(response, CoreMatchers.containsString(RequestDispatcher.ERROR_STATUS_CODE + ""=500"")); } else { - Assert.assertThat(response, CoreMatchers.containsString(RequestDispatcher.ERROR_EXCEPTION_TYPE + ""="" + ServletException.class)); - Assert.assertThat(response, CoreMatchers.containsString(RequestDispatcher.ERROR_EXCEPTION + ""=javax.servlet.ServletException: "" + exception.getName())); + Assert.assertThat(response, CoreMatchers.containsString(RequestDispatcher.ERROR_EXCEPTION_TYPE + ""="" + exception)); + Assert.assertThat(response, CoreMatchers.containsString(RequestDispatcher.ERROR_EXCEPTION + ""="" + exception.getName())); Assert.assertThat(response, CoreMatchers.containsString(RequestDispatcher.ERROR_MESSAGE + ""="" + exception.getName())); Assert.assertThat(response, CoreMatchers.containsString(RequestDispatcher.ERROR_STATUS_CODE + ""=500"")); } ",0 850a113226e21d376a6c227f9ff5c972f071fdac,https://github.com/apache/derby/commit/850a113226e21d376a6c227f9ff5c972f071fdac,"DERBY-7020: Make the release machinery pick up the current min.version value so that the generated user docs will report the correct minimum JDK version; commit derby-7020-02-aa-fixMinJDKVersionInDocs.diff. git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1847661 13f79535-47bb-0310-9956-ffa450edef68","diff --git a/build.xml b/build.xml index edf4c752df..d8ca17d505 100644 --- a/build.xml +++ b/build.xml @@ -2033,6 +2033,7 @@ + ",0 665226ae14a0f0a04a09cf53198b77fd09c16f14,https://github.com/jenkinsci/kubernetes-plugin/commit/665226ae14a0f0a04a09cf53198b77fd09c16f14,"Merge pull request #934 from jenkinsci/dependabot/maven/io.jenkins.tools.bom-bom-2.263.x-21 Bump bom-2.263.x from 20 to 21","diff --git a/pom.xml b/pom.xml index 13cef23b47..9f2fd9fd55 100644 --- a/pom.xml +++ b/pom.xml @@ -256,7 +256,7 @@ io.jenkins.tools.bom bom-2.263.x - 20 + 21 import pom ",0 0909d301705f197d0e62efacae7e65b534da46d5,https://github.com/apache/santuario-java/commit/0909d301705f197d0e62efacae7e65b534da46d5,"Add methods to remove References. git-svn-id: https://svn.apache.org/repos/asf/santuario/trunk@1027337 13f79535-47bb-0310-9956-ffa450edef68","diff --git a/c/CHANGELOG.txt b/c/CHANGELOG.txt index e2ae9e45d..bbe364ca4 100644 --- a/c/CHANGELOG.txt +++ b/c/CHANGELOG.txt @@ -20,6 +20,7 @@ Changes since 1.5.1 * Support debugging of Reference/SignedInfo data (SC) * Clean up tests for SHA2 algorithms in OpenSSL (SC) * Updated autoconf script, added NSS support, removed pre-automake material (SC) +* Add methods for Reference removal to DSIGSignature/DSIGSignedInfo classes (SC) Changes between 1.5 and 1.5.1 ===================================== diff --git a/c/xsec/dsig/DSIGReference.hpp b/c/xsec/dsig/DSIGReference.hpp index 59bba8c04..4e6689fe1 100644 --- a/c/xsec/dsig/DSIGReference.hpp +++ b/c/xsec/dsig/DSIGReference.hpp @@ -45,6 +45,7 @@ class DSIGTransformXPath; class DSIGTransformXPathFilter; class DSIGTransformXSL; class DSIGSignature; +class DSIGSignedInfo; class TXFMBase; class TXFMChain; @@ -569,6 +570,8 @@ class DSIG_EXPORT DSIGReference { DSIGReference(); /*\@}*/ + + friend class DSIGSignedInfo; }; diff --git a/c/xsec/dsig/DSIGSignature.cpp b/c/xsec/dsig/DSIGSignature.cpp index 463494efc..86a275008 100644 --- a/c/xsec/dsig/DSIGSignature.cpp +++ b/c/xsec/dsig/DSIGSignature.cpp @@ -699,6 +699,10 @@ DSIGReference * DSIGSignature::createReference( } +DSIGReference * DSIGSignature::removeReference(DSIGReferenceList::size_type index) { + return mp_signedInfo ? mp_signedInfo->removeReference(index) : NULL; +} + // -------------------------------------------------------------------------------- // Manipulation of KeyInfo elements // -------------------------------------------------------------------------------- diff --git a/c/xsec/dsig/DSIGSignature.hpp b/c/xsec/dsig/DSIGSignature.hpp index e993bc773..276d17cc3 100644 --- a/c/xsec/dsig/DSIGSignature.hpp +++ b/c/xsec/dsig/DSIGSignature.hpp @@ -390,6 +390,22 @@ class DSIG_EXPORT DSIGSignature { const XMLCh * hashAlgorithmURI, const XMLCh * type = NULL ); + + /** + * \brief Remove a reference from the signature + * + * Removes the reference at the index point and returns a pointer + * to the reference removed. + * + * @note This also releases ownership. It is the responsibility of + * the caller to ensure the reference is deleted. + * + * @note This removes the reference from the Signature + * + * @param index Point in the list to remove + */ + + DSIGReference * removeReference(DSIGReferenceList::size_type index); //@} /** @name General and Information functions. */ diff --git a/c/xsec/dsig/DSIGSignedInfo.cpp b/c/xsec/dsig/DSIGSignedInfo.cpp index 832abcb39..a69c9da0d 100644 --- a/c/xsec/dsig/DSIGSignedInfo.cpp +++ b/c/xsec/dsig/DSIGSignedInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 The Apache Software Foundation. + * Copyright 2002-2010 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the ""License""); * you may not use this file except in compliance with the License. @@ -175,6 +175,18 @@ DSIGReference * DSIGSignedInfo::createReference( return ref; } +DSIGReference * DSIGSignedInfo::removeReference(DSIGReferenceList::size_type index) { + + DSIGReference* ret = mp_referenceList ? mp_referenceList->removeReference(index): NULL; + if (ret && mp_signedInfoNode) { + mp_signedInfoNode->removeChild(ret->mp_referenceNode); + mp_env->doPrettyPrint(mp_signedInfoNode); + } + + return ret; + +} + // -------------------------------------------------------------------------------- // Create an empty SignedInfo diff --git a/c/xsec/dsig/DSIGSignedInfo.hpp b/c/xsec/dsig/DSIGSignedInfo.hpp index 8c2ac3aa5..fc68e4415 100644 --- a/c/xsec/dsig/DSIGSignedInfo.hpp +++ b/c/xsec/dsig/DSIGSignedInfo.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 The Apache Software Foundation. + * Copyright 2002-2010 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the ""License""); * you may not use this file except in compliance with the License. @@ -220,6 +220,22 @@ class DSIG_EXPORT DSIGSignedInfo { const XMLCh * type ); + /** + * \brief Remove a reference from the list + * + * Removes the reference at the index point and returns a pointer + * to the reference removed. + * + * @note This also releases ownership. It is the responsibility of + * the caller to ensure the reference is deleted. + * + * @note This removes the reference from the Signature + * + * @param index Point in the list to remove + */ + + DSIGReference * removeReference(DSIGReferenceList::size_type index); + //@} /** @name Getter functions */ ",0 256a5f9d3eafbc477dcf77c7682446cc4b449c7f,https://github.com/renlok/WeBid/commit/256a5f9d3eafbc477dcf77c7682446cc4b449c7f,Number of secerity fixes & fix for setup fee #510,"diff --git a/active_auctions.php b/active_auctions.php index e90c9a4d..2caadddd 100644 --- a/active_auctions.php +++ b/active_auctions.php @@ -66,7 +66,7 @@ $k = 0; while ($row = $db->fetch()) { if (strlen($row['pict_url']) > 0) { - $row['pict_url'] = $system->SETTINGS['siteurl'] . 'getthumb.php?w=' . $system->SETTINGS['thumb_show'] . '&fromfile=' . UPLOAD_FOLDER . $row['id'] . '/' . $row['pict_url']; + $row['pict_url'] = $system->SETTINGS['siteurl'] . 'getthumb.php?w=' . $system->SETTINGS['thumb_show'] . '&auction_id=' . $row['id'] . '&fromfile=' . $row['pict_url']; } else { $row['pict_url'] = get_lang_img('nopicture.gif'); } diff --git a/admin/editauction.php b/admin/editauction.php index ff16e1c3..26757aa7 100644 --- a/admin/editauction.php +++ b/admin/editauction.php @@ -36,7 +36,7 @@ function load_gallery($auc_id) if ($dir = opendir(UPLOAD_PATH . $auc_id)) { while ($file = @readdir($dir)) { if ($file != '.' && $file != '..' && strpos($file, 'thumb-') === false) { - $UPLOADED_PICTURES[] = UPLOAD_FOLDER . $auc_id . '/' . $file; + $UPLOADED_PICTURES[] = $file; } } closedir($dir); diff --git a/bid.php b/bid.php index 065e96f3..c8eecb25 100644 --- a/bid.php +++ b/bid.php @@ -561,7 +561,7 @@ function extend_auction($id, $ends) 'ERROR' => (isset($errmsg)) ? $errmsg : '', 'BID_HISTORY' => (isset($ARETHEREBIDS)) ? $ARETHEREBIDS : '', 'ID' => $id, - 'IMAGE' => (!empty($pict_url_plain)) ? '' : ' ', + 'IMAGE' => (!empty($pict_url_plain)) ? '' : '', 'TITLE' => $item_title, 'CURRENT_BID' => $system->print_money($cbid), 'ATYPE' => $atype, diff --git a/closed_auctions.php b/closed_auctions.php index 660bef21..f12a162f 100644 --- a/closed_auctions.php +++ b/closed_auctions.php @@ -65,7 +65,7 @@ $starting_price = $row['current_bid']; if (strlen($row['pict_url']) > 0) { - $row['pict_url'] = $system->SETTINGS['siteurl'] . 'getthumb.php?w=' . $system->SETTINGS['thumb_show'] . '&fromfile=' . UPLOAD_FOLDER . $row['id'] . '/' . $row['pict_url']; + $row['pict_url'] = $system->SETTINGS['siteurl'] . 'getthumb.php?w=' . $system->SETTINGS['thumb_show'] . '&auction_id=' . $row['id'] . '&fromfile=' . $row['pict_url']; } else { $row['pict_url'] = get_lang_img('nopicture.gif'); } diff --git a/getthumb.php b/getthumb.php index 76f753c8..848e835a 100644 --- a/getthumb.php +++ b/getthumb.php @@ -14,9 +14,31 @@ include 'common.php'; +// get passed values $w = (isset($_GET['w'])) ? intval($_GET['w']) : ''; -$_w = $w; -$fromfile = (isset($_GET['fromfile'])) ? $_GET['fromfile'] : ''; +$fromfile = $_GET['fromfile']; +$auction_id = $_GET['auction_id']; + +// check passed values +if (!isset($_GET['fromfile']) || + !isset($_GET['auction_id']) || !is_numeric($auction_id)) { + ErrorPNG($ERR_716); + exit; +} elseif (!file_exists($_GET['fromfile']) && !fopen($_GET['fromfile'], 'r')) { + ErrorPNG($ERR_716); + exit; +} + +if ($fromfile != '') { + // clean fromfile + $fromfile = basename($fromfile); + // build file path + $file_path = UPLOAD_FOLDER . $auction_id . '/' . $fromfile; +} else { + // if empty filename just show default image + $file_path = MAIN_PATH . 'images/email_alerts/default_item_img.jpg'; +} + $nomanage = false; $accepted_widths = array( $system->SETTINGS['thumb_show'], @@ -47,17 +69,8 @@ function load_image($file, $mime, $image_type, $output_type) exit; } -// control parameters and file existence -if (!isset($_GET['fromfile']) || $fromfile == '') { - ErrorPNG($ERR_716); - exit; -} elseif (!file_exists($_GET['fromfile']) && !fopen($_GET['fromfile'], 'r')) { - ErrorPNG($ERR_716); - exit; -} - if (file_exists(UPLOAD_PATH . 'cache/' . $w . '-' . md5($fromfile))) { - $img = getimagesize($fromfile); + $img = getimagesize($file_path); switch ($img[2]) { case IMAGETYPE_GIF: if (!(imagetypes() &IMG_GIF)) { @@ -98,7 +111,7 @@ function load_image($file, $mime, $image_type, $output_type) mkdir(UPLOAD_PATH . 'cache', 0777); } - $img = @getimagesize($fromfile); + $img = @getimagesize($file_path); if (is_array($img)) { switch ($img[2]) { case IMAGETYPE_GIF: @@ -141,7 +154,7 @@ function load_image($file, $mime, $image_type, $output_type) } if ($w == '') { // just load the image - load_image($fromfile, $img['mime'], $image_type, $output_type); + load_image($file_path, $img['mime'], $image_type, $output_type); } else { // check image orientation if ($img[0] < $img[1]) { @@ -156,9 +169,9 @@ function load_image($file, $mime, $image_type, $output_type) $ou = imagecreatetruecolor($w, $h); imagealphablending($ou, false); $funcall = ""imagecreatefrom$image_type""; - imagecopyresampled($ou, $funcall($fromfile), 0, 0, 0, 0, $w, $h, $img[0], $img[1]); + imagecopyresampled($ou, $funcall($file_path), 0, 0, 0, 0, $w, $h, $img[0], $img[1]); $funcall = ""image$output_type""; - $funcall($ou, UPLOAD_PATH . 'cache/' . $_w . '-' . md5($fromfile)); + $funcall($ou, UPLOAD_PATH . 'cache/' . $w . '-' . md5($fromfile)); header('Content-type: ' . $img['mime']); $funcall($ou); exit; diff --git a/includes/browseitems.inc.php b/includes/browseitems.inc.php index b7cdf685..341b6def 100644 --- a/includes/browseitems.inc.php +++ b/includes/browseitems.inc.php @@ -116,7 +116,7 @@ function build_items($row) // image icon if (!empty($row['pict_url'])) { - $row['pict_url'] = $system->SETTINGS['siteurl'] . 'getthumb.php?w=' . $system->SETTINGS['thumb_list'] . '&fromfile=' . UPLOAD_FOLDER . $row['id'] . '/' . $row['pict_url']; + $row['pict_url'] = $system->SETTINGS['siteurl'] . 'getthumb.php?w=' . $system->SETTINGS['thumb_list'] . '&auction_id=' . $row['id'] . '&fromfile=' . $row['pict_url']; } else { $row['pict_url'] = get_lang_img('nopicture.gif'); } diff --git a/includes/functions_sell.php b/includes/functions_sell.php index 08b4c4da..327dcc77 100644 --- a/includes/functions_sell.php +++ b/includes/functions_sell.php @@ -398,7 +398,7 @@ function get_fee($minimum_bid, $just_fee = true) 'extracat_fee' => 0 ); while ($row = $db->fetch()) { - if ($minimum_bid >= $row['fee_from'] && $minimum_bid <= $row['fee_to'] && $row['type'] == 'setup') { + if ($minimum_bid >= $row['fee_from'] && $minimum_bid <= $row['fee_to'] && $row['type'] == 'setup_fee') { if ($row['fee_type'] == 'flat') { $fee_data['setup_fee'] = $row['value']; $fee_value = bcadd($fee_value, $row['value'], $system->SETTINGS['moneydecimals']); diff --git a/index.php b/index.php index ceace577..994f00ce 100644 --- a/index.php +++ b/index.php @@ -104,7 +104,7 @@ function ShowFlags() 'ENDS' => $ends_string, 'ID' => $row['id'], 'BID' => $system->print_money($high_bid), - 'IMAGE' => (!empty($row['pict_url'])) ? 'getthumb.php?w=' . $system->SETTINGS['thumb_show'] . '&fromfile=' . UPLOAD_FOLDER . $row['id'] . '/' . $row['pict_url'] : 'images/email_alerts/default_item_img.jpg', + 'IMAGE' => (!empty($row['pict_url'])) ? 'getthumb.php?w=' . $system->SETTINGS['thumb_show'] . '&auction_id=' . $row['id'] . '&fromfile=' . $row['pict_url'] : '', 'TITLE' => htmlspecialchars($row['title']) )); $i++; @@ -188,7 +188,7 @@ function ShowFlags() 'ENDS' => $ends_string, 'ID' => $row['id'], 'BID' => $system->print_money($high_bid), - 'IMAGE' => (!empty($row['pict_url'])) ? 'getthumb.php?w=' . $system->SETTINGS['thumb_show'] . '&fromfile=' . UPLOAD_FOLDER . $row['id'] . '/' . $row['pict_url'] : 'images/email_alerts/default_item_img.jpg', + 'IMAGE' => (!empty($row['pict_url'])) ? 'getthumb.php?w=' . $system->SETTINGS['thumb_show'] . '&auction_id=' . $row['id'] . '&fromfile=' . $row['pict_url'] : '', 'TITLE' => htmlspecialchars($row['title']) )); } diff --git a/item.php b/item.php index b1cc285e..b0b768ec 100644 --- a/item.php +++ b/item.php @@ -466,7 +466,7 @@ 'TITLE' => htmlspecialchars($auction_data['title']), 'SUBTITLE' => htmlspecialchars($auction_data['subtitle']), 'AUCTION_DESCRIPTION' => $auction_data['description'], - 'PIC_URL' => UPLOAD_FOLDER . $id . '/' . $auction_data['pict_url'], + 'PIC_URL' => $auction_data['pict_url'], 'SHIPPING_COST' => ($auction_data['shipping_cost'] > 0) ? $system->print_money($auction_data['shipping_cost']) : $MSG['1152'], 'ADDITIONAL_SHIPPING_COST' => $system->print_money($auction_data['additional_shipping_cost']), 'COUNTRY' => $auction_data['country'], diff --git a/register.php b/register.php index a5021b23..0f616734 100644 --- a/register.php +++ b/register.php @@ -448,15 +448,15 @@ function emailDomainIsBlacklisted($email) 'V_YNEWSL' => ((isset($_POST['TPL_nletter']) && $_POST['TPL_nletter'] == 1) || !isset($_POST['TPL_nletter'])) ? 'checked=true' : '', 'V_NNEWSL' => (isset($_POST['TPL_nletter']) && $_POST['TPL_nletter'] == 2) ? 'checked=true' : '', - 'V_YNAME' => (isset($_POST['TPL_name'])) ? $_POST['TPL_name'] : '', - 'V_UNAME' => (isset($_POST['TPL_nick'])) ? $_POST['TPL_nick'] : '', - 'V_EMAIL' => (isset($_POST['TPL_email'])) ? $_POST['TPL_email'] : '', - 'V_YEAR' => (isset($_POST['TPL_year'])) ? $_POST['TPL_year'] : '', - 'V_ADDRE' => (isset($_POST['TPL_address'])) ? $_POST['TPL_address'] : '', - 'V_CITY' => (isset($_POST['TPL_city'])) ? $_POST['TPL_city'] : '', - 'V_PROV' => (isset($_POST['TPL_prov'])) ? $_POST['TPL_prov'] : '', - 'V_POSTCODE' => (isset($_POST['TPL_zip'])) ? $_POST['TPL_zip'] : '', - 'V_PHONE' => (isset($_POST['TPL_phone'])) ? $_POST['TPL_phone'] : '' + 'V_YNAME' => (isset($_POST['TPL_name'])) ? $system->cleanvars($_POST['TPL_name']) : '', + 'V_UNAME' => (isset($_POST['TPL_nick'])) ? $system->cleanvars($_POST['TPL_nick']) : '', + 'V_EMAIL' => (isset($_POST['TPL_email'])) ? $system->cleanvars($_POST['TPL_email']) : '', + 'V_YEAR' => (isset($_POST['TPL_year'])) ? $system->cleanvars($_POST['TPL_year']) : '', + 'V_ADDRE' => (isset($_POST['TPL_address'])) ? $system->cleanvars($_POST['TPL_address']) : '', + 'V_CITY' => (isset($_POST['TPL_city'])) ? $system->cleanvars($_POST['TPL_city']) : '', + 'V_PROV' => (isset($_POST['TPL_prov'])) ? $system->cleanvars($_POST['TPL_prov']) : '', + 'V_POSTCODE' => (isset($_POST['TPL_zip'])) ? $system->cleanvars($_POST['TPL_zip']) : '', + 'V_PHONE' => (isset($_POST['TPL_phone'])) ? $system->cleanvars($_POST['TPL_phone']) : '' )); include 'header.php'; diff --git a/themes/adminClassic/editauction.tpl b/themes/adminClassic/editauction.tpl index e2d35e40..589ccc18 100644 --- a/themes/adminClassic/editauction.tpl +++ b/themes/adminClassic/editauction.tpl @@ -71,7 +71,7 @@ diff --git a/themes/adminModern/editauction.tpl b/themes/adminModern/editauction.tpl index 4e290a7e..c11f7b12 100644 --- a/themes/adminModern/editauction.tpl +++ b/themes/adminModern/editauction.tpl @@ -71,7 +71,7 @@ diff --git a/themes/classic/item.tpl b/themes/classic/item.tpl index a573ffc1..14a00b93 100644 --- a/themes/classic/item.tpl +++ b/themes/classic/item.tpl @@ -81,7 +81,7 @@ $(document).ready(function() { diff --git a/themes/modern/item.tpl b/themes/modern/item.tpl index 25881532..cceba6f3 100644 --- a/themes/modern/item.tpl +++ b/themes/modern/item.tpl @@ -57,7 +57,7 @@ $(document).ready(function() {
    {L_113}: {ID}
    - +
    @@ -66,7 +66,7 @@ $(document).ready(function() {
    - +
    diff --git a/user_login.php b/user_login.php index ab98569b..8d386c11 100644 --- a/user_login.php +++ b/user_login.php @@ -124,7 +124,7 @@ $template->assign_vars(array( 'ERROR' => (isset($ERR)) ? $ERR : '', - 'USER' => (isset($_POST['username'])) ? $_POST['username'] : '' + 'USER' => (isset($_POST['username'])) ? $system->cleanvars($_POST['username']) : '' )); include 'header.php'; diff --git a/yourauctions.php b/yourauctions.php index 53f09125..0a3244bc 100644 --- a/yourauctions.php +++ b/yourauctions.php @@ -99,8 +99,9 @@ $_SESSION['oa_ord'] = 'title'; $_SESSION['oa_type'] = 'asc'; } elseif (!empty($_GET['oa_ord'])) { - $_SESSION['oa_ord'] = $_GET['oa_ord']; - $_SESSION['oa_type'] = $_GET['oa_type']; + // check oa_ord && oa_type are valid + $_SESSION['oa_ord'] = (in_array($_GET['oa_ord'], array('title', 'starts', 'ends', 'num_bids', 'current_bid'))) ? $_GET['oa_ord'] : 'title'; + $_SESSION['oa_type'] = (in_array($_GET['oa_type'], array('asc', 'desc'))) ? $_GET['oa_type'] : 'asc'; } elseif (isset($_SESSION['oa_ord']) && empty($_GET['oa_ord'])) { $_SESSION['oa_nexttype'] = $_SESSION['oa_type']; } diff --git a/yourauctions_c.php b/yourauctions_c.php index 3d89e1a3..089bc25d 100644 --- a/yourauctions_c.php +++ b/yourauctions_c.php @@ -204,8 +204,9 @@ $_SESSION['ca_ord'] = 'title'; $_SESSION['ca_type'] = 'asc'; } elseif (!empty($_GET['ca_ord'])) { - $_SESSION['ca_ord'] = $_GET['ca_ord']; - $_SESSION['ca_type'] = $_GET['ca_type']; + // check oa_ord && oa_type are valid + $_SESSION['ca_ord'] = (in_array($_GET['ca_ord'], array('title', 'starts', 'ends', 'num_bids', 'current_bid'))) ? $_GET['ca_ord'] : 'title'; + $_SESSION['ca_type'] = (in_array($_GET['ca_type'], array('asc', 'desc'))) ? $_GET['ca_type'] : 'asc'; } elseif (isset($_SESSION['ca_ord']) && empty($_GET['ca_ord'])) { $_SESSION['ca_nexttype'] = $_SESSION['ca_type']; } diff --git a/yourauctions_p.php b/yourauctions_p.php index 761dfa51..e1770eb3 100644 --- a/yourauctions_p.php +++ b/yourauctions_p.php @@ -109,8 +109,9 @@ $_SESSION['pa_ord'] = 'title'; $_SESSION['pa_type'] = 'asc'; } elseif (!empty($_GET['pa_ord'])) { - $_SESSION['pa_ord'] = $_GET['pa_ord']; - $_SESSION['pa_type'] = $_GET['pa_type']; + // check oa_ord && oa_type are valid + $_SESSION['pa_ord'] = (in_array($_GET['pa_ord'], array('title', 'starts', 'ends'))) ? $_GET['pa_ord'] : 'title'; + $_SESSION['pa_type'] = (in_array($_GET['pa_type'], array('asc', 'desc'))) ? $_GET['pa_type'] : 'asc'; } elseif (isset($_SESSION['pa_ord']) && empty($_GET['pa_ord'])) { $_SESSION['pa_nexttype'] = $_SESSION['pa_type']; } diff --git a/yourauctions_s.php b/yourauctions_s.php index fa909638..b3343bae 100644 --- a/yourauctions_s.php +++ b/yourauctions_s.php @@ -81,8 +81,9 @@ $_SESSION['sa_ord'] = 'title'; $_SESSION['sa_type'] = 'asc'; } elseif (!empty($_GET['sa_ord'])) { - $_SESSION['sa_ord'] = $_GET['sa_ord']; - $_SESSION['sa_type'] = $_GET['sa_type']; + // check oa_ord && oa_type are valid + $_SESSION['sa_ord'] = (in_array($_GET['sa_ord'], array('title', 'num_bids', 'current_bid'))) ? $_GET['sa_ord'] : 'title'; + $_SESSION['sa_type'] = (in_array($_GET['sa_type'], array('asc', 'desc'))) ? $_GET['sa_type'] : 'asc'; } elseif (isset($_SESSION['sa_ord']) && empty($_GET['sa_ord'])) { $_SESSION['sa_nexttype'] = $_SESSION['sa_type']; } diff --git a/yourauctions_sold.php b/yourauctions_sold.php index 578e785d..1cf2a08a 100644 --- a/yourauctions_sold.php +++ b/yourauctions_sold.php @@ -149,8 +149,9 @@ $_SESSION['solda_ord'] = 'title'; $_SESSION['solda_type'] = 'asc'; } elseif (!empty($_GET['solda_ord'])) { - $_SESSION['solda_ord'] = $_GET['solda_ord']; - $_SESSION['solda_type'] = $_GET['solda_type']; + // check oa_ord && oa_type are valid + $_SESSION['solda_ord'] = (in_array($_GET['solda_ord'], array('title', 'starts', 'ends', 'num_bids', 'current_bid'))) ? $_GET['solda_ord'] : 'title'; + $_SESSION['solda_type'] = (in_array($_GET['solda_type'], array('asc', 'desc'))) ? $_GET['solda_type'] : 'asc'; } elseif (isset($_SESSION['solda_ord']) && empty($_GET['solda_ord'])) { $_SESSION['solda_nexttype'] = $_SESSION['solda_type']; } ",1 5c819f7242fe208f4214d6017e4eb8bf397d60e3,https://github.com/qbittorrent/qBittorrent/commit/5c819f7242fe208f4214d6017e4eb8bf397d60e3,Revise version comparison,"diff --git a/src/gui/programupdater.cpp b/src/gui/programupdater.cpp index 6539770c9a..5d813434b9 100644 --- a/src/gui/programupdater.cpp +++ b/src/gui/programupdater.cpp @@ -36,7 +36,6 @@ #include #include #include -#include #include #if defined(Q_OS_WIN) @@ -44,35 +43,32 @@ #endif #include ""base/net/downloadmanager.h"" +#include ""base/utils/version.h"" #include ""base/version.h"" namespace { bool isVersionMoreRecent(const QString &remoteVersion) { - const QRegularExpressionMatch regVerMatch = QRegularExpression(""([0-9.]+)"").match(QBT_VERSION); - if (regVerMatch.hasMatch()) - { - const QString localVersion = regVerMatch.captured(1); - const QVector remoteParts = remoteVersion.splitRef('.'); - const QVector localParts = localVersion.splitRef('.'); + using Version = Utils::Version; - for (int i = 0; i < qMin(remoteParts.size(), localParts.size()); ++i) + try + { + const Version newVersion {remoteVersion}; + const Version currentVersion {QBT_VERSION_MAJOR, QBT_VERSION_MINOR, QBT_VERSION_BUGFIX, QBT_VERSION_BUILD}; + if (newVersion == currentVersion) { - if (remoteParts[i].toInt() > localParts[i].toInt()) + const bool isDevVersion = QString::fromLatin1(QBT_VERSION_STATUS).contains( + QRegularExpression(QLatin1String(""(alpha|beta|rc)""))); + if (isDevVersion) return true; - if (remoteParts[i].toInt() < localParts[i].toInt()) - return false; } - // Compared parts were equal, if remote version is longer, then it's more recent (2.9.2.1 > 2.9.2) - if (remoteParts.size() > localParts.size()) - return true; - // versions are equal, check if the local version is a development release, in which case it is older (2.9.2beta < 2.9.2) - const QRegularExpressionMatch regDevelMatch = QRegularExpression(""(alpha|beta|rc)"").match(QBT_VERSION); - if (regDevelMatch.hasMatch()) - return true; + return (newVersion > currentVersion); + } + catch (const std::runtime_error &) + { + return false; } - return false; } } ",0 c738e236fe8618ebb1507fd4b86297ad22ceb204,https://github.com/libarchive/libarchive/commit/c738e236fe8618ebb1507fd4b86297ad22ceb204,"Merge pull request #1367 from zoulasc/master Fix issues in acl tests","diff --git a/libarchive/test/test_acl_platform_nfs4.c b/libarchive/test/test_acl_platform_nfs4.c index 410582bfc..ae4bb5a10 100644 --- a/libarchive/test/test_acl_platform_nfs4.c +++ b/libarchive/test/test_acl_platform_nfs4.c @@ -634,9 +634,11 @@ acl_match(acl_entry_t aclent, struct myacl_t *myacl) case ACL_ENTRY_TYPE_AUDIT: if (myacl->type != ARCHIVE_ENTRY_ACL_TYPE_AUDIT) return (0); + break; case ACL_ENTRY_TYPE_ALARM: if (myacl->type != ARCHIVE_ENTRY_ACL_TYPE_ALARM) return (0); + break; default: return (0); } diff --git a/libarchive/test/test_acl_platform_posix1e.c b/libarchive/test/test_acl_platform_posix1e.c index 801a7acfc..c34f7c2e2 100644 --- a/libarchive/test/test_acl_platform_posix1e.c +++ b/libarchive/test/test_acl_platform_posix1e.c @@ -364,8 +364,8 @@ DEFINE_TEST(test_acl_platform_posix1e_read) struct archive *a; struct archive_entry *ae; int n, fd, flags, dflags; - char *func, *acl_text; - const char *acl1_text, *acl2_text, *acl3_text; + char *acl_text; + const char *func, *acl1_text, *acl2_text, *acl3_text; #if ARCHIVE_ACL_SUNOS void *aclp; int aclcnt; ",0 9a271a9368eaabf99e6c2046103acb33957e63b7,https://github.com/FFmpeg/FFmpeg/commit/9a271a9368eaabf99e6c2046103acb33957e63b7,"jpeg2000: check log2_cblk dimensions Fixes out of array access Fixes Ticket2895 Found-by: Piotr Bandurski Signed-off-by: Michael Niedermayer ","diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index 34ac53605603..8c0e6ffd66e9 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -384,6 +384,11 @@ static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c) return AVERROR_INVALIDDATA; } + if (c->log2_cblk_width > 6 || c->log2_cblk_height > 6) { + avpriv_request_sample(s->avctx, ""cblk size > 64""); + return AVERROR_PATCHWELCOME; + } + c->cblk_style = bytestream2_get_byteu(&s->g); if (c->cblk_style != 0) { // cblk style av_log(s->avctx, AV_LOG_WARNING, ""extra cblk styles %X\n"", c->cblk_style); @@ -1025,6 +1030,9 @@ static int decode_cblk(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty, int bpass_csty_symbol = codsty->cblk_style & JPEG2000_CBLK_BYPASS; int vert_causal_ctx_csty_symbol = codsty->cblk_style & JPEG2000_CBLK_VSC; + av_assert0(width <= JPEG2000_MAX_CBLKW); + av_assert0(height <= JPEG2000_MAX_CBLKH); + for (y = 0; y < height; y++) memset(t1->data[y], 0, width * sizeof(**t1->data)); ",1 0a1ea396d57c75b04aff7cb73d169717064c2b8a,https://github.com/golang/net/commit/0a1ea396d57c75b04aff7cb73d169717064c2b8a,"internal/socket: use Cmsg{Len,Space} from golang.org/x/sys/unix Instead of duplicating the logic for cmsg alignment, use CmsgLen and CmsgSpace from golang.org/x/sys/unix. Moreover, this should simplify adding new ports. Change-Id: Ic3ac9cf14781eff5b8e4f34bfd2b1c8bd3b69341 Reviewed-on: https://go-review.googlesource.com/c/net/+/259058 Trust: Tobias Klauser Run-TryBot: Tobias Klauser TryBot-Result: Go Bot Reviewed-by: Matt Layher ","diff --git a/internal/socket/cmsghdr_stub.go b/internal/socket/cmsghdr_stub.go index e581011b0..8328b7d19 100644 --- a/internal/socket/cmsghdr_stub.go +++ b/internal/socket/cmsghdr_stub.go @@ -6,9 +6,19 @@ package socket -type cmsghdr struct{} +func controlHeaderLen() int { + return 0 +} + +func controlMessageLen(dataLen int) int { + return 0 +} -const sizeofCmsghdr = 0 +func controlMessageSpace(dataLen int) int { + return 0 +} + +type cmsghdr struct{} func (h *cmsghdr) len() int { return 0 } func (h *cmsghdr) lvl() int { return 0 } diff --git a/internal/socket/cmsghdr_unix.go b/internal/socket/cmsghdr_unix.go new file mode 100644 index 000000000..c2b2b6595 --- /dev/null +++ b/internal/socket/cmsghdr_unix.go @@ -0,0 +1,21 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris + +package socket + +import ""golang.org/x/sys/unix"" + +func controlHeaderLen() int { + return unix.CmsgLen(0) +} + +func controlMessageLen(dataLen int) int { + return unix.CmsgLen(dataLen) +} + +func controlMessageSpace(dataLen int) int { + return unix.CmsgSpace(dataLen) +} diff --git a/internal/socket/defs_aix.go b/internal/socket/defs_aix.go index ae1b21c5e..90090d044 100644 --- a/internal/socket/defs_aix.go +++ b/internal/socket/defs_aix.go @@ -29,9 +29,8 @@ type sockaddrInet C.struct_sockaddr_in type sockaddrInet6 C.struct_sockaddr_in6 const ( - sizeofIovec = C.sizeof_struct_iovec - sizeofMsghdr = C.sizeof_struct_msghdr - sizeofCmsghdr = C.sizeof_struct_cmsghdr + sizeofIovec = C.sizeof_struct_iovec + sizeofMsghdr = C.sizeof_struct_msghdr sizeofSockaddrInet = C.sizeof_struct_sockaddr_in sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 diff --git a/internal/socket/defs_darwin.go b/internal/socket/defs_darwin.go index b780bc67a..ffb6d8ee2 100644 --- a/internal/socket/defs_darwin.go +++ b/internal/socket/defs_darwin.go @@ -27,9 +27,8 @@ type sockaddrInet C.struct_sockaddr_in type sockaddrInet6 C.struct_sockaddr_in6 const ( - sizeofIovec = C.sizeof_struct_iovec - sizeofMsghdr = C.sizeof_struct_msghdr - sizeofCmsghdr = C.sizeof_struct_cmsghdr + sizeofIovec = C.sizeof_struct_iovec + sizeofMsghdr = C.sizeof_struct_msghdr sizeofSockaddrInet = C.sizeof_struct_sockaddr_in sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 diff --git a/internal/socket/defs_dragonfly.go b/internal/socket/defs_dragonfly.go index b780bc67a..ffb6d8ee2 100644 --- a/internal/socket/defs_dragonfly.go +++ b/internal/socket/defs_dragonfly.go @@ -27,9 +27,8 @@ type sockaddrInet C.struct_sockaddr_in type sockaddrInet6 C.struct_sockaddr_in6 const ( - sizeofIovec = C.sizeof_struct_iovec - sizeofMsghdr = C.sizeof_struct_msghdr - sizeofCmsghdr = C.sizeof_struct_cmsghdr + sizeofIovec = C.sizeof_struct_iovec + sizeofMsghdr = C.sizeof_struct_msghdr sizeofSockaddrInet = C.sizeof_struct_sockaddr_in sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 diff --git a/internal/socket/defs_freebsd.go b/internal/socket/defs_freebsd.go index b780bc67a..ffb6d8ee2 100644 --- a/internal/socket/defs_freebsd.go +++ b/internal/socket/defs_freebsd.go @@ -27,9 +27,8 @@ type sockaddrInet C.struct_sockaddr_in type sockaddrInet6 C.struct_sockaddr_in6 const ( - sizeofIovec = C.sizeof_struct_iovec - sizeofMsghdr = C.sizeof_struct_msghdr - sizeofCmsghdr = C.sizeof_struct_cmsghdr + sizeofIovec = C.sizeof_struct_iovec + sizeofMsghdr = C.sizeof_struct_msghdr sizeofSockaddrInet = C.sizeof_struct_sockaddr_in sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 diff --git a/internal/socket/defs_linux.go b/internal/socket/defs_linux.go index 85bb7450b..35824392f 100644 --- a/internal/socket/defs_linux.go +++ b/internal/socket/defs_linux.go @@ -31,9 +31,8 @@ type sockaddrInet C.struct_sockaddr_in type sockaddrInet6 C.struct_sockaddr_in6 const ( - sizeofIovec = C.sizeof_struct_iovec - sizeofMsghdr = C.sizeof_struct_msghdr - sizeofCmsghdr = C.sizeof_struct_cmsghdr + sizeofIovec = C.sizeof_struct_iovec + sizeofMsghdr = C.sizeof_struct_msghdr sizeofSockaddrInet = C.sizeof_struct_sockaddr_in sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 diff --git a/internal/socket/defs_netbsd.go b/internal/socket/defs_netbsd.go index 5bfdd4676..379e1571d 100644 --- a/internal/socket/defs_netbsd.go +++ b/internal/socket/defs_netbsd.go @@ -29,9 +29,8 @@ type sockaddrInet C.struct_sockaddr_in type sockaddrInet6 C.struct_sockaddr_in6 const ( - sizeofIovec = C.sizeof_struct_iovec - sizeofMsghdr = C.sizeof_struct_msghdr - sizeofCmsghdr = C.sizeof_struct_cmsghdr + sizeofIovec = C.sizeof_struct_iovec + sizeofMsghdr = C.sizeof_struct_msghdr sizeofSockaddrInet = C.sizeof_struct_sockaddr_in sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 diff --git a/internal/socket/defs_openbsd.go b/internal/socket/defs_openbsd.go index b780bc67a..ffb6d8ee2 100644 --- a/internal/socket/defs_openbsd.go +++ b/internal/socket/defs_openbsd.go @@ -27,9 +27,8 @@ type sockaddrInet C.struct_sockaddr_in type sockaddrInet6 C.struct_sockaddr_in6 const ( - sizeofIovec = C.sizeof_struct_iovec - sizeofMsghdr = C.sizeof_struct_msghdr - sizeofCmsghdr = C.sizeof_struct_cmsghdr + sizeofIovec = C.sizeof_struct_iovec + sizeofMsghdr = C.sizeof_struct_msghdr sizeofSockaddrInet = C.sizeof_struct_sockaddr_in sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 diff --git a/internal/socket/defs_solaris.go b/internal/socket/defs_solaris.go index b780bc67a..ffb6d8ee2 100644 --- a/internal/socket/defs_solaris.go +++ b/internal/socket/defs_solaris.go @@ -27,9 +27,8 @@ type sockaddrInet C.struct_sockaddr_in type sockaddrInet6 C.struct_sockaddr_in6 const ( - sizeofIovec = C.sizeof_struct_iovec - sizeofMsghdr = C.sizeof_struct_msghdr - sizeofCmsghdr = C.sizeof_struct_cmsghdr + sizeofIovec = C.sizeof_struct_iovec + sizeofMsghdr = C.sizeof_struct_msghdr sizeofSockaddrInet = C.sizeof_struct_sockaddr_in sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 diff --git a/internal/socket/socket.go b/internal/socket/socket.go index 23571b8d4..dba47bf12 100644 --- a/internal/socket/socket.go +++ b/internal/socket/socket.go @@ -90,17 +90,9 @@ func (o *Option) SetInt(c *Conn, v int) error { return o.set(c, b) } -func controlHeaderLen() int { - return roundup(sizeofCmsghdr) -} - -func controlMessageLen(dataLen int) int { - return roundup(sizeofCmsghdr) + dataLen -} - // ControlMessageSpace returns the whole length of control message. func ControlMessageSpace(dataLen int) int { - return roundup(sizeofCmsghdr) + roundup(dataLen) + return controlMessageSpace(dataLen) } // A ControlMessage represents the head message in a stream of control diff --git a/internal/socket/sys.go b/internal/socket/sys.go index ee492ba86..4a26af186 100644 --- a/internal/socket/sys.go +++ b/internal/socket/sys.go @@ -9,13 +9,8 @@ import ( ""unsafe"" ) -var ( - // NativeEndian is the machine native endian implementation of - // ByteOrder. - NativeEndian binary.ByteOrder - - kernelAlign int -) +// NativeEndian is the machine native endian implementation of ByteOrder. +var NativeEndian binary.ByteOrder func init() { i := uint32(1) @@ -25,9 +20,4 @@ func init() { } else { NativeEndian = binary.BigEndian } - kernelAlign = probeProtocolStack() -} - -func roundup(l int) int { - return (l + kernelAlign - 1) &^ (kernelAlign - 1) } diff --git a/internal/socket/sys_bsdvar.go b/internal/socket/sys_bsdvar.go deleted file mode 100644 index 6e7e3d3cc..000000000 --- a/internal/socket/sys_bsdvar.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build aix freebsd netbsd openbsd - -package socket - -import ( - ""runtime"" - ""unsafe"" -) - -func probeProtocolStack() int { - if runtime.GOOS == ""netbsd"" && runtime.GOARCH == ""arm64"" { - return 16 - } - if (runtime.GOOS == ""netbsd"" || runtime.GOOS == ""openbsd"") && runtime.GOARCH == ""arm"" { - return 8 - } - if runtime.GOOS == ""aix"" { - return 1 - } - var p uintptr - return int(unsafe.Sizeof(p)) -} diff --git a/internal/socket/sys_darwin.go b/internal/socket/sys_darwin.go deleted file mode 100644 index b17d223bf..000000000 --- a/internal/socket/sys_darwin.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -func probeProtocolStack() int { return 4 } diff --git a/internal/socket/sys_dragonfly.go b/internal/socket/sys_dragonfly.go deleted file mode 100644 index ed0448fe9..000000000 --- a/internal/socket/sys_dragonfly.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package socket - -import ( - ""sync"" - ""syscall"" - ""unsafe"" -) - -// See version list in https://github.com/DragonFlyBSD/DragonFlyBSD/blob/master/sys/sys/param.h -var ( - osreldateOnce sync.Once - osreldate uint32 -) - -// First __DragonFly_version after September 2019 ABI changes -// http://lists.dragonflybsd.org/pipermail/users/2019-September/358280.html -const _dragonflyABIChangeVersion = 500705 - -func probeProtocolStack() int { - osreldateOnce.Do(func() { osreldate, _ = syscall.SysctlUint32(""kern.osreldate"") }) - var p uintptr - if int(unsafe.Sizeof(p)) == 8 && osreldate >= _dragonflyABIChangeVersion { - return int(unsafe.Sizeof(p)) - } - // 64-bit Dragonfly before the September 2019 ABI changes still requires - // 32-bit aligned access to network subsystem. - return 4 -} diff --git a/internal/socket/sys_linux.go b/internal/socket/sys_linux.go index 1559521e0..8b03cd6de 100644 --- a/internal/socket/sys_linux.go +++ b/internal/socket/sys_linux.go @@ -11,11 +11,6 @@ import ( ""unsafe"" ) -func probeProtocolStack() int { - var p uintptr - return int(unsafe.Sizeof(p)) -} - func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) { n, _, errno := syscall.Syscall6(sysRECVMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0) return int(n), errnoErr(errno) diff --git a/internal/socket/sys_linux_386.go b/internal/socket/sys_linux_386.go index 235b2cc08..651215321 100644 --- a/internal/socket/sys_linux_386.go +++ b/internal/socket/sys_linux_386.go @@ -9,8 +9,6 @@ import ( ""unsafe"" ) -func probeProtocolStack() int { return 4 } - const ( sysSETSOCKOPT = 0xe sysGETSOCKOPT = 0xf diff --git a/internal/socket/sys_linux_s390x.go b/internal/socket/sys_linux_s390x.go index 327979efb..651215321 100644 --- a/internal/socket/sys_linux_s390x.go +++ b/internal/socket/sys_linux_s390x.go @@ -9,8 +9,6 @@ import ( ""unsafe"" ) -func probeProtocolStack() int { return 8 } - const ( sysSETSOCKOPT = 0xe sysGETSOCKOPT = 0xf diff --git a/internal/socket/sys_solaris.go b/internal/socket/sys_solaris.go index 66b554786..e79ca9518 100644 --- a/internal/socket/sys_solaris.go +++ b/internal/socket/sys_solaris.go @@ -5,21 +5,10 @@ package socket import ( - ""runtime"" ""syscall"" ""unsafe"" ) -func probeProtocolStack() int { - switch runtime.GOARCH { - case ""amd64"": - return 4 - default: - var p uintptr - return int(unsafe.Sizeof(p)) - } -} - //go:cgo_import_dynamic libc___xnet_getsockopt __xnet_getsockopt ""libsocket.so"" //go:cgo_import_dynamic libc_setsockopt setsockopt ""libsocket.so"" //go:cgo_import_dynamic libc___xnet_recvmsg __xnet_recvmsg ""libsocket.so"" diff --git a/internal/socket/sys_stub.go b/internal/socket/sys_stub.go index 0f6174262..8e1e07427 100644 --- a/internal/socket/sys_stub.go +++ b/internal/socket/sys_stub.go @@ -6,11 +6,7 @@ package socket -import ( - ""net"" - ""runtime"" - ""unsafe"" -) +import ""net"" const ( sysAF_UNSPEC = 0x0 @@ -20,16 +16,6 @@ const ( sysSOCK_RAW = 0x3 ) -func probeProtocolStack() int { - switch runtime.GOARCH { - case ""amd64p32"", ""mips64p32"": - return 4 - default: - var p uintptr - return int(unsafe.Sizeof(p)) - } -} - func marshalInetAddr(ip net.IP, port int, zone string) []byte { return nil } diff --git a/internal/socket/zsys_aix_ppc64.go b/internal/socket/zsys_aix_ppc64.go index e740c8f02..93d923ad7 100644 --- a/internal/socket/zsys_aix_ppc64.go +++ b/internal/socket/zsys_aix_ppc64.go @@ -51,9 +51,8 @@ type sockaddrInet6 struct { } const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x30 - sizeofCmsghdr = 0xc + sizeofIovec = 0x10 + sizeofMsghdr = 0x30 sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c diff --git a/internal/socket/zsys_darwin_386.go b/internal/socket/zsys_darwin_386.go index 083bda51c..150f980f5 100644 --- a/internal/socket/zsys_darwin_386.go +++ b/internal/socket/zsys_darwin_386.go @@ -42,9 +42,8 @@ type sockaddrInet6 struct { } const ( - sizeofIovec = 0x8 - sizeofMsghdr = 0x1c - sizeofCmsghdr = 0xc + sizeofIovec = 0x8 + sizeofMsghdr = 0x1c sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c diff --git a/internal/socket/zsys_darwin_amd64.go b/internal/socket/zsys_darwin_amd64.go index 55c6c9f57..a686c9528 100644 --- a/internal/socket/zsys_darwin_amd64.go +++ b/internal/socket/zsys_darwin_amd64.go @@ -44,9 +44,8 @@ type sockaddrInet6 struct { } const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x30 - sizeofCmsghdr = 0xc + sizeofIovec = 0x10 + sizeofMsghdr = 0x30 sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c diff --git a/internal/socket/zsys_darwin_arm.go b/internal/socket/zsys_darwin_arm.go index 083bda51c..150f980f5 100644 --- a/internal/socket/zsys_darwin_arm.go +++ b/internal/socket/zsys_darwin_arm.go @@ -42,9 +42,8 @@ type sockaddrInet6 struct { } const ( - sizeofIovec = 0x8 - sizeofMsghdr = 0x1c - sizeofCmsghdr = 0xc + sizeofIovec = 0x8 + sizeofMsghdr = 0x1c sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c diff --git a/internal/socket/zsys_darwin_arm64.go b/internal/socket/zsys_darwin_arm64.go index 55c6c9f57..a686c9528 100644 --- a/internal/socket/zsys_darwin_arm64.go +++ b/internal/socket/zsys_darwin_arm64.go @@ -44,9 +44,8 @@ type sockaddrInet6 struct { } const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x30 - sizeofCmsghdr = 0xc + sizeofIovec = 0x10 + sizeofMsghdr = 0x30 sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c diff --git a/internal/socket/zsys_dragonfly_amd64.go b/internal/socket/zsys_dragonfly_amd64.go index 8b7d161d7..d45c197e2 100644 --- a/internal/socket/zsys_dragonfly_amd64.go +++ b/internal/socket/zsys_dragonfly_amd64.go @@ -44,9 +44,8 @@ type sockaddrInet6 struct { } const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x30 - sizeofCmsghdr = 0xc + sizeofIovec = 0x10 + sizeofMsghdr = 0x30 sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c diff --git a/internal/socket/zsys_freebsd_386.go b/internal/socket/zsys_freebsd_386.go index 3e71ff574..ffec860ea 100644 --- a/internal/socket/zsys_freebsd_386.go +++ b/internal/socket/zsys_freebsd_386.go @@ -42,9 +42,8 @@ type sockaddrInet6 struct { } const ( - sizeofIovec = 0x8 - sizeofMsghdr = 0x1c - sizeofCmsghdr = 0xc + sizeofIovec = 0x8 + sizeofMsghdr = 0x1c sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c diff --git a/internal/socket/zsys_freebsd_amd64.go b/internal/socket/zsys_freebsd_amd64.go index 238d90de6..aa701ab67 100644 --- a/internal/socket/zsys_freebsd_amd64.go +++ b/internal/socket/zsys_freebsd_amd64.go @@ -44,9 +44,8 @@ type sockaddrInet6 struct { } const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x30 - sizeofCmsghdr = 0xc + sizeofIovec = 0x10 + sizeofMsghdr = 0x30 sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c diff --git a/internal/socket/zsys_freebsd_arm.go b/internal/socket/zsys_freebsd_arm.go index 3e71ff574..ffec860ea 100644 --- a/internal/socket/zsys_freebsd_arm.go +++ b/internal/socket/zsys_freebsd_arm.go @@ -42,9 +42,8 @@ type sockaddrInet6 struct { } const ( - sizeofIovec = 0x8 - sizeofMsghdr = 0x1c - sizeofCmsghdr = 0xc + sizeofIovec = 0x8 + sizeofMsghdr = 0x1c sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c diff --git a/internal/socket/zsys_freebsd_arm64.go b/internal/socket/zsys_freebsd_arm64.go index 238d90de6..aa701ab67 100644 --- a/internal/socket/zsys_freebsd_arm64.go +++ b/internal/socket/zsys_freebsd_arm64.go @@ -44,9 +44,8 @@ type sockaddrInet6 struct { } const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x30 - sizeofCmsghdr = 0xc + sizeofIovec = 0x10 + sizeofMsghdr = 0x30 sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c diff --git a/internal/socket/zsys_linux_386.go b/internal/socket/zsys_linux_386.go index d33025b70..0c847bee7 100644 --- a/internal/socket/zsys_linux_386.go +++ b/internal/socket/zsys_linux_386.go @@ -45,9 +45,8 @@ type sockaddrInet6 struct { } const ( - sizeofIovec = 0x8 - sizeofMsghdr = 0x1c - sizeofCmsghdr = 0xc + sizeofIovec = 0x8 + sizeofMsghdr = 0x1c sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c diff --git a/internal/socket/zsys_linux_amd64.go b/internal/socket/zsys_linux_amd64.go index b20d21677..15e2aecaa 100644 --- a/internal/socket/zsys_linux_amd64.go +++ b/internal/socket/zsys_linux_amd64.go @@ -48,9 +48,8 @@ type sockaddrInet6 struct { } const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x38 - sizeofCmsghdr = 0x10 + sizeofIovec = 0x10 + sizeofMsghdr = 0x38 sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c diff --git a/internal/socket/zsys_linux_arm.go b/internal/socket/zsys_linux_arm.go index 1bb10a428..0c847bee7 100644 --- a/internal/socket/zsys_linux_arm.go +++ b/internal/socket/zsys_linux_arm.go @@ -48,8 +48,6 @@ const ( sizeofIovec = 0x8 sizeofMsghdr = 0x1c - sizeofCmsghdr = 0xc - sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c ) diff --git a/internal/socket/zsys_linux_arm64.go b/internal/socket/zsys_linux_arm64.go index 7f6e8a7fa..15e2aecaa 100644 --- a/internal/socket/zsys_linux_arm64.go +++ b/internal/socket/zsys_linux_arm64.go @@ -51,8 +51,6 @@ const ( sizeofIovec = 0x10 sizeofMsghdr = 0x38 - sizeofCmsghdr = 0x10 - sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c ) diff --git a/internal/socket/zsys_linux_mips.go b/internal/socket/zsys_linux_mips.go index 1bb10a428..0c847bee7 100644 --- a/internal/socket/zsys_linux_mips.go +++ b/internal/socket/zsys_linux_mips.go @@ -48,8 +48,6 @@ const ( sizeofIovec = 0x8 sizeofMsghdr = 0x1c - sizeofCmsghdr = 0xc - sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c ) diff --git a/internal/socket/zsys_linux_mips64.go b/internal/socket/zsys_linux_mips64.go index 7f6e8a7fa..15e2aecaa 100644 --- a/internal/socket/zsys_linux_mips64.go +++ b/internal/socket/zsys_linux_mips64.go @@ -51,8 +51,6 @@ const ( sizeofIovec = 0x10 sizeofMsghdr = 0x38 - sizeofCmsghdr = 0x10 - sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c ) diff --git a/internal/socket/zsys_linux_mips64le.go b/internal/socket/zsys_linux_mips64le.go index 7f6e8a7fa..15e2aecaa 100644 --- a/internal/socket/zsys_linux_mips64le.go +++ b/internal/socket/zsys_linux_mips64le.go @@ -51,8 +51,6 @@ const ( sizeofIovec = 0x10 sizeofMsghdr = 0x38 - sizeofCmsghdr = 0x10 - sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c ) diff --git a/internal/socket/zsys_linux_mipsle.go b/internal/socket/zsys_linux_mipsle.go index 1bb10a428..0c847bee7 100644 --- a/internal/socket/zsys_linux_mipsle.go +++ b/internal/socket/zsys_linux_mipsle.go @@ -48,8 +48,6 @@ const ( sizeofIovec = 0x8 sizeofMsghdr = 0x1c - sizeofCmsghdr = 0xc - sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c ) diff --git a/internal/socket/zsys_linux_ppc64.go b/internal/socket/zsys_linux_ppc64.go index 7f6e8a7fa..15e2aecaa 100644 --- a/internal/socket/zsys_linux_ppc64.go +++ b/internal/socket/zsys_linux_ppc64.go @@ -51,8 +51,6 @@ const ( sizeofIovec = 0x10 sizeofMsghdr = 0x38 - sizeofCmsghdr = 0x10 - sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c ) diff --git a/internal/socket/zsys_linux_ppc64le.go b/internal/socket/zsys_linux_ppc64le.go index 7f6e8a7fa..15e2aecaa 100644 --- a/internal/socket/zsys_linux_ppc64le.go +++ b/internal/socket/zsys_linux_ppc64le.go @@ -51,8 +51,6 @@ const ( sizeofIovec = 0x10 sizeofMsghdr = 0x38 - sizeofCmsghdr = 0x10 - sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c ) diff --git a/internal/socket/zsys_linux_riscv64.go b/internal/socket/zsys_linux_riscv64.go index f12a1d768..8640c03e4 100644 --- a/internal/socket/zsys_linux_riscv64.go +++ b/internal/socket/zsys_linux_riscv64.go @@ -52,8 +52,6 @@ const ( sizeofIovec = 0x10 sizeofMsghdr = 0x38 - sizeofCmsghdr = 0x10 - sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c ) diff --git a/internal/socket/zsys_linux_s390x.go b/internal/socket/zsys_linux_s390x.go index 7f6e8a7fa..15e2aecaa 100644 --- a/internal/socket/zsys_linux_s390x.go +++ b/internal/socket/zsys_linux_s390x.go @@ -51,8 +51,6 @@ const ( sizeofIovec = 0x10 sizeofMsghdr = 0x38 - sizeofCmsghdr = 0x10 - sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c ) diff --git a/internal/socket/zsys_netbsd_386.go b/internal/socket/zsys_netbsd_386.go index 7e258cec2..6b72d24dd 100644 --- a/internal/socket/zsys_netbsd_386.go +++ b/internal/socket/zsys_netbsd_386.go @@ -50,8 +50,6 @@ const ( sizeofIovec = 0x8 sizeofMsghdr = 0x1c - sizeofCmsghdr = 0xc - sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c ) diff --git a/internal/socket/zsys_netbsd_amd64.go b/internal/socket/zsys_netbsd_amd64.go index b3f9c0d7e..9aaa4ab1c 100644 --- a/internal/socket/zsys_netbsd_amd64.go +++ b/internal/socket/zsys_netbsd_amd64.go @@ -53,8 +53,6 @@ const ( sizeofIovec = 0x10 sizeofMsghdr = 0x30 - sizeofCmsghdr = 0xc - sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c ) diff --git a/internal/socket/zsys_netbsd_arm.go b/internal/socket/zsys_netbsd_arm.go index 7e258cec2..6b72d24dd 100644 --- a/internal/socket/zsys_netbsd_arm.go +++ b/internal/socket/zsys_netbsd_arm.go @@ -50,8 +50,6 @@ const ( sizeofIovec = 0x8 sizeofMsghdr = 0x1c - sizeofCmsghdr = 0xc - sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c ) diff --git a/internal/socket/zsys_netbsd_arm64.go b/internal/socket/zsys_netbsd_arm64.go index da26ef019..9aaa4ab1c 100644 --- a/internal/socket/zsys_netbsd_arm64.go +++ b/internal/socket/zsys_netbsd_arm64.go @@ -50,9 +50,8 @@ type sockaddrInet6 struct { } const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x30 - sizeofCmsghdr = 0xc + sizeofIovec = 0x10 + sizeofMsghdr = 0x30 sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c diff --git a/internal/socket/zsys_openbsd_386.go b/internal/socket/zsys_openbsd_386.go index 73655a14c..3ec8d42fe 100644 --- a/internal/socket/zsys_openbsd_386.go +++ b/internal/socket/zsys_openbsd_386.go @@ -42,9 +42,8 @@ type sockaddrInet6 struct { } const ( - sizeofIovec = 0x8 - sizeofMsghdr = 0x1c - sizeofCmsghdr = 0xc + sizeofIovec = 0x8 + sizeofMsghdr = 0x1c sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c diff --git a/internal/socket/zsys_openbsd_amd64.go b/internal/socket/zsys_openbsd_amd64.go index 0a4de80f2..ea0ee008d 100644 --- a/internal/socket/zsys_openbsd_amd64.go +++ b/internal/socket/zsys_openbsd_amd64.go @@ -44,9 +44,8 @@ type sockaddrInet6 struct { } const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x30 - sizeofCmsghdr = 0xc + sizeofIovec = 0x10 + sizeofMsghdr = 0x30 sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c diff --git a/internal/socket/zsys_openbsd_arm.go b/internal/socket/zsys_openbsd_arm.go index 73655a14c..3ec8d42fe 100644 --- a/internal/socket/zsys_openbsd_arm.go +++ b/internal/socket/zsys_openbsd_arm.go @@ -42,9 +42,8 @@ type sockaddrInet6 struct { } const ( - sizeofIovec = 0x8 - sizeofMsghdr = 0x1c - sizeofCmsghdr = 0xc + sizeofIovec = 0x8 + sizeofMsghdr = 0x1c sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c diff --git a/internal/socket/zsys_openbsd_arm64.go b/internal/socket/zsys_openbsd_arm64.go index 0a4de80f2..ea0ee008d 100644 --- a/internal/socket/zsys_openbsd_arm64.go +++ b/internal/socket/zsys_openbsd_arm64.go @@ -44,9 +44,8 @@ type sockaddrInet6 struct { } const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x30 - sizeofCmsghdr = 0xc + sizeofIovec = 0x10 + sizeofMsghdr = 0x30 sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x1c diff --git a/internal/socket/zsys_solaris_amd64.go b/internal/socket/zsys_solaris_amd64.go index 353cd5fb4..48b2b591f 100644 --- a/internal/socket/zsys_solaris_amd64.go +++ b/internal/socket/zsys_solaris_amd64.go @@ -43,9 +43,8 @@ type sockaddrInet6 struct { } const ( - sizeofIovec = 0x10 - sizeofMsghdr = 0x30 - sizeofCmsghdr = 0xc + sizeofIovec = 0x10 + sizeofMsghdr = 0x30 sizeofSockaddrInet = 0x10 sizeofSockaddrInet6 = 0x20 ",0 28d22af56e1253e83254f768688d3c16905184ac,https://github.com/mycolorway/simditor/commit/28d22af56e1253e83254f768688d3c16905184ac,CHG: update dependencies,"diff --git a/lib/simditor.js b/lib/simditor.js index 14d11044..031b90a0 100644 --- a/lib/simditor.js +++ b/lib/simditor.js @@ -1,5 +1,5 @@ /*! -* Simditor v2.3.21 +* Simditor v2.3.22 * http://simditor.tower.im/ * 2018-11-09 */ diff --git a/package-lock.json b/package-lock.json index 38f70888..e4798146 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { ""name"": ""simditor"", - ""version"": ""2.3.22"", + ""version"": ""2.3.23"", ""lockfileVersion"": 1, ""requires"": true, ""dependencies"": { @@ -2491,9 +2491,9 @@ ""dev"": true }, ""jquery"": { - ""version"": ""2.1.4"", - ""resolved"": ""https://registry.npmjs.org/jquery/-/jquery-2.1.4.tgz"", - ""integrity"": ""sha1-IoveaYoMYUMdwmMKahVPFYkNIxc="" + ""version"": ""3.3.1"", + ""resolved"": ""https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz"", + ""integrity"": ""sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg=="" }, ""js-yaml"": { ""version"": ""2.0.5"", @@ -3637,23 +3637,45 @@ ""requires"": { ""jquery"": ""2.x"", ""simple-module"": ""~2.0.5"" + }, + ""dependencies"": { + ""jquery"": { + ""version"": ""2.2.4"", + ""resolved"": ""https://registry.npmjs.org/jquery/-/jquery-2.2.4.tgz"", + ""integrity"": ""sha1-LInWiJterFIqfuoywUUhVZxsvwI="" + }, + ""simple-module"": { + ""version"": ""2.0.6"", + ""resolved"": ""https://registry.npmjs.org/simple-module/-/simple-module-2.0.6.tgz"", + ""integrity"": ""sha1-zsglAyX4x/V19Kp1yRmzg5amA3s="", + ""requires"": { + ""jquery"": ""2.x"" + } + } } }, ""simple-module"": { - ""version"": ""2.0.6"", - ""resolved"": ""https://registry.npmjs.org/simple-module/-/simple-module-2.0.6.tgz"", - ""integrity"": ""sha1-zsglAyX4x/V19Kp1yRmzg5amA3s="", + ""version"": ""3.0.3"", + ""resolved"": ""https://registry.npmjs.org/simple-module/-/simple-module-3.0.3.tgz"", + ""integrity"": ""sha1-rVJ2Z4XSfNlCfuhkWknkEZlyWpI="", ""requires"": { - ""jquery"": ""2.x"" + ""jquery"": ""^3.0.0"" } }, ""simple-uploader"": { - ""version"": ""2.0.8"", - ""resolved"": ""https://registry.npmjs.org/simple-uploader/-/simple-uploader-2.0.8.tgz"", - ""integrity"": ""sha1-X8QQbG2Wiws1MpPjsWCUqv3pV7o="", + ""version"": ""3.0.0"", + ""resolved"": ""https://registry.npmjs.org/simple-uploader/-/simple-uploader-3.0.0.tgz"", + ""integrity"": ""sha1-wJ9wbxz8vqH+eA41dZpoOxM21NE="", ""requires"": { - ""jquery"": ""2.x"", - ""simple-module"": ""~2.0.5"" + ""jquery"": ""~3.1.0"", + ""simple-module"": ""~3.0.0"" + }, + ""dependencies"": { + ""jquery"": { + ""version"": ""3.1.1"", + ""resolved"": ""https://registry.npmjs.org/jquery/-/jquery-3.1.1.tgz"", + ""integrity"": ""sha1-NHwcIcfgBBFeCk2jLOzgQfrTyKM="" + } } }, ""sntp"": { diff --git a/package.json b/package.json index f43b4bbb..b244b957 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { ""name"": ""simditor"", - ""version"": ""2.3.22"", + ""version"": ""2.3.23"", ""description"": ""A simple online editor"", ""keywords"": ""editor simditor"", ""repository"": { @@ -24,10 +24,10 @@ ""homepage"": ""http://simditor.tower.im"", ""dependencies"": { ""dompurify"": ""^1.0.8"", - ""jquery"": ""~2.1.4"", - ""simple-hotkeys"": ""~1.0.3"", - ""simple-module"": ""~2.0.6"", - ""simple-uploader"": ""~2.0.7"" + ""jquery"": ""^3.3.1"", + ""simple-hotkeys"": ""^1.0.3"", + ""simple-module"": ""^3.0.3"", + ""simple-uploader"": ""^3.0.0"" }, ""devDependencies"": { ""express"": ""~3.3.4"", diff --git a/site/assets/scripts/jquery.min.js b/site/assets/scripts/jquery.min.js index fad9ab12..4d9b3a25 100644 --- a/site/assets/scripts/jquery.min.js +++ b/site/assets/scripts/jquery.min.js @@ -1,5 +1,2 @@ -/*! jQuery v2.1.4 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */ -!function(a,b){""object""==typeof module&&""object""==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error(""jQuery requires a window with a document"");return b(a)}:b(a)}(""undefined""!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m=""2.1.4"",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"""",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for(""boolean""==typeof g&&(j=g,g=arguments[h]||{},h++),""object""==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:""jQuery""+(m+Math.random()).replace(/\D/g,""""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return""function""===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)+1>=0},isPlainObject:function(a){return""object""!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,""isPrototypeOf"")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"""":""object""==typeof a||""function""==typeof a?h[i.call(a)]||""object"":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf(""use strict"")?(b=l.createElement(""script""),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,""ms-"").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"""":(a+"""").replace(o,"""")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,""string""==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return""string""==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each(""Boolean Number String Function Array Date RegExp Object Error"".split("" ""),function(a,b){h[""[object ""+b+""]""]=b.toLowerCase()});function s(a){var b=""length""in a&&a.length,c=n.type(a);return""function""===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:""array""===c||0===b||""number""==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u=""sizzle""+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K=""checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped"",L=""[\\x20\\t\\r\\n\\f]"",M=""(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+"",N=M.replace(""w"",""w#""),O=""\\[""+L+""*(""+M+"")(?:""+L+""*([*^$|!~]?=)""+L+""*(?:'((?:\\\\.|[^\\\\'])*)'|\""((?:\\\\.|[^\\\\\""])*)\""|(""+N+""))|)""+L+""*\\]"",P="":(""+M+"")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\""((?:\\\\.|[^\\\\\""])*)\"")|((?:\\\\.|[^\\\\()[\\]]|""+O+"")*)|.*)\\)|)"",Q=new RegExp(L+""+"",""g""),R=new RegExp(""^""+L+""+|((?:^|[^\\\\])(?:\\\\.)*)""+L+""+$"",""g""),S=new RegExp(""^""+L+""*,""+L+""*""),T=new RegExp(""^""+L+""*([>+~]|""+L+"")""+L+""*""),U=new RegExp(""=""+L+""*([^\\]'\""]*?)""+L+""*\\]"",""g""),V=new RegExp(P),W=new RegExp(""^""+N+""$""),X={ID:new RegExp(""^#(""+M+"")""),CLASS:new RegExp(""^\\.(""+M+"")""),TAG:new RegExp(""^(""+M.replace(""w"",""w*"")+"")""),ATTR:new RegExp(""^""+O),PSEUDO:new RegExp(""^""+P),CHILD:new RegExp(""^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(""+L+""*(even|odd|(([+-]|)(\\d*)n|)""+L+""*(?:([+-]|)""+L+""*(\\d+)|))""+L+""*\\)|)"",""i""),bool:new RegExp(""^(?:""+K+"")$"",""i""),needsContext:new RegExp(""^""+L+""*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(""+L+""*((?:-\\d)?\\d*)""+L+""*\\)|)(?=[^-]|$)"",""i"")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp(""\\\\([\\da-f]{1,6}""+L+""?|(""+L+"")|.)"",""ig""),da=function(a,b,c){var d=""0x""+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,""string""!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&""object""!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute(""id""))?s=r.replace(ba,""\\$&""):b.setAttribute(""id"",s),s=""[id='""+s+""'] "",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join("","")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute(""id"")}}}return i(a.replace(R,""$1""),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+"" "")>d.cacheLength&&delete b[a.shift()],b[c+"" ""]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement(""div"");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split(""|""),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return""input""===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return(""input""===c||""button""===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&""undefined""!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?""HTML""!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener(""unload"",ea,!1):e.attachEvent&&e.attachEvent(""onunload"",ea)),p=!f(g),c.attributes=ja(function(a){return a.className=""i"",!a.getAttribute(""className"")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("""")),!a.getElementsByTagName(""*"").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(""undefined""!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute(""id"")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c=""undefined""!=typeof a.getAttributeNode&&a.getAttributeNode(""id"");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return""undefined""!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if(""*""===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="""",a.querySelectorAll(""[msallowcapture^='']"").length&&q.push(""[*^$]=""+L+""*(?:''|\""\"")""),a.querySelectorAll(""[selected]"").length||q.push(""\\[""+L+""*(?:value|""+K+"")""),a.querySelectorAll(""[id~=""+u+""-]"").length||q.push(""~=""),a.querySelectorAll("":checked"").length||q.push("":checked""),a.querySelectorAll(""a#""+u+""+*"").length||q.push("".#.+[+~]"")}),ja(function(a){var b=g.createElement(""input"");b.setAttribute(""type"",""hidden""),a.appendChild(b).setAttribute(""name"",""D""),a.querySelectorAll(""[name=d]"").length&&q.push(""name""+L+""*[*^$|!~]?=""),a.querySelectorAll("":enabled"").length||q.push("":enabled"","":disabled""),a.querySelectorAll(""*,:x""),q.push("",.*:"")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,""div""),s.call(a,""[s!='']:x""),r.push(""!="",P)}),q=q.length&&new RegExp(q.join(""|"")),r=r.length&&new RegExp(r.join(""|"")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,""='$1']""),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error(""Syntax error, unrecognized expression: ""+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="""",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if(""string""==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{"">"":{dir:""parentNode"",first:!0},"" "":{dir:""parentNode""},""+"":{dir:""previousSibling"",first:!0},""~"":{dir:""previousSibling""}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"""").replace(ca,da),""~=""===a[2]&&(a[3]="" ""+a[3]+"" ""),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),""nth""===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*(""even""===a[3]||""odd""===a[3])),a[5]=+(a[7]+a[8]||""odd""===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"""":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf("")"",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return""*""===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+"" ""];return b||(b=new RegExp(""(^|""+L+"")""+a+""(""+L+""|$)""))&&y(a,function(a){return b.test(""string""==typeof a.className&&a.className||""undefined""!=typeof a.getAttribute&&a.getAttribute(""class"")||"""")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?""!=""===b:b?(e+="""",""=""===b?e===c:""!=""===b?e!==c:""^=""===b?c&&0===e.indexOf(c):""*=""===b?c&&e.indexOf(c)>-1:""$=""===b?c&&e.slice(-c.length)===c:""~=""===b?("" ""+e.replace(Q,"" "")+"" "").indexOf(c)>-1:""|=""===b?e===c||e.slice(0,c.length+1)===c+""-"":!1):!0}},CHILD:function(a,b,c,d,e){var f=""nth""!==a.slice(0,3),g=""last""!==a.slice(-4),h=""of-type""===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?""nextSibling"":""previousSibling"",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p=""only""===a&&!o&&""nextSibling""}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error(""unsupported pseudo: ""+a);return e[u]?e(b):e.length>1?(c=[a,a,"""",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,""$1""));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"""")||ga.error(""unsupported lang: ""+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute(""xml:lang"")||b.getAttribute(""lang""))return c=c.toLowerCase(),c===a||0===c.indexOf(a+""-"");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return""input""===b&&!!a.checked||""option""===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return""input""===b&&""button""===a.type||""button""===b},text:function(a){var b;return""input""===a.nodeName.toLowerCase()&&""text""===a.type&&(null==(b=a.getAttribute(""type""))||""text""===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&""parentNode""===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||""*"",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative["" ""],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:"" ""===a[i-2].type?""*"":""""})).replace(R,""$1""),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q=""0"",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG(""*"",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+"" ""];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n=""function""==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&""ID""===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("""").sort(B).join("""")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement(""div""))}),ja(function(a){return a.innerHTML="""",""#""===a.firstChild.getAttribute(""href"")})||ka(""type|href|height|width"",function(a,b,c){return c?void 0:a.getAttribute(b,""type""===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="""",a.firstChild.setAttribute(""value"",""""),""""===a.firstChild.getAttribute(""value"")})||ka(""value"",function(a,b,c){return c||""input""!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute(""disabled"")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);n.find=t,n.expr=t.selectors,n.expr["":""]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if(""string""==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a="":not(""+a+"")""),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if(""string""!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+"" ""+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,""string""==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if(""string""==typeof a){if(c=""<""===a[0]&&"">""===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?""undefined""!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||""string""!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?""string""==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,""parentNode"")},parentsUntil:function(a,b,c){return n.dir(a,""parentNode"",c)},next:function(a){return D(a,""nextSibling"")},prev:function(a){return D(a,""previousSibling"")},nextAll:function(a){return n.dir(a,""nextSibling"")},prevAll:function(a){return n.dir(a,""previousSibling"")},nextUntil:function(a,b,c){return n.dir(a,""nextSibling"",c)},prevUntil:function(a,b,c){return n.dir(a,""previousSibling"",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return""Until""!==a.slice(-5)&&(d=c),d&&""string""==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a=""string""==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);""function""===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&""string""!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[[""resolve"",""done"",n.Callbacks(""once memory""),""resolved""],[""reject"",""fail"",n.Callbacks(""once memory""),""rejected""],[""notify"",""progress"",n.Callbacks(""memory"")]],c=""pending"",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+""With""](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+""With""](this===e?d:this,arguments),this},e[f[0]+""With""]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler(""ready""),n(l).off(""ready""))))}});function I(){l.removeEventListener(""DOMContentLoaded"",I,!1),a.removeEventListener(""load"",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),""complete""===l.readyState?setTimeout(n.ready):(l.addEventListener(""DOMContentLoaded"",I,!1),a.addEventListener(""load"",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if(""object""===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+K.uid++}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if(""string""==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&""string""==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d=""data-""+b.replace(O,""-$1"").toLowerCase(),c=a.getAttribute(d),""string""==typeof c){try{c=""true""===c?!0:""false""===c?!1:""null""===c?null:+c+""""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){ -return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,""hasDataAttrs""))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf(""data-"")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,""hasDataAttrs"",!0)}return e}return""object""==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf(""-"")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||""fx"")+""queue"",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||""fx"";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};""inprogress""===e&&(e=c.shift(),d--),e&&(""fx""===b&&c.unshift(""inprogress""),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+""queueHooks"";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks(""once memory"").add(function(){L.remove(a,[b+""queue"",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return""string""!=typeof a&&(b=a,a=""fx"",c--),arguments.lengthx"",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U=""undefined"";k.focusinBubbles=""onfocusin""in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"""").match(E)||[""""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"""").split(""."").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(""."")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"""").match(E)||[""""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"""").split(""."").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp(""(^|\\.)""+p.join(""\\.(?:.*\\.|)"")+""(\\.|$)""),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&(""**""!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,""events""))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,""type"")?b.type:b,r=j.call(b,""namespace"")?b.namespace.split("".""):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(""."")>=0&&(r=q.split("".""),q=r.shift(),r.sort()),k=q.indexOf("":"")<0&&""on""+q,b=b[n.expando]?b:new n.Event(q,""object""==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("".""),b.namespace_re=b.namespace?new RegExp(""(^|\\.)""+r.join(""\\.(?:.*\\.|)"")+""(\\.|$)""):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,""events"")||{})[b.type]&&L.get(g,""handle""),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,""events"")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||""click""!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||""click""!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+"" "",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,ba=/<([\w:]+)/,ca=/<|&#?\w+;/,da=/<(?:script|style|link)/i,ea=/checked\s*(?:[^=]|=\s*.checked.)/i,fa=/^$|\/(?:java|ecma)script/i,ga=/^true\/(.*)/,ha=/^\s*\s*$/g,ia={option:[1,""""],thead:[1,""
    -
    +
    {L_694} @@ -308,7 +308,7 @@ $(document).ready(function() {
    - +
    "",""
    ""],col:[2,"""",""
    ""],tr:[2,"""",""
    ""],td:[3,"""",""
    ""],_default:[0,"""",""""]};ia.optgroup=ia.option,ia.tbody=ia.tfoot=ia.colgroup=ia.caption=ia.thead,ia.th=ia.td;function ja(a,b){return n.nodeName(a,""table"")&&n.nodeName(11!==b.nodeType?b:b.firstChild,""tr"")?a.getElementsByTagName(""tbody"")[0]||a.appendChild(a.ownerDocument.createElement(""tbody"")):a}function ka(a){return a.type=(null!==a.getAttribute(""type""))+""/""+a.type,a}function la(a){var b=ga.exec(a.type);return b?a.type=b[1]:a.removeAttribute(""type""),a}function ma(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],""globalEval"",!b||L.get(b[c],""globalEval""))}function na(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function oa(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||""*""):a.querySelectorAll?a.querySelectorAll(b||""*""):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pa(a,b){var c=b.nodeName.toLowerCase();""input""===c&&T.test(a.type)?b.checked=a.checked:(""input""===c||""textarea""===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=oa(h),f=oa(a),d=0,e=f.length;e>d;d++)pa(f[d],g[d]);if(b)if(c)for(f=f||oa(a),g=g||oa(h),d=0,e=f.length;e>d;d++)na(f[d],g[d]);else na(a,h);return g=oa(h,""script""),g.length>0&&ma(g,!i&&oa(a,""script"")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if(""object""===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(ca.test(e)){f=f||k.appendChild(b.createElement(""div"")),g=(ba.exec(e)||["""",""""])[1].toLowerCase(),h=ia[g]||ia._default,f.innerHTML=h[1]+e.replace(aa,""<$1>"")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""""}else l.push(b.createTextNode(e));k.textContent="""",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=oa(k.appendChild(e),""script""),i&&ma(f),c)){j=0;while(e=f[j++])fa.test(e.type||"""")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=ja(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=ja(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(oa(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&ma(oa(c,""script"")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(oa(a,!1)),a.textContent="""");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if(""string""==typeof a&&!da.test(a)&&!ia[(ba.exec(a)||["""",""""])[1].toLowerCase()]){a=a.replace(aa,""<$1>"");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(oa(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(oa(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&""string""==typeof p&&!k.checkClone&&ea.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(oa(c,""script""),ka),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,oa(h,""script""))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,la),j=0;g>j;j++)h=f[j],fa.test(h.type||"""")&&!L.access(h,""globalEval"")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(ha,"""")))}return this}}),n.each({appendTo:""append"",prependTo:""prepend"",insertBefore:""before"",insertAfter:""after"",replaceAll:""replaceWith""},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qa,ra={};function sa(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],""display"");return e.detach(),f}function ta(a){var b=l,c=ra[a];return c||(c=sa(a,b),""none""!==c&&c||(qa=(qa||n(""