Add logging if its specfied by the configuration file
This commit is contained in:
		@@ -93,6 +93,7 @@ init_context_from_config_file(krb5_context context)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    krb5_error_code ret;
 | 
					    krb5_error_code ret;
 | 
				
			||||||
    const char * tmp;
 | 
					    const char * tmp;
 | 
				
			||||||
 | 
					    char **s;
 | 
				
			||||||
    krb5_enctype *tmptypes;
 | 
					    krb5_enctype *tmptypes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    INIT_FIELD(context, time, max_skew, 5 * 60, "clockskew");
 | 
					    INIT_FIELD(context, time, max_skew, 5 * 60, "clockskew");
 | 
				
			||||||
@@ -203,6 +204,16 @@ init_context_from_config_file(krb5_context context)
 | 
				
			|||||||
	krb5_enctype_enable(context, ETYPE_DES_PCBC_NONE);
 | 
						krb5_enctype_enable(context, ETYPE_DES_PCBC_NONE);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    s = krb5_config_get_strings(context, NULL, "logging", "krb5", NULL);
 | 
				
			||||||
 | 
					    if(s) {
 | 
				
			||||||
 | 
						char **p;
 | 
				
			||||||
 | 
						krb5_initlog(context, "libkrb5", &context->debug_dest);
 | 
				
			||||||
 | 
						for(p = s; *p; p++)
 | 
				
			||||||
 | 
						    krb5_addlog_dest(context, context->debug_dest, *p);
 | 
				
			||||||
 | 
						krb5_config_free_strings(s);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -400,6 +411,8 @@ krb5_copy_context(krb5_context context, krb5_context *out)
 | 
				
			|||||||
#if 0 /* XXX */
 | 
					#if 0 /* XXX */
 | 
				
			||||||
    if(context->warn_dest != NULL)
 | 
					    if(context->warn_dest != NULL)
 | 
				
			||||||
	;
 | 
						;
 | 
				
			||||||
 | 
					    if(context->debug_dest != NULL)
 | 
				
			||||||
 | 
						;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ret = krb5_set_extra_addresses(p, context->extra_addresses);
 | 
					    ret = krb5_set_extra_addresses(p, context->extra_addresses);
 | 
				
			||||||
@@ -449,6 +462,8 @@ krb5_free_context(krb5_context context)
 | 
				
			|||||||
    krb5_clear_error_message(context);
 | 
					    krb5_clear_error_message(context);
 | 
				
			||||||
    if(context->warn_dest != NULL)
 | 
					    if(context->warn_dest != NULL)
 | 
				
			||||||
	krb5_closelog(context, context->warn_dest);
 | 
						krb5_closelog(context, context->warn_dest);
 | 
				
			||||||
 | 
					    if(context->debug_dest != NULL)
 | 
				
			||||||
 | 
						krb5_closelog(context, context->debug_dest);
 | 
				
			||||||
    krb5_set_extra_addresses(context, NULL);
 | 
					    krb5_set_extra_addresses(context, NULL);
 | 
				
			||||||
    krb5_set_ignore_addresses(context, NULL);
 | 
					    krb5_set_ignore_addresses(context, NULL);
 | 
				
			||||||
    krb5_set_send_to_kdc_func(context, NULL, NULL);
 | 
					    krb5_set_send_to_kdc_func(context, NULL, NULL);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user