Attaching a patch which seems to work for me.
--- usmb-20090411.orig/usmb.conf
+++ usmb-20090411/usmb.conf
@@ -45,7 +45,8 @@
   <mount id="home" credentials="cred1">
     <server>192.168.0.5</server>
     <share>myshare</share>
-    <mountpoint>/tmp/smb</mountpoint>
+    <!--  Mount in ${HOME}/smb -->
+    <mountpoint>~/smb</mountpoint>
   </mount>
 
   <mount id="music" credentials="cred2">
--- usmb-20090411.orig/usmb.1.txt
+++ usmb-20090411/usmb.1.txt
@@ -0,0 +1,68 @@
+USMB(1)
+=======
+Geoff Johnstone
+
+
+NAME
+----
+
+usmb - mount SMB/CIFS shares via FUSE
+
+SYNOPSIS
+--------
+
+*usmb* [OPTION...]
+
+DESCRIPTION
+-----------
+
+usmb allows mounting Samba (CIFS) shares through FUSE.
+
+
+Unlike some other Samba FUSE implementation usmb can mount shares from any
+server, including serrvers and shares not visible in "Network neighbourhood"
+(not advertised on the local lan.
+
+The share, user name and other details are specified in a configuration file.
+An example configuration file is included in '/usr/share/doc/usmb/usmb.conf'
+
+A more complete documentation is included in '/usr/share/doc/usmb/README'
+
+OPTIONS
+-------
+
+*-c 'configuration file'*::
+*--config='configuration file'*::
+    Specify configuration file to use
+
+*-d*::
+*--debug*::
+    Debug mode
+
+*-f*::
+*--nofork*::
+    Do not fork, stay in foreground
+
+*-h*::
+*--help*::
+    Show options
+
+FILES
+-----
+*'~/.usmb.conf'*::
+  The default location of usmb configuration file.
+
+SEE ALSO
+--------
+'/usr/share/doc/usmb/README' '/usr/share/doc/usmb.conf' *fusermount*(1)
+
+
+AUTHORS
+-------
+ usmb was written by Geoff Johnstone
+ This minimal manpage was written by Michal Suchanek <[email protected]>
+
+COPYING
+-------
+Free use of this software is granted under the terms of the GNU General Public
+License (GPL).
--- usmb-20090411.orig/conffile.c
+++ usmb-20090411/conffile.c
@@ -124,8 +124,11 @@
 {
   xmlDocPtr doc;
   xmlXPathContextPtr ctx;
-  char xp[2048];
   char *creds = NULL;
+  char *xp = NULL;
+  char *mount_format = "/usmbconfig/mou...@id='%s']";
+  char *cred_format = "/usmbconfig/credentia...@id='%s']";
+  char *_ = NULL;
 
   *server = *share = *mountpoint = *options = NULL;
   *domain = *username = *password = NULL;
@@ -140,13 +143,52 @@
     return false;
 
   do {
+    xp = malloc(strlen(mount_format) + strlen(key));
+    if (!xp) {
+      fputs ("Out of memory.\n", stderr);
+      break;
+    }
+    sprintf (xp, mount_format, key);
+    if (!xml_xpath_attr_value (ctx, xp, "id", &_)) {
+      fprintf(stderr, "Configuration for %s not found.\n", key);
+      break;
+    }
+
     if (!do_xpath_text (ctx, "mount", key, "server", server)) break;
     if (!do_xpath_text (ctx, "mount", key, "share", share)) break;
     if (!do_xpath_text (ctx, "mount", key, "mountpoint", mountpoint)) break;
+    if ((**mountpoint == '~') && (*(*mountpoint + 1) == '/')) {
+      char * home = getenv("HOME");
+      char * newmount;
+      if (!home) {
+        fputs ("Mountpoint starts with ~/ and HOME is not set.\n", stderr);
+        break;
+      }
+      newmount = malloc(strlen(*mountpoint) + strlen(home));
+      if (!newmount) {
+        fputs ("Out of memory.\n", stderr);
+        break;
+      }
+      strcpy(newmount, home);
+      strcpy(newmount + strlen(home), *mountpoint + 1);
+      xfree(*mountpoint);
+      *mountpoint = newmount;
+    }
     (void)do_xpath_text (ctx, "mount", key, "options", options);
 
-    snprintf (xp, sizeof (xp), "/usmbconfig/mou...@id='%s']", key);
     if (!xml_xpath_attr_value (ctx, xp, "credentials", &creds)) break;
+    xfree(xp);
+    xfree(_);
+    xp = malloc(strlen(cred_format) + strlen(key));
+    if (!xp) {
+      fputs ("Out of memory.\n", stderr);
+      break;
+    }
+    sprintf (xp, cred_format, creds);
+    if (!xml_xpath_attr_value (ctx, xp, "id", &_)) {
+      fprintf(stderr, "Credentials %s not found.\n", creds);
+      break;
+    }
 
     (void)do_xpath_text (ctx, "credentials", creds, "domain", domain);
     if (!do_xpath_text (ctx, "credentials", creds, "username", username)) break;
@@ -167,6 +209,8 @@
   clear_and_free (*password);
   xfree (*domain);
   xfree (creds);
+  xfree (xp);
+  xfree (_);
   xfree (*options);
   xfree (*mountpoint);
   xfree (*share);
@@ -177,4 +221,3 @@
 
   return false;
 }
-
--- usmb-20090411.orig/Makefile.in
+++ usmb-20090411/Makefile.in
@@ -18,9 +18,11 @@
 
 CC = @CC@
 
-prefix = @prefix@
+prefix = ${destd...@prefix@
 exec_prefix = @exec_prefix@
 bindir = @bindir@
+mandir = @mandir@
+man1dir = @mandir@/man1
 
 CFLAGS = @CFLAGS@ -...@srcdir@ -...@builddir@
 LDFLAGS = @LDFLAGS@
@@ -34,16 +36,21 @@
 OBJECTS = $(SOURCES:.c=.o)
 
 PROGRAM = @PACKAGE_NAME@
+MAN = @[email protected]
 
 
-all: $(PROGRAM)
+all: $(PROGRAM) $(MAN)
 
 $(PROGRAM): $(OBJECTS)
 	$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
 
+%.1: %.1.txt
+	a2x -f manpage $<
+
 
 clean:
 	$(RM) $(PROGRAM) $(OBJECTS)
+	$(RM) $(MAN) $(MAN).xml
 
 
 distclean: clean
@@ -58,12 +65,16 @@
 install-strip: STRIPFLAGS = -s
 install install-strip: $(PROGRAM)
 	@MKDIR_P@ $(bindir)
+	@MKDIR_P@ $(man1dir)
 	@INSTALL@ -m 755 $(STRIPFLAGS) $(PROGRAM) $(bindir)/
+	@INSTALL@ -m 644 $(MAN) $(man1dir)/
 
 
 uninstall:
 	$(RM) $(bindir)/$(PROGRAM)
+	$(RM) $(man1dir)/$(MAN)
 	rmdir -p $(bindir)
+	rmdir -p $(man1dir)
 	@echo Please delete ~/.usmb.conf manually.
 
 
--- usmb-20090411.orig/debian/compat
+++ usmb-20090411/debian/compat
@@ -0,0 +1 @@
+7
--- usmb-20090411.orig/debian/changelog
+++ usmb-20090411/debian/changelog
@@ -0,0 +1,5 @@
+usmb (20090411-1) UNRELEASED; urgency=low
+
+  * Initial release. (Closes: #572703)
+
+ -- Michal Suchanek <[email protected]>  Wed, 10 Mar 2010 11:59:09 +0100
--- usmb-20090411.orig/debian/control
+++ usmb-20090411/debian/control
@@ -0,0 +1,30 @@
+Source: usmb
+Section: otherosfs
+Priority: optional
+Build-Depends:
+ debhelper,
+ dpkg-dev,
+ quilt,
+ libfuse-dev (>> 2.6),
+ libsmbclient-dev (>> 3 ),
+ libxml2-dev,
+ pkg-config,
+ libglib2.0-dev,
+ asciidoc,
+ xmlto,
+Standards-Version: 3.8.4
+Maintainer: Michal Suchanek <[email protected]>
+
+Package: usmb
+Recommends: fuse-utils
+Architecture: any
+Depends:
+ ${shlibs:Depends},
+ ${misc:Depends},
+Description: samba (CIFS) FUSE module
+ usmb mounts samba (cifs, windows, netbios) shares just like smbfs does,
+ only usmb uses FUSE allowing uses other than root to mount shares.
+ .
+ Previously smbsf allowed the same by making mount.cifs suid root but
+ this was recently disabled in the smbfs package due to security
+ concerns.
--- usmb-20090411.orig/debian/usmb.docs
+++ usmb-20090411/debian/usmb.docs
@@ -0,0 +1,3 @@
+README
+Changelog
+usmb.conf
--- usmb-20090411.orig/debian/rules
+++ usmb-20090411/debian/rules
@@ -0,0 +1,3 @@
+#!/usr/bin/make -f
+%:
+	dh $@

Reply via email to