/*
* 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
*/
/*
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
*/
/*
* These replace NODIRECT functions of the same name in
* smb_kmod_bind, smb_kmod_ioctl, smb_kmod_isbound,
* smb_kmod_start, smb_kmod_stop, smb_kmod_unbind.
*
* For all the other smb_kmod_... functions, we can just use the
* libsmb code because those all call smb_kmod_ioctl, for which
* we have an override here.
*
* The replacment functions here just call the libfksmbsrv code
* directly where the real (in-kernel) versions would be entered
* via the driver framework (open, close, ioctl). Aside from that,
* the call sequences are intentionally the same (where possible).
* problems in the user-space version of this code.
*/
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <note.h>
#include <smbsrv/smb_ioctl.h>
#include "smbd.h"
/*
* We want to adjust a few things in the standard configuration
* passed to the "fake" version of the smbsrv kernel module.
*
* Reduce the maximum number of connections and workers, just for
* convenience while debugging. (Don't want hundreds of threads.)
*/
static void
{
char *s;
smbd_report("maxconnections=%d, maxworkers=%d",
ioc->signing_enable = 0;
ioc->signing_required = 0;
switch (s[0]) {
case 'e':
break;
case 'r':
break;
default:
smbd_report("env SMB_SIGNING invalid");
break;
}
}
smbd_report("signing: enable=%d, required=%d",
}
smb_kmod_isbound(void)
{
return (smbdrv_opened);
}
int
smb_kmod_bind(void)
{
int rc;
if (smbdrv_opened) {
(void) fksmbsrv_drv_close();
}
rc = fksmbsrv_drv_open();
if (rc == 0)
return (rc);
}
void
smb_kmod_unbind(void)
{
if (smbdrv_opened) {
(void) fksmbsrv_drv_close();
}
}
int
{
int rc;
if (!smbdrv_opened)
return (EBADF);
if (cmd == SMB_IOC_CONFIG)
return (rc);
}
/* ARGSUSED */
int
{
int rc;
/* These three are unused */
/* These are the "door" dispatch callbacks */
return (rc);
}
void
smb_kmod_stop(void)
{
}