Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/smbfs - merge conflicts (updating to the versio...



details:   https://anonhg.NetBSD.org/src/rev/54c64428ec29
branches:  trunk
changeset: 325459:54c64428ec29
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Dec 25 22:03:14 2013 +0000

description:
- merge conflicts (updating to the version that was actually imported)
- add build glue

diffstat:

 external/bsd/smbfs/Makefile                       |    3 +
 external/bsd/smbfs/Makefile.inc                   |    8 +
 external/bsd/smbfs/dist/examples/dot.nsmbrc       |    8 +-
 external/bsd/smbfs/dist/include/netsmb/smb_lib.h  |   38 ++--
 external/bsd/smbfs/dist/lib/smb/cfopt.c           |    4 +
 external/bsd/smbfs/dist/lib/smb/ctx.c             |  123 +++++++++++----
 external/bsd/smbfs/dist/lib/smb/file.c            |   12 +-
 external/bsd/smbfs/dist/lib/smb/kiconv.c          |   27 +++-
 external/bsd/smbfs/dist/lib/smb/mbuf.c            |   31 ++-
 external/bsd/smbfs/dist/lib/smb/nb.c              |   12 +-
 external/bsd/smbfs/dist/lib/smb/nb_name.c         |   30 ++-
 external/bsd/smbfs/dist/lib/smb/nb_net.c          |  153 ++++++-------------
 external/bsd/smbfs/dist/lib/smb/nbns_rq.c         |   50 +++---
 external/bsd/smbfs/dist/lib/smb/nls.c             |  110 ++++++-------
 external/bsd/smbfs/dist/lib/smb/print.c           |    4 +
 external/bsd/smbfs/dist/lib/smb/rap.c             |   43 ++--
 external/bsd/smbfs/dist/lib/smb/rcfile.c          |    8 +-
 external/bsd/smbfs/dist/lib/smb/rq.c              |   15 +-
 external/bsd/smbfs/dist/lib/smb/subr.c            |  166 ++++++++++++++++++++-
 external/bsd/smbfs/dist/mount_smbfs/getmntopts.c  |  108 --------------
 external/bsd/smbfs/dist/mount_smbfs/mntopts.h     |   91 ------------
 external/bsd/smbfs/dist/mount_smbfs/mount_smbfs.8 |  155 +++++++++++++------
 external/bsd/smbfs/dist/mount_smbfs/mount_smbfs.c |  165 ++++++++++++---------
 external/bsd/smbfs/dist/mount_smbfs/mount_smbfs.h |   37 ++++
 external/bsd/smbfs/dist/smbutil/common.h          |   10 +-
 external/bsd/smbfs/dist/smbutil/dumptree.c        |   14 +-
 external/bsd/smbfs/dist/smbutil/login.c           |   11 +-
 external/bsd/smbfs/dist/smbutil/print.c           |    3 +-
 external/bsd/smbfs/dist/smbutil/smbutil.1         |  102 +++++++------
 external/bsd/smbfs/dist/smbutil/smbutil.c         |   26 +-
 external/bsd/smbfs/dist/smbutil/view.c            |   25 ++-
 external/bsd/smbfs/lib/Makefile                   |    3 +
 external/bsd/smbfs/lib/libsmb/Makefile            |   18 ++
 external/bsd/smbfs/sbin/Makefile                  |    3 +
 external/bsd/smbfs/sbin/mount_smbfs/Makefile      |   27 +++
 external/bsd/smbfs/usr.bin/Makefile               |    3 +
 external/bsd/smbfs/usr.bin/smbutil/Makefile       |   20 ++
 37 files changed, 954 insertions(+), 712 deletions(-)

diffs (truncated from 3205 to 300 lines):

diff -r 49c4cf9cb5cb -r 54c64428ec29 external/bsd/smbfs/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/smbfs/Makefile       Wed Dec 25 22:03:14 2013 +0000
@@ -0,0 +1,3 @@
+#      $NetBSD: Makefile,v 1.1 2013/12/25 22:03:14 christos Exp $
+SUBDIR+= lib .WAIT sbin usr.bin
+.include <bsd.subdir.mk>
diff -r 49c4cf9cb5cb -r 54c64428ec29 external/bsd/smbfs/Makefile.inc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/smbfs/Makefile.inc   Wed Dec 25 22:03:14 2013 +0000
@@ -0,0 +1,8 @@
+#      $NetBSD: Makefile.inc,v 1.1 2013/12/25 22:03:14 christos Exp $
+#
+
+.include <bsd.own.mk>
+
+SMBDIST=${NETBSDSRCDIR}/external/bsd/smbfs/dist
+
+CPPFLAGS+= -I${SMBDIST}/include
diff -r 49c4cf9cb5cb -r 54c64428ec29 external/bsd/smbfs/dist/examples/dot.nsmbrc
--- a/external/bsd/smbfs/dist/examples/dot.nsmbrc       Wed Dec 25 20:33:13 2013 +0000
+++ b/external/bsd/smbfs/dist/examples/dot.nsmbrc       Wed Dec 25 22:03:14 2013 +0000
@@ -1,10 +1,11 @@
+# $NetBSD: dot.nsmbrc,v 1.2 2013/12/25 22:03:14 christos Exp $
 # Id: dot.nsmbrc,v 1.6 2000/07/16 01:52:06 bp Exp 
 #
 # Example for .nsmbrc file
 #
 # smbfs lookups configuration files in next order:
 #      1. ~/.nsmbrc
-#      2. /usr/local/etc/nsmb.conf - if this file found it will
+#      2. /etc/nsmb.conf - if this file found it will
 #         override values with same keys from user files.
 #
 #
@@ -20,7 +21,8 @@
 # where 'key' represents parameter name and 'value' a value assigned
 # to this parameter.
 #
-# SMB library uses next forms of section names:
+# SMB library uses next forms of section names (please note that the section
+# name should be in upper case when it refers to server, user or share):
 # A) [default]
 # B) [SERVER]
 # C) [SERVER:USER]
@@ -31,7 +33,7 @@
 # keyword/section      A  B  C  D      Comment
 #
 # addr                 -  +  -  -      IP or IPX address of SMB server
-# charsets             -  +  +  +      local:remote charset pair
+# charsets             +  +  +  +      local:remote charset pair
 # nbns                 +  +  -  -      address of NetBIOS name server (WINS)
 # nbscope              +  +  -  -      NetBIOS scope
 # nbtimeout            +  +  -  -      timeout for NetBIOS name servers
diff -r 49c4cf9cb5cb -r 54c64428ec29 external/bsd/smbfs/dist/include/netsmb/smb_lib.h
--- a/external/bsd/smbfs/dist/include/netsmb/smb_lib.h  Wed Dec 25 20:33:13 2013 +0000
+++ b/external/bsd/smbfs/dist/include/netsmb/smb_lib.h  Wed Dec 25 22:03:14 2013 +0000
@@ -37,7 +37,9 @@
 #include <netsmb/smb.h>
 #include <netsmb/smb_dev.h>
 
-#define        SMB_CFG_FILE    "/usr/local/etc/nsmb.conf"
+#ifndef SMB_CFG_FILE
+#define        SMB_CFG_FILE    "/etc/nsmb.conf"
+#endif
 
 #define        STDPARAM_ARGS   'A':case 'B':case 'C':case 'E':case 'I': \
                   case 'L':case 'M': \
@@ -77,20 +79,16 @@
 #define setdbe(buf,ofs,val) getdle(buf,ofs)=htonl(val)
 
 #else  /* (BYTE_ORDER == LITTLE_ENDIAN) */
-#error "Macros for Big-Endians are incomplete"
-#define getwle(buf,ofs) ((u_int16_t)(getb(buf, ofs) | (getb(buf, ofs + 1) << 8)))
-#define getdle(buf,ofs) ((u_int32_t)(getb(buf, ofs) | \
-                                   (getb(buf, ofs + 1) << 8) | \
-                                   (getb(buf, ofs + 2) << 16) | \
-                                   (getb(buf, ofs + 3) << 24)))
-#define getwbe(buf,ofs) (*((u_int16_t*)(&((u_int8_t*)(buf))[ofs])))
-#define getdbe(buf,ofs) (*((u_int32_t*)(&((u_int8_t*)(buf))[ofs])))
-/*
-#define setwle(buf,ofs,val) getwle(buf,ofs)=val
-#define setdle(buf,ofs,val) getdle(buf,ofs)=val
-*/
-#define setwbe(buf,ofs,val) getwle(buf,ofs)=val
-#define setdbe(buf,ofs,val) getdle(buf,ofs)=val
+
+#define getwbe(buf,ofs)        (*((u_int16_t*)(&((u_int8_t*)(buf))[ofs])))
+#define getdbe(buf,ofs)        (*((u_int32_t*)(&((u_int8_t*)(buf))[ofs])))
+#define getwle(buf,ofs)        (bswap16(getwbe(buf,ofs)))
+#define getdle(buf,ofs)        (bswap32(getdbe(buf,ofs)))
+
+#define setwbe(buf,ofs,val) getwbe(buf,ofs)=val
+#define setwle(buf,ofs,val) getwbe(buf,ofs)=bswap16(val)
+#define setdbe(buf,ofs,val) getdbe(buf,ofs)=val
+#define setdle(buf,ofs,val) getdbe(buf,ofs)=bswap32(val)
 
 #endif /* (BYTE_ORDER == LITTLE_ENDIAN) */
 
@@ -153,7 +151,7 @@
 
 struct smb_bitname {
        u_int   bn_bit;
-       char    *bn_name;
+       const char *bn_name;
 };
 
 extern struct rcfile *smb_rc;
@@ -208,7 +206,7 @@
 int  smb_t2_request(struct smb_ctx *, int, int, const char *,
        int, void *, int, void *, int *, void *, int *, void *);
 
-void smb_simplecrypt(char *dst, const char *src);
+char *smb_simplecrypt(char *dst, const char *src);
 int  smb_simpledecrypt(char *dst, const char *src);
 
 int  m_getm(struct mbuf *, size_t, struct mbuf **);
@@ -216,7 +214,7 @@
 int  mb_init(struct mbdata *, size_t);
 int  mb_initm(struct mbdata *, struct mbuf *);
 int  mb_done(struct mbdata *);
-int  mb_fit(struct mbdata *mbp, size_t size, char **pp);
+int  mb_fit(struct mbdata *mbp, size_t size, void **pp);
 int  mb_put_uint8(struct mbdata *, u_int8_t);
 int  mb_put_uint16be(struct mbdata *, u_int16_t);
 int  mb_put_uint16le(struct mbdata *, u_int16_t);
@@ -246,8 +244,8 @@
 int   nls_setlocale(const char *);
 char* nls_str_toext(char *, const char *);
 char* nls_str_toloc(char *, const char *);
-void* nls_mem_toext(void *, const void *, int);
-void* nls_mem_toloc(void *, const void *, int);
+void* nls_mem_toext(void *, const void *, size_t);
+void* nls_mem_toloc(void *, const void *, size_t);
 char* nls_str_upper(char *, const char *);
 char* nls_str_lower(char *, const char *);
 
diff -r 49c4cf9cb5cb -r 54c64428ec29 external/bsd/smbfs/dist/lib/smb/cfopt.c
--- a/external/bsd/smbfs/dist/lib/smb/cfopt.c   Wed Dec 25 20:33:13 2013 +0000
+++ b/external/bsd/smbfs/dist/lib/smb/cfopt.c   Wed Dec 25 22:03:14 2013 +0000
@@ -31,6 +31,10 @@
  *
  * Id: cfopt.c,v 1.3 2000/07/11 01:51:49 bp Exp 
  */
+
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: cfopt.c,v 1.2 2013/12/25 22:03:15 christos Exp $");
+
 #include <sys/param.h>
 
 #include <stdio.h>
diff -r 49c4cf9cb5cb -r 54c64428ec29 external/bsd/smbfs/dist/lib/smb/ctx.c
--- a/external/bsd/smbfs/dist/lib/smb/ctx.c     Wed Dec 25 20:33:13 2013 +0000
+++ b/external/bsd/smbfs/dist/lib/smb/ctx.c     Wed Dec 25 22:03:14 2013 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, Boris Popov
+ * Copyright (c) 2000-2002, Boris Popov
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -29,8 +29,12 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * Id: ctx.c,v 1.21 2001/04/06 15:47:14 bp Exp 
+ * Id: ctx.c,v 1.24 2002/04/13 14:35:28 bp Exp 
  */
+
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: ctx.c,v 1.2 2013/12/25 22:03:15 christos Exp $");
+
 #include <sys/param.h>
 #include <sys/sysctl.h>
 #include <sys/ioctl.h>
@@ -45,7 +49,7 @@
 #include <pwd.h>
 #include <grp.h>
 #include <unistd.h>
-#include <sys/iconv.h>
+#include <netsmb/iconv.h>
 
 #define NB_NEEDRESOLVER
 
@@ -55,6 +59,8 @@
 #include <netsmb/smb_conn.h>
 #include <cflib.h>
 
+#include "smb_kernelops.h"
+
 /*
  * Prescan command line for [-U user] argument
  * and fill context with defaults
@@ -64,7 +70,9 @@
        int minlevel, int maxlevel, int sharetype)
 {
        int  opt, error = 0;
+       uid_t euid;
        const char *arg, *cp;
+       struct passwd *pwd;
 
        bzero(ctx,sizeof(*ctx));
        error = nb_ctx_create(&ctx->ct_nb);
@@ -92,8 +100,14 @@
        ctx->ct_sh.ioc_group = SMBM_ANY_GROUP;
 
        nb_ctx_setscope(ctx->ct_nb, "");
-       smb_ctx_setuser(ctx, getpwuid(geteuid())->pw_name);
-       endpwent();
+       euid = geteuid();
+       if ((pwd = getpwuid(euid)) != NULL) {
+               smb_ctx_setuser(ctx, pwd->pw_name);
+               endpwent();
+       } else if (euid == 0)
+               smb_ctx_setuser(ctx, "root");
+       else
+               return 0;
        if (argv == NULL)
                return 0;
        for (opt = 1; opt < argc; opt++) {
@@ -266,7 +280,30 @@
 int
 smb_ctx_setserver(struct smb_ctx *ctx, const char *name)
 {
-       if (strlen(name) >= SMB_MAXSRVNAMELEN) {
+       char *d;
+
+       /*
+        * If the name contains dot, it's likely a IP address
+        * or a name. Update srvaddr in that case, and use
+        * first part of the name (up to the dot) as NetBIOS name.
+        */
+       if ((d = strchr(name, '.'))) {
+               static char nm[sizeof(ctx->ct_ssn.ioc_srvname)];
+               int error;
+
+               error = smb_ctx_setsrvaddr(ctx, name);
+               if (error)
+                       return (error);
+               
+               /* cut name to MAXSRVNAMELEN */
+               if (strlen(name) >= sizeof(ctx->ct_ssn.ioc_srvname)) {
+                       snprintf(nm, sizeof(nm), "%.*s",
+                           (int)(sizeof(ctx->ct_ssn.ioc_srvname) - 1), name);
+                       name = nm;
+               }
+       }
+
+       if (strlen(name) >= sizeof(ctx->ct_ssn.ioc_srvname)) {
                smb_error("server name '%s' too long", 0, name);
                return ENAMETOOLONG;
        }
@@ -277,7 +314,7 @@
 int
 smb_ctx_setuser(struct smb_ctx *ctx, const char *name)
 {
-       if (strlen(name) >= SMB_MAXUSERNAMELEN) {
+       if (strlen(name) >= sizeof(ctx->ct_ssn.ioc_user)) {
                smb_error("user name '%s' too long", 0, name);
                return ENAMETOOLONG;
        }
@@ -354,7 +391,7 @@
                        if (gr) {
                                *gid = gr->gr_gid;
                        } else
-                               smb_error("Invalid group name %s, ignored",
+                               smb_error("Invalid group name '%s', ignored",
                                    0, cp);
                }
        }
@@ -363,7 +400,7 @@
                if (pw) {
                        *uid = pw->pw_uid;
                } else
-                       smb_error("Invalid user name %s, ignored", 0, pair);
+                       smb_error("Invalid user name '%s', ignored", 0, pair);
        }
        endpwent();
        return 0;
@@ -400,7 +437,7 @@
                            &ctx->ct_sh.ioc_group);
                }
                if (*p && error == 0) {
-                       error = smb_parse_owner(cp, &ctx->ct_ssn.ioc_owner,
+                       error = smb_parse_owner(p, &ctx->ct_ssn.ioc_owner,
                            &ctx->ct_ssn.ioc_group);
                }
                free(p);
@@ -564,31 +601,21 @@
        char buf[20];
 
        /*
-        * First try to open as clone
+        * First, try to open as cloned device
         */
-       fd = open("/dev/"NSMB_NAME, O_RDWR);
+       fd = smb_kops.ko_open("/dev/"NSMB_NAME, O_RDWR, 0);
        if (fd >= 0) {
                ctx->ct_fd = fd;
                return 0;



Home | Main Index | Thread Index | Old Index