/*
* 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
*/
/*
*/
/*
* storage mechanism. This interface is consumed by
* the "smbutil" commands: login, logout, ...
* and by the SMBFS PAM module.
*/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <libintl.h>
#include "smbfs_lib.h"
#include <netsmb/libsmbfs.h>
#include "smbfs_charsets.h"
#include "smbfs_private.h"
#include "smbfs_ntlm.h"
static int
int cmd,
const char *dom,
const char *usr,
{
err = 0;
fd = -1;
switch (cmd) {
case SMBIOC_PK_ADD:
/*
* Add password hashes to the keychain.
*/
goto out;
}
/* FALLTHROUGH */
case SMBIOC_PK_CHK:
case SMBIOC_PK_DEL:
/*
* Copy domain and user.
*/
goto out;
}
goto out;
}
goto out;
}
goto out;
}
break;
case SMBIOC_PK_DEL_OWNER: /* all owned by the caller */
case SMBIOC_PK_DEL_EVERYONE: /* all owned by everyone */
/*
* These two do not copyin any args, but we'll
* pass pk here anyway just so we can use the
* common code path below.
*/
break;
default:
goto out;
}
fd = smbfs_open_driver();
if (fd < 0) {
goto out;
}
err = 0;
goto out;
}
if (cmd == SMBIOC_PK_CHK) {
}
out:
if (fd != -1)
return (err);
}
/*
* Add a password to the keychain. /var/smb/smbfspasswd will be updated
* accordingly if 'updatefile' argument is set to B_TRUE.
*
* Note: pass is a cleartext password.
* We use it here to compute the LM hash and NT hash,
* and then store ONLY the hashes.
*/
int
{
return (SMB_KEYCHAIN_BADPASSWD);
return (err);
return (err);
!= 0)
return (err);
if (updatefile) {
(void) smbfs_iod_pwdadd(&pwdinfo);
}
return (0);
}
/*
* Variant of the above that takes LM and NT hashes.
* The parameter for LM hash or NT hash can be NULL.
*/
int
{
lmhash = hash_zeros;
nthash = hash_zeros;
return (err);
}
/*
* Delete a password from the keychain. /var/smb/smbfspasswd will be updated
* accordingly if 'updatefile' argument is set to B_TRUE.
*/
int
{
int err;
if ((err =
return (err);
if (updatefile) {
(void) smbfs_iod_pwddel(&pwdinfo);
}
return (0);
}
/*
* Check for existence of a keychain entry.
* Returns 0 if it exists, else ENOENT.
*/
int
{
}
/*
* Get the stored hashes
*/
int
{
return (err);
}
/*
* Delete all keychain entries owned by the caller. /var/smb/smbfspasswd will
* be updated accordingly if 'updatefile' argument is set to B_TRUE.
*/
int
{
return (err);
if (updatefile)
(void) smbfs_iod_pwddel(NULL);
return (0);
}
/*
* Delete all keychain entries (regardless of onwer).
* Requires super-user privliege.
*/
int
{
}
/*
* Private function to get keychain p/w hashes.
*/
int
{
int err;
DPRINT("ct_fullserver == NULL");
return (EINVAL);
}
/*
* 1st: try lookup using system name
*/
if (!err) {
DPRINT("found keychain entry for"
return (0);
}
/*
* 2nd: try lookup using domain name
*/
if (!err) {
DPRINT("found keychain entry for"
return (0);
}
return (err);
}
/*
* This is not really part of the keychain library,
* but is typically needed in code that wants to
*
* Get default domain and user names
*/
int
{
int err;
if (err)
return (err);
if (dom)
if (usr)
return (err);
}