Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Jun 2015 23:21:38 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org
Subject:   svn commit: r284985 - in releng/10.1: . contrib/sendmail/src lib/libc/locale lib/libiconv_modules/UTF7 sys/conf
Message-ID:  <201506302321.t5UNLciY098553@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Tue Jun 30 23:21:37 2015
New Revision: 284985
URL: https://svnweb.freebsd.org/changeset/base/284985

Log:
  [EN-15:08] Revised: Improvements to sendmail TLS/DH interoperability.
  
  [EN-15:09] Fix inconsistency between locale and rune locale states.
  
  [EN-15:10] Improved iconv(3) UTF-7 support.
  
  Approved by:	so

Modified:
  releng/10.1/UPDATING
  releng/10.1/contrib/sendmail/src/sendmail.h
  releng/10.1/lib/libc/locale/setrunelocale.c
  releng/10.1/lib/libc/locale/xlocale.c
  releng/10.1/lib/libiconv_modules/UTF7/citrus_utf7.c
  releng/10.1/sys/conf/newvers.sh

Modified: releng/10.1/UPDATING
==============================================================================
--- releng/10.1/UPDATING	Tue Jun 30 22:30:21 2015	(r284984)
+++ releng/10.1/UPDATING	Tue Jun 30 23:21:37 2015	(r284985)
@@ -16,6 +16,17 @@ from older versions of FreeBSD, try WITH
 stable/10, and then rebuild without this option. The bootstrap process from
 older version of current is a bit fragile.
 
+20150630:	p14	FreeBSD-EN-15:08.sendmail [revised]
+			FreeBSD-EN-15:09.xlocale
+			FreeBSD-EN-15:10.iconv
+
+	Improvements to sendmail TLS/DH interoperability. [EN-15:08]
+
+	Fix inconsistency between locale and rune locale states.
+	[EN-15:09]
+
+	Improved iconv(3) UTF-7 support. [EN-15:10]
+
 20150618:	p13	FreeBSD-EN-15:08.sendmail
 	Improvements to sendmail TLS/DH interoperability. [EN-15:08]
 

Modified: releng/10.1/contrib/sendmail/src/sendmail.h
==============================================================================
--- releng/10.1/contrib/sendmail/src/sendmail.h	Tue Jun 30 22:30:21 2015	(r284984)
+++ releng/10.1/contrib/sendmail/src/sendmail.h	Tue Jun 30 23:21:37 2015	(r284985)
@@ -1935,7 +1935,7 @@ struct termescape
 
 /* server requirements */
 #define TLS_I_SRV	(TLS_I_SRV_CERT | TLS_I_RSA_TMP | TLS_I_VRFY_PATH | \
-			 TLS_I_VRFY_LOC | TLS_I_TRY_DH | TLS_I_DH512 | \
+			 TLS_I_VRFY_LOC | TLS_I_TRY_DH | TLS_I_DH1024 | \
 			 TLS_I_CACHE)
 
 /* client requirements */

Modified: releng/10.1/lib/libc/locale/setrunelocale.c
==============================================================================
--- releng/10.1/lib/libc/locale/setrunelocale.c	Tue Jun 30 22:30:21 2015	(r284984)
+++ releng/10.1/lib/libc/locale/setrunelocale.c	Tue Jun 30 23:21:37 2015	(r284985)
@@ -202,6 +202,8 @@ __set_thread_rune_locale(locale_t loc)
 
 	if (loc == NULL) {
 		_ThreadRuneLocale = &_DefaultRuneLocale;
+	} else if (loc == LC_GLOBAL_LOCALE) {
+		_ThreadRuneLocale = 0;
 	} else {
 		_ThreadRuneLocale = XLOCALE_CTYPE(loc)->runes;
 	}

Modified: releng/10.1/lib/libc/locale/xlocale.c
==============================================================================
--- releng/10.1/lib/libc/locale/xlocale.c	Tue Jun 30 22:30:21 2015	(r284984)
+++ releng/10.1/lib/libc/locale/xlocale.c	Tue Jun 30 23:21:37 2015	(r284985)
@@ -154,23 +154,24 @@ __get_locale(void)
 static void
 set_thread_locale(locale_t loc)
 {
+	locale_t l = (loc == LC_GLOBAL_LOCALE) ? 0 : loc;
 
 	_once(&once_control, init_key);
 	
-	if (NULL != loc) {
-		xlocale_retain((struct xlocale_refcounted*)loc);
+	if (NULL != l) {
+		xlocale_retain((struct xlocale_refcounted*)l);
 	}
 	locale_t old = pthread_getspecific(locale_info_key);
-	if ((NULL != old) && (loc != old)) {
+	if ((NULL != old) && (l != old)) {
 		xlocale_release((struct xlocale_refcounted*)old);
 	}
 	if (fake_tls) {
-		thread_local_locale = loc;
+		thread_local_locale = l;
 	} else {
-		pthread_setspecific(locale_info_key, loc);
+		pthread_setspecific(locale_info_key, l);
 	}
 #ifndef __NO_TLS
-	__thread_locale = loc;
+	__thread_locale = l;
 	__set_thread_rune_locale(loc);
 #endif
 }
@@ -361,9 +362,6 @@ locale_t uselocale(locale_t loc)
 {
 	locale_t old = get_thread_locale();
 	if (NULL != loc) {
-		if (LC_GLOBAL_LOCALE == loc) {
-			loc = NULL;
-		}
 		set_thread_locale(loc);
 	}
 	return (old ? old : LC_GLOBAL_LOCALE);

Modified: releng/10.1/lib/libiconv_modules/UTF7/citrus_utf7.c
==============================================================================
--- releng/10.1/lib/libiconv_modules/UTF7/citrus_utf7.c	Tue Jun 30 22:30:21 2015	(r284984)
+++ releng/10.1/lib/libiconv_modules/UTF7/citrus_utf7.c	Tue Jun 30 23:21:37 2015	(r284985)
@@ -62,8 +62,7 @@ typedef struct {
 	unsigned int
 		mode: 1,	/* whether base64 mode */
 		bits: 4,	/* need to hold 0 - 15 */
-		cache: 22,	/* 22 = BASE64_BIT + UTF16_BIT */
-		surrogate: 1;	/* whether surrogate pair or not */
+		cache: 22;	/* 22 = BASE64_BIT + UTF16_BIT */
 	int chlen;
 	char ch[4]; /* BASE64_IN, 3 * 6 = 18, most closed to UTF16_BIT */
 } _UTF7State;
@@ -154,21 +153,17 @@ _citrus_UTF7_mbtoutf16(_UTF7EncodingInfo
     uint16_t * __restrict u16, const char ** __restrict s, size_t n,
     _UTF7State * __restrict psenc, size_t * __restrict nresult)
 {
-	_UTF7State sv;
 	const char *s0;
 	int done, i, len;
 
+	*nresult = 0;
 	s0 = *s;
-	sv = *psenc;
 
 	for (i = 0, done = 0; done == 0; i++) {
 		if (i == psenc->chlen) {
 			if (n-- < 1) {
 				*nresult = (size_t)-2;
 				*s = s0;
-				sv.chlen = psenc->chlen;
-				memcpy(sv.ch, psenc->ch, sizeof(sv.ch));
-				*psenc = sv;
 				return (0);
 			}
 			psenc->ch[psenc->chlen++] = *s0++;
@@ -257,34 +252,31 @@ _citrus_UTF7_mbrtowc_priv(_UTF7EncodingI
 		*nresult = (size_t)_ENCODING_IS_STATE_DEPENDENT;
 		return (0);
 	}
-	if (psenc->surrogate) {
-		hi = (psenc->cache >> psenc->bits) & UTF16_MAX;
-		if (hi < HISRG_MIN || hi > HISRG_MAX)
-			return (EINVAL);
-		siz = 0;
-	} else {
-		err = _citrus_UTF7_mbtoutf16(ei, &hi, s, n, psenc, &nr);
-		if (nr == (size_t)-1 || nr == (size_t)-2) {
-			*nresult = nr;
-			return (err);
-		}
-		if (err != 0)
-			return (err);
-		n -= nr;
-		siz = nr;
-		if (hi < HISRG_MIN || hi > HISRG_MAX) {
-			u32 = (uint32_t)hi;
-			goto done;
-		}
-		psenc->surrogate = 1;
+	err = _citrus_UTF7_mbtoutf16(ei, &hi, s, n, psenc, &nr);
+	if (nr == (size_t)-1 || nr == (size_t)-2) {
+		*nresult = nr;
+		return (err);
+	}
+	if (err != 0)
+		return (err);
+	n -= nr;
+	siz = nr;
+	if (hi < HISRG_MIN || hi > HISRG_MAX) {
+		u32 = (uint32_t)hi;
+		goto done;
 	}
 	err = _citrus_UTF7_mbtoutf16(ei, &lo, s, n, psenc, &nr);
 	if (nr == (size_t)-1 || nr == (size_t)-2) {
+		psenc->chlen = 1; /* make get_state_desc return incomplete */
 		*nresult = nr;
 		return (err);
 	}
 	if (err != 0)
 		return (err);
+	if (lo < LOSRG_MIN || lo > LOSRG_MAX) {
+		*nresult = (size_t)-1;
+		return (EILSEQ);
+	}
 	hi -= HISRG_MIN;
 	lo -= LOSRG_MIN;
 	u32 = (hi << 10 | lo) + SRG_BASE;
@@ -297,7 +289,6 @@ done:
 		_citrus_UTF7_init_state(ei, psenc);
 	} else {
 		*nresult = siz;
-		psenc->surrogate = 0;
 	}
 	return (err);
 }
@@ -396,7 +387,7 @@ _citrus_UTF7_put_state_reset(_UTF7Encodi
 {
 	int bits, pos;
 
-	if (psenc->chlen != 0 || psenc->bits > BASE64_BIT || psenc->surrogate)
+	if (psenc->chlen != 0 || psenc->bits > BASE64_BIT)
 		return (EINVAL);
 
 	if (psenc->mode) {

Modified: releng/10.1/sys/conf/newvers.sh
==============================================================================
--- releng/10.1/sys/conf/newvers.sh	Tue Jun 30 22:30:21 2015	(r284984)
+++ releng/10.1/sys/conf/newvers.sh	Tue Jun 30 23:21:37 2015	(r284985)
@@ -32,7 +32,7 @@
 
 TYPE="FreeBSD"
 REVISION="10.1"
-BRANCH="RELEASE-p13"
+BRANCH="RELEASE-p14"
 if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
 	BRANCH=${BRANCH_OVERRIDE}
 fi



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506302321.t5UNLciY098553>