#ifdef DPRINT
#undef DPRINT
#endif
-#define DPRINT(i) if (nofork) printf i
+#define DPRINT(i, ...) \
+ do { \
+ if (nofork) { \
+ fprintf(stderr, __VA_ARGS__); \
+ fflush(stderr); \
+ } \
+ } while (0)
static void
/* default return code */
ret.ret = UPDATE_ERROR;
- DPRINT(("%s: start, last_sno=%lu\n", whoami,
- (unsigned long) arg->last_sno));
+ DPRINT("%s: start, last_sno=%lu\n", whoami,
+ (unsigned long)arg->last_sno);
if (!handle) {
krb5_klog_syslog(LOG_ERR,
}
}
- DPRINT(("%s: clprinc=`%s'\n\tsvcprinc=`%s'\n",
- whoami, client_name, service_name));
+ DPRINT("%s: clprinc=`%s'\n\tsvcprinc=`%s'\n", whoami, client_name,
+ service_name);
if (!kadm5int_acl_check(handle->context,
rqst2name(rqstp),
NULL)) {
ret.ret = UPDATE_PERM_DENIED;
+ DPRINT("%s: PERMISSION DENIED: clprinc=`%s'\n\tsvcprinc=`%s'\n",
+ whoami, client_name, service_name);
+
krb5_klog_syslog(LOG_NOTICE, LOG_UNAUTH, whoami,
client_name, service_name,
client_addr(rqstp));
(unsigned long)arg->last_sno);
}
+ DPRINT("%s: request %s %s\n\tclprinc=`%s'\n\tsvcprinc=`%s'\n",
+ whoami, obuf,
+ ((kret == 0) ? "success" : error_message(kret)),
+ client_name, service_name);
+
krb5_klog_syslog(LOG_NOTICE,
_("Request: %s, %s, %s, client=%s, service=%s, addr=%s"),
whoami,
goto out;
}
- DPRINT(("%s: start\n", whoami));
+ DPRINT("%s: start\n", whoami);
{
gss_buffer_desc client_desc, service_desc;
if (setup_gss_names(rqstp, &client_desc, &service_desc) < 0) {
+ DPRINT("%s: setup_gss_names failed\n", whoami);
krb5_klog_syslog(LOG_ERR,
_("%s: setup_gss_names failed"),
whoami);
if (client_name == NULL || service_name == NULL) {
free(client_name);
free(service_name);
+ DPRINT("%s: out of memory\n", whoami);
krb5_klog_syslog(LOG_ERR,
_("%s: out of memory recording principal names"),
whoami);
}
}
- DPRINT(("%s: clprinc=`%s'\n\tsvcprinc=`%s'\n",
- whoami, client_name, service_name));
+ DPRINT("%s: clprinc=`%s'\n\tsvcprinc=`%s'\n",
+ whoami, client_name, service_name);
if (!kadm5int_acl_check(handle->context,
rqst2name(rqstp),
NULL)) {
ret.ret = UPDATE_PERM_DENIED;
+ DPRINT("%s: Permission denied\n", whoami);
krb5_klog_syslog(LOG_NOTICE, LOG_UNAUTH, whoami,
client_name, service_name,
client_addr(rqstp));
* acts like a callback to the slave).
*/
fret = fork();
- DPRINT(("%s: fork=%d (%d)\n", whoami, fret, getpid()));
+ DPRINT("%s: fork=%d (%d)\n", whoami, fret, getpid());
switch (fret) {
case -1: /* error */
if (nofork) {
perror(whoami);
}
+ DPRINT("%s: fork failed\n", whoami);
krb5_klog_syslog(LOG_ERR,
_("%s: fork failed: %s"),
whoami,
goto out;
case 0: /* child */
- DPRINT(("%s: run `%s' ...\n", whoami, ubuf));
+ DPRINT("%s: run `%s' ...\n", whoami, ubuf);
(void) signal(SIGCHLD, SIG_DFL);
/* run kdb5_util(1M) dump for IProp */
p = popen(ubuf, "w");
_exit(1);
}
pret = pclose(p);
- DPRINT(("%s: pclose=%d\n", whoami, pret));
+ DPRINT("%s: pclose=%d\n", whoami, pret);
if (pret != 0) {
/* XXX popen/pclose may not set errno
properly, and the error could be from the
_exit(1);
}
- DPRINT(("%s: exec `kprop -f %s %s' ...\n",
- whoami, KPROP_DEFAULT_FILE, clhost));
+ DPRINT("%s: exec `kprop -f %s %s' ...\n",
+ whoami, KPROP_DEFAULT_FILE, clhost);
/* XXX Yuck! */
if (getenv("KPROP_PORT")) {
pret = execl(KPROP_DEFAULT_FILE, "kprop", "-f",
ret.lastentry.last_time.seconds = 0;
ret.lastentry.last_time.useconds = 0;
+ DPRINT("%s: spawned resync process %d, client=%s, "
+ "service=%s, addr=%s\n", whoami, fret, client_name,
+ service_name, client_addr(rqstp));
krb5_klog_syslog(LOG_NOTICE,
_("Request: %s, spawned resync process %d, client=%s, service=%s, addr=%s"),
whoami, fret,