bump_pw_expire.c revision 72445
155714Skris/*
255714Skris * Copyright (c) 2000 Kungliga Tekniska H�gskolan
355714Skris * (Royal Institute of Technology, Stockholm, Sweden).
455714Skris * All rights reserved.
555714Skris *
655714Skris * Redistribution and use in source and binary forms, with or without
755714Skris * modification, are permitted provided that the following conditions
8296465Sdelphij * are met:
955714Skris *
1055714Skris * 1. Redistributions of source code must retain the above copyright
1155714Skris *    notice, this list of conditions and the following disclaimer.
1255714Skris *
1355714Skris * 2. Redistributions in binary form must reproduce the above copyright
1455714Skris *    notice, this list of conditions and the following disclaimer in the
15296465Sdelphij *    documentation and/or other materials provided with the distribution.
1655714Skris *
1755714Skris * 3. Neither the name of the Institute nor the names of its contributors
1855714Skris *    may be used to endorse or promote products derived from this software
1955714Skris *    without specific prior written permission.
2055714Skris *
2155714Skris * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22296465Sdelphij * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2355714Skris * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2455714Skris * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
2555714Skris * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2655714Skris * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2755714Skris * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2855714Skris * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2955714Skris * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3055714Skris * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3155714Skris * SUCH DAMAGE.
3255714Skris */
3355714Skris
3455714Skris#include "kadm5_locl.h"
3555714Skris
3655714SkrisRCSID("$Id: bump_pw_expire.c,v 1.1 2000/07/24 03:47:54 assar Exp $");
37296465Sdelphij
3855714Skris/*
3955714Skris * extend password_expiration if it's defined
40296465Sdelphij */
4155714Skris
4255714Skriskadm5_ret_t
4355714Skris_kadm5_bump_pw_expire(kadm5_server_context *context,
4455714Skris		      hdb_entry *ent)
4555714Skris{
4655714Skris    if (ent->pw_end != NULL) {
4755714Skris	time_t life;
4855714Skris
4955714Skris	life = krb5_config_get_time_default(context->context,
5055714Skris					    NULL,
5155714Skris					    365 * 24 * 60 * 60,
52296465Sdelphij					    "kadmin",
5355714Skris					    "password_lifetime",
5455714Skris					    NULL);
5555714Skris
5655714Skris	*(ent->pw_end) = time(NULL) + life;
5755714Skris    }
5855714Skris    return 0;
5955714Skris}
6055714Skris