+2000-10-16 Tom Yu <tlyu@mit.edu>
+
+ * kadmin.c (strdur): Print negative durations somewhat (!)
+ sanely.
+ (kadmin_startup): Call krb5_klog_init() to avoid coredumping if
+ kadm5_init() logs something via krb5_klog_syslog().
+
2000-10-03 Ezra Peisach <epeisach@mit.edu>
* kadmin.c (kadmin_getpol): Change format strings from %d to %ld
time_t duration;
{
static char out[50];
- int days, hours, minutes, seconds;
-
+ int neg, days, hours, minutes, seconds;
+
+ if (duration < 0) {
+ duration *= -1;
+ neg = 1;
+ } else
+ neg = 0;
days = duration / (24 * 3600);
duration %= 24 * 3600;
hours = duration / 3600;
minutes = duration / 60;
duration %= 60;
seconds = duration;
- sprintf(out, "%d %s %02d:%02d:%02d", days, days == 1 ? "day" : "days",
+ sprintf(out, "%s%d %s %02d:%02d:%02d", neg ? "-" : "",
+ days, days == 1 ? "day" : "days",
hours, minutes, seconds);
return out;
}
}
}
+ retval = krb5_klog_init(context, "admin_server", whoami, 0);
+ if (retval) {
+ com_err(whoami, retval, "while setting up logging");
+ exit(1);
+ }
+
/*
* Initialize the kadm5 connection. If we were given a ccache,
* use it. Otherwise, use/prompt for the password.
}
/* insert more random cleanup here */
+ krb5_klog_close(context);
krb5_free_context(context);
return 0;
}