keychain.c revision 4bff34e37def8a90f9194d81bc345c52ba20086a
/*
* 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
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* 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 <string.h>
#include <unistd.h>
#include <libintl.h>
#include <netsmb/smb_keychain.h>
#include <cflib.h>
static int
int cmd,
const char *dom,
const char *usr,
const char *pass)
{
switch (cmd) {
case SMBIOC_PK_ADD:
return (SMB_KEYCHAIN_BADPASSWD);
return (SMB_KEYCHAIN_BADPASSWD);
/* FALLTHROUGH */
case SMBIOC_PK_CHK:
case SMBIOC_PK_DEL:
return (SMB_KEYCHAIN_BADDOMAIN);
return (SMB_KEYCHAIN_BADDOMAIN);
return (SMB_KEYCHAIN_BADUSER);
return (SMB_KEYCHAIN_BADUSER);
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:
return (SMB_KEYCHAIN_UNKNOWN);
}
fd = smb_open_driver();
if (fd < 0) {
goto out;
}
err = 0;
out:
return (err);
}
/* Add a password to the keychain. */
int
const char *pass)
{
}
/* Delete a password from the keychain. */
int
{
}
/*
* Check for existence of a keychain entry.
* Returns 0 if it exists, else ENOENT.
*/
int
{
}
/*
* Delete all keychain entries owned by the caller.
*/
int
{
}
/*
* Delete all keychain entries (regardless of onwer).
* Requires super-user privliege.
*/
int
{
}
/*
* 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.
*/
int
{
int err;
if (err)
return (err);
if (server)
if (err)
return (err);
if (smb_rc)
if (dom)
if (usr)
return (0);
}