[Fedora-directory-commits] ldapserver/ldap/servers/slapd log.h, 1.8, 1.9 log.c, 1.24, 1.25
by Noriko Hosoi
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv12831
Modified Files:
log.h log.c
Log Message:
Resolves: #475338
Summary: LOG: the intenal type of maxlogsize, maxdiskspace and minfreespace
should be 64-bit integer
Description: support nsslapd-*log-maxlogsize, nsslapd-*log-logmaxdiskspace and
nsslapd-*log-logminfreediskspace larger than 2GB.
Index: log.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/log.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- log.h 8 Oct 2008 17:29:03 -0000 1.8
+++ log.h 10 Dec 2008 06:23:24 -0000 1.9
@@ -116,9 +116,9 @@
struct logfileinfo {
- int l_size; /* size is in KB */
- time_t l_ctime; /* log creation time*/
- struct logfileinfo *l_next; /* next log */
+ PRInt64 l_size; /* size is in bytes */
+ time_t l_ctime; /* log creation time*/
+ struct logfileinfo *l_next; /* next log */
};
typedef struct logfileinfo LogFileInfo;
@@ -127,7 +127,7 @@
char *current; /* current pointer into buffer */
size_t maxsize; /* size of buffer */
PRLock *lock; /* lock for access logging */
- PRInt32 refcount; /* Reference count for buffer copies */
+ PRInt32 refcount; /* Reference count for buffer copies */
};
typedef struct logbufinfo LogBufferInfo;
@@ -136,7 +136,7 @@
int log_access_state;
int log_access_mode; /* access mode */
int log_access_maxnumlogs; /* Number of logs */
- int log_access_maxlogsize; /* max log size in bytes*/
+ PRInt64 log_access_maxlogsize; /* max log size in bytes*/
int log_access_rotationtime; /* time in units. */
int log_access_rotationunit; /* time in units. */
int log_access_rotationtime_secs; /* time in seconds */
@@ -144,8 +144,8 @@
int log_access_rotationsynchour; /* 0-23 */
int log_access_rotationsyncmin; /* 0-59 */
time_t log_access_rotationsyncclock; /* clock in seconds */
- int log_access_maxdiskspace; /* space in bytes */
- int log_access_minfreespace; /* free space in bytes */
+ PRInt64 log_access_maxdiskspace; /* space in bytes */
+ PRInt64 log_access_minfreespace; /* free space in bytes */
int log_access_exptime; /* time */
int log_access_exptimeunit; /* unit time */
int log_access_exptime_secs; /* time in secs */
@@ -163,7 +163,7 @@
int log_error_state;
int log_error_mode; /* access mode */
int log_error_maxnumlogs; /* Number of logs */
- int log_error_maxlogsize; /* max log size in bytes*/
+ PRInt64 log_error_maxlogsize; /* max log size in bytes*/
int log_error_rotationtime; /* time in units. */
int log_error_rotationunit; /* time in units. */
int log_error_rotationtime_secs; /* time in seconds */
@@ -171,8 +171,8 @@
int log_error_rotationsynchour; /* 0-23 */
int log_error_rotationsyncmin; /* 0-59 */
time_t log_error_rotationsyncclock; /* clock in seconds */
- int log_error_maxdiskspace; /* space in bytes */
- int log_error_minfreespace; /* free space in bytes */
+ PRInt64 log_error_maxdiskspace; /* space in bytes */
+ PRInt64 log_error_minfreespace; /* free space in bytes */
int log_error_exptime; /* time */
int log_error_exptimeunit; /* unit time */
int log_error_exptime_secs; /* time in secs */
@@ -189,7 +189,7 @@
int log_audit_state;
int log_audit_mode; /* access mode */
int log_audit_maxnumlogs; /* Number of logs */
- int log_audit_maxlogsize; /* max log size in bytes*/
+ PRInt64 log_audit_maxlogsize; /* max log size in bytes*/
int log_audit_rotationtime; /* time in units. */
int log_audit_rotationunit; /* time in units. */
int log_audit_rotationtime_secs; /* time in seconds */
@@ -197,8 +197,8 @@
int log_audit_rotationsynchour; /* 0-23 */
int log_audit_rotationsyncmin; /* 0-59 */
time_t log_audit_rotationsyncclock; /* clock in seconds */
- int log_audit_maxdiskspace; /* space in bytes */
- int log_audit_minfreespace; /* free space in bytes */
+ PRInt64 log_audit_maxdiskspace; /* space in bytes */
+ PRInt64 log_audit_minfreespace; /* free space in bytes */
int log_audit_exptime; /* time */
int log_audit_exptimeunit; /* unit time */
int log_audit_exptime_secs; /* time in secs */
Index: log.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/log.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- log.c 1 Dec 2008 18:05:35 -0000 1.24
+++ log.c 10 Dec 2008 06:23:24 -0000 1.25
@@ -121,9 +121,9 @@
static int log__access_rotationinfof(char *pathname);
static int log__error_rotationinfof(char *pathname);
static int log__audit_rotationinfof(char *pathname);
-static int log__extract_logheader (FILE *fp, long *f_ctime, int *f_size);
+static int log__extract_logheader (FILE *fp, long *f_ctime, PRInt64 *f_size);
static int log__check_prevlogs (FILE *fp, char *filename);
-static int log__getfilesize(LOGFD fp);
+static PRInt64 log__getfilesize(LOGFD fp);
static int log__enough_freespace(char *path);
static int vslapd_log_error(LOGFD fp, char *subsystem, char *fmt, va_list ap, int locked );
@@ -767,9 +767,9 @@
log_set_logsize(const char *attrname, char *logsize_str, int logtype, char *returntext, int apply)
{
int rv = LDAP_SUCCESS;
- int mdiskspace= 0;
- int max_logsize;
- int logsize;
+ PRInt64 mdiskspace= 0; /* in bytes */
+ PRInt64 max_logsize; /* in bytes */
+ int logsize; /* in megabytes */
slapdFrontendConfig_t *fe_cfg = getFrontendConfig();
if (!apply || !logsize_str || !*logsize_str)
@@ -778,7 +778,7 @@
logsize = atoi(logsize_str);
/* convert it to bytes */
- max_logsize = logsize * LOG_MB_IN_BYTES;
+ max_logsize = (PRInt64)logsize * LOG_MB_IN_BYTES;
if (max_logsize <= 0) {
max_logsize = -1;
@@ -831,11 +831,11 @@
default:
rv = 1;
}
- /* logsize will be in n MB. Convert it to bytes */
+ /* logsize is in MB */
if (rv == 2) {
LDAPDebug (LDAP_DEBUG_ANY,
"Invalid value for Maximum log size:"
- "Maxlogsize:%d MB Maxdisksize:%d MB\n",
+ "Maxlogsize:%d (MB) exceeds Maxdisksize:%d (MB)\n",
logsize, mdiskspace/LOG_MB_IN_BYTES,0);
rv = LDAP_OPERATIONS_ERROR;
@@ -1244,9 +1244,9 @@
log_set_maxdiskspace(const char *attrname, char *maxdiskspace_str, int logtype, char *errorbuf, int apply)
{
int rv = 0;
- int mlogsize;
- int maxdiskspace;
- int s_maxdiskspace;
+ PRInt64 mlogsize; /* in bytes */
+ PRInt64 maxdiskspace; /* in bytes */
+ int s_maxdiskspace; /* in megabytes */
slapdFrontendConfig_t *fe_cfg = getFrontendConfig();
@@ -1261,8 +1261,7 @@
if (!apply || !maxdiskspace_str || !*maxdiskspace_str)
return rv;
- maxdiskspace = atoi(maxdiskspace_str);
- s_maxdiskspace = maxdiskspace;
+ s_maxdiskspace = atoi(maxdiskspace_str);
/* Disk space are in MB but store in bytes */
switch (logtype) {
@@ -1282,44 +1281,42 @@
rv = 1;
mlogsize = -1;
}
- maxdiskspace *= LOG_MB_IN_BYTES;
+ maxdiskspace = (PRInt64)s_maxdiskspace * LOG_MB_IN_BYTES;
if (maxdiskspace < 0) {
maxdiskspace = -1;
- }
- else if (maxdiskspace < mlogsize) {
+ } else if (maxdiskspace < mlogsize) {
rv = LDAP_OPERATIONS_ERROR;
PR_snprintf( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: maxdiskspace \"%d\" is less than max log size \"%d\"",
- attrname, maxdiskspace, mlogsize );
+ "%s: \"%d (MB)\" is less than max log size \"%d (MB)\"",
+ attrname, s_maxdiskspace, (int)(mlogsize/LOG_MB_IN_BYTES) );
}
switch (logtype) {
case SLAPD_ACCESS_LOG:
if (rv== 0 && apply) {
- loginfo.log_access_maxdiskspace = maxdiskspace;
- fe_cfg->accesslog_maxdiskspace = s_maxdiskspace ;
+ loginfo.log_access_maxdiskspace = maxdiskspace; /* in bytes */
+ fe_cfg->accesslog_maxdiskspace = s_maxdiskspace; /* in megabytes */
}
LOG_ACCESS_UNLOCK_WRITE();
break;
case SLAPD_ERROR_LOG:
if (rv== 0 && apply) {
- loginfo.log_error_maxdiskspace = maxdiskspace;
- fe_cfg->errorlog_maxdiskspace = s_maxdiskspace;
+ loginfo.log_error_maxdiskspace = maxdiskspace; /* in bytes */
+ fe_cfg->errorlog_maxdiskspace = s_maxdiskspace; /* in megabytes */
}
LOG_ERROR_UNLOCK_WRITE();
break;
case SLAPD_AUDIT_LOG:
if (rv== 0 && apply) {
- loginfo.log_audit_maxdiskspace = maxdiskspace;
- fe_cfg->auditlog_maxdiskspace = s_maxdiskspace;
+ loginfo.log_audit_maxdiskspace = maxdiskspace; /* in bytes */
+ fe_cfg->auditlog_maxdiskspace = s_maxdiskspace; /* in megabytes */
}
LOG_AUDIT_UNLOCK_WRITE();
break;
default:
PR_snprintf( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: invalid maximum log disk size:"
- "Maxdiskspace:%d MB Maxlogsize:%d MB \n",
- attrname, maxdiskspace, mlogsize);
+ "%s: invalid log type (%d) for setting maximum disk space: %d MB\n",
+ attrname, logtype, s_maxdiskspace);
rv = LDAP_OPERATIONS_ERROR;
}
return rv;
@@ -1335,8 +1332,8 @@
log_set_mindiskspace(const char *attrname, char *minfreespace_str, int logtype, char *errorbuf, int apply)
{
int rv=LDAP_SUCCESS;
- int minfreespaceB;
- int minfreespace;
+ int minfreespace; /* in megabytes */
+ PRInt64 minfreespaceB; /* in bytes */
slapdFrontendConfig_t *fe_cfg = getFrontendConfig();
@@ -1357,7 +1354,7 @@
/* Disk space are in MB but store in bytes */
if (minfreespace >= 1 ) {
- minfreespaceB = minfreespace * LOG_MB_IN_BYTES;
+ minfreespaceB = (PRInt64)minfreespace * LOG_MB_IN_BYTES;
switch (logtype) {
case SLAPD_ACCESS_LOG:
LOG_ACCESS_LOCK_WRITE( );
@@ -2115,13 +2112,13 @@
** in the array stack.
*/
if (loginfo.log_access_fdes != NULL) {
- struct logfileinfo *log;
- char newfile[BUFSIZ];
- int f_size;
+ struct logfileinfo *log;
+ char newfile[BUFSIZ];
+ PRInt64 f_size;
/* get rid of the old one */
if ((f_size = log__getfilesize(loginfo.log_access_fdes)) == -1) {
- /* Then assume that we have the max size */
+ /* Then assume that we have the max size (in bytes) */
f_size = loginfo.log_access_maxlogsize;
}
@@ -2158,15 +2155,13 @@
}
}
-
/* open a new log file */
if (! LOG_OPEN_APPEND(fp, loginfo.log_access_file, loginfo.log_access_mode)) {
int oserr = errno;
loginfo.log_access_fdes = NULL;
if (!locked) LOG_ACCESS_UNLOCK_WRITE();
- LDAPDebug( LDAP_DEBUG_ANY, "access file open %s failed errno %d (%s)\n",
- loginfo.log_access_file,
- oserr, slapd_system_strerror(oserr));
+ LDAPDebug(LDAP_DEBUG_ANY, "access file open %s failed errno %d (%s)\n",
+ loginfo.log_access_file, oserr, slapd_system_strerror(oserr));
return LOG_UNABLE_TO_OPENFILE;
}
@@ -2198,8 +2193,9 @@
logp = loginfo.log_access_logchain;
while ( logp) {
log_convert_time (logp->l_ctime, tbuf, 1 /*short*/);
- PR_snprintf(buffer, sizeof(buffer), "LOGINFO:%s%s.%s (%lu) (%u)\n",
- PREVLOGFILE, loginfo.log_access_file, tbuf, logp->l_ctime, logp->l_size);
+ PR_snprintf(buffer, sizeof(buffer), "LOGINFO:%s%s.%s (%lu) (%"
+ NSPRI64 "d)\n", PREVLOGFILE, loginfo.log_access_file, tbuf,
+ logp->l_ctime, logp->l_size);
LOG_WRITE(fpinfo, buffer, strlen(buffer), 0);
logp = logp->l_next;
}
@@ -2236,8 +2232,9 @@
time_t log_createtime= 0;
time_t syncclock = 0;
int type = LOG_CONTINUE;
- int f_size = 0;
- int maxlogsize, nlogs;
+ PRInt64 f_size = 0;
+ PRInt64 maxlogsize;
+ int nlogs;
int rotationtime_secs = -1;
int sync_enabled = 0, timeunit = 0;
@@ -2316,22 +2313,24 @@
}
log_rotate:
- /*
- ** Don't send messages to the error log whilst we're rotating it.
- ** This'll lead to a recursive call to the logging function, and
- ** an assertion trying to relock the write lock.
- */
+ /*
+ ** Don't send messages to the error log whilst we're rotating it.
+ ** This'll lead to a recursive call to the logging function, and
+ ** an assertion trying to relock the write lock.
+ */
if (logtype!=SLAPD_ERROR_LOG)
- {
- if (type == LOG_SIZE_EXCEEDED) {
- LDAPDebug (LDAP_DEBUG_TRACE,
- "LOGINFO:End of Log because size exceeded(Max:%d bytes) (Is:%d bytes)\n", maxlogsize, f_size, 0);
- } else if ( type == LOG_EXPIRED) {
- LDAPDebug(LDAP_DEBUG_TRACE,
- "LOGINFO:End of Log because time exceeded(Max:%d secs) (Is:%ld secs)\n",
- rotationtime_secs, curr_time - log_createtime,0);
- }
- }
+ {
+ if (type == LOG_SIZE_EXCEEDED) {
+ LDAPDebug (LDAP_DEBUG_TRACE,
+ "LOGINFO:End of Log because size exceeded(Max:%"
+ NSPRI64 "d bytes) (Is:%" NSPRI64 "d bytes)\n",
+ maxlogsize, f_size, 0);
+ } else if ( type == LOG_EXPIRED) {
+ LDAPDebug(LDAP_DEBUG_TRACE,
+ "LOGINFO:End of Log because time exceeded(Max:%d secs) (Is:%ld secs)\n",
+ rotationtime_secs, curr_time - log_createtime,0);
+ }
+ }
return (type == LOG_CONTINUE) ? LOG_CONTINUE : LOG_ROTATE;
}
@@ -2349,18 +2348,18 @@
log__delete_access_logfile()
{
- struct logfileinfo *logp = NULL;
- struct logfileinfo *delete_logp = NULL;
- struct logfileinfo *p_delete_logp = NULL;
- struct logfileinfo *prev_logp = NULL;
- int total_size=0;
- time_t cur_time;
- int f_size;
- int numoflogs=loginfo.log_numof_access_logs;
- int rv = 0;
- char *logstr;
- char buffer[BUFSIZ];
- char tbuf[TBUFSIZE];
+ struct logfileinfo *logp = NULL;
+ struct logfileinfo *delete_logp = NULL;
+ struct logfileinfo *p_delete_logp = NULL;
+ struct logfileinfo *prev_logp = NULL;
+ PRInt64 total_size=0;
+ time_t cur_time;
+ PRInt64 f_size;
+ int numoflogs=loginfo.log_numof_access_logs;
+ int rv = 0;
+ char *logstr;
+ char buffer[BUFSIZ];
+ char tbuf[TBUFSIZE];
/* If we have only one log, then will delete this one */
if (loginfo.log_access_maxnumlogs == 1) {
@@ -2629,7 +2628,7 @@
log__access_rotationinfof(char *pathname)
{
long f_ctime;
- int f_size;
+ PRInt64 f_size;
int main_log = 1;
time_t now;
FILE *fp;
@@ -2782,14 +2781,17 @@
* size info of all the old log files.
******************************************************************************/
static int
-log__extract_logheader (FILE *fp, long *f_ctime, int *f_size)
+log__extract_logheader (FILE *fp, long *f_ctime, PRInt64 *f_size)
{
char buf[BUFSIZ];
char *p, *s, *next;
+ if (NULL == f_ctime || NULL == f_size) {
+ return LOG_ERROR;
+ }
*f_ctime = 0L;
- *f_size = 0;
+ *f_size = 0L;
if ( fp == NULL)
return LOG_ERROR;
@@ -2817,11 +2819,11 @@
*s = '\0';
/* Now p must hold the ctime value */
- *f_ctime = atoi(p);
+ *f_ctime = strtol(p, (char **)NULL, 0);
if ((p = strchr(next, '(')) == NULL) {
/* that's fine -- it means we have no size info */
- *f_size = 0;
+ *f_size = 0L;
return LOG_CONTINUE;
}
@@ -2833,7 +2835,7 @@
*next = '\0';
/* Now p must hold the size value */
- *f_size = atoi(p);
+ *f_size = strtoll(p, (char **)NULL, 0);
/* check if the Previous Log file really exists */
if ((p = strstr(buf, PREVLOGFILE)) != NULL) {
@@ -2867,7 +2869,7 @@
* probably a safe assumption for now.
*/
#ifdef XP_WIN32
-static int
+static PRInt64
log__getfilesize(LOGFD fp)
{
struct stat info;
@@ -2876,10 +2878,10 @@
if ((rv = fstat(fileno(fp), &info)) != 0) {
return -1;
}
- return info.st_size;
+ return (PRInt64)info.st_size;
}
#else
-static int
+static PRInt64
log__getfilesize(LOGFD fp)
{
PRFileInfo info;
@@ -2887,7 +2889,7 @@
if (PR_GetOpenFileInfo (fp, &info) == PR_FAILURE) {
return -1;
}
- return info.size;
+ return (PRInt64)info.size; /* type of size is off_t */
}
#endif
@@ -3049,18 +3051,18 @@
log__delete_error_logfile(int locked)
{
- struct logfileinfo *logp = NULL;
- struct logfileinfo *delete_logp = NULL;
- struct logfileinfo *p_delete_logp = NULL;
- struct logfileinfo *prev_logp = NULL;
- int total_size=0;
- time_t cur_time;
- int f_size;
- int numoflogs=loginfo.log_numof_error_logs;
- int rv = 0;
- char *logstr;
- char buffer[BUFSIZ];
- char tbuf[TBUFSIZE];
+ struct logfileinfo *logp = NULL;
+ struct logfileinfo *delete_logp = NULL;
+ struct logfileinfo *p_delete_logp = NULL;
+ struct logfileinfo *prev_logp = NULL;
+ PRInt64 total_size=0;
+ time_t cur_time;
+ PRInt64 f_size;
+ int numoflogs=loginfo.log_numof_error_logs;
+ int rv = 0;
+ char *logstr;
+ char buffer[BUFSIZ];
+ char tbuf[TBUFSIZE];
/* If we have only one log, then will delete this one */
@@ -3222,18 +3224,18 @@
static int
log__delete_audit_logfile()
{
- struct logfileinfo *logp = NULL;
- struct logfileinfo *delete_logp = NULL;
- struct logfileinfo *p_delete_logp = NULL;
- struct logfileinfo *prev_logp = NULL;
- int total_size=0;
- time_t cur_time;
- int f_size;
- int numoflogs=loginfo.log_numof_audit_logs;
- int rv = 0;
- char *logstr;
- char buffer[BUFSIZ];
- char tbuf[TBUFSIZE];
+ struct logfileinfo *logp = NULL;
+ struct logfileinfo *delete_logp = NULL;
+ struct logfileinfo *p_delete_logp = NULL;
+ struct logfileinfo *prev_logp = NULL;
+ PRInt64 total_size=0;
+ time_t cur_time;
+ PRInt64 f_size;
+ int numoflogs=loginfo.log_numof_audit_logs;
+ int rv = 0;
+ char *logstr;
+ char buffer[BUFSIZ];
+ char tbuf[TBUFSIZE];
/* If we have only one log, then will delete this one */
if (loginfo.log_audit_maxnumlogs == 1) {
@@ -3378,7 +3380,7 @@
log__error_rotationinfof( char *pathname)
{
long f_ctime;
- int f_size;
+ PRInt64 f_size;
int main_log = 1;
time_t now;
FILE *fp;
@@ -3465,7 +3467,7 @@
log__audit_rotationinfof( char *pathname)
{
long f_ctime;
- int f_size;
+ PRInt64 f_size;
int main_log = 1;
time_t now;
FILE *fp;
@@ -3607,9 +3609,9 @@
** in the array stack.
*/
if (loginfo.log_error_fdes != NULL) {
- struct logfileinfo *log;
- char newfile[BUFSIZ];
- int f_size;
+ struct logfileinfo *log;
+ char newfile[BUFSIZ];
+ PRInt64 f_size;
/* get rid of the old one */
if ((f_size = log__getfilesize(loginfo.log_error_fdes)) == -1) {
@@ -3704,8 +3706,9 @@
logp = loginfo.log_error_logchain;
while (logp) {
log_convert_time (logp->l_ctime, tbuf, 1 /*short */);
- PR_snprintf(buffer, sizeof(buffer), "LOGINFO:%s%s.%s (%lu) (%u)\n",
- PREVLOGFILE, loginfo.log_error_file, tbuf, logp->l_ctime, logp->l_size);
+ PR_snprintf(buffer, sizeof(buffer), "LOGINFO:%s%s.%s (%lu) (%"
+ NSPRI64 "d)\n", PREVLOGFILE, loginfo.log_error_file, tbuf,
+ logp->l_ctime, logp->l_size);
LOG_WRITE(fpinfo, buffer, strlen(buffer), 0);
logp = logp->l_next;
}
@@ -3747,9 +3750,9 @@
** in the array stack.
*/
if (loginfo.log_audit_fdes != NULL) {
- struct logfileinfo *log;
- char newfile[BUFSIZ];
- int f_size;
+ struct logfileinfo *log;
+ char newfile[BUFSIZ];
+ PRInt64 f_size;
/* get rid of the old one */
@@ -3758,7 +3761,6 @@
f_size = loginfo.log_audit_maxlogsize;
}
-
/* Check if I have to delete any old file, delete it if it is required. */
while (log__delete_audit_logfile());
@@ -3785,7 +3787,6 @@
}
}
-
/* open a new log file */
if (! LOG_OPEN_APPEND(fp, loginfo.log_audit_file, loginfo.log_audit_mode)) {
LDAPDebug(LDAP_DEBUG_ANY, "WARNING: can't open file %s. "
@@ -3825,8 +3826,9 @@
logp = loginfo.log_audit_logchain;
while ( logp) {
log_convert_time (logp->l_ctime, tbuf, 1 /*short */);
- PR_snprintf(buffer, sizeof(buffer), "LOGINFO:%s%s.%s (%d) (%d)\n",
- PREVLOGFILE, loginfo.log_audit_file, tbuf, (int)logp->l_ctime, logp->l_size);
+ PR_snprintf(buffer, sizeof(buffer), "LOGINFO:%s%s.%s (%lu) (%"
+ NSPRI64 "d)\n", PREVLOGFILE, loginfo.log_audit_file, tbuf,
+ logp->l_ctime, logp->l_size);
LOG_WRITE(fpinfo, buffer, strlen(buffer), 0);
logp = logp->l_next;
}
@@ -4041,15 +4043,17 @@
int
check_log_max_size( char *maxdiskspace_str,
char *mlogsize_str,
- int maxdiskspace,
- int mlogsize,
+ int maxdiskspace, /* in megabytes */
+ int mlogsize, /* in megabytes */
char * returntext,
int logtype)
{
slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
int rc = LDAP_SUCCESS;
- int current_mlogsize = -1;
- int current_maxdiskspace = -1;
+ int current_mlogsize = -1; /* in megabytes */
+ int current_maxdiskspace = -1; /* in megabytes */
+ PRInt64 mlogsizeB; /* in bytes */
+ PRInt64 maxdiskspaceB; /* in bytes */
switch (logtype)
{
@@ -4070,35 +4074,40 @@
current_maxdiskspace = -1;
}
- if ( maxdiskspace == -1 )
+ if ( maxdiskspace == -1 ) {
maxdiskspace = current_maxdiskspace;
- if ( mlogsize == -1 )
+ }
+ maxdiskspaceB = (PRInt64)maxdiskspace * LOG_MB_IN_BYTES;
+
+ if ( mlogsize == -1 ) {
mlogsize = current_mlogsize;
+ }
+ mlogsizeB = (PRInt64)mlogsize * LOG_MB_IN_BYTES;
if ( maxdiskspace < mlogsize )
{
/* fail */
PR_snprintf ( returntext, SLAPI_DSE_RETURNTEXT_SIZE,
- "%s: maxdiskspace \"%d\" is less than max log size \"%d\"",
- maxdiskspace_str, maxdiskspace*LOG_MB_IN_BYTES, mlogsize*LOG_MB_IN_BYTES );
+ "%s: maxdiskspace \"%d (MB)\" is less than max log size \"%d (MB)\"",
+ maxdiskspace_str, maxdiskspace, mlogsize );
rc = LDAP_OPERATIONS_ERROR;
}
switch (logtype)
{
case SLAPD_ACCESS_LOG:
- loginfo.log_access_maxlogsize = mlogsize * LOG_MB_IN_BYTES;
- loginfo.log_access_maxdiskspace = maxdiskspace * LOG_MB_IN_BYTES;
+ loginfo.log_access_maxlogsize = mlogsizeB;
+ loginfo.log_access_maxdiskspace = maxdiskspaceB;
break;
case SLAPD_ERROR_LOG:
- loginfo.log_error_maxlogsize = mlogsize * LOG_MB_IN_BYTES;
- loginfo.log_error_maxdiskspace = maxdiskspace * LOG_MB_IN_BYTES;
+ loginfo.log_error_maxlogsize = mlogsizeB;
+ loginfo.log_error_maxdiskspace = maxdiskspaceB;
break;
case SLAPD_AUDIT_LOG:
- loginfo.log_audit_maxlogsize = mlogsize * LOG_MB_IN_BYTES;
- loginfo.log_audit_maxdiskspace = maxdiskspace * LOG_MB_IN_BYTES;
+ loginfo.log_audit_maxlogsize = mlogsizeB;
+ loginfo.log_audit_maxdiskspace = maxdiskspaceB;
break;
default:
- break;
+ break;
}
return rc;
15 years, 4 months
[Fedora-directory-commits] admservconsole/help/en/help administration_express_server_information.html, 1.1, 1.2
by Richard Allen Megginson
Author: rmeggins
Update of /cvs/dirsec/admservconsole/help/en/help
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv9496/admservconsole/help/en/help
Modified Files:
administration_express_server_information.html
Log Message:
Resolves: bug 452596
Bug Description: Help file for Status tab references server root
Reviewed by: nhosoi (Thanks!)
Fix Description: Remove/cleanup references to the old server root
Platforms tested: RHEL5
Flag Day: no
Doc impact: no
Index: administration_express_server_information.html
===================================================================
RCS file: /cvs/dirsec/admservconsole/help/en/help/administration_express_server_information.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- administration_express_server_information.html 9 Aug 2007 16:04:04 -0000 1.1
+++ administration_express_server_information.html 10 Dec 2008 02:56:52 -0000 1.2
@@ -12,9 +12,6 @@
<b>Installation Date.</b> The date and time when the server was installed.
</p>
<p class="text">
-<b>Server Root.</b> The directory where the server binary files are installed.
-</p>
-<p class="text">
<b>Port.</b> The port number the server is running on.
</p>
<p class="text">
15 years, 4 months
[Fedora-directory-commits] admservconsole/src/com/netscape/management/admserv AdminServerProduct.java, 1.1.1.1, 1.2
by Richard Allen Megginson
Author: rmeggins
Update of /cvs/dirsec/admservconsole/src/com/netscape/management/admserv
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv9496/admservconsole/src/com/netscape/management/admserv
Modified Files:
AdminServerProduct.java
Log Message:
Resolves: bug 452596
Bug Description: Help file for Status tab references server root
Reviewed by: nhosoi (Thanks!)
Fix Description: Remove/cleanup references to the old server root
Platforms tested: RHEL5
Flag Day: no
Doc impact: no
Index: AdminServerProduct.java
===================================================================
RCS file: /cvs/dirsec/admservconsole/src/com/netscape/management/admserv/AdminServerProduct.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- AdminServerProduct.java 22 May 2006 18:14:33 -0000 1.1.1.1
+++ AdminServerProduct.java 10 Dec 2008 02:56:52 -0000 1.2
@@ -100,7 +100,7 @@
* existing SIE. Also, since the admin server that is being invoked
* to do the migration via URL belongs to the target config root,
* the targetDN is also unused. Moreover, the server parameter is not
- * needed since there can only be one admin server per server root.
+ * needed since there can only be one admin server per machine.
*
* @param serverRoot - directory path for the migration origin.
* @param server - the server to migrate from the serverRoot.
15 years, 4 months
[Fedora-directory-commits] console/src/com/netscape/management/client/util About.java, 1.1.1.1, 1.2
by Richard Allen Megginson
Author: rmeggins
Update of /cvs/dirsec/console/src/com/netscape/management/client/util
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv9446/console/src/com/netscape/management/client/util
Modified Files:
About.java
Log Message:
Resolves: bug 452596
Bug Description: Help file for Status tab references server root
Reviewed by: nhosoi (Thanks!)
Fix Description: Remove/cleanup references to the old server root
Platforms tested: RHEL5
Flag Day: no
Doc impact: no
Index: About.java
===================================================================
RCS file: /cvs/dirsec/console/src/com/netscape/management/client/util/About.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- About.java 18 Jul 2005 00:34:25 -0000 1.1.1.1
+++ About.java 10 Dec 2008 02:56:30 -0000 1.2
@@ -131,8 +131,8 @@
othersPane.setLayout(new BoxLayout(othersPane, BoxLayout.X_AXIS));
// get resource string, figure out which logo file and copyright file to grab
- // path is relative to <server root>
- // copyright and logo info will stay under <server root>/manual/
+ // path is relative to datadir
+ // copyright and logo info will stay under datadir/manual/
StringTokenizer st =
new StringTokenizer(_resource.getString("", index), ",\n\r");
String htmlFile = "";
15 years, 4 months
[Fedora-directory-commits] console/examples/supermail/configuration ConfigurationNodeRHP.java, 1.1.1.1, 1.2
by Richard Allen Megginson
Author: rmeggins
Update of /cvs/dirsec/console/examples/supermail/configuration
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv9446/console/examples/supermail/configuration
Modified Files:
ConfigurationNodeRHP.java
Log Message:
Resolves: bug 452596
Bug Description: Help file for Status tab references server root
Reviewed by: nhosoi (Thanks!)
Fix Description: Remove/cleanup references to the old server root
Platforms tested: RHEL5
Flag Day: no
Doc impact: no
Index: ConfigurationNodeRHP.java
===================================================================
RCS file: /cvs/dirsec/console/examples/supermail/configuration/ConfigurationNodeRHP.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- ConfigurationNodeRHP.java 18 Jul 2005 00:34:06 -0000 1.1.1.1
+++ ConfigurationNodeRHP.java 10 Dec 2008 02:56:30 -0000 1.2
@@ -413,7 +413,7 @@
/**
* Show help for Netscape Server Product.
- * Help pages are expected to be installed in a netscape server root. The help page is
+ * Help pages are expected to be installed with other console help pages. The help page is
* retrieved using the Admin Server help CGI
*/
protected void showHelp() {
15 years, 4 months
[Fedora-directory-commits] directoryconsole/help/en/help statustab_general.html, 1.1, 1.2
by Richard Allen Megginson
Author: rmeggins
Update of /cvs/dirsec/directoryconsole/help/en/help
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv9400/directoryconsole/help/en/help
Modified Files:
statustab_general.html
Log Message:
Resolves: bug 452596
Bug Description: Help file for Status tab references server root
Reviewed by: nhosoi (Thanks!)
Fix Description: Remove/cleanup references to the old server root
Platforms tested: RHEL5
Flag Day: no
Doc impact: no
Index: statustab_general.html
===================================================================
RCS file: /cvs/dirsec/directoryconsole/help/en/help/statustab_general.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- statustab_general.html 13 Aug 2007 22:28:09 -0000 1.1
+++ statustab_general.html 10 Dec 2008 02:56:02 -0000 1.2
@@ -19,10 +19,6 @@
</p>
<p class="text">
-<b>Server root. </b>Indicates the directory where the server binaries are installed.
-</p>
-
-<p class="text">
<b>Product name. </b>Indicates the server's official product name.
</p>
15 years, 4 months
[Fedora-directory-commits] console/src/com/netscape/management/client/ug PickerEditorResource.properties, 1.2, 1.3 ResEditorPosixUser.java, 1.1.1.1, 1.2
by Richard Allen Megginson
Author: rmeggins
Update of /cvs/dirsec/console/src/com/netscape/management/client/ug
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv9267/console/src/com/netscape/management/client/ug
Modified Files:
PickerEditorResource.properties ResEditorPosixUser.java
Log Message:
Resolves: bug 458488
Bug Description: Console doesn't type-check input for schema-defined INTEGER attributes
Reviewed by: nhosoi (Thanks!)
Fix Description: Fixed for posix uidNumber and gidNumber. Non numeric or negative values will be rejected. If the user specifies an explicit value of 0, a warning dialog will ask if the user really wants to do this.
Platforms tested: RHEL5
Flag Day: no
Doc impact: yes
Index: PickerEditorResource.properties
===================================================================
RCS file: /cvs/dirsec/console/src/com/netscape/management/client/ug/PickerEditorResource.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PickerEditorResource.properties 13 Jun 2007 20:33:11 -0000 1.2
+++ PickerEditorResource.properties 10 Dec 2008 02:53:19 -0000 1.3
@@ -373,7 +373,20 @@
resourceEditor-IncompleteTitle=Incomplete Information
resourceEditor-UnableToSaveRDNEntryText=Changes cannot be saved for entries with multi-valued RDNs
resourceEditor-navigator_tt=List of views for navigation of this dialog
-
+resourceEditor-UidNotANumberTitle=uidNumber Must Be A Number
+resourceEditor-UidNotANumberText=The uidNumber field must have a numeric value.
+resourceEditor-GidNotANumberTitle=gidNumber Must Be A Number
+resourceEditor-GidNotANumberText=The gidNumber field must have a numeric value.
+resourceEditor-UidNotValidTitle=uidNumber Value Not Valid
+resourceEditor-UidNotValidText=The uidNumber field does not have a valid value.
+resourceEditor-GidNotValidTitle=gidNumber Value Not Valid
+resourceEditor-GidNotValidText=The gidNumber field does not have a valid value.
+resourceEditor-yesButton=Yes
+resourceEditor-noButton=No
+resourceEditor-errorText1=The value 0 is for privileged users only.
+resourceEditor-errorText2=Assigning this value to a user will give this user privileged access.
+resourceEditor-errorText3=Do you really want to use this value?
+resourceEditor-errorTitle=Value Warning
CALPage-displayName=Licenses
CALPage-ID=Licenses
CALPage-Title=To facilitate tracking of all Client Access Licenses (CAL), please indicate whether
Index: ResEditorPosixUser.java
===================================================================
RCS file: /cvs/dirsec/console/src/com/netscape/management/client/ug/ResEditorPosixUser.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- ResEditorPosixUser.java 18 Jul 2005 00:34:23 -0000 1.1.1.1
+++ ResEditorPosixUser.java 10 Dec 2008 02:53:19 -0000 1.2
@@ -490,14 +490,84 @@
* @return true if all required information has been provided; false otherwise
*/
public boolean isComplete() {
- if (_cbEnable.isSelected() &&
- ((_tfUIDNumber.getText().trim().length() == 0)||(_tfGIDNumber.getText().trim().length()==0))) {
- SuiOptionPane.showMessageDialog(null,
- _resource.getString("resourceEditor", "IncompleteText"),
- _resource.getString("resourceEditor",
- "IncompleteTitle"), SuiOptionPane.ERROR_MESSAGE);
- ModalDialogUtil.sleep();
- return false;
+ if (_cbEnable.isSelected()) {
+ if ((_tfUIDNumber.getText().trim().length() == 0)||(_tfGIDNumber.getText().trim().length()==0)) {
+ SuiOptionPane.showMessageDialog(null,
+ _resource.getString("resourceEditor", "IncompleteText"),
+ _resource.getString("resourceEditor",
+ "IncompleteTitle"), SuiOptionPane.ERROR_MESSAGE);
+ ModalDialogUtil.sleep();
+ return false;
+ }
+ int testval;
+ try {
+ testval = Integer.parseInt(_tfUIDNumber.getText().trim());
+ } catch (NumberFormatException nfe) {
+ SuiOptionPane.showMessageDialog(null,
+ _resource.getString("resourceEditor", "UidNotANumberText"),
+ _resource.getString("resourceEditor",
+ "UidNotANumberTitle"), SuiOptionPane.ERROR_MESSAGE);
+ ModalDialogUtil.sleep();
+ return false;
+ }
+ if (testval < 0) {
+ SuiOptionPane.showMessageDialog(null,
+ _resource.getString("resourceEditor", "UidNotValidText"),
+ _resource.getString("resourceEditor",
+ "UidNotValidTitle"), SuiOptionPane.ERROR_MESSAGE);
+ ModalDialogUtil.sleep();
+ return false;
+ }
+ if (testval == 0) {
+ Object[] val1 = {_resource.getString("resourceEditor", "yesButton"),
+ _resource.getString("resourceEditor", "noButton")};
+ Object[] msg1 = {_resource.getString("resourceEditor", "errorText1"),
+ _resource.getString("resourceEditor", "errorText2"),
+ _resource.getString("resourceEditor", "errorText3")};
+ int selection = SuiOptionPane.showOptionDialog(null, msg1,
+ _resource.getString("resourceEditor", "errorTitle"),
+ SuiOptionPane.DEFAULT_OPTION,
+ SuiOptionPane.WARNING_MESSAGE, null, val1, val1[0]);
+
+ if (selection == 1) {
+ ModalDialogUtil.sleep();
+ return false;
+ }
+ }
+ try {
+ testval = Integer.parseInt(_tfGIDNumber.getText().trim());
+ } catch (NumberFormatException nfe) {
+ SuiOptionPane.showMessageDialog(null,
+ _resource.getString("resourceEditor", "GidNotANumberText"),
+ _resource.getString("resourceEditor",
+ "GidNotANumberTitle"), SuiOptionPane.ERROR_MESSAGE);
+ ModalDialogUtil.sleep();
+ return false;
+ }
+ if (testval < 0) {
+ SuiOptionPane.showMessageDialog(null,
+ _resource.getString("resourceEditor", "GidNotValidText"),
+ _resource.getString("resourceEditor",
+ "GidNotValidTitle"), SuiOptionPane.ERROR_MESSAGE);
+ ModalDialogUtil.sleep();
+ return false;
+ }
+ if (testval == 0) {
+ Object[] val1 = {_resource.getString("resourceEditor", "yesButton"),
+ _resource.getString("resourceEditor", "noButton")};
+ Object[] msg1 = {_resource.getString("resourceEditor", "errorText1"),
+ _resource.getString("resourceEditor", "errorText2"),
+ _resource.getString("resourceEditor", "errorText3")};
+ int selection = SuiOptionPane.showOptionDialog(null, msg1,
+ _resource.getString("resourceEditor", "errorTitle"),
+ SuiOptionPane.DEFAULT_OPTION,
+ SuiOptionPane.WARNING_MESSAGE, null, val1, val1[0]);
+
+ if (selection == 1) {
+ ModalDialogUtil.sleep();
+ return false;
+ }
+ }
}
return true;
}
15 years, 4 months
[Fedora-directory-commits] mod_admserv mod_admserv.c,1.35,1.36
by Richard Allen Megginson
Author: rmeggins
Update of /cvs/dirsec/mod_admserv
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv15820
Modified Files:
mod_admserv.c
Log Message:
Resolves: bug 474936
Bug Description: configuring config ds to use ldaps forces user/group ds to use ldaps - console hangs
Reviewed by: nkinder (Thanks!)
Fix Description: The admin server was not putting the port number in the LDAP URL, so the console was attempting to use the secure port from the config ds with ldap://ughost. The console is already able to parse the :port part of the url.
Platforms tested: RHEL5
Flag Day: no
Doc impact: no
Index: mod_admserv.c
===================================================================
RCS file: /cvs/dirsec/mod_admserv/mod_admserv.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- mod_admserv.c 4 Dec 2008 20:01:45 -0000 1.35
+++ mod_admserv.c 9 Dec 2008 15:23:46 -0000 1.36
@@ -2583,9 +2583,10 @@
ap_set_content_type(r, "text/html");
ap_rprintf(r, "UserDN: %s\n", apr_table_get(r->notes, RQ_NOTES_USERDN));
- ap_rprintf(r, "UserDirectory: ldap%s://%s/%s\n",
+ ap_rprintf(r, "UserDirectory: ldap%s://%s:%d/%s\n",
userGroupServer.secure ? "s" : "",
- userGroupServer.host, userGroupServer.baseDN);
+ userGroupServer.host, userGroupServer.port,
+ userGroupServer.baseDN);
ap_rprintf(r, "ldapHost: %s\n", registryServer.host);
ap_rprintf(r, "ldapPort: %d\n", registryServer.port);
ap_rprintf(r, "ldapSecurity: %s\n", (registryServer.secure == 1) ? "on" : "off");
15 years, 4 months
[Fedora-directory-commits] ldapserver/ldap/servers/slapd/back-ldbm back-ldbm.h, 1.19, 1.20
by Noriko Hosoi
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv28711
Modified Files:
back-ldbm.h
Log Message:
Resolves: #447353
Summary: RFE: search optimization and single character substring searches
(comment #20)
Description: update the comments to adjust to the program.
Index: back-ldbm.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/slapd/back-ldbm/back-ldbm.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- back-ldbm.h 24 Oct 2008 22:36:59 -0000 1.19
+++ back-ldbm.h 6 Dec 2008 00:03:59 -0000 1.20
@@ -362,24 +362,36 @@
typedef struct attrcrypt_private attrcrypt_private;
/*
- * Special attribute for an index entry
- * Usage: turn an index object to extensibleobject and
- * set an integer value for each
- * dn: cn=sn, cn=index, cn=userRoot, cn=ldbm database, cn=plugins, cn=config
- * objectClass: extensibleObject
- * nsSubStrBegin: 2
- * nsSubStrMiddle: 3
- * nsSubStrEnd: 2
- * [...]
+ * Special attributes for an index entry to change the substring index width.
+ * By default, substring index width is 3, i.e., search with the filter
+ * "(cn=abc*)" is an indexed search, but "(cn=ab*)" or "(cn=a*)" isn't.
+ * There is a big performance gap between the indexed search and the unindexed
+ * search especially when the database is large. To convert such unindexed
+ * search to the indexed search to speed up the query, these nsSubStr
+ * attributes are introduced.
+ *
+ * How to use the nsSubStr attributes:
+ * 1) turn the target index to extensibleobject by adding
+ * "objectClass: extensibleObject" to the index entry
+ * 2) set the length to each nsSubStr attribute of the index
+ * dn: cn=sn, cn=index, cn=userRoot, cn=ldbm database, cn=plugins, cn=config
+ * objectClass: extensibleObject
+ * nsSubStrBegin: 2
+ * nsSubStrMiddle: 3
+ * nsSubStrEnd: 2
+ * [...]
*
- * By default, the minimum key length triplets of substring index is 2, 3, 2.
- * The length is changed by setting this nsSubStrLen value.
+ * By default, the minimum key length triplets of substring index is 3, 3, 3.
+ * The length is changed by setting the triplets nsSubStrBegin, nsSubStrMiddle,
+ * nsSubStrEnd, respectively.
*
* Note: If any of the key length value is modified, the index file needs
* to be regenerated. Otherwise, the index file is going to have mixed
* key length.
* To change the key length,
- * 1) stop the server, 2) run db2index -t <attr>, 3) start the server.
+ * 1) stop the server,
+ * 2) run db2index -t <attr>,
+ * 3) start the server.
*/
#define INDEX_ATTR_SUBSTRBEGIN "nsSubStrBegin"
#define INDEX_ATTR_SUBSTRMIDDLE "nsSubStrMiddle"
15 years, 5 months
[Fedora-directory-commits] ldapserver/ldap/servers/plugins/syntaxes bin.c, 1.5, 1.6
by Noriko Hosoi
Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/syntaxes
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv28241
Modified Files:
bin.c
Log Message:
Resolves: 459433
Summray: MMR: intensive conflict test crashes the server
Description: values2keys functions in the syntax plugin did not check the
existence of the input and output variable.
Index: bin.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/syntaxes/bin.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- bin.c 10 Nov 2006 23:45:31 -0000 1.5
+++ bin.c 5 Dec 2008 23:57:49 -0000 1.6
@@ -186,6 +186,14 @@
{
int i;
+ if (NULL == ivals) {
+ return 1;
+ }
+ *ivals = NULL;
+ if (NULL == bvals) {
+ return 1;
+ }
+
if ( ftype != LDAP_FILTER_EQUALITY ) {
return( LDAP_PROTOCOL_ERROR );
}
15 years, 5 months