1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/** BEGIN COPYRIGHT BLOCK
* Copyright 2001 Sun Microsystems, Inc.
* Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
* All rights reserved.
* END COPYRIGHT BLOCK **/
/***********************************************************************
**
** NAME
** plugin-utils.h
**
** DESCRIPTION
**
**
** AUTHOR
** <rweltman@netscape.com>
**
***********************************************************************/
#ifndef _PLUGIN_UTILS_H_
#define _PLUGIN_UTILS_H_
/***********************************************************************
** Includes
***********************************************************************/
#include <slapi-plugin.h>
/*
* slapi-plugin-compat4.h is needed because we use the following deprecated
* functions:
*
* slapi_search_internal()
* slapi_modify_internal()
*/
#include "slapi-plugin-compat4.h"
#include <dirlite_strings.h>
#include <stdio.h>
#include <string.h>
#ifdef _WINDOWS
#undef strcasecmp
#define strcasecmp strcmpi
#endif
#include "dirver.h"
#ifdef LDAP_DEBUG
#ifndef DEBUG
#define DEBUG
#endif
#endif
#define BEGIN do {
#define END } while(0);
int initCounterLock();
int op_error(int internal_error);
Slapi_PBlock *readPblockAndEntry( const char *baseDN, const char *filter,
char *attrs[] );
int entryHasObjectClass(Slapi_PBlock *pb, Slapi_Entry *e,
const char *objectClass);
Slapi_PBlock *dnHasObjectClass( const char *baseDN, const char *objectClass );
Slapi_PBlock *dnHasAttribute( const char *baseDN, const char *attrName );
int setCounter( Slapi_Entry *e, const char *attrName, int value );
int updateCounter( Slapi_Entry *e, const char *attrName, int increment );
int updateCounterByDN( const char *dn, const char *attrName, int increment );
typedef struct DNLink {
char *dn;
void *data;
struct DNLink *next;
} DNLink;
DNLink *cacheInit( void );
DNLink *cacheAdd( DNLink *root, char *dn, void *data );
char *cacheRemove( DNLink *root, char *dn );
int cacheDelete( DNLink *root, char *dn );
DNLink *cacheFind( DNLink *root, char *dn );
#endif /* _PLUGIN_UTILS_H_ */
|