Skip to content
Snippets Groups Projects
Commit 68a87985 authored by Kurt Spanier's avatar Kurt Spanier
Browse files

Definition of slapd pid and args files as slapd.conf general parameters;

introduction of pid/agrs parameters to the test-suite slapd.conf files;
creation of sub-directory test/var for storage of pid/args files during test;
update of the slapd and slapd.conf man pages.
(The change reduces dependency on ldapconfig.h, since SLAPD_PIDEXT
 and SLAPD_ARGSEXT are deleted from the code.)
parent 127ec9c4
No related branches found
No related tags found
No related merge requests found
.TH SLAPD.CONF 5 "22 September 1998" "OpenLDAP LDVERSION" .TH SLAPD.CONF 5 "20 January 1999" "OpenLDAP LDVERSION"
.SH NAME .SH NAME
slapd.conf \- configuration file for slapd, the stand-alone LDAP daemon slapd.conf \- configuration file for slapd, the stand-alone LDAP daemon
.SH SYNOPSIS .SH SYNOPSIS
...@@ -111,6 +111,19 @@ any other access line. The default behavior is to grant read access. ...@@ -111,6 +111,19 @@ any other access line. The default behavior is to grant read access.
Read additional configuration information from the given file before Read additional configuration information from the given file before
continuing with the next line of the current file. continuing with the next line of the current file.
.TP .TP
.B pidfile <filename>
The ( absolute ) name of a file that will hold the
.B slapd
server's process ID ( see
.BR getpid (2)
) if started without the debugging command line option.
.TP
.B argsfile <filename>
The ( absolute ) name of a file that will hold the
.B slapd
server's command line options
if started without the debugging command line option.
.TP
.B loglevel <integer> .B loglevel <integer>
Specify the level at which debugging statements and operation Specify the level at which debugging statements and operation
statistics should be syslogged (currently logged to the statistics should be syslogged (currently logged to the
......
.TH SLAPD 8C "22 September 1998" "OpenLDAP LDVERSION" .TH SLAPD 8C "20 January 1999" "OpenLDAP LDVERSION"
.SH NAME .SH NAME
slapd \- Stand-alone LDAP Daemon slapd \- Stand-alone LDAP Daemon
.SH SYNOPSIS .SH SYNOPSIS
...@@ -18,26 +18,19 @@ is typically invoked at boot time, usually out of ...@@ -18,26 +18,19 @@ is typically invoked at boot time, usually out of
Upon startup, Upon startup,
.B slapd .B slapd
normally forks and disassociates itself from the invoking tty. normally forks and disassociates itself from the invoking tty.
In this case, the If configured in
.BR ETCDIR/slapd.conf ,
the
.B slapd .B slapd
process will print its process ID to a process will print its process ID ( see
.B .pid
file ( see
.BR getpid (2) .BR getpid (2)
), as well as the command line options during invocation to an ) to a
.B .pid
file, as well as the command line options during invocation to an
.B .args .B .args
file. By default, these files are located in the directory file ( see
.B LOCALSTATEDIR. .BR slapd.conf (5)
The files' base names are derived from the ).
.B slapd
binary name, making it possible to run several
.B slapd
servers with differet names on the same machine, with each having
its own
.B .pid/.args
files. (Those
.B slapd
names might be obtained via symbolic links to one binary file.)
If the If the
.B \-d .B \-d
flag is given and debugging is set to some non-zero flag is given and debugging is set to some non-zero
......
...@@ -215,10 +215,6 @@ Please try again later.\r\n" ...@@ -215,10 +215,6 @@ Please try again later.\r\n"
#define SLAPD_DEFAULT_SIZELIMIT 500 #define SLAPD_DEFAULT_SIZELIMIT 500
/* default timelimit to spend on a search */ /* default timelimit to spend on a search */
#define SLAPD_DEFAULT_TIMELIMIT 3600 #define SLAPD_DEFAULT_TIMELIMIT 3600
/* extension of the slapd pid file */
#define SLAPD_PIDEXT ".pid"
/* extension of the slapd args file */
#define SLAPD_ARGSEXT ".args"
/* minimum max ids that a single index entry can map to in ldbm */ /* minimum max ids that a single index entry can map to in ldbm */
#define SLAPD_LDBM_MIN_MAXIDS 4000 #define SLAPD_LDBM_MIN_MAXIDS 4000
......
...@@ -24,6 +24,9 @@ char *replogfile; ...@@ -24,6 +24,9 @@ char *replogfile;
int global_lastmod; int global_lastmod;
char *ldap_srvtab = ""; char *ldap_srvtab = "";
char *slapd_pid_file = NULL;
char *slapd_args_file = NULL;
static char *fp_getline(FILE *fp, int *lineno); static char *fp_getline(FILE *fp, int *lineno);
static void fp_getline_init(int *lineno); static void fp_getline_init(int *lineno);
static void fp_parse_line(char *line, int *argcp, char **argv); static void fp_parse_line(char *line, int *argcp, char **argv);
...@@ -83,6 +86,28 @@ read_config( char *fname, Backend **bep, FILE *pfp ) ...@@ -83,6 +86,28 @@ read_config( char *fname, Backend **bep, FILE *pfp )
/* assign a default depth limit for alias deref */ /* assign a default depth limit for alias deref */
be->be_maxDerefDepth = SLAPD_DEFAULT_MAXDEREFDEPTH; be->be_maxDerefDepth = SLAPD_DEFAULT_MAXDEREFDEPTH;
/* get pid file name */
} else if ( strcasecmp( cargv[0], "pidfile" ) == 0 ) {
if ( cargc < 2 ) {
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing file name in \"pidfile <file>\" line\n",
fname, lineno, 0 );
exit( 1 );
}
slapd_pid_file = ch_strdup( cargv[1] );
/* get args file name */
} else if ( strcasecmp( cargv[0], "argsfile" ) == 0 ) {
if ( cargc < 2 ) {
Debug( LDAP_DEBUG_ANY,
"%s: line %d: missing file name in \"argsfile <file>\" line\n",
fname, lineno, 0 );
exit( 1 );
}
slapd_args_file = ch_strdup( cargv[1] );
/* set size limit */ /* set size limit */
} else if ( strcasecmp( cargv[0], "sizelimit" ) == 0 ) { } else if ( strcasecmp( cargv[0], "sizelimit" ) == 0 ) {
if ( cargc < 2 ) { if ( cargc < 2 ) {
......
...@@ -40,11 +40,9 @@ static volatile sig_atomic_t slapd_shutdown = 0; ...@@ -40,11 +40,9 @@ static volatile sig_atomic_t slapd_shutdown = 0;
static void set_shutdown(int sig); static void set_shutdown(int sig);
static void do_nothing (int sig); static void do_nothing (int sig);
/* we need the server's name for constructing the pid/args file names */ /* a link to the slapd.conf configuration parameters */
#if defined( SLAPD_PIDEXT ) || defined( SLAPD_ARGSEXT ) extern char *slapd_pid_file;
extern char *serverName; extern char *slapd_args_file;
#define DEFAULT_SERVERNAME "slapd"
#endif
void * void *
slapd_daemon( slapd_daemon(
...@@ -62,13 +60,6 @@ slapd_daemon( ...@@ -62,13 +60,6 @@ slapd_daemon(
FILE *fp; FILE *fp;
int on = 1; int on = 1;
#ifdef SLAPD_PIDEXT
char pidFile[BUFSIZ];
#endif
#ifdef SLAPD_ARGSEXT
char argsFile[BUFSIZ];
#endif
#ifdef HAVE_SYSCONF #ifdef HAVE_SYSCONF
dtblsize = sysconf( _SC_OPEN_MAX ); dtblsize = sysconf( _SC_OPEN_MAX );
#elif HAVE_GETDTABLESIZE #elif HAVE_GETDTABLESIZE
...@@ -150,30 +141,20 @@ slapd_daemon( ...@@ -150,30 +141,20 @@ slapd_daemon(
Debug( LDAP_DEBUG_ANY, "slapd starting\n", 0, 0, 0 ); Debug( LDAP_DEBUG_ANY, "slapd starting\n", 0, 0, 0 );
#if defined( SLAPD_PIDEXT ) || defined( SLAPD_ARGSEXT ) if (( slapd_pid_file != NULL ) &&
if ( !serverName ) serverName = DEFAULT_SERVERNAME; (( fp = fopen( slapd_pid_file, "w" )) != NULL )) {
#ifdef SLAPD_PIDEXT
sprintf( pidFile, "%s%s%s%s", DEFAULT_RUNDIR, DEFAULT_DIRSEP,
serverName, SLAPD_PIDEXT );
if ( (fp = fopen( pidFile, "w" )) != NULL ) {
fprintf( fp, "%d\n", (int) getpid() ); fprintf( fp, "%d\n", (int) getpid() );
fclose( fp ); fclose( fp );
} }
#endif
#ifdef SLAPD_ARGSEXT if (( slapd_args_file != NULL ) &&
sprintf( argsFile, "%s%s%s%s", DEFAULT_RUNDIR, DEFAULT_DIRSEP, (( fp = fopen( slapd_args_file, "w" )) != NULL )) {
serverName, SLAPD_ARGSEXT );
if ( (fp = fopen( argsFile, "w" )) != NULL ) {
for ( i = 0; i < g_argc; i++ ) { for ( i = 0; i < g_argc; i++ ) {
fprintf( fp, "%s ", g_argv[i] ); fprintf( fp, "%s ", g_argv[i] );
} }
fprintf( fp, "\n" ); fprintf( fp, "\n" );
fclose( fp ); fclose( fp );
} }
#endif
#endif
while ( !slapd_shutdown ) { while ( !slapd_shutdown ) {
struct sockaddr_in from; struct sockaddr_in from;
......
...@@ -49,12 +49,6 @@ static int cnvt_str2int(); ...@@ -49,12 +49,6 @@ static int cnvt_str2int();
#endif /* LOG_LOCAL4 */ #endif /* LOG_LOCAL4 */
/*
* the server's name must be accessible from the daemon module,
* to construct the pid/args file names
*/
char *serverName = NULL;
static void static void
usage( char *name ) usage( char *name )
...@@ -79,6 +73,7 @@ main( int argc, char **argv ) ...@@ -79,6 +73,7 @@ main( int argc, char **argv )
int syslogUser = DEFAULT_SYSLOG_USER; int syslogUser = DEFAULT_SYSLOG_USER;
#endif #endif
char *configfile; char *configfile;
char *serverName;
configfile = SLAPD_DEFAULT_CONFIGFILE; configfile = SLAPD_DEFAULT_CONFIGFILE;
port = LDAP_PORT; port = LDAP_PORT;
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
include ./data/slapd.at.conf include ./data/slapd.at.conf
include ./data/slapd.oc.conf include ./data/slapd.oc.conf
schemacheck off schemacheck off
pidfile ./var/slapd-acl.pid
argsfile ./var/slapd-acl.args
####################################################################### #######################################################################
# ldbm database definitions # ldbm database definitions
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
include ./data/slapd.at.conf include ./data/slapd.at.conf
include ./data/slapd.oc.conf include ./data/slapd.oc.conf
schemacheck on schemacheck on
pidfile ./var/slapd-master.pid
argsfile ./var/slapd-master.args
####################################################################### #######################################################################
# ldbm database definitions # ldbm database definitions
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
include ./data/slapd.at.conf include ./data/slapd.at.conf
include ./data/slapd.oc.conf include ./data/slapd.oc.conf
schemacheck off schemacheck off
pidfile ./var/slapd-repl-master.pid
argsfile ./var/slapd-repl-master.args
####################################################################### #######################################################################
# ldbm database definitions # ldbm database definitions
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
include ./data/slapd.at.conf include ./data/slapd.at.conf
include ./data/slapd.oc.conf include ./data/slapd.oc.conf
schemacheck off schemacheck off
pidfile ./var/slapd-repl-slave.pid
argsfile ./var/slapd-repl-slave.args
####################################################################### #######################################################################
# ldbm database definitions # ldbm database definitions
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment