X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslurpd%2Fsanity.c;h=5539dc392adec0c7cd86c8f8276f6c8d1e131bca;hb=a070e6c05ff054ea047defc78fe60ec2d67c4565;hp=ab6880c0b0c09686d961372ed63d270b42db2e69;hpb=a44adcfb43c4030328d8a92c56e6cc4018ee5d4f;p=openldap
diff --git a/servers/slurpd/sanity.c b/servers/slurpd/sanity.c
index ab6880c0b0..5539dc392a 100644
--- a/servers/slurpd/sanity.c
+++ b/servers/slurpd/sanity.c
@@ -1,6 +1,18 @@
/* $OpenLDAP$ */
-/*
- * Copyright (c) 1996 Regents of the University of Michigan.
+/* This work is part of OpenLDAP Software .
+ *
+ * Copyright 1998-2006 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * .
+ */
+/* Portions Copyright (c) 1996 Regents of the University of Michigan.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
@@ -10,6 +22,10 @@
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
*/
+/* ACKNOWLEDGEMENTS:
+ * This work was originally developed by the University of Michigan
+ * (as part of U-MICH LDAP).
+ */
/*
@@ -23,6 +39,7 @@
#include
+#include
#include
#include
@@ -66,7 +83,7 @@ sanity( void )
* Are there any replicas listed in the slapd config file?
*/
if ( sglob->replicas == NULL ) {
- fprintf( stderr, "No replicas in slapd config file \"%s\"!\n",
+ fprintf( stderr, "No replicas in slapd.conf file \"%s\"!\n",
sglob->slapd_configfile );
err++;
}
@@ -76,20 +93,24 @@ sanity( void )
* that the slapd replogfile is readable, if it exists.
*/
if ( sglob->slapd_replogfile == NULL ) {
- fprintf( stderr, "Fatal error: no \"replogfile\" directive given\n" );
+ fprintf( stderr, "Fatal error: no \"replogfile\" "
+ "slapd.conf directive given\n" );
err++;
} else {
rc = filecheck( sglob->slapd_replogfile );
if ( rc & FC_DIRBAD ) {
- fprintf( stderr, "Error: %s: directory does not exist\n",
+ fprintf( stderr, "Error: %s: directory specified in "
+ "\"replogfile\" slapd.conf directive does not exist\n",
sglob->slapd_replogfile );
err++;
} else if ( rc & FC_DIRUNREAD ) {
- fprintf( stderr, "Error: %s: directory not readable\n",
+ fprintf( stderr, "Error: %s: directory specified in "
+ "\"replogfile\" slapd.conf directive is not readable\n",
sglob->slapd_replogfile );
err++;
} else if (!( rc & FC_FILEBAD) && ( rc & FC_FILEUNREAD )) {
- fprintf( stderr, "Error: %s: file not readable\n",
+ fprintf( stderr, "Error: %s: file specified in "
+ "\"replogfile\" slapd.conf directive is not readable\n",
sglob->slapd_replogfile );
err++;
}
@@ -105,19 +126,21 @@ sanity( void )
} else {
rc = filecheck( sglob->slurpd_replogfile );
if ( rc & FC_DIRBAD ) {
- fprintf( stderr, "Error: %s: directory does not exist\n",
+ fprintf( stderr, "Error: %s: slurpd \"replogfile\" "
+ "directory does not exist\n",
sglob->slurpd_replogfile );
err++;
} else if ( rc & FC_DIRUNREAD ) {
- fprintf( stderr, "Error: %s: directory not readable\n",
+ fprintf( stderr, "Error: %s: slurpd \"replogfile\" "
+ "directory not readable\n",
sglob->slurpd_replogfile );
err++;
} else if ( !( rc & FC_FILEBAD ) && ( rc & FC_FILEUNREAD )) {
- fprintf( stderr, "Error: %s: file not readable\n",
+ fprintf( stderr, "Error: %s: slurpd \"replogfile\" not readable\n",
sglob->slurpd_replogfile );
err++;
} else if ( !( rc & FC_FILEBAD ) && ( rc & FC_FILEUNWRITE )) {
- fprintf( stderr, "Error: %s: file not writeable\n",
+ fprintf( stderr, "Error: %s: slurpd \"replogfile\" not writeable\n",
sglob->slurpd_replogfile );
err++;
}
@@ -129,19 +152,19 @@ sanity( void )
*/
rc = filecheck( sglob->slurpd_status_file );
if ( rc & FC_DIRBAD ) {
- fprintf( stderr, "Error: %s: directory does not exist\n",
+ fprintf( stderr, "Error: %s: status directory does not exist\n",
sglob->slurpd_status_file );
err++;
} else if ( rc & FC_DIRUNREAD ) {
- fprintf( stderr, "Error: %s: directory not readable\n",
+ fprintf( stderr, "Error: %s: status directory not readable\n",
sglob->slurpd_status_file );
err++;
} else if ( !( rc & FC_FILEBAD ) && ( rc & FC_FILEUNREAD )) {
- fprintf( stderr, "Error: %s: file not readable\n",
+ fprintf( stderr, "Error: %s: status file not readable\n",
sglob->slurpd_status_file );
err++;
} else if ( !( rc & FC_FILEBAD ) && ( rc & FC_FILEUNWRITE )) {
- fprintf( stderr, "Error: %s: file not writeable\n",
+ fprintf( stderr, "Error: %s: status file not writeable\n",
sglob->slurpd_status_file );
err++;
}
@@ -174,8 +197,8 @@ filecheck(
char *p;
unsigned int ret = 0;
- strcpy( dir, f );
- p = strrchr( dir, '/' );
+ snprintf( dir, sizeof dir, "%s", f );
+ p = strrchr( dir, LDAP_DIRSEP[0] );
if ( p != NULL ) {
*p = '\0';
}