/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#ifndef _LIBSMBFS_H
#define _LIBSMBFS_H
/*
* Defines the API exported to smbfs commands and to the
* MS-style RPC-over-named-pipes library (libndr).
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Some errno values we need to expose in this API.
* NB: These two defines are duplicated from the
* driver smb_dev.h to avoid exposing that here.
*
* EBADRPC is used for message decoding errors.
* EAUTH is used for CIFS authentication errors.
*/
#ifndef EBADRPC
#endif
#ifndef EAUTH
#endif
/*
* Share type values for smb_ctx_new, _init
* Based on NetUseAdd() USE_INFO_[12] _asg_type values
* They also happen to match: STYPE_DISKTREE, etc.
*/
typedef enum {
/*
* Parse "level" spec. for smb_ctx_parseunc()
* i.e. whether we require a share name, etc.
*/
typedef enum {
/*
* Authentication type flags
* See: smb_ctx_setauthflags()
*/
/*
* Value of the ct_rflags, used to determine the context of request.
*/
extern int smbfs_debug;
int smbfs_lib_init(void);
void smbfs_error(const char *, int, ...);
/*
* Context management
*/
int smbfs_ctx_alloc(struct smb_ctx **);
void smbfs_ctx_free(struct smb_ctx *);
int smbfs_ctx_kill(struct smb_ctx *);
int smbfs_ctx_parseunc(struct smb_ctx *, const char *, int, int, int,
const char **);
int smbfs_ctx_parsedomuser(char *, char **, char **);
int smbfs_get_authentication(struct smb_ctx *);
int smbfs_ctx_flags2(struct smb_ctx *);
int smbfs_ctx_resolve(struct smb_ctx *);
int smbfs_ctx_get_ssn(struct smb_ctx *);
int smbfs_ctx_get_tree(struct smb_ctx *);
int smbfs_ctx_setauthflags(struct smb_ctx *, int);
int smbfs_ctx_setcharset(struct smb_ctx *, const char *);
int smbfs_ctx_setfullserver(struct smb_ctx *, const char *);
int smbfs_ctx_setscope(struct smb_ctx *, const char *);
int smbfs_ctx_setwins(struct smb_ctx *, const char *, const char *);
int smbfs_ctx_setserver(struct smb_ctx *, const char *);
int smbfs_ctx_setshare(struct smb_ctx *, const char *, int);
int smbfs_ctx_setrealm(struct smb_ctx *, const char *);
int smbfs_ctx_setdomain(struct smb_ctx *, const char *, int);
int smbfs_ctx_setuser(struct smb_ctx *, const char *, int);
int smbfs_ctx_setpassword(struct smb_ctx *, const char *, int);
/*
* Additional client context passed from consumers of smbfs_fh_open calls.
* These context values are set by consumers of smbfs_fh_open calls to
* facilitate authentication.
*/
typedef struct smbfs_fh_ctx {
char *sf_realm;
void smbfs_fh_ctx_destroy(smbfs_fh_ctx_t *);
int smbfs_fh_open(const char *, int, const smbfs_fh_ctx_t *);
int smbfs_fh_close(int);
int smbfs_fh_xactnp(int, int, const char *,
int *, char *, int *);
int smbfs_print(const char *, const char *, const char *);
void smbfs_set_default_domain(const char *);
void smbfs_set_default_user(const char *);
char *smbfs_strerror(int);
/*
* The ACL is in the form used by libsec (type=ACE_T)
*/
/*
* Get a ZFS-style acl from an FD opened in smbfs.
* Intentionally similar to: facl_get(3SEC)
*
* Allocates an acl_t via libsec. Free with: acl_free(3SEC)
*/
/*
* Set a ZFS-style acl onto an FD opened in smbfs.
* Intentionally similar to: facl_set(3SEC)
*
* The acl_t must be of type ACE_T (from libsec).
*/
/*
* Slightly lower-level functions, allowing access to
* the raw Windows Security Descriptor (SD)
*
* The struct i_ntsid is opaque in this I/F.
* Real decl. in: common/smbclnt/smbfs_ntacl.h
*/
struct i_ntsd;
/*
* Get an "internal form" SD from the FD (opened in smbfs).
* Allocates a hierarchy in isdp. Caller must free it via
* smbfs_acl_free_isd()
*/
/*
* Set an "internal form" SD onto the FD (opened in smbfs).
*/
struct __FILE;
/*
* These are duplicated from common/smbclnt/smbfs_ntacl.h
* rather than exporting that header for this library.
*/
void smbfs_acl_free_sd(struct i_ntsd *);
/*
* storage mechanism. This interface is consumed by
* the smbfs commands like login, logout etc. and by the SMBFS PAM module.
*/
#define SMB_KEYCHAIN_SUCCESS 0
/* Add a password to the keychain. */
/* Add LM-hash and NT-hash (16-bytes) to the keychain. */
/* Delete a password from the keychain. */
/*
* Check for existence of a keychain entry.
* Returns 0 if it exists, else ENOENT.
*/
/*
* Delete all keychain entries owned by the caller.
*/
/*
* Delete all keychain entries (regardless of owner).
* Requires super-user privliege.
*/
int smbfs_keychain_del_everyone(void);
/*
* This is not really part of the keychain library,
* but is typically needed in code that wants to
*
* Get default domain and user names
* Server name is optional.
*/
#ifdef __cplusplus
}
#endif
#endif /* _LIBSMBFS_H */