Temporary fix for high-priority iprop issues
Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
This commit is contained in:

committed by
Love Hornquist Astrand

parent
435c02fa26
commit
72f0690694
@@ -32,9 +32,27 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "kadm5_locl.h"
|
#include "kadm5_locl.h"
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
RCSID("$Id$");
|
RCSID("$Id$");
|
||||||
|
|
||||||
|
#ifndef O_NONBLOCK
|
||||||
|
#define NBLK FNDELAY
|
||||||
|
#else
|
||||||
|
#define NBLK O_NONBLOCK
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static int non_blocking(int fd, int on)
|
||||||
|
{
|
||||||
|
int flags;
|
||||||
|
|
||||||
|
if ((flags = fcntl(fd, F_GETFL, 0)) < 0)
|
||||||
|
return -1;
|
||||||
|
if (fcntl(fd, F_SETFL, on ? flags | NBLK : flags & ~NBLK) < 0)
|
||||||
|
return -1;
|
||||||
|
return ((flags & NBLK) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static kadm5_ret_t
|
static kadm5_ret_t
|
||||||
kadm5_s_init_with_context(krb5_context context,
|
kadm5_s_init_with_context(krb5_context context,
|
||||||
@@ -92,6 +110,8 @@ kadm5_s_init_with_context(krb5_context context,
|
|||||||
ctx->log_context.socket_info->ai_protocol);
|
ctx->log_context.socket_info->ai_protocol);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
non_blocking(ctx->log_context.socket_fd, 1);
|
||||||
|
|
||||||
ret = krb5_parse_name(ctx->context, client_name, &ctx->caller);
|
ret = krb5_parse_name(ctx->context, client_name, &ctx->caller);
|
||||||
if(ret)
|
if(ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@@ -675,7 +675,9 @@ send_diffs (krb5_context context, slave *s, int log_fd,
|
|||||||
if (s->flags & SLAVE_F_DEAD)
|
if (s->flags & SLAVE_F_DEAD)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
flock(log_fd, LOCK_SH);
|
||||||
sp = kadm5_log_goto_end (log_fd);
|
sp = kadm5_log_goto_end (log_fd);
|
||||||
|
flock(log_fd, LOCK_UN);
|
||||||
right = krb5_storage_seek(sp, 0, SEEK_CUR);
|
right = krb5_storage_seek(sp, 0, SEEK_CUR);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ret = kadm5_log_previous (context, sp, &ver, ×tamp, &op, &len);
|
ret = kadm5_log_previous (context, sp, &ver, ×tamp, &op, &len);
|
||||||
@@ -1050,7 +1052,9 @@ main(int argc, char **argv)
|
|||||||
signal_fd = make_signal_socket (context);
|
signal_fd = make_signal_socket (context);
|
||||||
listen_fd = make_listen_socket (context, port_str);
|
listen_fd = make_listen_socket (context, port_str);
|
||||||
|
|
||||||
|
flock(log_fd, LOCK_SH);
|
||||||
kadm5_log_get_version_fd (log_fd, ¤t_version);
|
kadm5_log_get_version_fd (log_fd, ¤t_version);
|
||||||
|
flock(log_fd, LOCK_UN);
|
||||||
|
|
||||||
krb5_warnx(context, "ipropd-master started at version: %lu",
|
krb5_warnx(context, "ipropd-master started at version: %lu",
|
||||||
(unsigned long)current_version);
|
(unsigned long)current_version);
|
||||||
@@ -1091,7 +1095,9 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
old_version = current_version;
|
old_version = current_version;
|
||||||
|
flock(log_fd, LOCK_SH);
|
||||||
kadm5_log_get_version_fd (log_fd, ¤t_version);
|
kadm5_log_get_version_fd (log_fd, ¤t_version);
|
||||||
|
flock(log_fd, LOCK_UN);
|
||||||
|
|
||||||
if (current_version > old_version) {
|
if (current_version > old_version) {
|
||||||
krb5_warnx(context,
|
krb5_warnx(context,
|
||||||
@@ -1122,7 +1128,9 @@ main(int argc, char **argv)
|
|||||||
--ret;
|
--ret;
|
||||||
assert(ret >= 0);
|
assert(ret >= 0);
|
||||||
old_version = current_version;
|
old_version = current_version;
|
||||||
|
flock(log_fd, LOCK_SH);
|
||||||
kadm5_log_get_version_fd (log_fd, ¤t_version);
|
kadm5_log_get_version_fd (log_fd, ¤t_version);
|
||||||
|
flock(log_fd, LOCK_UN);
|
||||||
if (current_version > old_version) {
|
if (current_version > old_version) {
|
||||||
krb5_warnx(context,
|
krb5_warnx(context,
|
||||||
"Got a signal, updating slaves %lu to %lu",
|
"Got a signal, updating slaves %lu to %lu",
|
||||||
|
@@ -759,9 +759,12 @@ main(int argc, char **argv)
|
|||||||
else
|
else
|
||||||
krb5_err (context, 1, errno, "select");
|
krb5_err (context, 1, errno, "select");
|
||||||
}
|
}
|
||||||
if (ret == 0)
|
if (ret == 0) {
|
||||||
krb5_errx (context, 1, "server didn't send a message "
|
krb5_warn (context, 1, "server didn't send a message "
|
||||||
"in %d seconds", time_before_lost);
|
"in %d seconds", time_before_lost);
|
||||||
|
connected = FALSE;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ret = krb5_read_priv_message(context, auth_context, &master_fd, &out);
|
ret = krb5_read_priv_message(context, auth_context, &master_fd, &out);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
Reference in New Issue
Block a user