diff options
author | Gordon Ross <gwr@nexenta.com> | 2017-09-07 17:38:42 -0400 |
---|---|---|
committer | Gordon Ross <gwr@nexenta.com> | 2019-08-18 12:49:34 -0400 |
commit | 8d94f651a44d41a7147253bb5dad1a53941e8f50 (patch) | |
tree | cba3775c8f1f6ef216013772f9d391f1a4ff0297 /usr/src/cmd/smbsrv | |
parent | 2f57b5e005e6dce9d124b3dbd5fdcad1cc0372d2 (diff) | |
download | illumos-joyent-8d94f651a44d41a7147253bb5dad1a53941e8f50.tar.gz |
11031 SMB3 persistent handles
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>
Reviewed by: Jason King <jason.king@joyent.com>
Approved by: Garrett D'Amore <garrett@damore.org>
Diffstat (limited to 'usr/src/cmd/smbsrv')
-rw-r--r-- | usr/src/cmd/smbsrv/Makefile | 2 | ||||
-rw-r--r-- | usr/src/cmd/smbsrv/fksmbd/fksmbd_shr.c | 4 | ||||
-rw-r--r-- | usr/src/cmd/smbsrv/nvlprint/Makefile | 37 | ||||
-rw-r--r-- | usr/src/cmd/smbsrv/nvlprint/nvlprint.c | 88 |
4 files changed, 129 insertions, 2 deletions
diff --git a/usr/src/cmd/smbsrv/Makefile b/usr/src/cmd/smbsrv/Makefile index 8e7699c252..85d9ec05f1 100644 --- a/usr/src/cmd/smbsrv/Makefile +++ b/usr/src/cmd/smbsrv/Makefile @@ -26,7 +26,7 @@ # SUBDIRS = smbadm smbd smbstat dtrace fksmbd bind-helper \ - test-msgbuf testoplock + nvlprint testoplock test-msgbuf MSGSUBDIRS = smbadm smbstat include ../Makefile.cmd diff --git a/usr/src/cmd/smbsrv/fksmbd/fksmbd_shr.c b/usr/src/cmd/smbsrv/fksmbd/fksmbd_shr.c index 23038f1641..20f1f146b0 100644 --- a/usr/src/cmd/smbsrv/fksmbd/fksmbd_shr.c +++ b/usr/src/cmd/smbsrv/fksmbd/fksmbd_shr.c @@ -10,7 +10,7 @@ */ /* - * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + * Copyright 2018 Nexenta Systems, Inc. All rights reserved. */ /* @@ -115,6 +115,8 @@ smb_shr_load(void *args) */ new_share("test", "/var/smb/test", "fksmbd test share", SMB_SHRF_GUEST_OK); + new_share("testca", "/var/smb/test", "fksmbd test CA share", + SMB_SHRF_CA); /* Allow creating lots of shares for testing. */ shr_file = getenv("FKSMBD_SHARE_FILE"); diff --git a/usr/src/cmd/smbsrv/nvlprint/Makefile b/usr/src/cmd/smbsrv/nvlprint/Makefile new file mode 100644 index 0000000000..6e107f4219 --- /dev/null +++ b/usr/src/cmd/smbsrv/nvlprint/Makefile @@ -0,0 +1,37 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2017 Nexenta Systems, Inc. All rights reserved. +# + + +PROG= nvlprint + +include ../../Makefile.cmd +ROOTCMDDIR= $(ROOT)/usr/lib/smbsrv + +CFLAGS += $(CCVERBOSE) + +CPPFLAGS += -D_FILE_OFFSET_BITS=64 +LDLIBS += -lnvpair + +.KEEP_STATE: + +all: $(PROG) + +install: all $(ROOTCMD) + +clean: + +lint: + +include ../../Makefile.targ diff --git a/usr/src/cmd/smbsrv/nvlprint/nvlprint.c b/usr/src/cmd/smbsrv/nvlprint/nvlprint.c new file mode 100644 index 0000000000..939cedd933 --- /dev/null +++ b/usr/src/cmd/smbsrv/nvlprint/nvlprint.c @@ -0,0 +1,88 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2017 Nexenta Systems, Inc. All rights reserved. + */ + +/* + * Print a packed nvlist from a file. + */ + +#include <stdio.h> +#include <fcntl.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "libnvpair.h" + +char buf[65536]; + +void +dumpit(FILE *fp) +{ + struct stat st; + size_t flen; + int rlen; + nvlist_t *nvl = NULL; + int err; + + if (fstat(fileno(fp), &st) < 0) { + perror("fstat"); + return; + } + flen = (size_t)st.st_size; + if (flen > sizeof (buf)) { + (void) printf("File too large\n"); + return; + } + rlen = fread(buf, 1, flen, fp); + if (rlen <= 0) { + perror("fread"); + return; + } + if (rlen != flen) { + (void) printf("Short read %d %d \n", rlen, flen); + return; + } + + err = nvlist_unpack(buf, flen, &nvl, 0); + if (err != 0) { + (void) printf("nvlist_unpack, err=%d\n", err); + return; + } + + nvlist_print(stdout, nvl); + nvlist_free(nvl); +} + +int +main(int argc, char **argv) +{ + FILE *fp; + int i; + + if (argc < 2) { + (void) fprintf(stderr, "usage: %s {filename} [filename2...]\n", + argv[0]); + return (1); + } + for (i = 1; i < argc; i++) { + fp = fopen(argv[i], "r"); + if (fp == NULL) { + perror(argv[i]); + return (1); + } + (void) printf("%s:\n", argv[i]); + dumpit(fp); + (void) fclose(fp); + } + return (0); +} |