xref: /illumos-gate/usr/src/common/smbsrv/smb_cfg_util.c (revision 45ede40b2394db7967e59f19288fae9b62efd4aa)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
14  */
15 
16 #if !defined(_KERNEL) && !defined(_FAKE_KERNEL)
17 #include <string.h>
18 #else
19 #include <sys/sunddi.h>
20 #endif
21 #include <smbsrv/smbinfo.h>
22 
23 void
24 smb_cfg_set_require(const char *value, smb_cfg_val_t *cfg)
25 {
26 	if (value == NULL) {
27 		*cfg = SMB_CONFIG_DISABLED;
28 		return;
29 	}
30 
31 	if (strcmp(value, "required") == 0)
32 		*cfg = SMB_CONFIG_REQUIRED;
33 	else if (strcmp(value, "enabled") == 0)
34 		*cfg = SMB_CONFIG_ENABLED;
35 	else
36 		*cfg = SMB_CONFIG_DISABLED;
37 }
38