4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
27 * CIFS configuration management library
39 #include <sys/types.h>
42 #include <uuid/uuid.h>
43 #include <smbsrv/libsmb.h>
45 typedef struct smb_cfg_param
{
53 * config parameter flags
55 #define SMB_CF_PROTECTED 0x01
56 #define SMB_CF_EXEC 0x02
58 /* idmap SMF fmri and Property Group */
59 #define IDMAP_FMRI_PREFIX "system/idmap"
60 #define MACHINE_SID "machine_sid"
61 #define IDMAP_DOMAIN "domain_name"
62 #define IDMAP_PG_NAME "config"
64 #define SMB_SECMODE_WORKGRP_STR "workgroup"
65 #define SMB_SECMODE_DOMAIN_STR "domain"
67 #define SMB_ENC_LEN 1024
68 #define SMB_DEC_LEN 256
70 static char *b64_data
=
71 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
73 static smb_cfg_param_t smb_cfg_table
[] =
75 /* Oplock configuration, Kernel Only */
76 {SMB_CI_OPLOCK_ENABLE
, "oplock_enable", SCF_TYPE_BOOLEAN
, 0},
78 /* Autohome configuration */
79 {SMB_CI_AUTOHOME_MAP
, "autohome_map", SCF_TYPE_ASTRING
, 0},
81 /* Domain/PDC configuration */
82 {SMB_CI_DOMAIN_SID
, "domain_sid", SCF_TYPE_ASTRING
, 0},
83 {SMB_CI_DOMAIN_MEMB
, "domain_member", SCF_TYPE_BOOLEAN
, 0},
84 {SMB_CI_DOMAIN_NAME
, "domain_name", SCF_TYPE_ASTRING
, 0},
85 {SMB_CI_DOMAIN_FQDN
, "fqdn", SCF_TYPE_ASTRING
, 0},
86 {SMB_CI_DOMAIN_FOREST
, "forest", SCF_TYPE_ASTRING
, 0},
87 {SMB_CI_DOMAIN_GUID
, "domain_guid", SCF_TYPE_ASTRING
, 0},
88 {SMB_CI_DOMAIN_SRV
, "pdc", SCF_TYPE_ASTRING
, 0},
90 /* WINS configuration */
91 {SMB_CI_WINS_SRV1
, "wins_server_1", SCF_TYPE_ASTRING
, 0},
92 {SMB_CI_WINS_SRV2
, "wins_server_2", SCF_TYPE_ASTRING
, 0},
93 {SMB_CI_WINS_EXCL
, "wins_exclude", SCF_TYPE_ASTRING
, 0},
95 /* Kmod specific configuration */
96 {SMB_CI_MAX_WORKERS
, "max_workers", SCF_TYPE_INTEGER
, 0},
97 {SMB_CI_MAX_CONNECTIONS
, "max_connections", SCF_TYPE_INTEGER
, 0},
98 {SMB_CI_KEEPALIVE
, "keep_alive", SCF_TYPE_INTEGER
, 0},
99 {SMB_CI_RESTRICT_ANON
, "restrict_anonymous", SCF_TYPE_BOOLEAN
, 0},
101 {SMB_CI_SIGNING_ENABLE
, "signing_enabled", SCF_TYPE_BOOLEAN
, 0},
102 {SMB_CI_SIGNING_REQD
, "signing_required", SCF_TYPE_BOOLEAN
, 0},
104 /* Kmod tuning configuration */
105 {SMB_CI_SYNC_ENABLE
, "sync_enable", SCF_TYPE_BOOLEAN
, 0},
107 /* SMBd configuration */
108 {SMB_CI_SECURITY
, "security", SCF_TYPE_ASTRING
, 0},
109 {SMB_CI_NBSCOPE
, "netbios_scope", SCF_TYPE_ASTRING
, 0},
110 {SMB_CI_SYS_CMNT
, "system_comment", SCF_TYPE_ASTRING
, 0},
111 {SMB_CI_LM_LEVEL
, "lmauth_level", SCF_TYPE_INTEGER
, 0},
113 /* ADS Configuration */
114 {SMB_CI_ADS_SITE
, "ads_site", SCF_TYPE_ASTRING
, 0},
117 {SMB_CI_DYNDNS_ENABLE
, "ddns_enable", SCF_TYPE_BOOLEAN
, 0},
119 {SMB_CI_MACHINE_PASSWD
, "machine_passwd", SCF_TYPE_ASTRING
,
121 {SMB_CI_KPASSWD_SRV
, "kpasswd_server", SCF_TYPE_ASTRING
,
123 {SMB_CI_KPASSWD_DOMAIN
, "kpasswd_domain", SCF_TYPE_ASTRING
,
125 {SMB_CI_KPASSWD_SEQNUM
, "kpasswd_seqnum", SCF_TYPE_INTEGER
,
127 {SMB_CI_NETLOGON_SEQNUM
, "netlogon_seqnum", SCF_TYPE_INTEGER
,
129 {SMB_CI_IPV6_ENABLE
, "ipv6_enable", SCF_TYPE_BOOLEAN
, 0},
130 {SMB_CI_MAP
, "map", SCF_TYPE_ASTRING
, SMB_CF_EXEC
},
131 {SMB_CI_UNMAP
, "unmap", SCF_TYPE_ASTRING
, SMB_CF_EXEC
},
132 {SMB_CI_DISPOSITION
, "disposition", SCF_TYPE_ASTRING
, SMB_CF_EXEC
}
137 static smb_cfg_param_t
*smb_config_getent(smb_cfg_id_t
);
139 static boolean_t
smb_is_base64(unsigned char c
);
140 static char *smb_base64_encode(char *str_to_encode
);
141 static char *smb_base64_decode(char *encoded_str
);
144 smb_config_getname(smb_cfg_id_t id
)
146 smb_cfg_param_t
*cfg
;
147 cfg
= smb_config_getent(id
);
148 return (cfg
->sc_name
);
152 smb_is_base64(unsigned char c
)
154 return (isalnum(c
) || (c
== '+') || (c
== '/'));
160 * Encode a string using base64 algorithm.
161 * Caller should free the returned buffer when done.
164 smb_base64_encode(char *str_to_encode
)
168 char arr_3
[3], arr_4
[4];
169 int len
= strlen(str_to_encode
);
170 char *ret
= malloc(SMB_ENC_LEN
);
177 arr_3
[i
++] = *(str_to_encode
++);
179 arr_4
[0] = (arr_3
[0] & 0xfc) >> 2;
180 arr_4
[1] = ((arr_3
[0] & 0x03) << 4) +
181 ((arr_3
[1] & 0xf0) >> 4);
182 arr_4
[2] = ((arr_3
[1] & 0x0f) << 2) +
183 ((arr_3
[2] & 0xc0) >> 6);
184 arr_4
[3] = arr_3
[2] & 0x3f;
186 for (i
= 0; i
< 4; i
++)
187 ret
[ret_cnt
++] = b64_data
[arr_4
[i
]];
193 for (j
= i
; j
< 3; j
++)
196 arr_4
[0] = (arr_3
[0] & 0xfc) >> 2;
197 arr_4
[1] = ((arr_3
[0] & 0x03) << 4) +
198 ((arr_3
[1] & 0xf0) >> 4);
199 arr_4
[2] = ((arr_3
[1] & 0x0f) << 2) +
200 ((arr_3
[2] & 0xc0) >> 6);
201 arr_4
[3] = arr_3
[2] & 0x3f;
203 for (j
= 0; j
< (i
+ 1); j
++)
204 ret
[ret_cnt
++] = b64_data
[arr_4
[j
]];
207 ret
[ret_cnt
++] = '=';
210 ret
[ret_cnt
++] = '\0';
217 * Decode using base64 algorithm.
218 * Caller should free the returned buffer when done.
221 smb_base64_decode(char *encoded_str
)
223 int len
= strlen(encoded_str
);
226 char arr_4
[4], arr_3
[3];
228 char *ret
= malloc(SMB_DEC_LEN
);
235 while (len
-- && (encoded_str
[en_ind
] != '=') &&
236 smb_is_base64(encoded_str
[en_ind
])) {
237 arr_4
[i
++] = encoded_str
[en_ind
];
240 for (i
= 0; i
< 4; i
++) {
241 if ((p
= strchr(b64_data
, arr_4
[i
])) == NULL
)
244 arr_4
[i
] = (int)(p
- b64_data
);
247 arr_3
[0] = (arr_4
[0] << 2) +
248 ((arr_4
[1] & 0x30) >> 4);
249 arr_3
[1] = ((arr_4
[1] & 0xf) << 4) +
250 ((arr_4
[2] & 0x3c) >> 2);
251 arr_3
[2] = ((arr_4
[2] & 0x3) << 6) +
254 for (i
= 0; i
< 3; i
++)
255 ret
[ret_cnt
++] = arr_3
[i
];
262 for (j
= i
; j
< 4; j
++)
265 for (j
= 0; j
< 4; j
++) {
266 if ((p
= strchr(b64_data
, arr_4
[j
])) == NULL
)
269 arr_4
[j
] = (int)(p
- b64_data
);
271 arr_3
[0] = (arr_4
[0] << 2) +
272 ((arr_4
[1] & 0x30) >> 4);
273 arr_3
[1] = ((arr_4
[1] & 0xf) << 4) +
274 ((arr_4
[2] & 0x3c) >> 2);
275 arr_3
[2] = ((arr_4
[2] & 0x3) << 6) +
277 for (j
= 0; j
< (i
- 1); j
++)
278 ret
[ret_cnt
++] = arr_3
[j
];
281 ret
[ret_cnt
++] = '\0';
286 smb_config_getenv_generic(char *name
, char *svc_fmri_prefix
, char *svc_propgrp
)
288 smb_scfhandle_t
*handle
;
291 if ((value
= malloc(MAX_VALUE_BUFLEN
* sizeof (char))) == NULL
)
294 handle
= smb_smf_scf_init(svc_fmri_prefix
);
295 if (handle
== NULL
) {
300 (void) smb_smf_create_service_pgroup(handle
, svc_propgrp
);
302 if (smb_smf_get_string_property(handle
, name
, value
,
303 sizeof (char) * MAX_VALUE_BUFLEN
) != 0) {
304 smb_smf_scf_fini(handle
);
309 smb_smf_scf_fini(handle
);
315 smb_config_setenv_generic(char *svc_fmri_prefix
, char *svc_propgrp
,
316 char *name
, char *value
)
318 smb_scfhandle_t
*handle
= NULL
;
322 handle
= smb_smf_scf_init(svc_fmri_prefix
);
323 if (handle
== NULL
) {
327 (void) smb_smf_create_service_pgroup(handle
, svc_propgrp
);
329 if (smb_smf_start_transaction(handle
) != SMBD_SMF_OK
) {
330 smb_smf_scf_fini(handle
);
334 if (smb_smf_set_string_property(handle
, name
, value
) != SMBD_SMF_OK
)
337 if (smb_smf_end_transaction(handle
) != SMBD_SMF_OK
)
340 smb_smf_scf_fini(handle
);
347 * Fetch the specified string configuration item from SMF
350 smb_config_getstr(smb_cfg_id_t id
, char *cbuf
, int bufsz
)
352 smb_scfhandle_t
*handle
;
353 smb_cfg_param_t
*cfg
;
354 int rc
= SMBD_SMF_OK
;
356 char protbuf
[SMB_ENC_LEN
];
360 cfg
= smb_config_getent(id
);
361 assert(cfg
->sc_type
== SCF_TYPE_ASTRING
);
363 handle
= smb_smf_scf_init(SMBD_FMRI_PREFIX
);
365 return (SMBD_SMF_SYSTEM_ERR
);
367 if (cfg
->sc_flags
& SMB_CF_PROTECTED
) {
368 if ((rc
= smb_smf_create_service_pgroup(handle
,
369 SMBD_PROTECTED_PG_NAME
)) != SMBD_SMF_OK
)
372 if ((rc
= smb_smf_get_string_property(handle
, cfg
->sc_name
,
373 protbuf
, sizeof (protbuf
))) != SMBD_SMF_OK
)
376 if (*protbuf
!= '\0') {
377 tmp
= smb_base64_decode(protbuf
);
378 (void) strlcpy(cbuf
, tmp
, bufsz
);
382 pg
= (cfg
->sc_flags
& SMB_CF_EXEC
) ? SMBD_EXEC_PG_NAME
:
384 rc
= smb_smf_create_service_pgroup(handle
, pg
);
385 if (rc
== SMBD_SMF_OK
)
386 rc
= smb_smf_get_string_property(handle
, cfg
->sc_name
,
391 smb_smf_scf_fini(handle
);
396 * Translate the value of an astring SMF property into a binary
397 * IP address. If the value is neither a valid IPv4 nor IPv6
398 * address, attempt to look it up as a hostname using the
399 * configured address type.
402 smb_config_getip(smb_cfg_id_t sc_id
, smb_inaddr_t
*ipaddr
)
406 char ipstr
[MAXHOSTNAMELEN
];
408 smb_cfg_param_t
*cfg
;
411 return (SMBD_SMF_INVALID_ARG
);
413 bzero(ipaddr
, sizeof (smb_inaddr_t
));
414 rc
= smb_config_getstr(sc_id
, ipstr
, sizeof (ipstr
));
415 if (rc
== SMBD_SMF_OK
) {
417 return (SMBD_SMF_INVALID_ARG
);
419 if (inet_pton(AF_INET
, ipstr
, &ipaddr
->a_ipv4
) == 1) {
420 ipaddr
->a_family
= AF_INET
;
421 return (SMBD_SMF_OK
);
424 if (inet_pton(AF_INET6
, ipstr
, &ipaddr
->a_ipv6
) == 1) {
425 ipaddr
->a_family
= AF_INET6
;
426 return (SMBD_SMF_OK
);
430 * The value is neither an IPv4 nor IPv6 address;
431 * so check if it's a hostname.
433 a_family
= smb_config_getbool(SMB_CI_IPV6_ENABLE
) ?
435 h
= getipnodebyname(ipstr
, a_family
, AI_DEFAULT
,
438 bcopy(*(h
->h_addr_list
), &ipaddr
->a_ip
,
440 ipaddr
->a_family
= a_family
;
444 cfg
= smb_config_getent(sc_id
);
445 syslog(LOG_ERR
, "smbd/%s: %s unable to get %s "
446 "address: %d", cfg
->sc_name
, ipstr
,
447 a_family
== AF_INET
? "IPv4" : "IPv6", error
);
448 rc
= SMBD_SMF_INVALID_ARG
;
458 * Returns the value of a numeric config param.
461 smb_config_getnum(smb_cfg_id_t id
, int64_t *cint
)
463 smb_scfhandle_t
*handle
;
464 smb_cfg_param_t
*cfg
;
465 int rc
= SMBD_SMF_OK
;
468 cfg
= smb_config_getent(id
);
469 assert(cfg
->sc_type
== SCF_TYPE_INTEGER
);
471 handle
= smb_smf_scf_init(SMBD_FMRI_PREFIX
);
473 return (SMBD_SMF_SYSTEM_ERR
);
475 rc
= smb_smf_create_service_pgroup(handle
, SMBD_PG_NAME
);
476 if (rc
== SMBD_SMF_OK
)
477 rc
= smb_smf_get_integer_property(handle
, cfg
->sc_name
, cint
);
478 smb_smf_scf_fini(handle
);
486 * Returns the value of a boolean config param.
489 smb_config_getbool(smb_cfg_id_t id
)
491 smb_scfhandle_t
*handle
;
492 smb_cfg_param_t
*cfg
;
493 int rc
= SMBD_SMF_OK
;
496 cfg
= smb_config_getent(id
);
497 assert(cfg
->sc_type
== SCF_TYPE_BOOLEAN
);
499 handle
= smb_smf_scf_init(SMBD_FMRI_PREFIX
);
503 rc
= smb_smf_create_service_pgroup(handle
, SMBD_PG_NAME
);
504 if (rc
== SMBD_SMF_OK
)
505 rc
= smb_smf_get_boolean_property(handle
, cfg
->sc_name
, &vbool
);
506 smb_smf_scf_fini(handle
);
508 return ((rc
== SMBD_SMF_OK
) ? (vbool
== 1) : B_FALSE
);
514 * This function returns the value of the requested config
515 * iterm regardless of its type in string format. This should
516 * be used when the config item type is not known by the caller.
519 smb_config_get(smb_cfg_id_t id
, char *cbuf
, int bufsz
)
521 smb_cfg_param_t
*cfg
;
525 cfg
= smb_config_getent(id
);
526 switch (cfg
->sc_type
) {
527 case SCF_TYPE_ASTRING
:
528 return (smb_config_getstr(id
, cbuf
, bufsz
));
530 case SCF_TYPE_INTEGER
:
531 rc
= smb_config_getnum(id
, &cint
);
532 if (rc
== SMBD_SMF_OK
)
533 (void) snprintf(cbuf
, bufsz
, "%lld", cint
);
536 case SCF_TYPE_BOOLEAN
:
537 if (smb_config_getbool(id
))
538 (void) strlcpy(cbuf
, "true", bufsz
);
540 (void) strlcpy(cbuf
, "false", bufsz
);
541 return (SMBD_SMF_OK
);
544 return (SMBD_SMF_INVALID_ARG
);
550 * Set the specified config param with the given
554 smb_config_setstr(smb_cfg_id_t id
, char *value
)
556 smb_scfhandle_t
*handle
;
557 smb_cfg_param_t
*cfg
;
558 int rc
= SMBD_SMF_OK
;
563 cfg
= smb_config_getent(id
);
564 assert(cfg
->sc_type
== SCF_TYPE_ASTRING
);
568 switch (cfg
->sc_flags
) {
569 case SMB_CF_PROTECTED
:
571 pg
= SMBD_PROTECTED_PG_NAME
;
574 pg
= SMBD_EXEC_PG_NAME
;
581 handle
= smb_smf_scf_init(SMBD_FMRI_PREFIX
);
583 return (SMBD_SMF_SYSTEM_ERR
);
585 rc
= smb_smf_create_service_pgroup(handle
, pg
);
586 if (rc
== SMBD_SMF_OK
)
587 rc
= smb_smf_start_transaction(handle
);
589 if (rc
!= SMBD_SMF_OK
) {
590 smb_smf_scf_fini(handle
);
594 if (protected && value
&& (*value
!= '\0')) {
595 if ((tmp
= smb_base64_encode(value
)) == NULL
) {
596 (void) smb_smf_end_transaction(handle
);
597 smb_smf_scf_fini(handle
);
598 return (SMBD_SMF_NO_MEMORY
);
604 rc
= smb_smf_set_string_property(handle
, cfg
->sc_name
, value
);
607 (void) smb_smf_end_transaction(handle
);
608 smb_smf_scf_fini(handle
);
615 * Sets a numeric configuration iterm
618 smb_config_setnum(smb_cfg_id_t id
, int64_t value
)
620 smb_scfhandle_t
*handle
;
621 smb_cfg_param_t
*cfg
;
622 int rc
= SMBD_SMF_OK
;
624 cfg
= smb_config_getent(id
);
625 assert(cfg
->sc_type
== SCF_TYPE_INTEGER
);
627 handle
= smb_smf_scf_init(SMBD_FMRI_PREFIX
);
629 return (SMBD_SMF_SYSTEM_ERR
);
631 rc
= smb_smf_create_service_pgroup(handle
, SMBD_PG_NAME
);
632 if (rc
== SMBD_SMF_OK
)
633 rc
= smb_smf_start_transaction(handle
);
635 if (rc
!= SMBD_SMF_OK
) {
636 smb_smf_scf_fini(handle
);
640 rc
= smb_smf_set_integer_property(handle
, cfg
->sc_name
, value
);
642 (void) smb_smf_end_transaction(handle
);
643 smb_smf_scf_fini(handle
);
650 * Sets a boolean configuration iterm
653 smb_config_setbool(smb_cfg_id_t id
, boolean_t value
)
655 smb_scfhandle_t
*handle
;
656 smb_cfg_param_t
*cfg
;
657 int rc
= SMBD_SMF_OK
;
659 cfg
= smb_config_getent(id
);
660 assert(cfg
->sc_type
== SCF_TYPE_BOOLEAN
);
662 handle
= smb_smf_scf_init(SMBD_FMRI_PREFIX
);
664 return (SMBD_SMF_SYSTEM_ERR
);
666 rc
= smb_smf_create_service_pgroup(handle
, SMBD_PG_NAME
);
667 if (rc
== SMBD_SMF_OK
)
668 rc
= smb_smf_start_transaction(handle
);
670 if (rc
!= SMBD_SMF_OK
) {
671 smb_smf_scf_fini(handle
);
675 rc
= smb_smf_set_boolean_property(handle
, cfg
->sc_name
, value
);
677 (void) smb_smf_end_transaction(handle
);
678 smb_smf_scf_fini(handle
);
685 * This function sets the value of the specified config
686 * iterm regardless of its type in string format. This should
687 * be used when the config item type is not known by the caller.
690 smb_config_set(smb_cfg_id_t id
, char *value
)
692 smb_cfg_param_t
*cfg
;
695 cfg
= smb_config_getent(id
);
696 switch (cfg
->sc_type
) {
697 case SCF_TYPE_ASTRING
:
698 return (smb_config_setstr(id
, value
));
700 case SCF_TYPE_INTEGER
:
702 return (smb_config_setnum(id
, cint
));
704 case SCF_TYPE_BOOLEAN
:
705 return (smb_config_setbool(id
, strcasecmp(value
, "true") == 0));
708 return (SMBD_SMF_INVALID_ARG
);
711 smb_config_get_fg_flag()
713 uint8_t run_fg
= 0; /* Default is to run in daemon mode */
714 smb_scfhandle_t
*handle
= NULL
;
716 handle
= smb_smf_scf_init(SMBD_FMRI_PREFIX
);
717 if (handle
== NULL
) {
721 if (smb_smf_create_service_pgroup(handle
,
722 SMBD_PG_NAME
) != SMBD_SMF_OK
) {
723 smb_smf_scf_fini(handle
);
727 if (smb_smf_get_boolean_property(handle
, "run_fg", &run_fg
) != 0) {
728 smb_smf_scf_fini(handle
);
732 smb_smf_scf_fini(handle
);
738 * smb_config_get_localsid
740 * Returns value of the "config/machine_sid" parameter
741 * from the IDMAP SMF configuration repository.
745 smb_config_get_localsid(void)
747 return (smb_config_getenv_generic(MACHINE_SID
, IDMAP_FMRI_PREFIX
,
752 * smb_config_set_idmap_domain
754 * Set the "config/domain_name" parameter from IDMAP SMF repository.
757 smb_config_set_idmap_domain(char *value
)
759 return (smb_config_setenv_generic(IDMAP_FMRI_PREFIX
, IDMAP_PG_NAME
,
760 IDMAP_DOMAIN
, value
));
764 * smb_config_refresh_idmap
766 * Refresh IDMAP SMF service after making changes to its configuration.
769 smb_config_refresh_idmap(void)
773 (void) snprintf(instance
, sizeof (instance
), "%s:default",
775 return (smf_refresh_instance(instance
));
779 smb_config_secmode_fromstr(char *secmode
)
782 return (SMB_SECMODE_WORKGRP
);
784 if (strcasecmp(secmode
, SMB_SECMODE_DOMAIN_STR
) == 0)
785 return (SMB_SECMODE_DOMAIN
);
787 return (SMB_SECMODE_WORKGRP
);
791 smb_config_secmode_tostr(int secmode
)
793 if (secmode
== SMB_SECMODE_DOMAIN
)
794 return (SMB_SECMODE_DOMAIN_STR
);
796 return (SMB_SECMODE_WORKGRP_STR
);
800 smb_config_get_secmode()
804 (void) smb_config_getstr(SMB_CI_SECURITY
, p
, sizeof (p
));
805 return (smb_config_secmode_fromstr(p
));
809 smb_config_set_secmode(int secmode
)
813 p
= smb_config_secmode_tostr(secmode
);
814 return (smb_config_setstr(SMB_CI_SECURITY
, p
));
817 static smb_cfg_param_t
*
818 smb_config_getent(smb_cfg_id_t id
)
822 for (i
= 0; i
< SMB_CI_MAX
; i
++)
823 if (smb_cfg_table
[i
].sc_id
== id
)
824 return (&smb_cfg_table
[id
]);
831 smb_config_getdomaininfo(char *domain
, char *fqdn
, char *sid
, char *forest
,
835 (void) smb_config_getstr(SMB_CI_DOMAIN_NAME
, domain
,
839 (void) smb_config_getstr(SMB_CI_DOMAIN_FQDN
, fqdn
,
843 (void) smb_config_getstr(SMB_CI_DOMAIN_SID
, sid
,
847 (void) smb_config_getstr(SMB_CI_DOMAIN_FOREST
, forest
,
851 (void) smb_config_getstr(SMB_CI_DOMAIN_GUID
, guid
,
852 UUID_PRINTABLE_STRING_LENGTH
);
856 smb_config_setdomaininfo(char *domain
, char *fqdn
, char *sid
, char *forest
,
860 (void) smb_config_setstr(SMB_CI_DOMAIN_NAME
, domain
);
862 (void) smb_config_setstr(SMB_CI_DOMAIN_FQDN
, fqdn
);
864 (void) smb_config_setstr(SMB_CI_DOMAIN_SID
, sid
);
866 (void) smb_config_setstr(SMB_CI_DOMAIN_FOREST
, forest
);
868 (void) smb_config_setstr(SMB_CI_DOMAIN_GUID
, guid
);