libsmbns.h revision a0aa776e20803c84edd153d9cb584fd67163aef3
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/*
fc724630b14603e4c1147df68b7bf45f7de7431fAlan Wright * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Use is subject to license terms.
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 {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw char *domain; /* ADS domain */
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/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The possible return status of the adjoin routine.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
3db3f65c6274eb042354801a308c8e9bc4994553amwtypedef enum smb_adjoin_status {
3db3f65c6274eb042354801a308c8e9bc4994553amw SMB_ADJOIN_SUCCESS = 0,
3db3f65c6274eb042354801a308c8e9bc4994553amw SMB_ADJOIN_ERR_GET_HANDLE,
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,
fc724630b14603e4c1147df68b7bf45f7de7431fAlan Wright SMB_ADJOIN_ERR_COMMIT_KEYTAB
3db3f65c6274eb042354801a308c8e9bc4994553amw} smb_adjoin_status_t;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/* ADS functions */
3db3f65c6274eb042354801a308c8e9bc4994553amwextern void smb_ads_init(void);
29bd28862cfb8abbd3a0f0a4b17e08bbc3652836Alan Wrightextern void smb_ads_fini(void);
3db3f65c6274eb042354801a308c8e9bc4994553amwextern void smb_ads_refresh(void);
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 *);
3db3f65c6274eb042354801a308c8e9bc4994553amwextern smb_adjoin_status_t smb_ads_join(char *, char *, char *, char *, int);
fc724630b14603e4c1147df68b7bf45f7de7431fAlan Wrightextern void smb_ads_join_errmsg(smb_adjoin_status_t);
8d7e41661dc4633488e93b13363137523ce59977jose borregoextern boolean_t smb_ads_lookup_msdcs(char *, char *, char *, uint32_t);
29bd28862cfb8abbd3a0f0a4b17e08bbc3652836Alan Wrightextern smb_ads_host_info_t *smb_ads_find_host(char *, char *);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/* DYNDNS functions */
8d7e41661dc4633488e93b13363137523ce59977jose borregoextern int 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 */