Specify the default access to grant requestors not matched by
any other access line. The default behavior is to grant read access.
.TP
+.B idletimeout <integer>
+Specify the number of seconds to wait before forcibly closing
+an idle client connections. A idletimeout of 0 disables this
+feature. The default is 0.
+.TP
.B include <filename>
Read additional configuration information from the given file before
continuing with the next line of the current file.
int global_default_access = ACL_READ;
char *replogfile;
int global_lastmod;
+int global_idletimeout = 0;
char *ldap_srvtab = "";
char *slapd_pid_file = NULL;
global_lastmod = OFF;
}
+ /* set idle timeout value */
+ } else if ( strcasecmp( cargv[0], "idletimeout" ) == 0 ) {
+ int i;
+ if ( cargc < 2 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "%s: line %d: missing timeout value in \"idletimeout <seconds>\" line\n",
+ fname, lineno, 0 );
+ return( 1 );
+ }
+
+ i = atoi( cargv[1] );
+
+ if( i < 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "%s: line %d: timeout value (%d) invalid \"idletimeout <seconds>\" line\n",
+ fname, lineno, i );
+ return( 1 );
+ }
+
+ global_idletimeout = i;
+
/* include another config file */
} else if ( strcasecmp( cargv[0], "include" ) == 0 ) {
if ( cargc < 2 ) {
assert( c->c_struct_state == SLAP_C_USED );
assert( c->c_conn_state != SLAP_C_INVALID );
assert( ber_pvt_sb_in_use( c->c_sb ) );
+
+ c->c_activitytime = slap_get_time();
}
return c;
c->c_n_ops_completed = 0;
#endif
- c->c_starttime = slap_get_time();
+ c->c_activitytime = c->c_starttime = slap_get_time();
ber_pvt_sb_set_desc( c->c_sb, s );
ber_pvt_sb_set_io( c->c_sb, &ber_pvt_sb_io_tcp, NULL );
#endif
c->c_protocol = 0;
- c->c_starttime = 0;
+ c->c_activitytime = c->c_starttime = 0;
if(c->c_dn != NULL) {
free(c->c_dn);
#ifdef LDAP_COUNTERS
int i;
char buf2[22]
+ char buf3[22]
Connection *c;
int connindex;
#endif
#ifndef LDAP_LOCALTIME
ltm = gmtime( &c->c_starttime );
strftime( buf2, sizeof(buf2), "%Y%m%d%H%M%SZ", ltm );
+
+ ltm = gmtime( &c->.c_activitytime );
+ strftime( buf3, sizeof(buf2), "%y%m%d%H%M%SZ", ltm );
#else
ltm = localtime( &c->.c_starttime );
strftime( buf2, sizeof(buf2), "%y%m%d%H%M%SZ", ltm );
+
+ ltm = localtime( &c->.c_activitytime );
+ strftime( buf3, sizeof(buf2), "%y%m%d%H%M%SZ", ltm );
#endif
+
ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
- sprintf( buf, "%d : %s : %d : %d : %s : %s%s%s%s", i,
+ sprintf( buf, "%d : %s : %d : %d : %s : %s%s%s%s : %s", i,
buf2, c[i].c_n_ops_received, c[i].c_n_ops_completed,
c[i].c_cdn ? c[i].c_cdn : "NULLDN",
c[i].c_currentber ? "r" : "",
c[i].c_writewaiter ? "w" : "",
c[i].c_ops != NULL ? "x" : "",
c[i].c_pending_ops != NULL ? "p" : ""
+ buf3
);
val.bv_val = buf;
extern int g_argc;
extern int global_default_access;
extern int global_lastmod;
+extern int global_idletimeout;
extern int global_schemacheck;
extern int lber_debug;
extern int ldap_syslog;
/* only can be changed by connect_init */
time_t c_starttime; /* when the connection was opened */
+ time_t c_activitytime; /* when the connection was last used */
long c_connid; /* id of this connection for stats*/
char *c_client_addr; /* address of client */
char *c_client_name; /* name of client */