bump_pw_expire.c revision 233294
167555Smsmith/*
267555Smsmith * Copyright (c) 2000 Kungliga Tekniska H��gskolan
3123103Sps * (Royal Institute of Technology, Stockholm, Sweden).
4123103Sps * All rights reserved.
567555Smsmith *
667555Smsmith * Redistribution and use in source and binary forms, with or without
767555Smsmith * modification, are permitted provided that the following conditions
867555Smsmith * are met:
967555Smsmith *
1067555Smsmith * 1. Redistributions of source code must retain the above copyright
1167555Smsmith *    notice, this list of conditions and the following disclaimer.
1267555Smsmith *
1367555Smsmith * 2. Redistributions in binary form must reproduce the above copyright
1467555Smsmith *    notice, this list of conditions and the following disclaimer in the
1567555Smsmith *    documentation and/or other materials provided with the distribution.
1667555Smsmith *
1767555Smsmith * 3. Neither the name of the Institute nor the names of its contributors
1867555Smsmith *    may be used to endorse or promote products derived from this software
1967555Smsmith *    without specific prior written permission.
2067555Smsmith *
2167555Smsmith * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
2267555Smsmith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2367555Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2467555Smsmith * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
2567555Smsmith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2667555Smsmith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2767555Smsmith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2867555Smsmith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2967555Smsmith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3067555Smsmith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3167555Smsmith * SUCH DAMAGE.
3267555Smsmith */
3367555Smsmith
3467555Smsmith#include "kadm5_locl.h"
3567555Smsmith
3667555SmsmithRCSID("$Id$");
3767555Smsmith
3867555Smsmith/*
3967555Smsmith * extend password_expiration if it's defined
4067555Smsmith */
4167555Smsmith
42118816Spskadm5_ret_t
4367555Smsmith_kadm5_bump_pw_expire(kadm5_server_context *context,
4467555Smsmith		      hdb_entry *ent)
4567555Smsmith{
46239244Sjhb    if (ent->pw_end != NULL) {
47129879Sphk	time_t life;
48239244Sjhb
49118508Sps	life = krb5_config_get_time_default(context->context,
50239244Sjhb					    NULL,
5167555Smsmith					    365 * 24 * 60 * 60,
52240209Sjhb					    "kadmin",
5367555Smsmith					    "password_lifetime",
5467555Smsmith					    NULL);
5567555Smsmith
5667555Smsmith	*(ent->pw_end) = time(NULL) + life;
5767555Smsmith    }
5867555Smsmith    return 0;
5967555Smsmith}
6067555Smsmith