diff options
Diffstat (limited to 'usr/src/lib/libsmbfs')
-rw-r--r-- | usr/src/lib/libsmbfs/Makefile.com | 16 | ||||
-rw-r--r-- | usr/src/lib/libsmbfs/netsmb/smb_lib.h | 8 | ||||
-rw-r--r-- | usr/src/lib/libsmbfs/smb/acl_api.c | 8 | ||||
-rw-r--r-- | usr/src/lib/libsmbfs/smb/ctx.c | 49 | ||||
-rw-r--r-- | usr/src/lib/libsmbfs/smb/file.c | 14 | ||||
-rw-r--r-- | usr/src/lib/libsmbfs/smb/findvc.c | 6 | ||||
-rw-r--r-- | usr/src/lib/libsmbfs/smb/iod_wk.c | 12 | ||||
-rw-r--r-- | usr/src/lib/libsmbfs/smb/keychain.c | 6 | ||||
-rw-r--r-- | usr/src/lib/libsmbfs/smb/lgrep.awk | 68 | ||||
-rw-r--r-- | usr/src/lib/libsmbfs/smb/mapfile-vers | 16 | ||||
-rw-r--r-- | usr/src/lib/libsmbfs/smb/print.c | 11 | ||||
-rw-r--r-- | usr/src/lib/libsmbfs/smb/rcfile.c | 12 | ||||
-rw-r--r-- | usr/src/lib/libsmbfs/smb/rq.c | 9 |
13 files changed, 111 insertions, 124 deletions
diff --git a/usr/src/lib/libsmbfs/Makefile.com b/usr/src/lib/libsmbfs/Makefile.com index 160494aff1..3a5c62c46c 100644 --- a/usr/src/lib/libsmbfs/Makefile.com +++ b/usr/src/lib/libsmbfs/Makefile.com @@ -111,23 +111,21 @@ CPPFLAGS += -D__EXTENSIONS__ -D_REENTRANT -DMIA \ -I$(SRC)/uts/common \ -I$(SRC)/common/smbclnt +# This is pretty mature code, so let's just ignore these. +LINTCHECKFLAGS += -erroff=E_INCONS_ARG_DECL2 +LINTCHECKFLAGS += -erroff=E_INCONS_VAL_TYPE_DECL2 +LINTCHECKFLAGS += -erroff=E_FUNC_RET_MAYBE_IGNORED2 +LINTCHECKFLAGS += -erroff=E_FUNC_RET_ALWAYS_IGNOR2 + # Debugging ${NOT_RELEASE_BUILD} CPPFLAGS += -DDEBUG -# Filter out the less important lint. -# See lgrep.awk -LGREP = $(AWK) -f $(SRCDIR)/lgrep.awk -LTAIL += 2>&1 | $(LGREP) - all: $(LIBS) -lint: lintcheck_t +lint: lintcheck include ../../Makefile.targ -lintcheck_t: $$(SRCS) - $(LINT.c) $(LINTCHECKFLAGS) $(SRCS) $(LDLIBS) $(LTAIL) - objs/%.o pics/%.o: $(CMNDIR)/%.c $(COMPILE.c) -o $@ $< $(POST_PROCESS_O) diff --git a/usr/src/lib/libsmbfs/netsmb/smb_lib.h b/usr/src/lib/libsmbfs/netsmb/smb_lib.h index c1dc6886ac..1f6e062e74 100644 --- a/usr/src/lib/libsmbfs/netsmb/smb_lib.h +++ b/usr/src/lib/libsmbfs/netsmb/smb_lib.h @@ -34,7 +34,7 @@ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2013 Nexenta Systems, Inc. All rights reserved. + * Copyright 2017 Nexenta Systems, Inc. All rights reserved. */ #ifndef _NETSMB_SMB_LIB_H_ @@ -136,8 +136,8 @@ struct smb_ctx { #define ct_owner ct_iod_ssn.iod_ossn.ssn_owner #define ct_srvaddr ct_iod_ssn.iod_ossn.ssn_srvaddr #define ct_domain ct_iod_ssn.iod_ossn.ssn_domain -#define ct_user ct_iod_ssn.iod_ossn.ssn_user -#define ct_srvname ct_iod_ssn.iod_ossn.ssn_srvname +#define ct_user ct_iod_ssn.iod_ossn.ssn_user +#define ct_srvname ct_iod_ssn.iod_ossn.ssn_srvname #define ct_authflags ct_iod_ssn.iod_authflags #define ct_nthash ct_iod_ssn.iod_nthash #define ct_lmhash ct_iod_ssn.iod_lmhash @@ -181,6 +181,8 @@ struct smb_ctx { int smb_ctx_init(struct smb_ctx *); void smb_ctx_done(struct smb_ctx *); int smb_open_driver(void); +int nsmb_ioctl(int, int, void *); +int nsmb_close(int); int smb_ctx_gethandle(struct smb_ctx *); int smb_ctx_findvc(struct smb_ctx *); diff --git a/usr/src/lib/libsmbfs/smb/acl_api.c b/usr/src/lib/libsmbfs/smb/acl_api.c index 052539316b..92a3262f79 100644 --- a/usr/src/lib/libsmbfs/smb/acl_api.c +++ b/usr/src/lib/libsmbfs/smb/acl_api.c @@ -22,6 +22,8 @@ /* * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * + * Copyright 2017 Nexenta Systems, Inc. All rights reserved. */ /* @@ -83,6 +85,7 @@ smbfs_acl_iocget(int fd, uint32_t selector, mbdata_t *mbp) return (error); m = mbp->mb_top; + bzero(&iocb, sizeof (iocb)); iocb.addr = mtod(m, uintptr_t); iocb.alloc = m->m_maxlen; iocb.used = 0; @@ -91,7 +94,7 @@ smbfs_acl_iocget(int fd, uint32_t selector, mbdata_t *mbp) /* * This does the OTW Get. */ - if (ioctl(fd, SMBFSIO_GETSD, &iocb) < 0) { + if (nsmb_ioctl(fd, SMBFSIO_GETSD, &iocb) < 0) { error = errno; goto errout; } @@ -120,6 +123,7 @@ smbfs_acl_iocset(int fd, uint32_t selector, mbdata_t *mbp) if (mbp->mb_top != m) mb_initm(mbp, m); + bzero(&iocb, sizeof (iocb)); iocb.addr = mtod(m, uintptr_t); iocb.alloc = m->m_maxlen; iocb.used = m->m_len; @@ -128,7 +132,7 @@ smbfs_acl_iocset(int fd, uint32_t selector, mbdata_t *mbp) /* * This does the OTW Set. */ - if (ioctl(fd, SMBFSIO_SETSD, &iocb) < 0) + if (nsmb_ioctl(fd, SMBFSIO_SETSD, &iocb) < 0) error = errno; return (error); diff --git a/usr/src/lib/libsmbfs/smb/ctx.c b/usr/src/lib/libsmbfs/smb/ctx.c index 9455a92344..e28599e28f 100644 --- a/usr/src/lib/libsmbfs/smb/ctx.c +++ b/usr/src/lib/libsmbfs/smb/ctx.c @@ -34,7 +34,7 @@ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2013 Nexenta Systems, Inc. All rights reserved. + * Copyright 2017 Nexenta Systems, Inc. All rights reserved. */ #include <sys/param.h> @@ -333,7 +333,12 @@ smb_ctx_scan_argv(struct smb_ctx *ctx, int argc, char **argv, cf_opt_lock(); /* Careful: no return/goto before cf_opt_unlock! */ while (error == 0) { - opt = cf_getopt(argc, argv, STDPARAM_OPT); + /* + * Leading ':' tells this to skip unknown opts. + * Just get -A and -U here so we know the user + * for config file parsing. + */ + opt = cf_getopt(argc, argv, ":AU:"); if (opt == -1) break; arg = cf_optarg; @@ -398,7 +403,7 @@ smb_ctx_done(struct smb_ctx *ctx) rpc_cleanup_smbctx(ctx); if (ctx->ct_dev_fd != -1) { - close(ctx->ct_dev_fd); + nsmb_close(ctx->ct_dev_fd); ctx->ct_dev_fd = -1; } if (ctx->ct_door_fd != -1) { @@ -1147,6 +1152,10 @@ smb_ctx_resolve(struct smb_ctx *ctx) return (0); } +/* + * Note: The next three have NODIRECT binding so the + * "fksmbcl" development tool can provide its own. + */ int smb_open_driver() { @@ -1164,6 +1173,19 @@ smb_open_driver() } int +nsmb_close(int fd) +{ + return (close(fd)); +} + +int +nsmb_ioctl(int fd, int cmd, void *arg) +{ + return (ioctl(fd, cmd, arg)); +} + + +int smb_ctx_gethandle(struct smb_ctx *ctx) { int fd, err; @@ -1171,7 +1193,7 @@ smb_ctx_gethandle(struct smb_ctx *ctx) if (ctx->ct_dev_fd != -1) { rpc_cleanup_smbctx(ctx); - close(ctx->ct_dev_fd); + nsmb_close(ctx->ct_dev_fd); ctx->ct_dev_fd = -1; ctx->ct_flags &= ~SMBCF_SSNACTIVE; } @@ -1187,12 +1209,12 @@ smb_ctx_gethandle(struct smb_ctx *ctx) /* * Check the driver version (paranoia) */ - if (ioctl(fd, SMBIOC_GETVERS, &version) < 0) + if (nsmb_ioctl(fd, SMBIOC_GETVERS, &version) < 0) version = 0; if (version != NSMB_VERSION) { smb_error(dgettext(TEXT_DOMAIN, "incorrect driver version"), 0); - close(fd); + nsmb_close(fd); return (ENODEV); } @@ -1221,6 +1243,15 @@ smb_ctx_get_ssn(struct smb_ctx *ctx) DPRINT("found an existing VC"); } else { /* + * If we're authenticating (real user, not NULL session) + * and we don't yet have a password, return EAUTH and + * the caller will prompt for it and call again. + */ + if (ctx->ct_user[0] != '\0' && + ctx->ct_password[0] == '\0') + return (EAUTH); + + /* * This calls the IOD to create a new session. */ DPRINT("setup a new VC"); @@ -1272,7 +1303,7 @@ smb_ctx_get_tree(struct smb_ctx *ctx) * * The driver does the actual TCON call. */ - if (ioctl(ctx->ct_dev_fd, cmd, tcon) == -1) { + if (nsmb_ioctl(ctx->ct_dev_fd, cmd, tcon) == -1) { err = errno; goto out; } @@ -1303,7 +1334,7 @@ smb_ctx_flags2(struct smb_ctx *ctx) { uint16_t flags2; - if (ioctl(ctx->ct_dev_fd, SMBIOC_FLAGS2, &flags2) == -1) { + if (nsmb_ioctl(ctx->ct_dev_fd, SMBIOC_FLAGS2, &flags2) == -1) { smb_error(dgettext(TEXT_DOMAIN, "can't get flags2 for a session"), errno); return (-1); @@ -1321,7 +1352,7 @@ smb_fh_getssnkey(int dev_fd, uchar_t *key, size_t len) if (len < SMBIOC_HASH_SZ) return (EINVAL); - if (ioctl(dev_fd, SMBIOC_GETSSNKEY, key) == -1) + if (nsmb_ioctl(dev_fd, SMBIOC_GETSSNKEY, key) == -1) return (errno); return (0); diff --git a/usr/src/lib/libsmbfs/smb/file.c b/usr/src/lib/libsmbfs/smb/file.c index 8ca9d2cee1..b104502d9c 100644 --- a/usr/src/lib/libsmbfs/smb/file.c +++ b/usr/src/lib/libsmbfs/smb/file.c @@ -33,7 +33,7 @@ */ /* - * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright 2017 Nexenta Systems, Inc. All rights reserved. * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -65,7 +65,7 @@ int smb_fh_close(int fd) { - return (close(fd)); + return (nsmb_close(fd)); } int @@ -96,7 +96,7 @@ smb_fh_ntcreate( goto errout; } from_fd = ctx->ct_dev_fd; - if (ioctl(new_fd, SMBIOC_DUP_DEV, &from_fd) == -1) { + if (nsmb_ioctl(new_fd, SMBIOC_DUP_DEV, &from_fd) == -1) { err = errno; goto errout; } @@ -111,7 +111,7 @@ smb_fh_ntcreate( ioc.ioc_share_acc = share_acc; ioc.ioc_open_disp = open_disp; ioc.ioc_creat_opts = create_opts; - if (ioctl(new_fd, SMBIOC_NTCREATE, &ioc) == -1) { + if (nsmb_ioctl(new_fd, SMBIOC_NTCREATE, &ioc) == -1) { err = errno; goto errout; } @@ -120,7 +120,7 @@ smb_fh_ntcreate( errout: if (new_fd != -1) - close(new_fd); + nsmb_close(new_fd); errno = err; return (-1); } @@ -214,7 +214,7 @@ smb_fh_read(int fd, off64_t offset, size_t count, rwrq.ioc_base = dst; rwrq.ioc_cnt = count; rwrq.ioc_offset = offset; - if (ioctl(fd, SMBIOC_READ, &rwrq) == -1) { + if (nsmb_ioctl(fd, SMBIOC_READ, &rwrq) == -1) { return (-1); } return (rwrq.ioc_cnt); @@ -231,7 +231,7 @@ smb_fh_write(int fd, off64_t offset, size_t count, rwrq.ioc_base = (char *)src; rwrq.ioc_cnt = count; rwrq.ioc_offset = offset; - if (ioctl(fd, SMBIOC_WRITE, &rwrq) == -1) { + if (nsmb_ioctl(fd, SMBIOC_WRITE, &rwrq) == -1) { return (-1); } return (rwrq.ioc_cnt); diff --git a/usr/src/lib/libsmbfs/smb/findvc.c b/usr/src/lib/libsmbfs/smb/findvc.c index 63c6cce242..9d9ccd678c 100644 --- a/usr/src/lib/libsmbfs/smb/findvc.c +++ b/usr/src/lib/libsmbfs/smb/findvc.c @@ -22,6 +22,8 @@ /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * + * Copyright 2017 Nexenta Systems, Inc. All rights reserved. */ /* @@ -76,7 +78,7 @@ findvc(struct smb_ctx *ctx, struct addrinfo *ai) bzero(&ssn->ssn_srvaddr, sizeof (ssn->ssn_srvaddr)); bcopy(ai->ai_addr, &ssn->ssn_srvaddr, ai->ai_addrlen); - if (ioctl(ctx->ct_dev_fd, SMBIOC_SSN_FIND, ssn) == -1) + if (nsmb_ioctl(ctx->ct_dev_fd, SMBIOC_SSN_FIND, ssn) == -1) return (errno); return (0); @@ -137,7 +139,7 @@ int smb_ctx_kill(struct smb_ctx *ctx) { - if (ioctl(ctx->ct_dev_fd, SMBIOC_SSN_KILL, NULL) == -1) + if (nsmb_ioctl(ctx->ct_dev_fd, SMBIOC_SSN_KILL, NULL) == -1) return (errno); return (0); diff --git a/usr/src/lib/libsmbfs/smb/iod_wk.c b/usr/src/lib/libsmbfs/smb/iod_wk.c index 53f3c515be..8b56fdaf18 100644 --- a/usr/src/lib/libsmbfs/smb/iod_wk.c +++ b/usr/src/lib/libsmbfs/smb/iod_wk.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2012 Nexenta Systems, Inc. All rights reserved. + * Copyright 2017 Nexenta Systems, Inc. All rights reserved. * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -69,7 +69,7 @@ smb_iod_work(smb_ctx_t *ctx) DPRINT("server: %s", ctx->ct_srvname); - /* Calle should have opened these */ + /* Caller should have opened these */ if (ctx->ct_tran_fd == -1 || ctx->ct_dev_fd == -1) { err = EINVAL; goto out; @@ -96,7 +96,7 @@ smb_iod_work(smb_ctx_t *ctx) * Next state is normally RECONNECT. */ DPRINT("state: idle"); - if (ioctl(ctx->ct_dev_fd, + if (nsmb_ioctl(ctx->ct_dev_fd, SMBIOC_IOD_IDLE, &vcst) == -1) { err = errno; DPRINT("ioc_idle: err %d", err); @@ -132,7 +132,7 @@ smb_iod_work(smb_ctx_t *ctx) * then get ready to try again. * Next state is normally IDLE. */ - if (ioctl(ctx->ct_dev_fd, + if (nsmb_ioctl(ctx->ct_dev_fd, SMBIOC_IOD_RCFAIL, &vcst) == -1) { err = errno; DPRINT("ioc_rcfail: err %d", err); @@ -142,7 +142,7 @@ smb_iod_work(smb_ctx_t *ctx) case SMBIOD_ST_VCACTIVE: DPRINT("state: active"); - if (ioctl(ctx->ct_dev_fd, + if (nsmb_ioctl(ctx->ct_dev_fd, SMBIOC_IOD_WORK, work) == -1) { err = errno; DPRINT("ioc_work: err %d", err); @@ -176,7 +176,7 @@ out: ctx->ct_tran_fd = -1; } if (ctx->ct_dev_fd != -1) { - close(ctx->ct_dev_fd); + nsmb_close(ctx->ct_dev_fd); ctx->ct_dev_fd = -1; } diff --git a/usr/src/lib/libsmbfs/smb/keychain.c b/usr/src/lib/libsmbfs/smb/keychain.c index fd9bcc9496..3a89fbd550 100644 --- a/usr/src/lib/libsmbfs/smb/keychain.c +++ b/usr/src/lib/libsmbfs/smb/keychain.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright 2017 Nexenta Systems, Inc. All rights reserved. * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -128,7 +128,7 @@ smbfs_keychain_cmn( } err = 0; - if (ioctl(fd, cmd, &pk) < 0) { + if (nsmb_ioctl(fd, cmd, &pk) < 0) { err = errno; goto out; } @@ -142,7 +142,7 @@ smbfs_keychain_cmn( out: if (fd != -1) - close(fd); + nsmb_close(fd); return (err); } diff --git a/usr/src/lib/libsmbfs/smb/lgrep.awk b/usr/src/lib/libsmbfs/smb/lgrep.awk deleted file mode 100644 index fe6e8fa0b9..0000000000 --- a/usr/src/lib/libsmbfs/smb/lgrep.awk +++ /dev/null @@ -1,68 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# Copyright 2012 Milan Jurik. All rights reserved. -# - -# This is a "lint tail" that removes all the -# uninteresting lines from our lint output. -# It's nawk because sed doesn't do (a|b). -# Also comments are easier here. - -# There's no lintlib for krb5 yet (CR 6911968) -/: Warning: -lkrb5 not found/ { next; } -/: Warning: library -lkrb5 not found/ { next; } - -# Kill noise from xti.h with _XOPEN_SOURCE vs not. (CR 6911717) -/: _xti_.* .E_INCONS_ARG_DECL2./ { next; } -/: _xti_.* .E_INCONS_ARG_USED2./ { next; } -/: _xti_.* .E_INCONS_VAL_TYPE_DECL2./ { next; } - -# This is third-party code we'd rather not "fix" -/\/spnego.c.* .E_STMT_NOT_REACHED./ { next; } - -# The mb_put/md_get functions are intentionally used both -# with and without return value checks. Not a concern. -/: mb_put_.* .E_FUNC_RET_[A-Z]*_IGNOR/ { next; } -/: md_get_.* .E_FUNC_RET_[A-Z]*_IGNOR/ { next; } - -# The rc_get* functions clear the out arg even on failure, -# so most callers don't need to check the return value. -/: rc_get[a-z]* .E_FUNC_RET_[A-Z]*_IGNOR/ { next; } - -# These have uninteresting return values, usually ignored. -/: (n|sm)b_ctx_readrcsection .E_FUNC_RET_[A-Z]*_IGNOR/ { next; } -/: nls_str_(lower|upper) .E_FUNC_RET_[A-Z]*_IGNOR/ { next; } -/: rc_(close|freesect) .E_FUNC_RET_[A-Z]*_IGNOR/ { next; } - -# Other functions for which we often ignore return values. -/: [a-z]*close .E_FUNC_RET_[A-Z]*_IGNOR/ { next; } -/: [a-z]*flush .E_FUNC_RET_[A-Z]*_IGNOR/ { next; } -/: [a-z]*printf .E_FUNC_RET_[A-Z]*_IGNOR/ { next; } -/: mem(cpy|move|set) .E_FUNC_RET_[A-Z]*_IGNOR/ { next; } -/: mutex_.* .E_FUNC_RET_[A-Z]*_IGNOR/ { next; } -/: str[ln]?(cat|cpy) .E_FUNC_RET_[A-Z]*_IGNOR/ { next; } - -{ print; } diff --git a/usr/src/lib/libsmbfs/smb/mapfile-vers b/usr/src/lib/libsmbfs/smb/mapfile-vers index 8f0c3905c6..8d658ab937 100644 --- a/usr/src/lib/libsmbfs/smb/mapfile-vers +++ b/usr/src/lib/libsmbfs/smb/mapfile-vers @@ -19,7 +19,7 @@ # # # Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. -# Copyright 2013 Nexenta Systems, Inc. All rights reserved. +# Copyright 2017 Nexenta Systems, Inc. All rights reserved. # # @@ -36,6 +36,11 @@ # MAPFILE HEADER END # +# +# Note that several things in here are NODIRECT so that the +# "fksmbcl" development tool can provide its own versions. +# + $mapfile_version 2 SYMBOL_VERSION SUNWprivate { @@ -60,6 +65,9 @@ SYMBOL_VERSION SUNWprivate { nls_str_toloc; nls_str_upper; + nsmb_close { FLAGS = NODIRECT }; + nsmb_ioctl { FLAGS = NODIRECT }; + smb_close_rcfile; smb_ctx_alloc; @@ -72,6 +80,7 @@ SYMBOL_VERSION SUNWprivate { smb_ctx_gethandle; smb_ctx_init; smb_ctx_kill; + smb_ctx_newvc { FLAGS = NODIRECT }; smb_ctx_opt; smb_ctx_parseunc; smb_ctx_readrc; @@ -108,10 +117,11 @@ SYMBOL_VERSION SUNWprivate { smb_getprogname; smb_iod_connect; smb_iod_door_path; - smb_iod_open_door; - smb_iod_start; + smb_iod_open_door { FLAGS = NODIRECT }; + smb_iod_start { FLAGS = NODIRECT }; smb_iod_work; smb_lib_init; + smb_open_driver { FLAGS = NODIRECT }; smb_open_printer; smb_open_rcfile; smb_simplecrypt; diff --git a/usr/src/lib/libsmbfs/smb/print.c b/usr/src/lib/libsmbfs/smb/print.c index c59bef81b4..80fcab7d10 100644 --- a/usr/src/lib/libsmbfs/smb/print.c +++ b/usr/src/lib/libsmbfs/smb/print.c @@ -1,5 +1,4 @@ /* - * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2000, Boris Popov * All rights reserved. * @@ -33,6 +32,10 @@ * $Id: print.c,v 1.1.1.3 2001/07/06 22:38:43 conrad Exp $ */ +/* + * Copyright 2017 Nexenta Systems, Inc. All rights reserved. + */ + #include <sys/param.h> #include <sys/ioctl.h> #include <sys/time.h> @@ -75,7 +78,7 @@ smb_open_printer(struct smb_ctx *ctx, const char *title, if (new_fd < 0) return (errno); from_fd = ctx->ct_dev_fd; - if (ioctl(new_fd, SMBIOC_DUP_DEV, &from_fd) == -1) { + if (nsmb_ioctl(new_fd, SMBIOC_DUP_DEV, &from_fd) == -1) { err = errno; goto errout; } @@ -88,7 +91,7 @@ smb_open_printer(struct smb_ctx *ctx, const char *title, ioc.ioc_prmode = mode; strlcpy(ioc.ioc_title, title, SMBIOC_MAX_NAME); - if (ioctl(new_fd, SMBIOC_PRINTJOB, &ioc) == -1) { + if (nsmb_ioctl(new_fd, SMBIOC_PRINTJOB, &ioc) == -1) { err = errno; goto errout; } @@ -96,7 +99,7 @@ smb_open_printer(struct smb_ctx *ctx, const char *title, return (new_fd); errout: - close(new_fd); + nsmb_close(new_fd); errno = err; return (-1); } diff --git a/usr/src/lib/libsmbfs/smb/rcfile.c b/usr/src/lib/libsmbfs/smb/rcfile.c index 22ca0fc420..56335d0954 100644 --- a/usr/src/lib/libsmbfs/smb/rcfile.c +++ b/usr/src/lib/libsmbfs/smb/rcfile.c @@ -31,6 +31,9 @@ * * $Id: rcfile.c,v 1.1.1.2 2001/07/06 22:38:43 conrad Exp $ */ +/* + * Copyright 2017 Nexenta Systems, Inc. All rights reserved. + */ #include <fcntl.h> #include <sys/types.h> @@ -343,11 +346,10 @@ set_value(struct rcfile *rcp, struct rcsection *rsp, struct rckey *rkp, { int now, new; #ifdef DEBUG - char *from; + char *from = "SMF"; - if (smb_debug) - from = (home_nsmbrc) ? - "user file" : "SMF"; + if (home_nsmbrc != 0) + from = "user file"; #endif if (strcmp(rkp->rk_name, "minauth") == 0) { @@ -485,7 +487,7 @@ rc_parse(struct rcfile *rcp) set_value(rcp, rsp, rkp, buf); state = stNewLine; rkp = NULL; - } /* while */ + } /* while */ if (c == EOF && state == stGetValue) { *next = 0; set_value(rcp, rsp, rkp, buf); diff --git a/usr/src/lib/libsmbfs/smb/rq.c b/usr/src/lib/libsmbfs/smb/rq.c index c4e929eff9..f6004dfa06 100644 --- a/usr/src/lib/libsmbfs/smb/rq.c +++ b/usr/src/lib/libsmbfs/smb/rq.c @@ -1,5 +1,4 @@ /* - * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2000, Boris Popov * All rights reserved. * @@ -33,6 +32,10 @@ * $Id: rq.c,v 1.4 2004/12/13 00:25:23 lindak Exp $ */ +/* + * Copyright 2017 Nexenta Systems, Inc. All rights reserved. + */ + #include <sys/types.h> #include <sys/param.h> #include <sys/ioctl.h> @@ -266,7 +269,7 @@ smb_rq_simple(struct smb_rq *rqp) /* * Call the driver */ - if (ioctl(rqp->rq_ctx->ct_dev_fd, SMBIOC_REQUEST, &krq) == -1) + if (nsmb_ioctl(rqp->rq_ctx->ct_dev_fd, SMBIOC_REQUEST, &krq) == -1) return (errno); /* @@ -312,7 +315,7 @@ smb_t2_request(int dev_fd, int setupcount, uint16_t *setup, krq->ioc_rparam = rparam; krq->ioc_rdata = rdata; - if (ioctl(dev_fd, SMBIOC_T2RQ, krq) == -1) { + if (nsmb_ioctl(dev_fd, SMBIOC_T2RQ, krq) == -1) { return (errno); } |