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.
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.
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]
23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
28 #ifndef _SMB_KEYCHAIN_H
29 #define _SMB_KEYCHAIN_H
32 * External interface to the libsmbfs/netsmb keychain
33 * storage mechanism. This interface is consumed by
34 * the "smbutil" commands: login, logout, ...
35 * and by the SMBFS PAM module.
42 #define SMB_KEYCHAIN_SUCCESS 0
43 #define SMB_KEYCHAIN_BADPASSWD 300
44 #define SMB_KEYCHAIN_BADDOMAIN 301
45 #define SMB_KEYCHAIN_BADUSER 302
46 #define SMB_KEYCHAIN_NODRIVER 303
47 #define SMB_KEYCHAIN_UNKNOWN 304
49 /* Add a password to the keychain. */
50 int smbfs_keychain_add(uid_t uid
, const char *domain
, const char *user
,
51 const char *password
);
53 /* Add an NT-hash (16-bytes) to the keychain. */
54 int smbfs_keychain_addhash(uid_t uid
, const char *domain
, const char *user
,
55 const uchar_t
*nthash
);
57 /* Delete a password from the keychain. */
58 int smbfs_keychain_del(uid_t uid
, const char *domain
, const char *user
);
61 * Check for existence of a keychain entry.
62 * Returns 0 if it exists, else ENOENT.
64 int smbfs_keychain_chk(const char *domain
, const char *user
);
67 * Delete all keychain entries owned by the caller.
69 int smbfs_keychain_del_owner(void);
72 * Delete all keychain entries (regardless of owner).
73 * Requires super-user privliege.
75 int smbfs_keychain_del_everyone(void);
78 * This is not really part of the keychain library,
79 * but is typically needed in code that wants to
80 * provide (editable) defaults for domain/user
82 * Get default domain and user names
83 * Server name is optional.
86 smbfs_default_dom_usr(const char *home
, const char *server
,
87 char *dom
, int maxdom
, char *usr
, int maxusr
);
93 #endif /* _SMB_KEYCHAIN_H */