Update control framework

Misc cleanup
NT updates
This commit is contained in:
Kurt Zeilenga 2002-03-24 02:17:21 +00:00
parent 41138a8ca7
commit 0be4d842bc
12 changed files with 147 additions and 87 deletions

View file

@ -53,8 +53,12 @@ monitor_subsys_time_init(
Entry *e, *e_tmp, *e_time;
struct monitorentrypriv *mp;
char buf[1024], ztmbuf[20], ltmbuf[20];
struct tm *ztm, *ltm;
char buf[1024], ztmbuf[20];
struct tm *ztm;
#ifdef HACK_LOCAL_TIME
struct tm *ltm;
char ltmbuf[20];
#endif
/*
* Note: ltmbuf, ltm are used only if HACK_LOCAL_TIME is defined
@ -227,8 +231,12 @@ monitor_subsys_time_update(
Entry *e
)
{
char ztmbuf[20], ltmbuf[20];
struct tm *ztm, *ltm;
char ztmbuf[20];
struct tm *ztm;
#ifdef HACK_LOCAL_TIME
char ltmbuf[20];
struct tm *
#endif
time_t currenttime;
Attribute *a;
static AttributeDescription *ad_local = NULL;

View file

@ -1349,6 +1349,8 @@ connection_input(
op = slap_op_alloc( ber, msgid, tag, conn->c_n_ops_received++ );
op->o_pagedresults_state = conn->c_pagedresults_state;
#ifdef LDAP_CONNECTIONLESS
op->o_peeraddr = peeraddr;
if (cdn) {

View file

@ -46,6 +46,7 @@ typedef int (SLAP_CTRL_PARSE_FN) LDAP_P((
static SLAP_CTRL_PARSE_FN parseManageDSAit;
static SLAP_CTRL_PARSE_FN parseSubentries;
static SLAP_CTRL_PARSE_FN parseNoOp;
static SLAP_CTRL_PARSE_FN parsePagedResults;
static struct slap_control {
char *sc_oid;
@ -66,6 +67,11 @@ static struct slap_control {
{ LDAP_CONTROL_NOOP,
SLAP_CTRL_UPDATE, NULL,
parseNoOp },
#endif
#ifdef LDAP_CONTROL_PAGEDRESULTS_REQUEST
{ LDAP_CONTROL_PAGEDRESULTS_REQUEST,
SLAP_CTRL_SEARCH, NULL,
parsePagedResults },
#endif
{ NULL }
};
@ -442,3 +448,82 @@ static int parseNoOp (
}
#endif
#ifdef LDAP_CONTROL_PAGEDRESULTS_REQUEST
static int parsePagedResults (
Connection *conn,
Operation *op,
LDAPControl *ctrl,
const char **text )
{
ber_tag_t tag;
ber_int_t size;
BerElement *ber;
struct berval cookie = { 0, NULL };
if ( op->o_pagedresults != SLAP_NO_CONTROL ) {
*text = "paged results control specified multiple times";
return LDAP_PROTOCOL_ERROR;
}
if ( ctrl->ldctl_value.bv_len == 0 ) {
*text = "paged results control value is empty";
return LDAP_PROTOCOL_ERROR;
}
/* Parse the control value
* realSearchControlValue ::= SEQUENCE {
* size INTEGER (0..maxInt),
* -- requested page size from client
* -- result set size estimate from server
* cookie OCTET STRING
*/
ber = ber_init( &ctrl->ldctl_value );
if( ber == NULL ) {
*text = "internal error";
return LDAP_OTHER;
}
tag = ber_scanf( ber, "{im}", &size, &cookie );
(void) ber_free( ber, 1 );
if( tag == LBER_ERROR ) {
*text = "paged results control could not be decoded";
return LDAP_PROTOCOL_ERROR;
}
if( size <= 0 ) {
*text = "paged results control size invalid";
return LDAP_PROTOCOL_ERROR;
}
if( cookie.bv_len ) {
PagedResultsCookie reqcookie;
if( cookie.bv_len != sizeof( reqcookie ) ) {
/* bad cookie */
*text = "paged results cookie is invalid";
return LDAP_PROTOCOL_ERROR;
}
AC_MEMCPY( &reqcookie, cookie.bv_val, sizeof( reqcookie ));
if( reqcookie > op->o_pagedresults_state.ps_cookie ) {
/* bad cookie */
*text = "paged results cookie is invalid";
return LDAP_PROTOCOL_ERROR;
} else if( reqcookie < op->o_pagedresults_state.ps_cookie ) {
*text = "paged results cookie is invalid or old";
return LDAP_UNWILLING_TO_PERFORM;
}
}
op->o_pagedresults_state.ps_cookie = op->o_opid;
op->o_pagedresults_size = size;
op->o_pagedresults = ctrl->ldctl_iscritical
? SLAP_CRITICAL_CONTROL
: SLAP_NONCRITICAL_CONTROL;
return LDAP_SUCCESS;
}
#endif

View file

@ -64,59 +64,3 @@ slap_op_alloc(
return( op );
}
#if 0
int slap_op_add(
Operation **olist,
Operation *op
)
{
Operation **tmp;
for ( tmp = olist; *tmp != NULL; tmp = &(*tmp)->o_next )
; /* NULL */
*tmp = op;
return 0;
}
int
slap_op_remove( Operation **olist, Operation *op )
{
Operation **tmp;
for ( tmp = olist; *tmp != NULL && *tmp != op; tmp = &(*tmp)->o_next )
; /* NULL */
if ( *tmp == NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
"slap_op_remove: can't find op %ld.\n",
(long)op->o_msgid ));
#else
Debug( LDAP_DEBUG_ANY, "op_delete: can't find op %ld\n",
(long) op->o_msgid, 0, 0 );
#endif
return -1;
}
*tmp = (*tmp)->o_next;
op->o_next = NULL;
return 0;
}
Operation * slap_op_pop( Operation **olist )
{
Operation *tmp = *olist;
if(tmp != NULL) {
*olist = tmp->o_next;
tmp->o_next = NULL;
}
return tmp;
}
#endif

View file

@ -53,9 +53,6 @@ LDAP_SLAPD_F (int) slap_bv2ad LDAP_P((
AttributeDescription **ad,
const char **text ));
LDAP_SLAPD_F (AttributeDescription *) ad_dup LDAP_P((
AttributeDescription *desc ));
LDAP_SLAPD_F (void) ad_destroy LDAP_P(( AttributeDescription * ));
#define ad_cmp(l,r) (((l)->ad_cname.bv_len < (r)->ad_cname.bv_len) \

View file

@ -353,7 +353,7 @@ print_vals(
struct berval *type,
struct berval *bv )
{
int i, len;
ber_len_t i, len;
char *buf, *bufp;
for ( i = 0, len = 0; bv && bv[i].bv_val; i++ ) {

View file

@ -3931,6 +3931,7 @@ check_time_syntax (struct berval *val,
return LDAP_SUCCESS;
}
#ifdef SUPPORT_OBSOLETE_UTC_SYNTAX
static int
utcTimeNormalize(
Syntax *syntax,
@ -3956,7 +3957,9 @@ utcTimeNormalize(
return LDAP_SUCCESS;
}
#endif
#ifdef SUPPORT_OBSOLETE_UTC_SYNTAX
static int
utcTimeValidate(
Syntax *syntax,
@ -3966,6 +3969,7 @@ utcTimeValidate(
return check_time_syntax(in, 1, parts);
}
#endif
static int
generalizedTimeValidate(
@ -4210,8 +4214,10 @@ static struct syntax_defs_rec {
0, NULL, NULL, NULL},
{"( 1.3.6.1.4.1.1466.115.121.1.52 DESC 'Telex Number' )",
0, printablesStringValidate, IA5StringNormalize, NULL},
#ifdef SUPPORT_OBSOLETE_UTC_SYNTAX
{"( 1.3.6.1.4.1.1466.115.121.1.53 DESC 'UTC Time' )",
0, utcTimeValidate, utcTimeNormalize, NULL},
#endif
{"( 1.3.6.1.4.1.1466.115.121.1.54 DESC 'LDAP Syntax Description' )",
0, NULL, NULL, NULL},
{"( 1.3.6.1.4.1.1466.115.121.1.55 DESC 'Modify Rights' )",

View file

@ -1413,28 +1413,44 @@ typedef struct slap_callback {
void *sc_private;
} slap_callback;
/*
* Paged Results state
*/
typedef unsigned long PagedResultsCookie;
typedef struct slap_paged_state {
Backend *ps_be;
PagedResultsCookie ps_cookie;
ID ps_id;
} PagedResultsState;
/*
* represents an operation pending from an ldap client
*/
typedef struct slap_op {
ber_int_t o_opid; /* id of this operation */
ber_int_t o_msgid; /* msgid of the request */
unsigned long o_opid; /* id of this operation */
unsigned long o_connid; /* id of conn initiating this op */
ber_int_t o_msgid; /* msgid of the request */
ber_int_t o_protocol; /* version of the LDAP protocol used by client */
ber_tag_t o_tag; /* tag of the request */
time_t o_time; /* time op was initiated */
unsigned long o_connid; /* id of conn initiating this op */
ldap_pvt_thread_t o_tid; /* thread handling this op */
ber_tag_t o_tag; /* tag of the request */
time_t o_time; /* time op was initiated */
ldap_pvt_thread_t o_tid; /* thread handling this op */
ldap_pvt_thread_mutex_t o_abandonmutex; /* protects o_abandon */
char o_abandon; /* abandon flag */
#define SLAP_NO_CONTROL 0
#define SLAP_NONCRITICAL_CONTROL 1
#define SLAP_CRITICAL_CONTROL 2
char o_managedsait;
char o_noop;
char o_subentries;
char o_subentries_visibility;
char o_noop;
char o_abandon; /* abandon flag */
ldap_pvt_thread_mutex_t o_abandonmutex; /* protects o_abandon */
char o_pagedresults;
ber_int_t o_pagedresults_size;
PagedResultsState o_pagedresults_state;
#ifdef LDAP_CONNECTIONLESS
Sockaddr o_peeraddr; /* UDP peer address */
@ -1523,6 +1539,8 @@ typedef struct slap_conn {
void *c_sasl_context; /* SASL session context */
void *c_sasl_extra; /* SASL session extra stuff */
PagedResultsState c_pagedresults_state; /* paged result state */
long c_n_ops_received; /* num of ops received (next op_id) */
long c_n_ops_executing; /* num of ops currently executing */
long c_n_ops_pending; /* num of ops pending execution */

View file

@ -102,7 +102,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 hs_regexd.lib libdbs.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 libdb32.lib hs_regex.lib libsasl.lib rpcrt4.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug"
# ADD LINK32 rpcrt4.lib libdb32.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\SDebug"
!ELSEIF "$(CFG)" == "slapd - Win32 Single Release"
@ -127,7 +127,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 hs_regex.lib libdb.lib wsock32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 libdb.lib libdb32.lib hs_regex.lib libsasl.lib rpcrt4.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease"
# ADD LINK32 libdb.lib libdb32.lib rpcrt4.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease"
!ENDIF

View file

@ -53,7 +53,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 sasl.lib libdb40.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\Release"
# ADD LINK32 sasl.lib libdb40.lib rpcrt4.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\Release"
!ELSEIF "$(CFG)" == "slapadd - Win32 Debug"
@ -77,7 +77,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 libdb40d.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\Debug"
# ADD LINK32 libdb40d.lib rpcrt4.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\Debug"
!ELSEIF "$(CFG)" == "slapadd - Win32 Single Debug"
@ -102,7 +102,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib hs_regexd.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 libdb32.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\SDebug"
# ADD LINK32 libdb32.lib rpcrt4.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\SDebug"
!ELSEIF "$(CFG)" == "slapadd - Win32 Single Release"
@ -127,7 +127,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 hs_regex.lib libdb.lib ws2_32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 libdbs.lib libdb32.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\SRelease"
# ADD LINK32 libdbs.lib libdb32.lib hs_regex.lib libsasl.lib ws2_32.lib rpcrt4.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\SRelease"
!ENDIF

View file

@ -53,7 +53,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 sasl.lib libdb40.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\Release"
# ADD LINK32 sasl.lib libdb40.lib rpcrt4.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\Release"
!ELSEIF "$(CFG)" == "slapcat - Win32 Debug"
@ -77,7 +77,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 libdb40d.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\Debug"
# ADD LINK32 libdb40d.lib rpcrt4.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\Debug"
!ELSEIF "$(CFG)" == "slapcat - Win32 Single Debug"
@ -102,7 +102,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 oldbm32.lib libdb.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\libraries\Debug"
# ADD LINK32 libdb32.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\SDebug"
# ADD LINK32 libdb32.lib rpcrt4.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\SDebug"
!ELSEIF "$(CFG)" == "slapcat - Win32 Single Release"
@ -126,7 +126,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libdb.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\libraries\Release"
# ADD LINK32 libdbs.lib libdb32.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\SRelease"
# ADD LINK32 libdbs.lib libdb32.lib hs_regex.lib libsasl.lib ws2_32.lib rpcrt4.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\SRelease"
!ENDIF

View file

@ -54,7 +54,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 sasl.lib libdb40.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\Release"
# ADD LINK32 sasl.lib libdb40.lib rpcrt4.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\Release"
!ELSEIF "$(CFG)" == "slapindex - Win32 Debug"
@ -78,7 +78,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 libdb40d.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\Debug"
# ADD LINK32 libdb40d.lib rpcrt4.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\Debug"
!ELSEIF "$(CFG)" == "slapindex - Win32 Single Debug"
@ -103,7 +103,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib shell32.lib hs_regexd.lib libdbs.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 libdb32.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\SDebug"
# ADD LINK32 libdb32.lib rpcrt4.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\SDebug"
!ELSEIF "$(CFG)" == "slapindex - Win32 Single Release"
@ -128,7 +128,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 hs_regex.lib libdb.lib ws2_32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 libdbs.lib libdb32.lib hs_regex.lib libsasl.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease"
# ADD LINK32 libdbs.lib libdb32.lib hs_regex.lib libsasl.lib ws2_32.lib rpcrt4.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\SRelease"
!ENDIF