diff options
Diffstat (limited to 'lib/kadm5/iprop-log.c')
| -rw-r--r-- | lib/kadm5/iprop-log.c | 91 | 
1 files changed, 47 insertions, 44 deletions
| diff --git a/lib/kadm5/iprop-log.c b/lib/kadm5/iprop-log.c index 7b43076832c3..b201de66d1f6 100644 --- a/lib/kadm5/iprop-log.c +++ b/lib/kadm5/iprop-log.c @@ -1,34 +1,34 @@  /* - * Copyright (c) 1997 - 2005 Kungliga Tekniska Högskolan - * (Royal Institute of Technology, Stockholm, Sweden).  - * All rights reserved.  + * Copyright (c) 1997 - 2005 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved.   * - * Redistribution and use in source and binary forms, with or without  - * modification, are permitted provided that the following conditions  - * are met:  + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met:   * - * 1. Redistributions of source code must retain the above copyright  - *    notice, this list of conditions and the following disclaimer.  + * 1. Redistributions of source code must retain the above copyright + *    notice, this list of conditions and the following disclaimer.   * - * 2. Redistributions in binary form must reproduce the above copyright  - *    notice, this list of conditions and the following disclaimer in the  - *    documentation and/or other materials provided with the distribution.  + * 2. Redistributions in binary form must reproduce the above copyright + *    notice, this list of conditions and the following disclaimer in the + *    documentation and/or other materials provided with the distribution.   * - * 3. Neither the name of the Institute nor the names of its contributors  - *    may be used to endorse or promote products derived from this software  - *    without specific prior written permission.  + * 3. Neither the name of the Institute nor the names of its contributors + *    may be used to endorse or promote products derived from this software + *    without specific prior written permission.   * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND  - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE  - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE  - * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE  - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL  - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS  - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)  - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT  - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY  - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF  - * SUCH DAMAGE.  + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE.   */  #include "iprop.h" @@ -36,7 +36,7 @@  #include <parse_time.h>  #include "iprop-commands.h" -RCSID("$Id: iprop-log.c 22211 2007-12-07 19:27:27Z lha $"); +RCSID("$Id$");  static krb5_context context; @@ -75,7 +75,7 @@ get_kadmin_context(const char *config_file, char *realm)  					KADM5_ADMIN_SERVICE,  					NULL,  					KADM5_ADMIN_SERVICE, -					&conf, 0, 0,  +					&conf, 0, 0,  					&kadm_handle);      if (ret)  	krb5_err (context, 1, ret, "kadm5_init_with_password_ctx"); @@ -119,12 +119,12 @@ print_entry(kadm5_server_context *server_context,      krb5_context scontext = server_context->context;      off_t end = krb5_storage_seek(sp, 0, SEEK_CUR) + len; -     +      krb5_error_code ret;      strftime(t, sizeof(t), "%Y-%m-%d %H:%M:%S", localtime(×tamp)); -    if(op < kadm_get || op > kadm_nop) { +    if((int)op < (int)kadm_get || (int)op > (int)kadm_nop) {  	printf("unknown op: %d\n", op);  	krb5_storage_seek(sp, end, SEEK_SET);  	return; @@ -184,7 +184,7 @@ print_entry(kadm5_server_context *server_context,  	    if(ent.valid_end == NULL) {  		strlcpy(t, "never", sizeof(t));  	    } else { -		strftime(t, sizeof(t), "%Y-%m-%d %H:%M:%S",  +		strftime(t, sizeof(t), "%Y-%m-%d %H:%M:%S",  			 localtime(ent.valid_end));  	    }  	    printf("    expires = %s\n", t); @@ -193,7 +193,7 @@ print_entry(kadm5_server_context *server_context,  	    if(ent.pw_end == NULL) {  		strlcpy(t, "never", sizeof(t));  	    } else { -		strftime(t, sizeof(t), "%Y-%m-%d %H:%M:%S",  +		strftime(t, sizeof(t), "%Y-%m-%d %H:%M:%S",  			 localtime(ent.pw_end));  	    }  	    printf("    password exp = %s\n", t); @@ -201,7 +201,7 @@ print_entry(kadm5_server_context *server_context,  	if(mask & KADM5_LAST_PWD_CHANGE) {  	}  	if(mask & KADM5_ATTRIBUTES) { -	    unparse_flags(HDBFlags2int(ent.flags),  +	    unparse_flags(HDBFlags2int(ent.flags),  			  asn1_HDBFlags_units(), t, sizeof(t));  	    printf("    attributes = %s\n", t);  	} @@ -271,7 +271,7 @@ iprop_dump(struct dump_options *opt, int argc, char **argv)      kadm5_server_context *server_context;      krb5_error_code ret; -    server_context = get_kadmin_context(opt->config_file_string,  +    server_context = get_kadmin_context(opt->config_file_string,  					opt->realm_string);      ret = kadm5_log_init (server_context); @@ -294,7 +294,7 @@ iprop_truncate(struct truncate_options *opt, int argc, char **argv)      kadm5_server_context *server_context;      krb5_error_code ret; -    server_context = get_kadmin_context(opt->config_file_string,  +    server_context = get_kadmin_context(opt->config_file_string,  					opt->realm_string);      ret = kadm5_log_truncate (server_context); @@ -311,7 +311,7 @@ last_version(struct last_version_options *opt, int argc, char **argv)      krb5_error_code ret;      uint32_t version; -    server_context = get_kadmin_context(opt->config_file_string,  +    server_context = get_kadmin_context(opt->config_file_string,  					opt->realm_string);      ret = kadm5_log_init (server_context); @@ -344,14 +344,14 @@ apply_entry(kadm5_server_context *server_context,  	    time_t timestamp,  	    enum kadm_ops op,  	    uint32_t len, -	    krb5_storage *sp,  +	    krb5_storage *sp,  	    void *ctx)  {      struct replay_options *opt = ctx;      krb5_error_code ret; -    if((opt->start_version_integer != -1 && ver < opt->start_version_integer) || -       (opt->end_version_integer != -1 && ver > opt->end_version_integer)) { +    if((opt->start_version_integer != -1 && ver < (uint32_t)opt->start_version_integer) || +       (opt->end_version_integer != -1 && ver > (uint32_t)opt->end_version_integer)) {  	/* XXX skip this entry */  	krb5_storage_seek(sp, len, SEEK_CUR);  	return; @@ -363,7 +363,7 @@ apply_entry(kadm5_server_context *server_context,  			    op, ver, len, sp);      if (ret)  	krb5_warn (server_context->context, ret, "kadm5_log_replay"); -     +      printf ("done\n");  } @@ -373,7 +373,7 @@ iprop_replay(struct replay_options *opt, int argc, char **argv)      kadm5_server_context *server_context;      krb5_error_code ret; -    server_context = get_kadmin_context(opt->config_file_string,  +    server_context = get_kadmin_context(opt->config_file_string,  					opt->realm_string);      ret = server_context->db->hdb_open(context, @@ -404,9 +404,9 @@ static int version_flag;  static struct getargs args[] = {      { "version", 	0,	arg_flag, 	&version_flag, -      NULL,		NULL  -    },  -    { "help", 	'h', 	arg_flag, 	&help_flag,  +      NULL,		NULL +    }, +    { "help", 	'h', 	arg_flag, 	&help_flag,        NULL, NULL      }  }; @@ -426,8 +426,11 @@ help(void *opt, int argc, char **argv)  		     argv[0]);  	} else {  	    if(c->func) { -		char *fake[] = { NULL, "--help", NULL }; +		static char shelp[] = "--help"; +		char *fake[3];  		fake[0] = argv[0]; +		fake[1] = shelp; +		fake[2] = NULL;  		(*c->func)(2, fake);  		fprintf(stderr, "\n");  	    } | 
