]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Import updated SLAPD .args/.pid file handling from devel.
authorKurt Zeilenga <kurt@openldap.org>
Sat, 23 Jan 1999 22:24:58 +0000 (22:24 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sat, 23 Jan 1999 22:24:58 +0000 (22:24 +0000)
CHANGES
doc/man/man5/slapd.conf.5
doc/man/man8/slapd.8
include/ldapconfig.h.edit
servers/slapd/config.c
servers/slapd/daemon.c
servers/slapd/main.c
tests/data/slapd-acl.conf
tests/data/slapd-master.conf
tests/data/slapd-repl-master.conf
tests/data/slapd-repl-slave.conf

diff --git a/CHANGES b/CHANGES
index 842fde7c338ea4c298109e6635bac705e995d0e9..9f03c0cce4cf574f1ea87802b55f9abe21afbf12 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -7,12 +7,15 @@ Changes included in OpenLDAP 1.2
        Add client/tools password prompting (-W)
        Add slapd logging option
        Add slapd alternative args/pid file locations
-       Fix client SIGPIPE handling
-       Fix configure wait3 handling
-       Fix lber leaking ber_scanf
+       Fixed client SIGPIPE handling
+       Fixed configure wait3 handling
+       Fixed lber leaking ber_scanf
+       Fixed slapd/add entry rwlock race fix.
+       Fixed slapd/nextid race fix.
        Updated client -d(ebug) handling
        Updated slapd alias deref functionality to be optional
        Updated slapd DN handling
+       Updated slapd .args/.pid file handling
        Updated client/tools Kerberos option handling
 
 Changes included in OpenLDAP 1.1.3
index 3d7831293d6a8403258a187912deb7709f5a75a1..8cfdb7674b80f7bfb41312b98127b340860df6eb 100644 (file)
@@ -1,4 +1,4 @@
-.TH SLAPD.CONF 5 "22 September 1998" "OpenLDAP LDVERSION"
+.TH SLAPD.CONF 5 "20 January 1999" "OpenLDAP LDVERSION"
 .SH NAME
 slapd.conf \- configuration file for slapd, the stand-alone LDAP daemon
 .SH SYNOPSIS
@@ -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
 continuing with the next line of the current file.
 .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>
 Specify the level at which debugging statements and operation 
 statistics should be syslogged (currently logged to the
index 85f3aa830ac2f7c2bf2a6493a6d360a231157242..bc6cd546807f277610c57db586123c6e9fed534e 100644 (file)
@@ -1,4 +1,4 @@
-.TH SLAPD 8C "22 September 1998" "OpenLDAP LDVERSION"
+.TH SLAPD 8C "20 January 1999" "OpenLDAP LDVERSION"
 .SH NAME
 slapd \- Stand-alone LDAP Daemon
 .SH SYNOPSIS
@@ -18,26 +18,19 @@ is typically invoked at boot time, usually out of
 Upon startup,
 .B slapd
 normally forks and disassociates itself from the invoking tty.
-In this case, the
+If configured in
+.BR ETCDIR/slapd.conf ,
+the
 .B slapd
-process will print its process ID to a 
-.B .pid
-file ( see
+process will print its process ID ( see
 .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
-file. By default, these files are located in the directory 
-.B LOCALSTATEDIR.
-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.)
+file ( see 
+.BR slapd.conf (5)
+).
 If the
 .B \-d
 flag is given and debugging is set to some non-zero
index 6d73cf991def1dd66472b34d88bbe12c0976b645..ae9bea12e62763441ec26363a5e822a4df617103 100644 (file)
@@ -215,10 +215,6 @@ Please try again later.\r\n"
 #define SLAPD_DEFAULT_SIZELIMIT                500
        /* default timelimit to spend on a search */
 #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 */
 #define SLAPD_LDBM_MIN_MAXIDS          4000
 
index 77ea81673122af91dec7f684f5fbdd5c498ab166..ce5ddcdfb660fc3b19595b8f0b32347d8d1e3e3e 100644 (file)
@@ -24,6 +24,9 @@ char          *replogfile;
 int            global_lastmod;
 char           *ldap_srvtab = "";
 
+char   *slapd_pid_file  = NULL;
+char   *slapd_args_file = NULL;
+
 static char    *fp_getline(FILE *fp, int *lineno);
 static void    fp_getline_init(int *lineno);
 static void    fp_parse_line(char *line, int *argcp, char **argv);
@@ -83,6 +86,28 @@ read_config( char *fname, Backend **bep, FILE *pfp )
                /* assign a default depth limit for alias deref */
                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 */
                } else if ( strcasecmp( cargv[0], "sizelimit" ) == 0 ) {
                        if ( cargc < 2 ) {
index 738707165d99256f05bf13e44ecdb1d71d9ae6bd..a9372fdac21ac383649df8a66e7cc0140ef8d968 100644 (file)
@@ -40,11 +40,9 @@ static int slapd_shutdown = 0;
 static void    set_shutdown(int sig);
 static void    do_nothing  (int sig);
 
-/* we need the server's name for constructing the pid/args file names */
-#if defined( SLAPD_PIDEXT ) || defined( SLAPD_ARGSEXT )
-extern char  *serverName;
-#define DEFAULT_SERVERNAME  "slapd"
-#endif
+/* a link to the slapd.conf configuration parameters */
+extern char *slapd_pid_file;
+extern char *slapd_args_file;
 
 void *
 slapd_daemon(
@@ -62,13 +60,6 @@ slapd_daemon(
        FILE                    *fp;
        int                     on = 1;
 
-#ifdef SLAPD_PIDEXT
-    char            pidFile[BUFSIZ];
-#endif
-#ifdef SLAPD_ARGSEXT
-    char            argsFile[BUFSIZ];
-#endif
-
 #ifdef HAVE_SYSCONF
        dtblsize = sysconf( _SC_OPEN_MAX );
 #elif HAVE_GETDTABLESIZE
@@ -150,30 +141,20 @@ slapd_daemon(
 
        Debug( LDAP_DEBUG_ANY, "slapd starting\n", 0, 0, 0 );
 
-#if defined( SLAPD_PIDEXT ) || defined( SLAPD_ARGSEXT )
-    if ( !serverName ) serverName = DEFAULT_SERVERNAME;
-
-#ifdef SLAPD_PIDEXT
-    sprintf( pidFile, "%s%s%s%s", DEFAULT_RUNDIR, DEFAULT_DIRSEP,
-               serverName, SLAPD_PIDEXT );
-       if ( (fp = fopen( pidFile, "w" )) != NULL ) {
+       if (( slapd_pid_file != NULL ) &&
+                       (( fp = fopen( slapd_pid_file, "w" )) != NULL )) {
                fprintf( fp, "%d\n", (int) getpid() );
                fclose( fp );
        }
-#endif
-#ifdef SLAPD_ARGSEXT
-    sprintf( argsFile, "%s%s%s%s", DEFAULT_RUNDIR, DEFAULT_DIRSEP,
-       serverName, SLAPD_ARGSEXT );
-       if ( (fp = fopen( argsFile, "w" )) != NULL ) {
+
+       if (( slapd_args_file != NULL ) &&
+                       (( fp = fopen( slapd_args_file, "w" )) != NULL )) {
                for ( i = 0; i < g_argc; i++ ) {
                        fprintf( fp, "%s ", g_argv[i] );
                }
                fprintf( fp, "\n" );
                fclose( fp );
        }
-#endif
-#endif
-
 
        while ( !slapd_shutdown ) {
                struct sockaddr_in      from;
index dd7ecf0027a33e20ad5f5a530391c7d47c2bea68..fb2ee3f36d722d9afc5e858e60066ebc934ba7a8 100644 (file)
@@ -48,12 +48,6 @@ static int   cnvt_str2int();
 
 #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
 usage( char *name )
@@ -75,6 +69,7 @@ main( int argc, char **argv )
        Backend         *be = NULL;
        FILE            *fp = NULL;
        char            *configfile;
+       char    *serverName;
 #ifdef LOG_LOCAL4
        int     syslogUser = DEFAULT_SYSLOG_USER;
 #endif
index 5e56dea19c4f65759ed6425af7d0d5b2bed06481..80dd2b65940aa7c3d1699a1e3d49a8b8fd4ea756 100644 (file)
@@ -4,6 +4,8 @@
 include                ./data/slapd.at.conf
 include                ./data/slapd.oc.conf
 schemacheck    off
+pidfile     ./test-db/slapd.pid
+argsfile    ./test-db/slapd.args
 
 #######################################################################
 # ldbm database definitions
index 74ce2d19b00fa86e987cd3984536438b24445883..8d642c56d47a80b0318e2c549078f61c5963a0f0 100644 (file)
@@ -4,6 +4,8 @@
 include                ./data/slapd.at.conf
 include                ./data/slapd.oc.conf
 schemacheck    on
+pidfile     ./test-db/slapd.pid
+argsfile    ./test-db/slapd.args
 
 #######################################################################
 # ldbm database definitions
index bce1d6821cd41854f1c05dc8f748bc6fb218e202..9bc24b482e8ebae08581511ba76d5c6ac7b6a789 100644 (file)
@@ -4,6 +4,8 @@
 include                ./data/slapd.at.conf
 include                ./data/slapd.oc.conf
 schemacheck    off
+pidfile     ./test-db/slapd.pid
+argsfile    ./test-db/slapd.args
 
 #######################################################################
 # ldbm database definitions
index 47c74aa3c5645a38a8e05b0c4139e0ad3ef0a3f7..66926c6c411ad747c354f7af91fe232bb82a509b 100644 (file)
@@ -4,6 +4,8 @@
 include                ./data/slapd.at.conf
 include                ./data/slapd.oc.conf
 schemacheck    off
+pidfile     ./test-repl/slapd.pid
+argsfile    ./test-repl/slapd.args
 
 #######################################################################
 # ldbm database definitions