#include <string.h>
#include <unistd.h>
+#ifdef HAVE_KRB4
#include <krb.h>
+#endif
+#include <krb5.h>
RCSID("$Header$");
-extern char *krb_get_lrealm(char *, int);
-
client *cur_client;
char *whoami;
time_t now;
char *host;
-char krb_realm[REALM_SZ];
+krb5_context context = NULL;
+char *krb_realm = NULL;
/* Client array and associated data. This needs to be global for _list_users */
client **clients;
int nclients, clientssize;
int dormant;
+int child_exited_abnormally = 0;
+int child_pid, child_signal, child_status;
void reapchild(int x);
void godormant(int x);
}
}
- krb_get_lrealm(krb_realm, 1);
+ status = krb5_init_context(&context);
+ if (status)
+ {
+ com_err(whoami, status, "Initializing krb5 context.");
+ exit(1);
+ }
+
+ status = krb5_get_default_realm(context, &krb_realm);
+ if (status)
+ {
+ com_err(whoami, status, "Getting default Kerberos realm.");
+ exit(1);
+ }
/*
* Database initialization. Only init if database should be open.
/*
* Establish template connection.
*/
- if (!(listener = mr_listen(port)))
+ listener = mr_listen(port);
+ if (listener == -1)
{
- com_err(whoami, status, "trying to create listening connection");
+ com_err(whoami, MR_ABORTED, "trying to create listening connection");
exit(1);
}
FD_ZERO(&xreadfds);
if (takedown)
break;
+
+ if (child_exited_abnormally)
+ {
+ critical_alert("moirad", "%d: child exits with signal %d status %d",
+ child_pid, child_signal, child_status);
+ child_exited_abnormally = 0;
+ }
+
time(&now);
if (!inc_running || now - inc_started > INC_TIMEOUT)
next_incremental();
inc_running = 0;
if (!takedown && (WTERMSIG(status) != 0 || WEXITSTATUS(status) != 0))
{
- critical_alert("moirad", "%d: child exits with signal %d status %d",
- pid, WTERMSIG(status), WEXITSTATUS(status));
+ child_exited_abnormally = 1;
+ child_pid = pid;
+ child_signal = WTERMSIG(status);
+ child_status = WEXITSTATUS(status);
}
}
}