import ports/sysutils/usmb; ok and readdir fix from syl@ (who also fixed

various fuse problems found in the course of porting/testing).


usmb lets you mount SMB shares as unprivileged users via FUSE, in the
vein of Windows' Map Network Drive facility. It differs from the other
FUSE SMB filesystems (fusesmb, SMB for FUSE) in that it doesn't have
Network Neighbourhood functionality: this means that you can mount
shares that you can't see via NetBIOS browsing.

(Note: unprivileged mounting requires both kern.usermount=1 and access
to /dev/fuse0).
This commit is contained in:
sthen 2014-06-05 15:40:09 +00:00
parent edb29ac731
commit 16bc27b856
6 changed files with 123 additions and 0 deletions

37
sysutils/usmb/Makefile Normal file
View File

@ -0,0 +1,37 @@
# $OpenBSD: Makefile,v 1.1.1.1 2014/06/05 15:40:09 sthen Exp $
COMMENT= mount SMB shares from userland via FUSE
DISTNAME= usmb-20130204
CATEGORIES= sysutils
HOMEPAGE= http://ametros.net/code.html
# GPLv3
PERMIT_PACKAGE_CDROM= Yes
WANTLIB += c fuse glib-2.0 lib/samba/smbclient xml2
# http://repo.or.cz/w/usmb.git/snapshot/aa94e132c12faf1a00f547ea4a96b5728612dea6.tar.gz
MASTER_SITES= http://spacehopper.org/mirrors/
MODULES= devel/gettext
BUILD_DEPENDS= textproc/gsed
LIB_DEPENDS= devel/glib2 \
net/samba \
textproc/libxml
SEPARATE_BUILD= Yes
USE_GMAKE= Yes
CONFIGURE_STYLE= gnu
CONFIGURE_ARGS+= --with-samba=${LOCALBASE}
NO_TEST= Yes
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/{doc,examples}/usmb/
${INSTALL_DATA} ${WRKSRC}/README ${PREFIX}/share/doc/usmb/
${INSTALL_DATA} ${WRKSRC}/usmb.conf ${PREFIX}/share/examples/usmb/
.include <bsd.port.mk>

2
sysutils/usmb/distinfo Normal file
View File

@ -0,0 +1,2 @@
SHA256 (usmb-20130204.tar.gz) = WUX2tQ1LrUNHOBnrRLs6GMntwTYYR/r87xeHgrUDJr8=
SIZE (usmb-20130204.tar.gz) = 129786

View File

@ -0,0 +1,30 @@
$OpenBSD: patch-Makefile_in,v 1.1.1.1 2014/06/05 15:40:09 sthen Exp $
--- Makefile.in.orig Mon Feb 4 19:32:17 2013
+++ Makefile.in Tue Jun 3 10:36:28 2014
@@ -22,7 +22,7 @@ prefix = ${DESTDIR}@prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
datarootdir = @datarootdir@
-mandir = @mandir@
+mandir = ${DESTDIR}@mandir@
man1dir = $(mandir)/man1
CFLAGS = @CFLAGS@ -I@srcdir@ -I@builddir@ -Werror
@@ -65,7 +65,7 @@ install-strip: STRIPFLAGS = -s
install install-strip: $(PROGRAM)
@MKDIR_P@ $(bindir) $(man1dir)
@INSTALL@ -m 755 $(STRIPFLAGS) $(PROGRAM) $(bindir)/
- @INSTALL@ -m 644 $(MANPAGE) $(man1dir)/
+ @INSTALL@ -m 644 @srcdir@/$(MANPAGE) $(man1dir)/
uninstall:
@@ -100,7 +100,7 @@ tar:
tar zcf $(PWD)/$(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION))
rm -rf $(STAGING)
-include debian/Makefile.pkgdeb
+include @srcdir@/debian/Makefile.pkgdeb
config.rng.h: @srcdir@/config.rng

View File

@ -0,0 +1,39 @@
$OpenBSD: patch-usmb_dir_c,v 1.1.1.1 2014/06/05 15:40:09 sthen Exp $
allow readdir to work.
--- usmb_dir.c.orig Mon Feb 4 20:32:17 2013
+++ usmb_dir.c Thu Jun 5 16:35:40 2014
@@ -30,6 +30,7 @@
#include "usmb.h"
#include "utils.h"
+#include <unistd.h>
int usmb_mkdir (const char *dirname, mode_t mode)
{
@@ -111,19 +112,21 @@ int usmb_readdir (const char *path, void *h, fuse_fill
while (NULL != (dirent = smbc_getFunctionReaddir (ctx_) (ctx_, file)))
{
struct stat stbuf;
+ memset(&stbuf, 0, sizeof(&stbuf));
+ stbuf.st_ino = arc4random();
switch (dirent->smbc_type)
{
case SMBC_DIR:
- stbuf.st_mode = DT_DIR << 12;
+ stbuf.st_mode = S_IFDIR;
break;
case SMBC_FILE:
- stbuf.st_mode = DT_REG << 12;
+ stbuf.st_mode = S_IFREG;
break;
case SMBC_LINK:
- stbuf.st_mode = DT_LNK << 12;
+ stbuf.st_mode = S_IFLNK;
break;
default:

8
sysutils/usmb/pkg/DESCR Normal file
View File

@ -0,0 +1,8 @@
usmb lets you mount SMB shares as unprivileged users via FUSE, in the
vein of Windows' Map Network Drive facility. It differs from the other
FUSE SMB filesystems (fusesmb, SMB for FUSE) in that it doesn't have
Network Neighbourhood functionality: this means that you can mount
shares that you can't see via NetBIOS browsing.
(Note: unprivileged mounting requires both kern.usermount=1 and access
to /dev/fuse0).

7
sysutils/usmb/pkg/PLIST Normal file
View File

@ -0,0 +1,7 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2014/06/05 15:40:09 sthen Exp $
@bin bin/usmb
share/doc/usmb/
share/doc/usmb/README
share/examples/usmb/
share/examples/usmb/usmb.conf
@man man/man1/usmb.1