da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * CDDL HEADER START
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The contents of this file are subject to the terms of the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Common Development and Distribution License (the "License").
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You may not use this file except in compliance with the License.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * See the License for the specific language governing permissions
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * and limitations under the License.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * When distributing Covered Code, include this CDDL HEADER in each
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If applicable, add the following below this CDDL HEADER, with the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * fields enclosed by brackets "[]" replaced with your own identifying
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * information: Portions Copyright [yyyy] [name of copyright owner]
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * CDDL HEADER END
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright * IPC connection information that may be passed to the SMB Redirector.
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wrighttypedef struct {
eb1d736b1c19f6abeee90c921a9320b67fedd016afshin salek ardakani - Sun Microsystems - Irvine United States/*
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * These three parameters are all related:
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * skc_initial_credits
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * skc_maximum_credits
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * skc_maxworkers (max worker threads)
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * They must be in non-decreasing order. Get the values in order:
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * maxworkers, maximum_credits, initial_credits
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * enforcing maximum values and relations as we go. Then in the
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * opposite order check minimum values and relations.
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * smb_config_getnum puts a zero in the &citem if it fails getting
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * the parameter value. When fetch parameters for which zero is OK,
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * the return code is intentionally ignored.
eb1d736b1c19f6abeee90c921a9320b67fedd016afshin salek ardakani - Sun Microsystems - Irvine United States */
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * skc_maxworkers (max. no. of taskq worker threads)
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross rc = smb_config_getnum(SMB_CI_MAX_WORKERS, &citem);
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * The largest number of credits we let a single client have.
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * It never makes sense for this to be > max_workers
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross rc = smb_config_getnum(SMB_CI_MAXIMUM_CREDITS, &citem);
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross if (kcfg->skc_maximum_credits > kcfg->skc_maxworkers)
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross kcfg->skc_maximum_credits = (uint16_t)kcfg->skc_maxworkers;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * The number of credits we give a client initially.
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * Should be enough for a "light" workload, as the
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * client will request additional credits when the
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * workload increases. Must be <= maximum_credits.
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross rc = smb_config_getnum(SMB_CI_INITIAL_CREDITS, &citem);
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross if (kcfg->skc_initial_credits > kcfg->skc_maximum_credits)
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross kcfg->skc_initial_credits = kcfg->skc_maximum_credits;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * Now enforce minimums, smaller to larger.
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross if (kcfg->skc_initial_credits < SMB_PI_INITIAL_CREDITS_MIN)
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross kcfg->skc_initial_credits = SMB_PI_INITIAL_CREDITS_MIN;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross if (kcfg->skc_maximum_credits < SMB_PI_MAXIMUM_CREDITS_MIN)
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross kcfg->skc_maximum_credits = SMB_PI_MAXIMUM_CREDITS_MIN;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross if (kcfg->skc_maximum_credits < kcfg->skc_initial_credits)
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross kcfg->skc_maximum_credits = kcfg->skc_initial_credits;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross if (kcfg->skc_maxworkers < SMB_PI_MAX_WORKERS_MIN)
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross if (kcfg->skc_maxworkers < kcfg->skc_maximum_credits)
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross kcfg->skc_maxworkers = kcfg->skc_maximum_credits;
eb1d736b1c19f6abeee90c921a9320b67fedd016afshin salek ardakani - Sun Microsystems - Irvine United States
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as (void) smb_config_getnum(SMB_CI_MAX_CONNECTIONS, &citem);
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as kcfg->skc_restrict_anon = smb_config_getbool(SMB_CI_RESTRICT_ANON);
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as kcfg->skc_signing_enable = smb_config_getbool(SMB_CI_SIGNING_ENABLE);
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as kcfg->skc_signing_required = smb_config_getbool(SMB_CI_SIGNING_REQD);
83d2dfe69259e79314662cf95e6d1f9103dcffe2Gordon Ross kcfg->skc_netbios_enable = smb_config_getbool(SMB_CI_NETBIOS_ENABLE);
7f667e74610492ddbce8ce60f52ece95d2401949jose borrego kcfg->skc_ipv6_enable = smb_config_getbool(SMB_CI_IPV6_ENABLE);
cb174861876aea6950a7ab4ce944aff84b1914cdjoyce mcintosh kcfg->skc_print_enable = smb_config_getbool(SMB_CI_PRINT_ENABLE);
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as kcfg->skc_oplock_enable = smb_config_getbool(SMB_CI_OPLOCK_ENABLE);
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as kcfg->skc_sync_enable = smb_config_getbool(SMB_CI_SYNC_ENABLE);
5f1ef25c7a11451cbd3080dc3ce8e8db4ca996c4Aram Hăvărneanu kcfg->skc_traverse_mounts = smb_config_getbool(SMB_CI_TRAVERSE_MOUNTS);
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross kcfg->skc_max_protocol = smb_config_get_max_protocol();
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States (void) smb_getdomainname(kcfg->skc_nbdomain,
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States sizeof (kcfg->skc_nbdomain));
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States (void) smb_getfqdomainname(kcfg->skc_fqdn,
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States sizeof (kcfg->skc_fqdn));
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States (void) smb_getnetbiosname(kcfg->skc_hostname,
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States sizeof (kcfg->skc_hostname));
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as (void) smb_config_getstr(SMB_CI_SYS_CMNT, kcfg->skc_system_comment,
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States smb_config_get_version(&kcfg->skc_version);
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright kcfg->skc_execflags = smb_config_get_execinfo(NULL, NULL, 0);
12b65585e720714b31036daaa2b30eb76014048eGordon Ross if (smb_config_get_localuuid(kcfg->skc_machine_uuid) < 0) {
12b65585e720714b31036daaa2b30eb76014048eGordon Ross syslog(LOG_ERR, "smb_load_kconfig: no machine_uuid");
12b65585e720714b31036daaa2b30eb76014048eGordon Ross /* skc_negtok, skc_negtok_len: see smbd_authsvc.c */
12b65585e720714b31036daaa2b30eb76014048eGordon Ross (void) snprintf(kcfg->skc_native_os, sizeof (kcfg->skc_native_os),
12b65585e720714b31036daaa2b30eb76014048eGordon Ross "%s %s %s", uts.sysname, uts.release, uts.version);
12b65585e720714b31036daaa2b30eb76014048eGordon Ross (void) strlcpy(kcfg->skc_native_lm, "Native SMB service",
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Get the current system NetBIOS name. The hostname is truncated at
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the first `.` or 15 bytes, whichever occurs first, and converted
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * to uppercase (by smb_gethostname). Text that appears after the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * first '.' is considered to be part of the NetBIOS scope.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Returns 0 on success, otherwise -1 to indicate an error.
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States if (smb_gethostname(buf, buflen, SMB_CASE_UPPER) != 0)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (-1);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (0);
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States * Get the SAM account of the current system.
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States * Returns 0 on success, otherwise, -1 to indicate an error.
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United Statessmb_getsamaccount(char *buf, size_t buflen)
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States if (smb_getnetbiosname(buf, buflen - 1) != 0)
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States return (-1);
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States (void) strlcat(buf, "$", buflen);
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States return (0);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Get the current system node name. The returned name is guaranteed
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * to be null-terminated (gethostname may not null terminate the name).
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If the hostname has been fully-qualified for some reason, the domain
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States * part will be removed. The returned hostname is converted to the
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States * specified case (lower, upper, or preserved).
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If gethostname fails, the returned buffer will contain an empty
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United Statessmb_gethostname(char *buf, size_t buflen, smb_caseconv_t which)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (-1);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (-1);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *p = '\0';
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States switch (which) {
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States case SMB_CASE_LOWER:
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States (void) smb_strlwr(buf);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States break;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States case SMB_CASE_UPPER:
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States break;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States case SMB_CASE_PRESERVE:
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States default:
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States break;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (0);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States * Obtain the fully-qualified name for this machine in lower case. If
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States * the hostname is fully-qualified, accept it. Otherwise, try to find an
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States * appropriate domain name to append to the hostname.
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States if (smb_gethostname(hostname, MAXHOSTNAMELEN,
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States SMB_CASE_LOWER) != 0)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (-1);
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as return (-1);
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as return (-1);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (0);
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as return (0);
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as * smb_getdomainname
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as * Returns NETBIOS name of the domain if the system is in domain
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as * mode. Or returns workgroup name if the system is in workgroup
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as return (-1);
8d7e41661dc4633488e93b13363137523ce59977jose borrego rc = smb_config_getstr(SMB_CI_DOMAIN_NAME, buf, buflen);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (-1);
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as return (0);
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as * smb_getfqdomainname
8d7e41661dc4633488e93b13363137523ce59977jose borrego * In the system is in domain mode, the dns_domain property value
8d7e41661dc4633488e93b13363137523ce59977jose borrego * is returned. Otherwise, it returns the local domain obtained via
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as * Returns 0 upon success. Otherwise, returns -1.
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as return (-1);
8d7e41661dc4633488e93b13363137523ce59977jose borrego rc = smb_config_getstr(SMB_CI_DOMAIN_FQDN, buf, buflen);
8d7e41661dc4633488e93b13363137523ce59977jose borrego return (-1);
8d7e41661dc4633488e93b13363137523ce59977jose borrego bzero(&res_state, sizeof (struct __res_state));
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as return (-1);
8d7e41661dc4633488e93b13363137523ce59977jose borrego return (-1);
8d7e41661dc4633488e93b13363137523ce59977jose borrego (void) strlcpy(buf, res_state.defdname, buflen);
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as return (rc);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * smb_set_machine_passwd
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * This function should be used when setting the machine password property.
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * The associated sequence number is incremented.
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb if (smb_config_set(SMB_CI_MACHINE_PASSWD, passwd) != SMBD_SMF_OK)
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (-1);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (rc);
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wrightsmb_get_machine_passwd(uint8_t *buf, size_t buflen)
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright return (-1);
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright rc = smb_config_getstr(SMB_CI_MACHINE_PASSWD, pwd, sizeof (pwd));
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright return (-1);
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright return (-1);
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright * Set up IPC connection credentials.
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright (void) smb_getsamaccount(ipc_info.user, SMB_USERNAME_MAXLEN);
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright rc = smb_get_machine_passwd(ipc_info.passwd, SMBAUTH_HASH_SZ);
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright * Set the IPC username and password hash in memory. If the domain
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright * join succeeds, the credentials will be committed for use with
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright * authenticated IPC. Otherwise, they should be rolled back.
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wrightsmb_ipc_set(char *plain_user, uint8_t *passwd_hash)
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright (void) strlcpy(ipc_info.user, plain_user, sizeof (ipc_info.user));
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright (void) memcpy(ipc_info.passwd, passwd_hash, SMBAUTH_HASH_SZ);
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright * Save the host credentials to be used for authenticated IPC.
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright * The credentials are also saved to the original IPC info as
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright * rollback data in case the join domain process fails later.
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright (void) smb_getsamaccount(ipc_info.user, SMB_USERNAME_MAXLEN);
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright (void) smb_get_machine_passwd(ipc_info.passwd, SMBAUTH_HASH_SZ);
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright (void) memcpy(&ipc_orig_info, &ipc_info, sizeof (smb_ipc_t));
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright * Restore the original credentials
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright (void) strlcpy(ipc_info.user, ipc_orig_info.user,
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright (void) memcpy(ipc_info.passwd, ipc_orig_info.passwd,
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright (void) memcpy(buf, ipc_info.passwd, SMBAUTH_HASH_SZ);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * smb_match_netlogon_seqnum
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * A sequence number is associated with each machine password property
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * update and the netlogon credential chain setup. If the
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * sequence numbers don't match, a NETLOGON credential chain
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * establishment is required.
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * Returns 0 if kpasswd_seqnum equals to netlogon_seqnum. Otherwise,
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * returns -1.
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb (void) smb_config_getnum(SMB_CI_KPASSWD_SEQNUM, &setpasswd_seqnum);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb (void) smb_config_getnum(SMB_CI_NETLOGON_SEQNUM, &netlogon_seqnum);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * smb_setdomainprops
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * This function should be called after joining an AD to
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * set all the domain related SMF properties.
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * The kpasswd_domain property is the AD domain to which the system
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * is joined via kclient. If this function is invoked by the SMB
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * daemon, fqdn should be set to NULL.
faa1795a28a5c712eed6d0a3f84d98c368a316c6jbsmb_setdomainprops(char *fqdn, char *server, char *passwd)
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (-1);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (-1);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb if (fqdn && (smb_config_set(SMB_CI_KPASSWD_DOMAIN, fqdn) != 0))
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (-1);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (-1);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb " machine account password");
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (-1);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * If we successfully create a trust account, we mark
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * ourselves as a domain member in the environment so
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * that we use the SAMLOGON version of the NETLOGON
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * PDC location protocol.
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (0);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * smb_update_netlogon_seqnum
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * This function should only be called upon a successful netlogon
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * credential chain establishment to set the sequence number of the
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb * netlogon to match with that of the kpasswd.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Temporary fbt for dtrace until user space sdt enabled.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Temporary fbt for dtrace until user space sdt enabled.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * This function is designed to be used with dtrace, i.e. see:
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Outside of dtrace, the messages passed to this function usually
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * lack sufficient context to be useful, so we don't log them.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross/* ARGSUSED */
7b59d02d2a384be9a08087b14defadd214b3c1ddjb * smb_tonetbiosname
7b59d02d2a384be9a08087b14defadd214b3c1ddjb * Creates a NetBIOS name based on the given name and suffix.
7b59d02d2a384be9a08087b14defadd214b3c1ddjb * NetBIOS name is 15 capital characters, padded with space if needed
7b59d02d2a384be9a08087b14defadd214b3c1ddjb * and the 16th byte is the suffix.
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown rc = smb_mbstowcs(wtmp_name, (const char *)name, NETBIOS_NAME_SZ);
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown rc = ucstooem(tmp_name, wtmp_name, NETBIOS_NAME_SZ,
7b59d02d2a384be9a08087b14defadd214b3c1ddjb return (0);
7b59d02d2a384be9a08087b14defadd214b3c1ddjb return (0);
7b59d02d2a384be9a08087b14defadd214b3c1ddjb for (i = 0; i < cnt; i++) {
7b59d02d2a384be9a08087b14defadd214b3c1ddjb if (i >= sz)
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross bcopy(&set[i].sin.sin_addr, &ips[i].a_ipv4, NS_INADDRSZ);
7f667e74610492ddbce8ce60f52ece95d2401949jose borrego syslog(LOG_DEBUG, "Found %s name server\n", ipstr);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross bcopy(&set[i].sin.sin_addr, &ips[i].a_ipv6, NS_IN6ADDRSZ);
7f667e74610492ddbce8ce60f52ece95d2401949jose borrego syslog(LOG_DEBUG, "Found %s name server\n", ipstr);
7b59d02d2a384be9a08087b14defadd214b3c1ddjb return (i);
8d7e41661dc4633488e93b13363137523ce59977jose borrego * smb_gethostbyname
8d7e41661dc4633488e93b13363137523ce59977jose borrego * Looks up a host by the given name. The host entry can come
8d7e41661dc4633488e93b13363137523ce59977jose borrego * from any of the sources for hosts specified in the
8d7e41661dc4633488e93b13363137523ce59977jose borrego * /etc/nsswitch.conf and the NetBIOS cache.
8d7e41661dc4633488e93b13363137523ce59977jose borrego * XXX Invokes nbt_name_resolve API once the NBTD is integrated
8d7e41661dc4633488e93b13363137523ce59977jose borrego * to look in the NetBIOS cache if getipnodebyname fails.
8d7e41661dc4633488e93b13363137523ce59977jose borrego * Caller should invoke freehostent to free the returned hostent.
8d7e41661dc4633488e93b13363137523ce59977jose borregosmb_gethostbyname(const char *name, int *err_num)
8d7e41661dc4633488e93b13363137523ce59977jose borrego h = getipnodebyname(name, AF_INET, 0, err_num);
7f667e74610492ddbce8ce60f52ece95d2401949jose borrego h = getipnodebyname(name, AF_INET6, AI_DEFAULT, err_num);
8d7e41661dc4633488e93b13363137523ce59977jose borrego * smb_gethostbyaddr
8d7e41661dc4633488e93b13363137523ce59977jose borrego * Looks up a host by the given IP address. The host entry can come
8d7e41661dc4633488e93b13363137523ce59977jose borrego * from any of the sources for hosts specified in the
8d7e41661dc4633488e93b13363137523ce59977jose borrego * /etc/nsswitch.conf and the NetBIOS cache.
8d7e41661dc4633488e93b13363137523ce59977jose borrego * XXX Invokes nbt API to resolve name by IP once the NBTD is integrated
8d7e41661dc4633488e93b13363137523ce59977jose borrego * to look in the NetBIOS cache if getipnodebyaddr fails.
8d7e41661dc4633488e93b13363137523ce59977jose borrego * Caller should invoke freehostent to free the returned hostent.
8d7e41661dc4633488e93b13363137523ce59977jose borregosmb_gethostbyaddr(const char *addr, int len, int type, int *err_num)