bump_pw_expire.c revision 233294
1263320Sdim/* 2263320Sdim * Copyright (c) 2000 Kungliga Tekniska H��gskolan 3263320Sdim * (Royal Institute of Technology, Stockholm, Sweden). 4263320Sdim * All rights reserved. 5269012Semaste * 6263320Sdim * Redistribution and use in source and binary forms, with or without 7263320Sdim * modification, are permitted provided that the following conditions 8263320Sdim * are met: 9263320Sdim * 10263320Sdim * 1. Redistributions of source code must retain the above copyright 11263320Sdim * notice, this list of conditions and the following disclaimer. 12263320Sdim * 13263320Sdim * 2. Redistributions in binary form must reproduce the above copyright 14263320Sdim * notice, this list of conditions and the following disclaimer in the 15263320Sdim * documentation and/or other materials provided with the distribution. 16263320Sdim * 17263320Sdim * 3. Neither the name of the Institute nor the names of its contributors 18263320Sdim * may be used to endorse or promote products derived from this software 19263320Sdim * without specific prior written permission. 20263320Sdim * 21263320Sdim * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 22263320Sdim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23263320Sdim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24263320Sdim * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 25263320Sdim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26263320Sdim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27263320Sdim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28263320Sdim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29263320Sdim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30263320Sdim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31263320Sdim * SUCH DAMAGE. 32263320Sdim */ 33263320Sdim 34263320Sdim#include "kadm5_locl.h" 35263320Sdim 36263320SdimRCSID("$Id$"); 37263320Sdim 38263320Sdim/* 39263320Sdim * extend password_expiration if it's defined 40263320Sdim */ 41263320Sdim 42263320Sdimkadm5_ret_t 43263320Sdim_kadm5_bump_pw_expire(kadm5_server_context *context, 44263320Sdim hdb_entry *ent) 45263320Sdim{ 46263320Sdim if (ent->pw_end != NULL) { 47263320Sdim time_t life; 48263320Sdim 49263320Sdim life = krb5_config_get_time_default(context->context, 50263320Sdim NULL, 51263320Sdim 365 * 24 * 60 * 60, 52263320Sdim "kadmin", 53263320Sdim "password_lifetime", 54263320Sdim NULL); 55263320Sdim 56263320Sdim *(ent->pw_end) = time(NULL) + life; 57263320Sdim } 58263320Sdim return 0; 59263320Sdim} 60263320Sdim