/*
* 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"
#include <string.h>
#include <syslog.h>
#include <stdlib.h>
#include <unistd.h>
#include <pwd.h>
#include <nss_dbdefs.h>
#include <security/pam_appl.h>
#include <security/pam_modules.h>
#include <security/pam_impl.h>
#include <libintl.h>
#include <passwdutil.h>
#include <errno.h>
#include <netsmb/smb_keychain.h>
/*ARGSUSED*/
int
{
return (PAM_IGNORE);
}
/*ARGSUSED*/
int
{
char *user;
char *pw;
char *service;
char *home;
int i, mask;
for (i = 0; i < argc; i++) {
}
/* Since our creds don't time out, ignore a refresh. */
if ((flags & PAM_REFRESH_CRED) != 0)
return (PAM_IGNORE);
/* Check for unknown options */
return (PAM_IGNORE);
"pam_smbfs_login: username is empty");
return (PAM_IGNORE);
}
"pam_smbfs_login: username %s can't be found", user);
return (PAM_IGNORE);
}
/*
* A module on the stack has removed PAM_AUTHTOK.
*/
return (PAM_IGNORE);
}
if (res != 0)
if (debug)
"pam_smbfs_login: service %s, dom %s, user %s",
if ((flags & PAM_DELETE_CRED) != 0)
/*
* map errors to user messages and PAM return codes.
*/
switch (res) {
case SMB_KEYCHAIN_SUCCESS:
if (debug)
"smbfs password successfully stored for %s", user);
break;
case SMB_KEYCHAIN_BADPASSWD:
break;
case SMB_KEYCHAIN_BADDOMAIN:
break;
case SMB_KEYCHAIN_BADUSER:
break;
case SMB_KEYCHAIN_NODRIVER:
"driver open failed (%s), smbfs password not stored",
break;
case SMB_KEYCHAIN_UNKNOWN:
"Unexpected failure, smbfs password not stored");
break;
default:
"driver ioctl failed (%s), smbfs password not stored",
break;
}
return (PAM_IGNORE);
}