xref: /titanic_51/usr/src/lib/smbsrv/libsmbns/common/libsmbns.h (revision 63251bc7f1ca38259078c48e316fee4ed66d4e93)
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 2009 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 #include <ldap.h>
30 #include <smbsrv/libsmb.h>
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /* ADS typedef/data structures and functions */
37 #define	SMB_ADS_MAXBUFLEN 100
38 
39 typedef struct smb_ads_handle {
40 	char *user;		/* admin user to create share in ADS */
41 	char *pwd;		/* user password */
42 	char *domain;		/* ADS domain */
43 	char *domain_dn;	/* domain in Distinquish Name format */
44 	char *ip_addr;		/* ip addr in string format */
45 	char *hostname;		/* fully qualified hostname */
46 	char *site;		/* local ADS site */
47 	LDAP *ld;		/* LDAP handle */
48 } smb_ads_handle_t;
49 
50 /*
51  * The possible return status of the adjoin routine.
52  */
53 typedef enum smb_adjoin_status {
54 	SMB_ADJOIN_SUCCESS = 0,
55 	SMB_ADJOIN_ERR_GET_HANDLE,
56 	SMB_ADJOIN_ERR_GET_DCLEVEL,
57 	SMB_ADJOIN_ERR_ADD_TRUST_ACCT,
58 	SMB_ADJOIN_ERR_MOD_TRUST_ACCT,
59 	SMB_ADJOIN_ERR_DUP_TRUST_ACCT,
60 	SMB_ADJOIN_ERR_TRUST_ACCT,
61 	SMB_ADJOIN_ERR_INIT_KRB_CTX,
62 	SMB_ADJOIN_ERR_GET_SPNS,
63 	SMB_ADJOIN_ERR_KSETPWD,
64 	SMB_ADJOIN_ERR_UPDATE_CNTRL_ATTR,
65 	SMB_ADJOIN_ERR_WRITE_KEYTAB,
66 	SMB_ADJOIN_ERR_IDMAP_SET_DOMAIN,
67 	SMB_ADJOIN_ERR_IDMAP_REFRESH,
68 	SMB_ADJOIN_ERR_COMMIT_KEYTAB
69 } smb_adjoin_status_t;
70 
71 /* ADS functions */
72 extern void smb_ads_init(void);
73 extern void smb_ads_refresh(void);
74 extern smb_ads_handle_t *smb_ads_open(void);
75 extern void smb_ads_close(smb_ads_handle_t *);
76 extern int smb_ads_publish_share(smb_ads_handle_t *, const char *, const char *,
77     const char *, const char *);
78 extern int smb_ads_remove_share(smb_ads_handle_t *, const char *, const char *,
79     const char *, const char *);
80 extern int smb_ads_build_unc_name(char *, int, const char *, const char *);
81 extern int smb_ads_lookup_share(smb_ads_handle_t *, const char *, const char *,
82     char *);
83 extern int smb_ads_add_share(smb_ads_handle_t *, const char *, const char *,
84     const char *);
85 extern smb_adjoin_status_t smb_ads_join(char *, char *, char *, char *, int);
86 extern void smb_ads_join_errmsg(smb_adjoin_status_t);
87 extern boolean_t smb_ads_lookup_msdcs(char *, char *, char *, uint32_t);
88 
89 /* DYNDNS functions */
90 extern int dyndns_start(void);
91 extern void dyndns_stop(void);
92 extern int dyndns_update(char *);
93 extern void dyndns_update_zones(void);
94 extern void dyndns_clear_zones(void);
95 
96 /* Kerberos initialization function */
97 extern int smb_kinit(char *, char *);
98 extern int smb_ccache_init(char *, char *);
99 extern void smb_ccache_remove(char *);
100 
101 /* NETBIOS Functions */
102 extern int smb_netbios_start(void);
103 extern void smb_netbios_shutdown(void);
104 extern void smb_netbios_name_reconfig(void);
105 
106 /* Browser Functions */
107 extern void smb_browser_reconfig(void);
108 extern boolean_t smb_browser_netlogon(char *, char *, uint32_t);
109 
110 
111 #ifdef	__cplusplus
112 }
113 #endif
114 
115 #endif	/* _LIBSMBNS_H */
116