xref: /titanic_50/usr/src/lib/smbsrv/libsmbns/common/libsmbns.h (revision a6d42e7d71324c5193c3b94d57d96ba2925d52e1)
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_DUP_TRUST_ACCT,
63 	SMB_ADJOIN_ERR_TRUST_ACCT,
64 	SMB_ADJOIN_ERR_GET_ENCTYPES,
65 	SMB_ADJOIN_ERR_INIT_KRB_CTX,
66 	SMB_ADJOIN_ERR_GET_SPNS,
67 	SMB_ADJOIN_ERR_KSETPWD,
68 	SMB_ADJOIN_ERR_UPDATE_CNTRL_ATTR,
69 	SMB_ADJOIN_ERR_WRITE_KEYTAB,
70 	SMB_ADJOIN_ERR_IDMAP_SET_DOMAIN,
71 	SMB_ADJOIN_ERR_IDMAP_REFRESH,
72 	SMB_ADJOIN_NUM_STATUS
73 } smb_adjoin_status_t;
74 
75 /* ADS functions */
76 extern void smb_ads_init(void);
77 extern void smb_ads_refresh(void);
78 extern smb_ads_handle_t *smb_ads_open(void);
79 extern void smb_ads_close(smb_ads_handle_t *);
80 extern int smb_ads_publish_share(smb_ads_handle_t *, const char *, const char *,
81     const char *, const char *);
82 extern int smb_ads_remove_share(smb_ads_handle_t *, const char *, const char *,
83     const char *, const char *);
84 extern int smb_ads_build_unc_name(char *, int, const char *, const char *);
85 extern int smb_ads_lookup_share(smb_ads_handle_t *, const char *, const char *,
86     char *);
87 extern int smb_ads_add_share(smb_ads_handle_t *, const char *, const char *,
88     const char *);
89 extern smb_adjoin_status_t smb_ads_join(char *, char *, char *, char *, int);
90 extern char *smb_adjoin_report_err(smb_adjoin_status_t);
91 extern int smb_ads_domain_change_cleanup(char *);
92 
93 /* DYNDNS functions */
94 extern void dns_msgid_init(void);
95 extern int dyndns_update(char *);
96 extern int dyndns_update_core(char *);
97 extern int dyndns_clear_rev_zone(char *);
98 
99 /* Kerberos initialization function */
100 extern int smb_kinit(char *, char *);
101 extern int smb_ccache_init(char *, char *);
102 extern void smb_ccache_remove(char *);
103 
104 /* NETBIOS Functions */
105 extern int smb_msdcs_lookup_ads(char *, char *);
106 extern int smb_netbios_start(void);
107 extern void smb_netbios_shutdown(void);
108 extern void smb_netbios_name_reconfig(void);
109 
110 /* Browser Functions */
111 extern void smb_browser_reconfig(void);
112 extern void smb_browser_netlogon(char *);
113 
114 
115 #ifdef	__cplusplus
116 }
117 #endif
118 
119 #endif	/* _LIBSMBNS_H */
120