/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
*
* Copyright (C) 2009 by the Massachusetts Institute of Technology.
* All rights reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*
*
*
*/
#include <stdio.h>
#include <errno.h>
#include <k5-int.h>
#include <kdb.h>
#include "kdb_ldap.h"
#include "princ_xdr.h"
#include "ldap_principal.h"
#include "ldap_pwd_policy.h"
#include "ldap_tkt_policy.h"
static krb5_error_code
{
*pw_max_fail = 0;
*pw_failcnt_interval = 0;
*pw_lockout_duration = 0;
return code;
if (code != 0)
return code;
int count = 0;
}
}
xdr_destroy(&xdrs);
return 0;
}
/* draft-behera-ldap-password-policy-10.txt 7.1 */
static krb5_boolean
{
return FALSE;
if (lockout_duration == 0)
return TRUE; /* principal permanently locked */
}
{
if (code != 0 || failcnt_interval == 0)
return code;
return KRB5KDC_ERR_CLIENT_REVOKED;
return 0;
}
{
switch (status) {
case 0:
break;
default:
return 0;
}
return 0;
if (code != 0)
return code;
/*
* Don't continue to modify the DB for an already locked account.
* (In most cases, status will be KRB5KDC_ERR_CLIENT_REVOKED, and
* this check is unneeded, but in rare cases, we can fail with an
* integrity error or preauth failure before a policy check.)
*/
return 0;
/*
* Only mark the authentication as successful if the entry
* required preauthentication, otherwise we have no idea.
*/
entry->fail_auth_count = 0;
} else if (status == KRB5KDC_ERR_PREAUTH_FAILED ||
if (failcnt_interval != 0 &&
/* Reset fail_auth_count after failcnt_interval */
entry->fail_auth_count = 0;
}
}
if (code != 0)
return code;
}
return 0;
}