mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-01-12 19:20:28 +03:00
Add smb_available() sanity checks
Do basic sanity checks in smb_available() to verify that the 'net' command and the usershare directory exists. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #1124
This commit is contained in:
parent
b5d8c5fb08
commit
be8bc8c0d3
@ -423,7 +423,15 @@ static const sa_share_ops_t smb_shareops = {
|
||||
static boolean_t
|
||||
smb_available(void)
|
||||
{
|
||||
/* TODO: Sanity check NET_CMD_PATH and SHARE_DIR */
|
||||
struct stat statbuf;
|
||||
|
||||
if (lstat(SHARE_DIR, &statbuf) != 0 ||
|
||||
!S_ISDIR(statbuf.st_mode))
|
||||
return B_FALSE;
|
||||
|
||||
if (access(NET_CMD_PATH, F_OK) != 0)
|
||||
return B_FALSE;
|
||||
|
||||
return B_TRUE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user