libsmbns.h revision b3700b074e637f8c6991b70754c88a2cfffb246b
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * CDDL HEADER START
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
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 *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * or http://www.opensolaris.org/os/licensing.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * See the License for the specific language governing permissions
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * and limitations under the License.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
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 *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * CDDL HEADER END
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
fd9ee8b58485b20072eeef1310a88ff348d5e7fajoyce mcintosh * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#ifndef _LIBSMBNS_H
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define _LIBSMBNS_H
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#include <ldap.h>
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#include <smbsrv/libsmb.h>
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#ifdef __cplusplus
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwextern "C" {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#endif
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/* ADS typedef/data structures and functions */
29bd28862cfb8abbd3a0f0a4b17e08bbc3652836Alan Wright
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
3db3f65c6274eb042354801a308c8e9bc4994553amwtypedef struct smb_ads_handle {
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States char *domain; /* ADS domain (in lower case) */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw char *domain_dn; /* domain in Distinquish Name format */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw char *ip_addr; /* ip addr in string format */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw char *hostname; /* fully qualified hostname */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw char *site; /* local ADS site */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw LDAP *ld; /* LDAP handle */
3db3f65c6274eb042354801a308c8e9bc4994553amw} smb_ads_handle_t;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
29bd28862cfb8abbd3a0f0a4b17e08bbc3652836Alan Wrighttypedef struct smb_ads_host_info {
29bd28862cfb8abbd3a0f0a4b17e08bbc3652836Alan Wright char name[MAXHOSTNAMELEN]; /* fully qualified hostname */
29bd28862cfb8abbd3a0f0a4b17e08bbc3652836Alan Wright int port; /* ldap port */
29bd28862cfb8abbd3a0f0a4b17e08bbc3652836Alan Wright int priority; /* DNS SRV record priority */
29bd28862cfb8abbd3a0f0a4b17e08bbc3652836Alan Wright int weight; /* DNS SRV record weight */
29bd28862cfb8abbd3a0f0a4b17e08bbc3652836Alan Wright smb_inaddr_t ipaddr; /* network byte order */
29bd28862cfb8abbd3a0f0a4b17e08bbc3652836Alan Wright} smb_ads_host_info_t;
29bd28862cfb8abbd3a0f0a4b17e08bbc3652836Alan Wright
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross * Return status codes for the ads functions.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Rosstypedef enum smb_ads_status {
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross SMB_ADS_SUCCESS = 0,
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross /* errno values... */
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross SMB_ADS_ERRNO_GAP = 200,
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross SMB_ADS_KRB5_INIT_CTX,
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross SMB_ADS_KRB5_CC_DEFAULT,
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross SMB_ADS_KRB5_PARSE_PRINCIPAL,
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross SMB_ADS_KRB5_GET_INIT_CREDS_PW,
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross SMB_ADS_KRB5_CC_INITIALIZE,
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross SMB_ADS_KRB5_CC_STORE_CRED,
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross SMB_ADS_CANT_LOCATE_DC,
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross SMB_ADS_LDAP_INIT,
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross SMB_ADS_LDAP_SETOPT,
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross SMB_ADS_LDAP_SET_DOM,
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross SMB_ADS_LDAP_SASL_BIND,
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross
77191e8775ec29406dec7210fc064d8fd759dd24Shawn Emery SMB_ADJOIN_ERR_GEN_PWD,
3db3f65c6274eb042354801a308c8e9bc4994553amw SMB_ADJOIN_ERR_GET_DCLEVEL,
3db3f65c6274eb042354801a308c8e9bc4994553amw SMB_ADJOIN_ERR_ADD_TRUST_ACCT,
3db3f65c6274eb042354801a308c8e9bc4994553amw SMB_ADJOIN_ERR_MOD_TRUST_ACCT,
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States SMB_ADJOIN_ERR_DUP_TRUST_ACCT,
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States SMB_ADJOIN_ERR_TRUST_ACCT,
3db3f65c6274eb042354801a308c8e9bc4994553amw SMB_ADJOIN_ERR_INIT_KRB_CTX,
3db3f65c6274eb042354801a308c8e9bc4994553amw SMB_ADJOIN_ERR_GET_SPNS,
3db3f65c6274eb042354801a308c8e9bc4994553amw SMB_ADJOIN_ERR_KSETPWD,
3db3f65c6274eb042354801a308c8e9bc4994553amw SMB_ADJOIN_ERR_UPDATE_CNTRL_ATTR,
3db3f65c6274eb042354801a308c8e9bc4994553amw SMB_ADJOIN_ERR_WRITE_KEYTAB,
3db3f65c6274eb042354801a308c8e9bc4994553amw SMB_ADJOIN_ERR_IDMAP_SET_DOMAIN,
3db3f65c6274eb042354801a308c8e9bc4994553amw SMB_ADJOIN_ERR_IDMAP_REFRESH,
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross SMB_ADJOIN_ERR_COMMIT_KEYTAB,
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross SMB_ADJOIN_ERR_AUTH_NETLOGON,
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross SMB_ADJOIN_ERR_STORE_PROPS,
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Ross} smb_ads_status_t;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/* ADS functions */
3db3f65c6274eb042354801a308c8e9bc4994553amwextern void smb_ads_init(void);
29bd28862cfb8abbd3a0f0a4b17e08bbc3652836Alan Wrightextern void smb_ads_fini(void);
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Rossextern void smb_ads_refresh(boolean_t);
3db3f65c6274eb042354801a308c8e9bc4994553amwextern smb_ads_handle_t *smb_ads_open(void);
3db3f65c6274eb042354801a308c8e9bc4994553amwextern void smb_ads_close(smb_ads_handle_t *);
3db3f65c6274eb042354801a308c8e9bc4994553amwextern int smb_ads_publish_share(smb_ads_handle_t *, const char *, const char *,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw const char *, const char *);
3db3f65c6274eb042354801a308c8e9bc4994553amwextern int smb_ads_remove_share(smb_ads_handle_t *, const char *, const char *,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw const char *, const char *);
3db3f65c6274eb042354801a308c8e9bc4994553amwextern int smb_ads_build_unc_name(char *, int, const char *, const char *);
3db3f65c6274eb042354801a308c8e9bc4994553amwextern int smb_ads_lookup_share(smb_ads_handle_t *, const char *, const char *,
3db3f65c6274eb042354801a308c8e9bc4994553amw char *);
3db3f65c6274eb042354801a308c8e9bc4994553amwextern int smb_ads_add_share(smb_ads_handle_t *, const char *, const char *,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw const char *);
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Rossextern smb_ads_status_t smb_ads_join(char *, char *, char *, char *);
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Rossextern void smb_ads_log_errmsg(smb_ads_status_t);
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Rossextern const char *smb_ads_strerror(int);
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Rossextern uint32_t smb_ads_lookup_msdcs(char *, smb_dcinfo_t *);
b3700b074e637f8c6991b70754c88a2cfffb246bGordon Rossextern smb_ads_host_info_t *smb_ads_find_host(char *);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/* DYNDNS functions */
fd9ee8b58485b20072eeef1310a88ff348d5e7fajoyce mcintoshextern void *dyndns_publisher(void *);
fd9ee8b58485b20072eeef1310a88ff348d5e7fajoyce mcintoshextern void dyndns_start(void);
8d7e41661dc4633488e93b13363137523ce59977jose borregoextern void dyndns_stop(void);
8c10a8659ac31335ed870a1711c0182623f72fd6asextern int dyndns_update(char *);
8d7e41661dc4633488e93b13363137523ce59977jose borregoextern void dyndns_update_zones(void);
8d7e41661dc4633488e93b13363137523ce59977jose borregoextern void dyndns_clear_zones(void);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wright/* Kerberos cache management function */
faa1795a28a5c712eed6d0a3f84d98c368a316c6jbextern int smb_ccache_init(char *, char *);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jbextern void smb_ccache_remove(char *);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/* NETBIOS Functions */
dc20a3024900c47dd2ee44b9707e6df38f7d62a5asextern int smb_netbios_start(void);
a0aa776e20803c84edd153d9cb584fd67163aef3Alan Wrightextern void smb_netbios_stop(void);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwextern void smb_netbios_name_reconfig(void);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
7b59d02d2a384be9a08087b14defadd214b3c1ddjb/* Browser Functions */
7b59d02d2a384be9a08087b14defadd214b3c1ddjbextern void smb_browser_reconfig(void);
8d7e41661dc4633488e93b13363137523ce59977jose borregoextern boolean_t smb_browser_netlogon(char *, char *, uint32_t);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#ifdef __cplusplus
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw}
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#endif
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#endif /* _LIBSMBNS_H */