[Midnightbsd-cvs] mports: mports/net: Allows you to mount windows shares on UNIX hosts.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Fri May 30 16:50:08 EDT 2008


Log Message:
-----------
Allows you to mount windows shares on UNIX hosts.  I used to use this on OS X before it supported smbfs (10.1?) and on NetBSD (sparc).

Modified Files:
--------------
    mports/net:
        Makefile (r1.69 -> r1.70)

Added Files:
-----------
    mports/net/sharity-light:
        Makefile (r1.1)
        distinfo (r1.1)
        pkg-descr (r1.1)
    mports/net/sharity-light/files:
        Makefile.unshlight (r1.1)
        patch-aa (r1.1)
        patch-ad (r1.1)
        patch-ae (r1.1)
        patch-getenv (r1.1)
        unshlight.c (r1.1)

-------------- next part --------------
--- /dev/null
+++ net/sharity-light/pkg-descr
@@ -0,0 +1,14 @@
+If you want a short description of what Sharity-Light can do for you: you can 
+mount volumes exported by Windows or related operating systems on your Unix 
+machine. For a more detailed description I will quote from the README file:
+
+What does Sharity-Light do?
+===========================
+If you know smbfs for Linux: Sharity-Light is roughly the same. It is
+derived from smbfs, but runs as a user level program, not in the kernel.
+If you know samba: Sharity-Light is roughly the opposite: a client for the
+Lanmanager protocol. If you know neither of these: Sharity-Light lets you
+mount drives exported by Windows (f.Workgroups/95/NT), Lan Manager, OS/2
+etc. on Unix machines.
+
+WWW: http://www.obdev.at/products/index.html
--- /dev/null
+++ net/sharity-light/Makefile
@@ -0,0 +1,41 @@
+# New ports collection makefile for:	sharity-light
+# Date created:		May 30, 2008
+# Whom:			Lucas Holt <luke at Midnightbsd.org>
+#
+# $MidnightBSD: mports/net/sharity-light/Makefile,v 1.1 2008/05/30 20:50:05 laffer1 Exp $
+#
+
+PORTNAME=	sharity-light
+PORTVERSION=	1.3
+CATEGORIES=	net
+MASTER_SITES=	http://www.obdev.at/ftp/pub/Products/Sharity-Light/
+DISTNAME=	Sharity-Light.1.3
+
+MAINTAINER=	ports at MidnightBSD.org
+COMMENT=	An userland smbfs --- SMB to NFS protocols converter
+LICENSE=	gpl2
+
+MAN8=		smbmount.8
+
+PLIST_FILES=	sbin/shlight sbin/unshlight
+PORTDOCS=	*
+
+post-extract:
+	@${MKDIR} ${WRKDIR}/unshlight
+	@${CP} ${FILESDIR}/unshlight.c ${WRKDIR}/unshlight
+	@${CP} ${FILESDIR}/Makefile.unshlight ${WRKDIR}/unshlight/Makefile
+
+post-build:
+	cd ${WRKDIR}/unshlight && make
+
+do-install:
+	${INSTALL_PROGRAM} ${WRKSRC}/shlight ${PREFIX}/sbin
+	${INSTALL_PROGRAM} ${WRKDIR}/unshlight/unshlight ${PREFIX}/sbin
+.if !defined(NOPORTDOCS)
+	${MKDIR} ${DOCSDIR}
+	${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}/README
+	${INSTALL_DATA} ${WRKSRC}/FAQ.txt ${DOCSDIR}/FAQ
+.endif
+	${INSTALL_MAN} ${WRKSRC}/smbmount.8 ${PREFIX}/man/man8
+
+.include <bsd.port.mk>
--- /dev/null
+++ net/sharity-light/distinfo
@@ -0,0 +1,3 @@
+MD5 (Sharity-Light.1.3.tar.gz) = 13249f332ff0b7124b669c5b61cc3293
+SHA256 (Sharity-Light.1.3.tar.gz) = 01239ad9a81867f2c08d2306af6165f81aeea9b1a34bea368f46303555d76811
+SIZE (Sharity-Light.1.3.tar.gz) = 78504
Index: Makefile
===================================================================
RCS file: /home/cvs/mports/net/Makefile,v
retrieving revision 1.69
retrieving revision 1.70
diff -L net/Makefile -L net/Makefile -u -r1.69 -r1.70
--- net/Makefile
+++ net/Makefile
@@ -65,6 +65,7 @@
     SUBDIR += samba4wins
     SUBDIR += sambasentinel
     SUBDIR += sdl_net
+    SUBDIR += sharity-light
     SUBDIR += skype
     SUBDIR += tsocks
     SUBDIR += ulxmlrpcpp
--- /dev/null
+++ net/sharity-light/files/Makefile.unshlight
@@ -0,0 +1,4 @@
+PROG=unshlight
+NOMAN=sorry
+
+.include <bsd.prog.mk>
--- /dev/null
+++ net/sharity-light/files/patch-getenv
@@ -0,0 +1,74 @@
+--- rumba.c.orig	Tue Jun 11 11:27:59 2002
++++ rumba.c	Tue Jun 11 13:32:39 2002
+@@ -24,6 +24,8 @@
+ 
+ /* ------------------------------------------------------------------------- */
+ 
++#define	NAMESIZE 64
++
+ int		debug_mode = 0;
+ char	fake_dot_in_root = 1;
+ char	fake_dotdot_in_root = 1;
+@@ -260,7 +262,7 @@
+ int				got_password, upcase_password;
+ int				port = -1, max_xmit = -1;
+ char			server_name[17], client_name[17];
+-char			username[64], password[64], run_as_daemon;
++char			username[NAMESIZE], password[NAMESIZE], run_as_daemon;
+ char			*mount_point, *server, *share, *root, *user_dummy, *p;
+ static fh_t		root_fh[32/sizeof(fh_t)] = {0};
+ unsigned		ipAddr;
+@@ -320,12 +322,17 @@
+ 			strcpy(server_name, hostName);
+ 		}
+ 	}
++
+ 	if(getenv("USER")){
+-		strcpy(username, getenv("USER"));
++		if (strlcpy(username, getenv("USER"), NAMESIZE) >= NAMESIZE)
++			eprintf("$USER too long, truncated to \"%s\"\n",
++			    username);
+ 		str_upper(username);
+ 	}
+-	if(username[0] == 0 && getenv("LOGNAME")){
+-		strcpy(username,getenv("LOGNAME"));
++	else if(getenv("LOGNAME")){
++		if (strlcpy(username, getenv("LOGNAME"), NAMESIZE) >= NAMESIZE);
++			eprintf("$LOGNAME too long, truncated to \"%s\"\n",
++			    username);
+ 		str_upper(username);
+ 	}
+ 
+@@ -415,7 +422,7 @@
+ 			got_password = 1;
+ 			break;
+ 		case 'i':
+-			if(fgets(password, sizeof(password), stdin) != NULL){
++			if(fgets(password, NAMESIZE, stdin) != NULL){
+ 				if((p = strrchr(password, '\n')) != NULL)
+ 					*p = 0;
+ 				got_password = 1;
+@@ -462,13 +469,18 @@
+ 		conf_dirmode = conf_filemode;
+ 		conf_dirmode |= (conf_dirmode & 0444) >> 2;
+ 	}
++
+ 	if(!got_password){
+-		char *pw;
+-		if((pw = getenv("PASSWD")))
+-			strcpy(password, pw);
+-		else
+-			strcpy(password, getpass("Password: "));
++		char *pw, *src = "$PASSWD";
++		if ((pw = getenv("PASSWD")) == NULL) {
++			src = "User entered password";
++			pw = getpass("Password: ");
++		}
++		if (strlcpy(password, pw, NAMESIZE) >= NAMESIZE)
++			eprintf("%s too long, truncated to \"%s\"\n",
++			    src, password);
+ 	}
++
+ 	if(upcase_password){
+ 		str_upper(password);
+ 	}
--- /dev/null
+++ net/sharity-light/files/patch-ae
@@ -0,0 +1,49 @@
+--- nfs/syscalls.c.orig	Tue Jun 30 14:24:56 1998
++++ nfs/syscalls.c	Sat May  1 14:30:02 2004
+@@ -12,8 +12,10 @@
+ #define NFSCLIENT
+ #include "syshdr.h"
+ #include <rpc/rpc.h>
+-#if !(defined HP || defined IRIX)
++#if !(defined HP || defined IRIX || __FreeBSD_version >= 501113) 
+ #include "nfs_prot.h"
++#else
++#include <nfs/nfsproto.h>
+ #endif
+ #include <netdb.h>
+ #include <arpa/inet.h>
+@@ -56,7 +58,16 @@
+ #define NFSX_V2FH 32
+ #ifdef BSD4_4_LITE2
+ #	include <nfs/rpcv2.h>
+-#	include <nfs/nfs.h>
++#	if (__FreeBSD_version >= 500024)
++#
++#		/* XXX __FreeBSD_version 500024 is the closest we have to the
++#		   NFS reorganization that took place 2001-09-18. This leaves
++#		   a 2 week window. */
++#
++#		include <nfsclient/nfs.h>
++#	else
++#		include <nfs/nfs.h>
++#	endif
+ #endif
+ int	syscall_mount(char *dir, void *root_fh, int sock_fd,
+ 									struct sockaddr_in *socket, char *mntfrom)
+@@ -103,6 +114,8 @@
+ #		define VFCERROR		!vfc
+ #		define VFCNFSNAME	vfc->vfc_index
+ #	endif
++
++#if __FreeBSD_version < 502111
+ 	GETVFSBYNAME;
+ 	if (VFCERROR && vfsisloadable("nfs")) {
+ 		if(vfsload("nfs"))
+@@ -112,6 +125,7 @@
+ 	}
+ 	if (VFCERROR)
+ 		return -1;
++#endif
+ 	return mount(VFCNFSNAME, dir, 0, &nfs_args);
+ #else	/* __FreeBSD__ */
+ 	return mount(NFSNAME, dir, 0, &nfs_args);
--- /dev/null
+++ net/sharity-light/files/patch-ad
@@ -0,0 +1,49 @@
+--- Makefile.orig	Tue Nov 24 05:52:13 1998
++++ Makefile	Sat Jul 24 23:04:14 1999
+@@ -12,11 +12,11 @@
+ ##############################################################################
+ 
+ # For NEXTSTEP/OPENSTEP:
+-CFLAGS = -Wall -O2 -traditional-cpp -g
++#CFLAGS = -Wall -O2 -traditional-cpp -g
+ # put your architecture here:
+-ARCH = -arch i386
+-THE_CC = cc
+-RPC_WARNFLAGS = -Wno-unused -Wno-switch -Wno-uninitialized
++#ARCH = -arch i386
++#THE_CC = cc
++#RPC_WARNFLAGS = -Wno-unused -Wno-switch -Wno-uninitialized
+ 
+ # For Linux: (use static linking because of libc5/libc6 troubles)
+ #CFLAGS = -Wall -O2 -g
+@@ -24,9 +24,9 @@
+ #RPC_WARNFLAGS = -Wno-unused -Wno-switch -Wno-uninitialized
+ 
+ # For FreeBSD
+-#CFLAGS = -Wall -O2
+-#THE_CC = cc
+-#RPC_WARNFLAGS = -Wno-unused -Wno-switch -Wno-uninitialized
++CFLAGS += -Wall
++THE_CC := $(CC)
++RPC_WARNFLAGS = -Wno-unused -Wno-switch -Wno-uninitialized
+ 
+ # For NetBsd
+ #CFLAGS = -Wall -O2 -DNETBSD
+@@ -66,7 +66,7 @@
+ OFILES = proc.o sock.o rumba.o psinode.o kernel.o smb_abstraction.o fo_nfs.o
+ 
+ .c.o:
+-	$(CC) $(CFLAGS) $(ARCH) -c -o $*.o $<
++	$(CC) $(CFLAGS) -c -o $*.o $<
+ 
+ all: $(NAME)
+ 
+@@ -74,7 +74,7 @@
+ 	(cd nfs; $(MAKE) "CFLAGS=$(CFLAGS)" "CC=$(THE_CC)" "ARCH=$(ARCH)" "RPC_WARNFLAGS=$(RPC_WARNFLAGS)")
+ 
+ $(NAME): $(OFILES) nfs_dir
+-	$(CC) $(LDFLAGS) $(ARCH) -o $(NAME) $(OFILES) nfs/nfs.o $(LIBS)
++	$(CC) $(LDFLAGS) -o $(NAME) $(OFILES) nfs/nfs.o $(LIBS)
+ 
+ clean:
+ 	rm -f $(OFILES)
--- /dev/null
+++ net/sharity-light/files/unshlight.c
@@ -0,0 +1,77 @@
+#include <sys/param.h>
+#include <sys/mount.h>
+
+#include <err.h>
+#include <sysexits.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <signal.h>
+
+static void usage(void);
+
+int
+main(int argc, char** argv)
+{
+	struct statfs* mntbuf;
+	int mntcount, i;
+	int aflag=0;
+	int ch;
+	
+	while ( (ch = getopt(argc, argv, "a")) != -1) {
+		switch (ch) {
+		case 'a':
+			aflag=1;
+			break;
+		case '?':
+		default:
+			usage();
+		}
+	}
+	argc -= optind;
+	argv += optind;
+	if (aflag && argc != 0)
+		usage();
+	if (!aflag && argc == 0)
+		usage();
+
+	for (; argc>0 || aflag; aflag?(void)(aflag=0):(void)(argc--, argv++)) {
+		char abspath[MAXPATHLEN];
+		pid_t pid=0;
+		if (argc > 0) {
+			if (realpath(argv[0], abspath) == 0) {
+				warn(abspath);
+				continue;
+			}
+		}
+		mntcount=getmntinfo(&mntbuf, MNT_NOWAIT);
+		if (mntcount < 0)
+			err(EX_OSERR, "getmntinfo");
+		for (i=0; i<mntcount; i++) {
+			char* s;
+			int error;
+			if (argc > 0 && strcmp(abspath, mntbuf[i].f_mntonname) != 0) continue;
+#if defined(__FreeBSD_version) && __FreeBSD_version > 300000
+			if (strcmp(mntbuf[i].f_fstypename, "nfs") != 0) continue;
+#else
+			if (mntbuf[i].f_type != MOUNT_NFS) continue;
+#endif
+			if (strncmp(mntbuf[i].f_mntfromname, "shlight-", 8) != 0) continue;
+			pid=strtoul(mntbuf[i].f_mntfromname+8, &s, 10);
+			if (*s) continue;
+			error = unmount (mntbuf[i].f_mntonname, 0);
+			if (error == 0) {
+				kill (pid, SIGHUP);
+			} else {
+				warn(mntbuf[i].f_mntonname);
+			}
+		}
+		if (argc > 0 && !pid) 
+			warnx("%s: not currently mounted", abspath);
+	}
+}
+
+void
+usage(void)
+{
+	errx(EX_USAGE, "Usage: unshlight [-a] [node]");
+}
--- /dev/null
+++ net/sharity-light/files/patch-aa
@@ -0,0 +1,18 @@
+--- nfs/Makefile.orig	Sat Jul 24 23:05:05 1999
++++ nfs/Makefile	Sat Jul 24 23:05:17 1999
+@@ -16,13 +16,13 @@
+ 
+ all: nfs.o
+ 
+-COMPILE = $(CC) $(ARCH) -c $(INCLUDES) $(CFLAGS)
++COMPILE = $(CC) -c $(INCLUDES) $(CFLAGS)
+ 
+ .c.o:
+ 	$(COMPILE) $<
+ 
+ nfs.o: $(OFILES)
+-	$(LD) $(ARCH) -r -o $@ $(OFILES)
++	$(LD) -r -o $@ $(OFILES)
+ 
+ # the purpose of the sed "s/char data/long long data/" hack is to ensure
+ # proper alignment. [Marc Boucher <marc at CAM.ORG>]


More information about the Midnightbsd-cvs mailing list