bump_pw_expire.c revision 178826
164567Sgshapiro/*
264567Sgshapiro * Copyright (c) 2000 Kungliga Tekniska H�gskolan
364567Sgshapiro * (Royal Institute of Technology, Stockholm, Sweden).
464567Sgshapiro * All rights reserved.
564567Sgshapiro *
690798Sgshapiro * Redistribution and use in source and binary forms, with or without
764567Sgshapiro * modification, are permitted provided that the following conditions
864567Sgshapiro * are met:
965970Sgshapiro *
1065970Sgshapiro * 1. Redistributions of source code must retain the above copyright
1165970Sgshapiro *    notice, this list of conditions and the following disclaimer.
12201381Sed *
13201381Sed * 2. Redistributions in binary form must reproduce the above copyright
1464567Sgshapiro *    notice, this list of conditions and the following disclaimer in the
1564567Sgshapiro *    documentation and/or other materials provided with the distribution.
1690798Sgshapiro *
1764567Sgshapiro * 3. Neither the name of the Institute nor the names of its contributors
1890798Sgshapiro *    may be used to endorse or promote products derived from this software
1964567Sgshapiro *    without specific prior written permission.
20136910Sru *
2164567Sgshapiro * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
2290798Sgshapiro * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2390798Sgshapiro * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2490798Sgshapiro * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
2564567Sgshapiro * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include "kadm5_locl.h"
35
36RCSID("$Id: bump_pw_expire.c 8797 2000-07-24 03:47:54Z assar $");
37
38/*
39 * extend password_expiration if it's defined
40 */
41
42kadm5_ret_t
43_kadm5_bump_pw_expire(kadm5_server_context *context,
44		      hdb_entry *ent)
45{
46    if (ent->pw_end != NULL) {
47	time_t life;
48
49	life = krb5_config_get_time_default(context->context,
50					    NULL,
51					    365 * 24 * 60 * 60,
52					    "kadmin",
53					    "password_lifetime",
54					    NULL);
55
56	*(ent->pw_end) = time(NULL) + life;
57    }
58    return 0;
59}
60