From ce102ac2aed8def521f53e59c070ec011dd202c7 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Tue, 12 Nov 2013 15:09:28 +0000 Subject: [PATCH] Just disable recoding support in libsmb if built WITHOUT_ICONV. --- contrib/smbfs/lib/smb/nls.c | 29 +++++++++++++++++++++++++---- lib/libsmb/Makefile | 6 ++++++ 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/contrib/smbfs/lib/smb/nls.c b/contrib/smbfs/lib/smb/nls.c index 1637fa73c09c..5c2dbd9b48c4 100644 --- a/contrib/smbfs/lib/smb/nls.c +++ b/contrib/smbfs/lib/smb/nls.c @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include @@ -47,10 +46,16 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef HAVE_ICONV +#include +#endif + u_char nls_lower[256]; u_char nls_upper[256]; +#ifdef HAVE_ICONV static iconv_t nls_toext, nls_toloc; +#endif int nls_setlocale(const char *name) @@ -71,9 +76,7 @@ nls_setlocale(const char *name) int nls_setrecode(const char *local, const char *external) { -#ifdef APPLE - return ENOENT; -#else +#ifdef HAVE_ICONV iconv_t icd; if (nls_toext) @@ -93,12 +96,15 @@ nls_setrecode(const char *local, const char *external) } nls_toloc = icd; return 0; +#else + return ENOENT; #endif } char * nls_str_toloc(char *dst, const char *src) { +#ifdef HAVE_ICONV char *p = dst; size_t inlen, outlen; @@ -113,11 +119,15 @@ nls_str_toloc(char *dst, const char *src) } *p = 0; return dst; +#else + return strcpy(dst, src); +#endif } char * nls_str_toext(char *dst, const char *src) { +#ifdef HAVE_ICONV char *p = dst; size_t inlen, outlen; @@ -132,11 +142,15 @@ nls_str_toext(char *dst, const char *src) } *p = 0; return dst; +#else + return strcpy(dst, src); +#endif } void * nls_mem_toloc(void *dst, const void *src, int size) { +#ifdef HAVE_ICONV char *p = dst; const char *s = src; size_t inlen, outlen; @@ -154,11 +168,15 @@ nls_mem_toloc(void *dst, const void *src, int size) outlen--; } return dst; +#else + return memcpy(dst, src, size); +#endif } void * nls_mem_toext(void *dst, const void *src, int size) { +#ifdef HAVE_ICONV char *p = dst; const char *s = src; size_t inlen, outlen; @@ -177,6 +195,9 @@ nls_mem_toext(void *dst, const void *src, int size) outlen--; } return dst; +#else + return memcpy(dst, src, size); +#endif } char * diff --git a/lib/libsmb/Makefile b/lib/libsmb/Makefile index 3a9a64da9ec1..e464a8fd9875 100644 --- a/lib/libsmb/Makefile +++ b/lib/libsmb/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + CONTRIBDIR= ${.CURDIR}/../../contrib/smbfs .PATH: ${CONTRIBDIR}/lib/smb @@ -16,4 +18,8 @@ SRCS= rcfile.c ctx.c cfopt.c subr.c nls.c rap.c mbuf.c rq.c file.c \ WARNS?= 1 CFLAGS+= -DSMB_CFG_FILE=\"/etc/nsmb.conf\" -I${CONTRIBDIR}/include +.if ${MK_ICONV} != "no" +CFLAGS+= -DHAVE_ICONV=1 +.endif + .include