diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2018-07-14 21:03:06 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2018-07-14 21:03:06 +0100 |
commit | 8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch) | |
tree | 7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /app-mobilephone/sobexsrv/files | |
parent | 30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff) |
gentoo resync : 14.07.2018
Diffstat (limited to 'app-mobilephone/sobexsrv/files')
-rw-r--r-- | app-mobilephone/sobexsrv/files/conf.d_sobexsrv | 35 | ||||
-rw-r--r-- | app-mobilephone/sobexsrv/files/init.d_sobexsrv | 58 | ||||
-rw-r--r-- | app-mobilephone/sobexsrv/files/sobexsrv-1.0.1-openobex16.patch | 49 |
3 files changed, 142 insertions, 0 deletions
diff --git a/app-mobilephone/sobexsrv/files/conf.d_sobexsrv b/app-mobilephone/sobexsrv/files/conf.d_sobexsrv new file mode 100644 index 000000000000..1afdc0c772e3 --- /dev/null +++ b/app-mobilephone/sobexsrv/files/conf.d_sobexsrv @@ -0,0 +1,35 @@ +# /etc/conf.d/sobexsrv +# Config file for sobexsrv daemon + +# owner of sobexsrv process (don't change, must be existing) +USER="sobexsrv" +GROUP="sobexsrv" + +# Incomming of pushed files +INBOX="/var/spool/sobexsrv" + +# chroot to INBOX. +# *NEEDS* the binary to be suid root (not installed by default). +#CHROOT="yes" + +# Listen on the specified RFCOMM channel. If this option is not specified the +# first available channel will be used. Legal range for channel is 1-31 and 0 +# to force auto selection of first available channel. +CHANNEL="10" + +# Set Bluetooth security mode-2 level. Legal values are: 1 (insecure) every- +# body can connect, 2 authentication required and 3 authentication and encryp- +# tion required. +SECURITY_LEVEL="2" + +# Don't register OPUSH service at local ServiceDiscoveryProtocol Server. +#DISABLE_OPUSH="yes" +# Don't register OBEX-FTP service at local ServiceDiscoveryProtocol Server. +DISABLE_OBEXFTP="yes" +DISABLE_OBEXFTP_LISTING="yes" + +# Enable transfer log via syslog(8). +USE_SYSLOG="yes" + +# Additional options. See sobexsrv(8) +#SOBEXSRV_OPT="-l NPTD -m /etc/sobexsrv-mime" diff --git a/app-mobilephone/sobexsrv/files/init.d_sobexsrv b/app-mobilephone/sobexsrv/files/init.d_sobexsrv new file mode 100644 index 000000000000..e02530314ca8 --- /dev/null +++ b/app-mobilephone/sobexsrv/files/init.d_sobexsrv @@ -0,0 +1,58 @@ +#!/sbin/openrc-run +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +depend() { + need bluetooth + use logger +} + +check_config() { + if [ -z "${USER}" ] ; then + eerror "Please set \$USER in /etc/conf.d/sobexsrv!" + return 1 + fi + if [ -z "${GROUP}" ] ; then + eerror "Please set \$GROUP in /etc/conf.d/sobexsrv!" + return 1 + fi + + if [ ${CHROOT} = "yes" ] ; then + if [ ! -u /usr/bin/sobexsrv ] ; then + eerror "The \$CHROOT option requires /usr/bin/sobexsrv to be suid root!" + return 1 + fi + fi + + if [ -z "${INBOX}" ] || [ ! -e "${INBOX}" ] ; then + eerror "Please configure \$INBOX correctly in /etc/conf.d/sobexsrv!" + return 1 + fi +} + + +start() { + check_config || return 1 + + ebegin "Starting sobexsrv" + + OPTIONS="" + [ -n "${CHANNEL}" ] && OPTIONS="${OPTIONS} -c ${CHANNEL}" + [ -n "${SECURITY_LEVEL}" ] && OPTIONS="${OPTIONS} -s ${SECURITY_LEVEL}" + [ "${CHROOT}" = "yes" ] && OPTIONS="${OPTIONS} -R" + [ "${DISABLE_OPUSH}" = "yes" ] && OPTIONS="${OPTIONS} -o" + [ "${DISABLE_OBEXFTP}" = "yes" ] && OPTIONS="${OPTIONS} -f" + [ "${DISABLE_OBEXFTP_LISTING}" = "yes" ] && OPTIONS="${OPTIONS} -F" + [ "${USE_SYSLOG}" = "yes" ] && OPTIONS="${OPTIONS} -S" + + OPTIONS="-I -r ${INBOX} ${OPTIONS} ${SOBEXSRV_OPT}" + + start-stop-daemon --chuid ${USER}:${GROUP} --start --quiet --exec /usr/bin/sobexsrv -- $OPTIONS + eend $? +} + +stop() { + ebegin "Stopping sobexsrv" + start-stop-daemon --stop --quiet --exec /usr/bin/sobexsrv + eend $? +} diff --git a/app-mobilephone/sobexsrv/files/sobexsrv-1.0.1-openobex16.patch b/app-mobilephone/sobexsrv/files/sobexsrv-1.0.1-openobex16.patch new file mode 100644 index 000000000000..57fff87e4d2b --- /dev/null +++ b/app-mobilephone/sobexsrv/files/sobexsrv-1.0.1-openobex16.patch @@ -0,0 +1,49 @@ +--- sobexsrv-1.0.1/src/obexsrv.c.orig 2016-06-13 01:59:28.000000000 +0300 ++++ sobexsrv-1.0.1/src/obexsrv.c 2016-06-13 12:20:15.501101147 +0300 +@@ -32,6 +32,10 @@ + #include <langinfo.h> + #include <assert.h> + ++#if ((OPENOBEX_VERSION_MAJOR==1) && (OPENOBEX_VERSION_MINOR>=6)) ++#include <string.h> ++#endif ++ + #include "obexsrv.h" + #include "util.h" + #include "sdp.h" +@@ -46,7 +50,8 @@ + + void UnicodeToChar(uint8_t *c, const uint8_t *uc, int size) + { +- iconv_t dsc = iconv_open(nl_langinfo(CODESET),"UTF16BE"); ++ char *lang = nl_langinfo(CODESET); ++ iconv_t dsc = iconv_open(lang,"UTF16BE"); + size_t isiz,osiz; + char *ip = (char*)uc; + char *op = (char*)c; +@@ -54,7 +59,25 @@ + + if (iconv(dsc,&ip,&isiz,&op,&osiz) == -1) { + debug_printf("iconv: error %s\n", strerror(errno)); ++#if ((OPENOBEX_VERSION_MAJOR==1) && (OPENOBEX_VERSION_MINOR>=6)) ++ // try to convert ignoring errors ++ iconv_close(dsc); ++ debug_printf("iconv: characters that cannot be converted will be discarded\n"); ++ ++ // append "//IGNORE" ++ const char *const suf = "//IGNORE"; ++ size_t len = strlen(lang); ++ char *cd = malloc(len + 9); ++ memcpy(cd, lang, len); ++ memcpy(cd+len, suf, 8); ++ cd[len+8] = '\0'; ++ ++ dsc = iconv_open(cd,"UTF16BE"); ++ iconv(dsc,&ip,&isiz,&op,&osiz); ++ free(cd); ++#else + OBEX_UnicodeToChar(c,uc,size); ++#endif + } + iconv_close(dsc); + } |