diff options
Diffstat (limited to 'app-mobilephone/sobexsrv')
-rw-r--r-- | app-mobilephone/sobexsrv/Manifest | 7 | ||||
-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 | ||||
-rw-r--r-- | app-mobilephone/sobexsrv/metadata.xml | 21 | ||||
-rw-r--r-- | app-mobilephone/sobexsrv/sobexsrv-1.0.1-r1.ebuild | 93 |
6 files changed, 263 insertions, 0 deletions
diff --git a/app-mobilephone/sobexsrv/Manifest b/app-mobilephone/sobexsrv/Manifest new file mode 100644 index 000000000000..c72980197f28 --- /dev/null +++ b/app-mobilephone/sobexsrv/Manifest @@ -0,0 +1,7 @@ +AUX conf.d_sobexsrv 1095 BLAKE2B 858ca7030f7809c7eabc1ccd5b856b010a79bc693ef279232ecafa07ccfd99006a72190785308c27c6cd6d9f0422c1fb252e4e85ccb1be11c7445aad59cd2c9e SHA512 c38b6105826208c72392b7e781831ec28e93c60ba63f95e6042c3de9a3097af1e370ccdb832f1993b6e85a0224180b36a92ba97cf9af8a606044a61d9ddf7a05 +AUX init.d_sobexsrv 1473 BLAKE2B f5ed1fccc6de4419a62185fee1460b2acbd101602c09b516c7944a84507f84912b4a493dd9483611ecafbb6ee5083300ba6bf5354e7645240759845c102d6a1f SHA512 0ab5c6020af3c8de1e7f302f1f9b1fb6c8d9f6ef8518f878c48ee396032aa96f2da148e197655a1235a072abf30767e3db8047d0c9c6d7d3606bf9ad30398ec4 +AUX sobexsrv-1.0.1-openobex16.patch 1346 BLAKE2B ec63105eb6db6fd959044134fd66b8b3018093a5efec4b6b6b63c45d9bcca84c678addc56bfefaad0fca1696c148107513a1640473cb37f5320c2fab9a623ded SHA512 a1db1a916c0c2f6f237a4434bf1f11b0b6f540ad62fa9687d886e4ff97f6bb916be7763a24bdc56bf8fd3334ead426e0ed2003c0208c3c743f49b13b2bf8ab2a +DIST sobexsrv-1.0.1-fix64.patch 25040 BLAKE2B 9796779fdde39c79371a978d4bdb9d6761f9467ecc353096c3d1b13fe1d5aa4f7ceef137d07c52467a175b7bc756e6c747a2800a2dbb2dcd281be463499106c9 SHA512 9d555bee8d03c13061bbe132df6442daa4d8817ef713e92e5150b1994af110c5b01b34f8bcc1c3ae734529e36bb70f56976ab261f860e95e3de3ffe440a7b393 +DIST sobexsrv-1.0.1.tar.gz 27683 BLAKE2B f1aa103aa8a70ea7408ced7b0a3944d0ba61dc9750425160ee95bb69e1f1cf4479fbecef7be3ba4b6cbec2a7f518bed18318ca694545a4606888e7663adb0d38 SHA512 52fe5eff812596caa1f4b8579740ce8b2591db17950d68c093cfdb33ca5b899bfc5c142594843948a29ae0b1bdbe4499a1e24c270c92e61d02fd07a02d9d40cd +EBUILD sobexsrv-1.0.1-r1.ebuild 1997 BLAKE2B ff1f1ee9b4e2f151744a4e85564c03109871af976c472c454d67db26564d4de199a3e8aac34552e081df3c8f85e0dba75ca7b9cfdb13e1aa6d905967b58c01b5 SHA512 c6df47e37562c499f5fcdc362d463ab008af8743f0dce91ab77f1260a51041f22c5010f45d895fd19b523cef3e27af101e05e46e3ff3a6df7bc0a65b3b4add28 +MISC metadata.xml 920 BLAKE2B ac1ea1fc1f85d7dd43c548d89ef3473bb5b78f2e3ab4275c28db702865e492261db1ab908496661ebda406771d7d8080e9057bed865b703b9920ee86b48c8b34 SHA512 30b149f3e197dc0a45cd27a618a0dcc6c9968dae44576c47dd6ebdedda06d5fed8b03ae1e0f94133804551366a90a97614d5d5eca334dbdabd4398278645aab9 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); + } diff --git a/app-mobilephone/sobexsrv/metadata.xml b/app-mobilephone/sobexsrv/metadata.xml new file mode 100644 index 000000000000..99bdbeccf4c8 --- /dev/null +++ b/app-mobilephone/sobexsrv/metadata.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>bircoph@gentoo.org</email> + <name>Andrew Savchenko</name> + </maintainer> + <longdescription> + sobexsrv is a Bluetooth OBEX server with Bluetooth Security + Mode-2 (application triggered security) support. It implements + OPUSH (put), OPULL (get) and OBEX-FTP (setpath + directory + listing) and therefore is a full OBEX server. Further it + supports pulling generic mime-types and provides a capability + object. sobexsrv was designed with flexibility and security in + mind and supports chroot (if suid root drop to calling uid + immediately). For flexibility a scripting interface provides + access to all functionalities of the server and therefore + allows implementation of further OBEX services on top of + sobexsrv. + </longdescription> +</pkgmetadata> diff --git a/app-mobilephone/sobexsrv/sobexsrv-1.0.1-r1.ebuild b/app-mobilephone/sobexsrv/sobexsrv-1.0.1-r1.ebuild new file mode 100644 index 000000000000..14cde193148e --- /dev/null +++ b/app-mobilephone/sobexsrv/sobexsrv-1.0.1-r1.ebuild @@ -0,0 +1,93 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 +PYTHON_COMPAT=( python2_7 ) + +inherit python-single-r1 toolchain-funcs user + +MY_P="${P/_pre/pre}" + +DESCRIPTION="Scripting/Secure OBEX Server (for BlueZ Linux)" +SRC_URI="http://www.mulliner.org/bluetooth/${MY_P}.tar.gz + https://dev.gentoo.org/~joker/${P}-fix64.patch" +HOMEPAGE="http://www.mulliner.org/bluetooth/sobexsrv.php" + +SLOT="0" +LICENSE="GPL-2" +KEYWORDS="amd64 ppc x86" +IUSE="gtk" + +DEPEND=" + dev-libs/openobex + net-wireless/bluez + gtk? ( ${PYTHON_DEPS} )" +RDEPEND="${DEPEND} + gtk? ( + ${PYTHON_DEPS} + >=dev-python/pygtk-2.2 + )" +REQUIRED_USE=" + gtk? ( ${PYTHON_REQUIRED_USE} )" + +S="${WORKDIR}/${MY_P}" + +PATCHES=( + "${DISTDIR}/${P}"-fix64.patch + "${FILESDIR}/${P}"-openobex16.patch +) + +pkg_setup() { + use gtk && python-single-r1_pkg_setup + + enewgroup sobexsrv + enewuser sobexsrv -1 -1 /var/spool/sobexsrv sobexsrv +} + +src_prepare() { + default + + sed -e 's:/usr/man/man8:/usr/share/man/man8:' \ + -e 's/install: all/install:/' \ + -i Makefile || die + + sed -e 's/^CFLAGS =/CFLAGS +=/' \ + -e 's/^CC =/CC ?=/' \ + -e 's/$(CC) $(CFLAGS)/$(CC) $(LDFLAGS) $(CFLAGS)/' \ + -i src/Makefile || die +} + +src_compile() { + tc-export CC + emake -C src +} + +src_install() { + default + dodoc AUTHOR CONFIG SECURITY THANKS + + if use gtk; then + python_doscript "${D}/usr/bin/sobexsrv_handler" + newdoc "${S}/scripts/test" sobexsrv_handler.sample_script + else + rm "${D}/usr/bin/sobexsrv_handler" || die + fi + + newinitd "${FILESDIR}/init.d_sobexsrv" sobexsrv + newconfd "${FILESDIR}/conf.d_sobexsrv" sobexsrv + + keepdir /var/spool/sobexsrv + fowners sobexsrv:sobexsrv /var/spool/sobexsrv +} + +pkg_postinst() { + elog + elog "/usr/bin/sobexsrv is *NOT* installed set-uid root by" + elog "default. suid is required for the chroot option (-R)." + elog + elog "Execute the following commands to enable suid:" + elog + elog "chown root:sobexsrv /usr/bin/sobexsrv" + elog "chmod 4710 /usr/bin/sobexsrv" + elog +} |