xref: /titanic_44/usr/src/lib/smbsrv/libsmbns/common/libsmbns.h (revision c651b32e568cbf9b715a127805fe1cba321be5b0)
1 /*
2  * CDDL HEADER START
3  *
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.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_LIBSMBNS_H
27 #define	_LIBSMBNS_H
28 
29 #pragma ident	"@(#)libsmbns.h	1.10	08/07/24 SMI"
30 
31 #include <ldap.h>
32 #include <smbsrv/libsmb.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 /* ADS typedef/data structures and functions */
39 #define	SMB_ADS_MAXBUFLEN 100
40 
41 typedef struct smb_ads_handle {
42 	char *user;		/* admin user to create share in ADS */
43 	char *pwd;		/* user password */
44 	char *domain;		/* ADS domain */
45 	char *domain_dn;	/* domain in Distinquish Name format */
46 	char *ip_addr;		/* ip addr in string format */
47 	char *hostname;		/* fully qualified hostname */
48 	char *site;		/* local ADS site */
49 	LDAP *ld;		/* LDAP handle */
50 } smb_ads_handle_t;
51 
52 /*
53  * The possible return status of the adjoin routine.
54  */
55 typedef enum smb_adjoin_status {
56 	SMB_ADJOIN_SUCCESS = 0,
57 	SMB_ADJOIN_ERR_GET_HANDLE,
58 	SMB_ADJOIN_ERR_GEN_PASSWD,
59 	SMB_ADJOIN_ERR_GET_DCLEVEL,
60 	SMB_ADJOIN_ERR_ADD_TRUST_ACCT,
61 	SMB_ADJOIN_ERR_MOD_TRUST_ACCT,
62 	SMB_ADJOIN_ERR_GET_ENCTYPES,
63 	SMB_ADJOIN_ERR_INIT_KRB_CTX,
64 	SMB_ADJOIN_ERR_GET_SPNS,
65 	SMB_ADJOIN_ERR_KSETPWD,
66 	SMB_ADJOIN_ERR_UPDATE_CNTRL_ATTR,
67 	SMB_ADJOIN_ERR_WRITE_KEYTAB,
68 	SMB_ADJOIN_ERR_IDMAP_SET_DOMAIN,
69 	SMB_ADJOIN_ERR_IDMAP_REFRESH,
70 	SMB_ADJOIN_NUM_STATUS
71 } smb_adjoin_status_t;
72 
73 /* ADS functions */
74 extern void smb_ads_init(void);
75 extern void smb_ads_refresh(void);
76 extern smb_ads_handle_t *smb_ads_open(void);
77 extern void smb_ads_close(smb_ads_handle_t *);
78 extern int smb_ads_publish_share(smb_ads_handle_t *, const char *, const char *,
79     const char *, const char *);
80 extern int smb_ads_remove_share(smb_ads_handle_t *, const char *, const char *,
81     const char *, const char *);
82 extern int smb_ads_build_unc_name(char *, int, const char *, const char *);
83 extern int smb_ads_lookup_share(smb_ads_handle_t *, const char *, const char *,
84     char *);
85 extern int smb_ads_add_share(smb_ads_handle_t *, const char *, const char *,
86     const char *);
87 extern smb_adjoin_status_t smb_ads_join(char *, char *, char *, char *, int);
88 extern char *smb_adjoin_report_err(smb_adjoin_status_t);
89 extern int smb_ads_domain_change_cleanup(char *);
90 extern int smb_ads_update_attrs(void);
91 
92 /* DYNDNS functions */
93 extern void dns_msgid_init(void);
94 extern int dyndns_update(char *);
95 extern int dyndns_update_core(char *);
96 extern int dyndns_clear_rev_zone(char *);
97 
98 /* Kerberos initialization function */
99 extern int smb_kinit(char *, char *);
100 extern int smb_ccache_init(char *, char *);
101 extern void smb_ccache_remove(char *);
102 
103 /* NETBIOS Functions */
104 extern int smb_msdcs_lookup_ads(char *, char *);
105 extern int smb_netbios_start(void);
106 extern void smb_netbios_shutdown(void);
107 extern void smb_netbios_name_reconfig(void);
108 
109 /* Browser Functions */
110 extern void smb_browser_reconfig(void);
111 extern void smb_browser_netlogon(char *);
112 
113 
114 #ifdef	__cplusplus
115 }
116 #endif
117 
118 #endif	/* _LIBSMBNS_H */
119