View | Details | Raw Unified | Return to bug 41842 | Differences between
and this patch

Collapse All | Expand All

(-)a/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-listener/src/handlers.h (-6 lines)
 Lines 50-59    Link Here 
50
50
51
#define HANDLER_PREPARED        000000004
51
#define HANDLER_PREPARED        000000004
52
52
53
#define HANDLER_HAS_FLAG(handler, flag)		((handler->state & flag) == flag)
54
#define HANDLER_SET_FLAG(handler, flag)		handler->state |= flag
55
#define HANDLER_UNSET_FLAG(handler, flag)	handler->state &= ~flag
56
57
struct filter {
53
struct filter {
58
	char	*base;
54
	char	*base;
59
	int	 scope;
55
	int	 scope;
60
- 
61
--
62
.../management/univention-directory-listener/src/handlers.c   |  2 +-
56
.../management/univention-directory-listener/src/handlers.c   |  2 +-
63
.../management/univention-directory-listener/src/handlers.h   | 11 ++++++-----
57
.../management/univention-directory-listener/src/handlers.h   | 11 ++++++-----
64
2 files changed, 7 insertions(+), 6 deletions(-)
58
2 files changed, 7 insertions(+), 6 deletions(-)
(-)a/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-listener/src/handlers.c (-1 / +1 lines)
 Lines 262-268   static int handler_import(char* filename) Link Here 
262
	if (state_fp == NULL) {
262
	if (state_fp == NULL) {
263
		handler->state = 0;
263
		handler->state = 0;
264
	} else {
264
	} else {
265
		fscanf(state_fp, "%d", &handler->state);
265
		fscanf(state_fp, "%u", &handler->state);
266
		fclose(state_fp);
266
		fclose(state_fp);
267
	}
267
	}
268
268
(-)a/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-listener/src/handlers.h (-7 / +6 lines)
 Lines 45-54    Link Here 
45
   initializing, HANDLER_READY will be set; however, if the
45
   initializing, HANDLER_READY will be set; however, if the
46
   initialization fails, it will be removed again. If it's successful,
46
   initialization fails, it will be removed again. If it's successful,
47
   both, HANDLER_INITIALIZED and HANDLER_READY will be set */
47
   both, HANDLER_INITIALIZED and HANDLER_READY will be set */
48
#define HANDLER_INITIALIZED	000000001
48
enum state {
49
#define HANDLER_READY		000000002
49
	HANDLER_INITIALIZED = 1 << 0,
50
50
	HANDLER_READY = 1 << 1,
51
#define HANDLER_PREPARED        000000004
51
	HANDLER_PREPARED = 1 << 2,
52
};
52
53
53
struct filter {
54
struct filter {
54
	char	*base;
55
	char	*base;
 Lines 71-77   struct _Handler { Link Here 
71
	PyObject	 *setdata;
72
	PyObject	 *setdata;
72
	struct _Handler	 *next;
73
	struct _Handler	 *next;
73
74
74
	int		  state;
75
	enum state		  state;
75
	int		  prepared : 1;
76
	int		  prepared : 1;
76
} typedef Handler;
77
} typedef Handler;
77
78
78
- 
79
--
80
.../univention-directory-listener/src/handlers.c   | 24 ++++++++++++++--------
79
.../univention-directory-listener/src/handlers.c   | 24 ++++++++++++++--------
81
.../univention-directory-listener/src/handlers.h   |  1 +
80
.../univention-directory-listener/src/handlers.h   |  1 +
82
2 files changed, 16 insertions(+), 9 deletions(-)
81
2 files changed, 16 insertions(+), 9 deletions(-)
(-)a/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-listener/src/handlers.c (-9 / +15 lines)
 Lines 566-584   int handlers_load_all_paths(void) Link Here 
566
}
566
}
567
567
568
568
569
/* Free one handler. */
569
void handler_write_state(Handler *handler) {
570
int handler_free(Handler *handler)
571
{
572
	char **a;
573
	struct filter **f;
574
	char state_filename[PATH_MAX];
570
	char state_filename[PATH_MAX];
575
	FILE *state_fp;
571
	FILE *state_fp;
576
	int rv;
572
	int rv;
577
573
578
	if ( handler == NULL || handler->name == NULL ) {
579
		return 0;
580
	}
581
582
	/* write handler state */
574
	/* write handler state */
583
	/* XXX: can be removed, once we use a database for this */
575
	/* XXX: can be removed, once we use a database for this */
584
	rv = snprintf(state_filename, PATH_MAX, "%s/handlers/%s", cache_dir, handler->name);
576
	rv = snprintf(state_filename, PATH_MAX, "%s/handlers/%s", cache_dir, handler->name);
 Lines 591-596   int handler_free(Handler *handler) Link Here 
591
		fprintf(state_fp, "%d", handler->state);
583
		fprintf(state_fp, "%d", handler->state);
592
		fclose(state_fp);
584
		fclose(state_fp);
593
	}
585
	}
586
}
587
588
589
/* Free one handler. */
590
int handler_free(Handler *handler)
591
{
592
	char **a;
593
	struct filter **f;
594
595
	if ( handler == NULL || handler->name == NULL ) {
596
		return 0;
597
	}
598
599
	handler_write_state(handler);
594
600
595
	/* free list node */
601
	/* free list node */
596
	free(handler->name);
602
	free(handler->name);
(-)a/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-listener/src/handlers.h (-2 / +1 lines)
 Lines 78-83   struct _Handler { Link Here 
78
78
79
int	handlers_init			(void);
79
int	handlers_init			(void);
80
int	handlers_free_all		(void);
80
int	handlers_free_all		(void);
81
void handler_write_state(Handler *handler);
81
int	handlers_load_path		(char		*filename);
82
int	handlers_load_path		(char		*filename);
82
int	handlers_reload_all_paths	(void);
83
int	handlers_reload_all_paths	(void);
83
int	handlers_dump			(void);
84
int	handlers_dump			(void);
84
- 
85
--
86
.../ucs-4.1-2/management/univention-directory-listener/src/change.c     | 2 ++
85
.../ucs-4.1-2/management/univention-directory-listener/src/change.c     | 2 ++
87
1 file changed, 2 insertions(+)
86
1 file changed, 2 insertions(+)
(-)a/branches/ucs-4.1/ucs-4.1-2/management/univention-directory-listener/src/change.c (-1 / +2 lines)
 Lines 240-245   int change_new_modules(univention_ldap_parameters_t *lp) Link Here 
240
				handler->state |= HANDLER_INITIALIZED;
240
				handler->state |= HANDLER_INITIALIZED;
241
			else
241
			else
242
				handler->state ^= HANDLER_READY;
242
				handler->state ^= HANDLER_READY;
243
244
			handler_write_state(handler);
243
		}
245
		}
244
	}
246
	}
245
	INIT_ONLY = old_init_only;
247
	INIT_ONLY = old_init_only;
246
- 

Return to bug 41842