lib/libadmsslutil
by Richard Allen Megginson
lib/libadmsslutil/admsslutil.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 2eb198fae8532bad8c5dffbbf2fbf9bae78798e7
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Fri Jan 27 08:17:30 2012 -0700
Ticket #161 - Review and address latest Coverity issues
https://fedorahosted.org/389/ticket/161
Resolves: Ticket #161
Bug Description: Review and address latest Coverity issues
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description:
11120 Dereference after null check
don't access info if it is NULL
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/lib/libadmsslutil/admsslutil.c b/lib/libadmsslutil/admsslutil.c
index 3233cf0..ae3d1bb 100644
--- a/lib/libadmsslutil/admsslutil.c
+++ b/lib/libadmsslutil/admsslutil.c
@@ -197,7 +197,7 @@ ADMSSL_InitSimple(char* configdir, char *securitydir, int force)
admLdapInfo = admldapBuildInfo(configdir, &error);
if (!admLdapInfo && !force) return -1;
- if (force || admldapGetSecurity(admLdapInfo)) {
+ if (force || (admLdapInfo && admldapGetSecurity(admLdapInfo))) {
error = ADMSSL_Init(admLdapInfo, securitydir, force);
} else {
error = 0;
@@ -218,11 +218,11 @@ ADMSSL_Init(AdmldapInfo info, char *securitydir, int force)
if (force) {
secure = 1;
- } else {
+ } else if (info) {
secure = admldapGetSecurity(info);
}
- if (!secure) {
+ if (!secure && info) {
admldapGetLocalUserDirectory(info,
&dirURL,
&bindDN,
12 years, 3 months
admserv/cgi-src40 include/base include/libadmin include/libdsa lib/base lib/libadmin lib/libdsa mod_restartd/mod_restartd-2.2.c
by Richard Allen Megginson
admserv/cgi-src40/config.c | 14 +-
include/base/file.h | 3
include/base/util.h | 3
include/libadmin/libadmin.h | 28 ----
include/libdsa/dsalib.h | 2
lib/base/file.cpp | 22 ---
lib/base/nscputil.cpp | 46 +-----
lib/libadmin/util.c | 267 ----------------------------------------
lib/libdsa/dsalib_confs.c | 2
lib/libdsa/dsalib_updown.c | 4
lib/libdsa/dsalib_util.c | 35 -----
mod_restartd/mod_restartd-2.2.c | 4
12 files changed, 29 insertions(+), 401 deletions(-)
New commits:
commit fc8a615d66d526e25356cc0fbeed149ddd64f4a8
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Thu Jan 26 14:24:55 2012 -0700
Ticket #161 - Review and address latest Coverity issues
https://fedorahosted.org/389/ticket/161
Resolves: Ticket #161
Bug Description: Review and address latest Coverity issues
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description:
12456-12455 Time of check time of use
get rid of unused code
12454 Time of check time of use In change_uid()
open file first using open() and perform other operations using the fd
12452 Format string vulnerability
get rid of unused code
12448 Time of check time of use
get rid of unused code
11147-11146 Missing varargs init or cleanup
be sure to call va_end() to cleanup
11145 Resource leak In cgid_server()
close(sd) before leaving function
11144-11142 Resource leak
get rid of unused code
11141 Resource leak In list_directory():
free ar
11140 Resource leak
get rid of unused code
11121 Missing break in switch
get rid of unused code
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/admserv/cgi-src40/config.c b/admserv/cgi-src40/config.c
index fb0188e..74e0a0c 100644
--- a/admserv/cgi-src40/config.c
+++ b/admserv/cgi-src40/config.c
@@ -1020,21 +1020,31 @@ static int change_uid_all(char *dir, int olduid, int newuid) {
static int change_uid(char *fpath, int olduid, int newuid) {
struct stat filestat;
char buf[BIG_LINE];
+ int fd = -1;
+
+ if (0 > (fd = open(fpath, O_RDONLY))) {
+ PR_snprintf(buf, sizeof(buf), "Change Server UID: open(%s) failed, errno=%d\n", fpath, errno);
+ rpt_err(SYSTEM_ERROR, buf, NULL, NULL);
+ return -1;
+ }
- if (stat(fpath, &filestat) != 0) {
+ if (fstat(fd, &filestat) != 0) {
+ close(fd);
PR_snprintf(buf, sizeof(buf), "Change Server UID: stat(%s) failed, errno=%d\n", fpath, errno);
rpt_err(SYSTEM_ERROR, buf, NULL, NULL);
return -1;
}
if (filestat.st_uid == olduid) {
- int rc = chown(fpath, newuid, -1);
+ int rc = fchown(fd, newuid, -1);
if (rc != 0) {
+ close(fd);
PR_snprintf(buf, sizeof(buf), "Change Server UID: Can not change file owner for %s, errno=%d\n", fpath, errno);
rpt_err(SYSTEM_ERROR, buf, NULL, NULL);
return -1;
}
}
+ close(fd);
return 0;
}
#endif
diff --git a/include/base/file.h b/include/base/file.h
index c5baece..9fd0f9e 100644
--- a/include/base/file.h
+++ b/include/base/file.h
@@ -68,8 +68,6 @@ NSAPI_PUBLIC SYS_DIRENT *INTdir_read(SYS_DIR ds);
NSAPI_PUBLIC void INTdir_close(SYS_DIR ds);
#endif /* XP_WIN32 */
-NSAPI_PUBLIC int INTdir_create_all(char *dir);
-
/* --- OBSOLETE ----------------------------------------------------------
* The following macros/functions are obsolete and are only maintained for
* compatibility. Do not use them. 11-19-96
@@ -113,7 +111,6 @@ NSPR_END_EXTERN_C
#define dir_read INTdir_read
#define dir_close INTdir_close
#endif /* XP_WIN32 */
-#define dir_create_all INTdir_create_all
/* Obsolete */
#ifdef XP_WIN32
diff --git a/include/base/util.h b/include/base/util.h
index a9ad091..c77d90c 100644
--- a/include/base/util.h
+++ b/include/base/util.h
@@ -80,8 +80,6 @@ NSAPI_PUBLIC int INTutil_time_equal(struct tm *lms, char *ims);
NSAPI_PUBLIC int INTutil_str_time_equal(char *t1, char *t2);
-NSAPI_PUBLIC int INTutil_uri_is_evil(char *t);
-
NSAPI_PUBLIC void INTutil_uri_parse(char *uri);
NSAPI_PUBLIC void INTutil_uri_unescape(char *s);
@@ -162,7 +160,6 @@ NSPR_END_EXTERN_C
#define util_later_than INTutil_later_than
#define util_time_equal INTutil_time_equal
#define util_str_time_equal INTutil_str_time_equal
-#define util_uri_is_evil INTutil_uri_is_evil
#define util_uri_parse INTutil_uri_parse
#define util_uri_unescape INTutil_uri_unescape
#define util_uri_escape INTutil_uri_escape
diff --git a/include/libadmin/libadmin.h b/include/libadmin/libadmin.h
index 7a47f95..c2e7f5a 100644
--- a/include/libadmin/libadmin.h
+++ b/include/libadmin/libadmin.h
@@ -59,7 +59,6 @@ NSPR_BEGIN_EXTERN_C
#define GET_QUERY_STRING() (getenv("QUERY_STRING"))
#define NOT_ABSOLUTE_PATH(str) (str[0] != '/')
#define CREATE_DIRECTORY(Directory)
-#define FILE_LOCK_PATH (get_flock_path())
#else /* XP_WIN32 */
#define verify_adm_dbm
@@ -106,7 +105,6 @@ NSAPI_PUBLIC char *GetQueryNT(void);
((str[0] != '/') && (str[0] != '\\') && (str[2] != '/') && (str[2] != '\\'))
#define CREATE_DIRECTORY(Directory) CreateDirectory(Directory, NULL)
-#define FILE_LOCK_PATH (get_flock_path())
#endif /* XP_WIN32 */
@@ -427,16 +425,6 @@ NSAPI_PUBLIC int all_numbers_float(char *target);
/* util.c */
NSAPI_PUBLIC char *get_serv_url(void);
-/* Run a command and check the output */
-struct runcmd_s {
- char *title;
- char *msg;
- char *arg;
- int sysmsg;
-};
-/* util.c */
-NSAPI_PUBLIC int run_cmd(char *cmd, FILE *closeme, struct runcmd_s *rm);
-
/* This is basically copy_file from the install section, with the error
* reporting changed to match the admin stuff. Since some stuff depends
* on copy_file being the install version, I'll cheat and call this one
@@ -448,28 +436,12 @@ NSAPI_PUBLIC void cp_file(char *sfile, char *dfile, int mode);
/* util.c */
NSAPI_PUBLIC int delete_file(char *path);
-/* Delete the directory with the given path. Returns positive value on failure.*/
-/* BEWARE! Be sure to verify you're not deleting things you */
-/* shouldn't. Testing the directory with "util_uri_is_evil" */
-/* is often a good idea. */
-/* util.c */
-NSAPI_PUBLIC void remove_directory(char *path);
-
/* Simply creates a directory that you give it. Checks for errors and
* all that. (Not to be confused with create_subdirs in install, since
* it relies on some installation stuff.) */
/* util.c */
NSAPI_PUBLIC void create_dir(char *dir, int mode);
-/* Open a file, with file locking. Close a file, releasing the lock. */
-/* util.c */
-NSAPI_PUBLIC FILE *fopen_l(char *pathname, char *mode);
-NSAPI_PUBLIC void fclose_l(FILE *f);
-
-/* helper function to figure out where to put the lock */
-/* util.c */
-NSAPI_PUBLIC char *get_flock_path(void);
-
/* uuencode a given buffer. both src and dst need to be allocated. dst
* should be 1 1/4 as big as src (i saved some math and just made it twice
* as big when I called it) */
diff --git a/include/libdsa/dsalib.h b/include/libdsa/dsalib.h
index c5696c6..a3bf254 100644
--- a/include/libdsa/dsalib.h
+++ b/include/libdsa/dsalib.h
@@ -318,8 +318,6 @@ extern DS_EXPORT_SYMBOL char* ds_become_localuser (char** ds_config);
what they were before calling ds_become_localuser(). */
extern DS_EXPORT_SYMBOL char* ds_become_original();
-extern DS_EXPORT_SYMBOL int ds_search_file(char *filename, char *searchstring, char **returnstring);
-
/* Display an error to the user and exit from a CGI */
extern DS_EXPORT_SYMBOL void ds_report_error(int type, char *errmsg, char *details);
diff --git a/lib/base/file.cpp b/lib/base/file.cpp
index 850e889..ac2ece6 100644
--- a/lib/base/file.cpp
+++ b/lib/base/file.cpp
@@ -474,28 +474,6 @@ NSAPI_PUBLIC int file_notfound(void)
#endif
}
-NSAPI_PUBLIC int dir_create_all(char *dir)
-{
- struct stat fi;
- char *t;
-
-#ifdef XP_WIN32
- t = dir + 3;
-#else /* XP_UNIX */
- t = dir + 1;
-#endif
- while(1) {
- t = strchr(t, FILE_PATHSEP);
- if(t) *t = '\0';
- if(stat(dir, &fi) == -1) {
- if(dir_create(dir) == -1)
- return -1;
- }
- if(t) *t++ = FILE_PATHSEP;
- else break;
- }
- return 0;
-}
#define ERRMSG_SIZE 35
#include "util.h"
diff --git a/lib/base/nscputil.cpp b/lib/base/nscputil.cpp
index 1267870..77e7a6e 100644
--- a/lib/base/nscputil.cpp
+++ b/lib/base/nscputil.cpp
@@ -537,42 +537,6 @@ NSAPI_PUBLIC int util_str_time_equal(char *t1, char *t2)
}
-/* --------------------------- util_uri_is_evil --------------------------- */
-
-
-NSAPI_PUBLIC int util_uri_is_evil(char *t)
-{
- register int x;
-
- for(x = 0; t[x]; ++x) {
- if(t[x] == '/') {
- if(t[x+1] == '/')
- return 1;
- if(t[x+1] == '.') {
- switch(t[x+2]) {
- case '.':
- if((!t[x+3]) || (t[x+3] == '/'))
- return 1;
- case '/':
- case '\0':
- return 1;
- }
- }
- }
-#ifdef XP_WIN32
- /* On NT, the directory "abc...." is the same as "abc"
- * The only cheap way to catch this globally is to disallow
- * names with the trailing "."s. Hopefully this is not over
- * restrictive
- */
- if ((t[x] == '.') && ( (t[x+1] == '/') || (t[x+1] == '\0') )) {
- return 1;
- }
-#endif
- }
- return 0;
-}
-
/* ---------------------------- util_uri_parse ---------------------------- */
NSAPI_PUBLIC void util_uri_parse(char *uri)
@@ -769,9 +733,12 @@ NSAPI_PUBLIC int util_vsnprintf(char *s, int n, register const char *fmt,
NSAPI_PUBLIC int util_snprintf(char *s, int n, const char *fmt, ...)
{
+ int rc;
va_list args;
va_start(args, fmt);
- return PR_vsnprintf(s, n, fmt, args);
+ rc = PR_vsnprintf(s, n, fmt, args);
+ va_end(args);
+ return rc;
}
NSAPI_PUBLIC int util_vsprintf(char *s, register const char *fmt, va_list args)
@@ -781,9 +748,12 @@ NSAPI_PUBLIC int util_vsprintf(char *s, register const char *fmt, va_list args)
NSAPI_PUBLIC int util_sprintf(char *s, const char *fmt, ...)
{
+ int rc;
va_list args;
va_start(args, fmt);
- return PR_vsnprintf(s, UTIL_PRF_MAXSIZE, fmt, args);
+ rc = PR_vsnprintf(s, UTIL_PRF_MAXSIZE, fmt, args);
+ va_end(args);
+ return rc;
}
/* ---------------------------- util_sh_escape ---------------------------- */
diff --git a/lib/libadmin/util.c b/lib/libadmin/util.c
index bfb7354..c5689a6 100644
--- a/lib/libadmin/util.c
+++ b/lib/libadmin/util.c
@@ -227,6 +227,7 @@ char **list_directory(char *path, int dashA)
ar = (char **) MALLOC(n * sizeof(char *));
if(!(ds = opendir(path))) {
+ free(ar);
return NULL;
}
@@ -368,161 +369,6 @@ char *get_serv_url(void)
return(getenv("SERVER_URL"));
}
-/* ------------------------------- run_cmd -------------------------------- */
-
-
-/* Previously in install. This is also pretty UNIX-ish. */
-
-/* Nirmal: Added code for Win32 implementation of this function. */
-
-#include <signal.h>
-#ifdef XP_UNIX
-#include <sys/wait.h>
-#endif /* XP_UNIX */
-
-
-int run_cmd(char *cmd, FILE *closeme, struct runcmd_s *rm)
-{
-#ifdef WIN32
- HANDLE hproc;
- PROCESS_INFORMATION child;
- STARTUPINFO siStartInfo ;
-#else
- struct stat fi;
- int exstat;
- char *errmsg, tfn[128];
- FILE *f;
- int fd;
- pid_t pid;
-#endif
-
-
-#ifdef WIN32
- /* Nirmal:
- For now, i will just spawn
- a child in WINNT to execute the command. Communication to
- the parent is done through stdout pipe, that was setup by
- the parent.
-
- */
- hproc = OpenProcess(STANDARD_RIGHTS_REQUIRED, FALSE, GetCurrentProcessId());
- if (hproc == NULL) {
- fprintf(stdout, "Content-type: text/html\n\n");
- fflush(stdout);
- report_error(SYSTEM_ERROR, NULL, "Could not open handle to myself");
- return -1; // stmt. not reached.
- }
-
- ZeroMemory(&child, sizeof(PROCESS_INFORMATION));
- ZeroMemory(&siStartInfo, sizeof(STARTUPINFO));
- siStartInfo.cb = sizeof(STARTUPINFO);
- siStartInfo.lpReserved = siStartInfo.lpReserved2 = NULL;
- siStartInfo.cbReserved2 = 0;
- siStartInfo.lpDesktop = NULL;
- siStartInfo.dwFlags = STARTF_USESHOWWINDOW;
-// Several fields arent used when dwFlags is not set.
-// siStartInfo.hStdInput = hChildStdinRd;
-// siStartInfo.hStdOutput = siStartInfo.hStdError = hChildStdoutWr;
- siStartInfo.wShowWindow = SW_HIDE;
-
- if ( ! CreateProcess(
- NULL, // pointer to name of executable module
- cmd, // pointer to command line string
- NULL, // pointer to process security attribute
- NULL, // pointer to thread security attributes
- TRUE, // handle inheritance flag
- 0, // creation flags
- NULL, // pointer to new environment block
- NULL, // pointer to current directory name
- &siStartInfo, // pointer to STARTUPINFO
- &child // pointer to PROCESS_INFORMATION
- ))
- {
- rm->title = "CreateProcess failed";
- rm->msg = "run_cmd: Can't create new process. ";
- rm->arg = "";
- rm->sysmsg = 1;
- return -1;
- }
- else
- return 0;
-#else
- sprintf(cmd, "%s > /tmp/startmsg.%d 2>&1 < /dev/null", cmd, getpid()); /* */
- /* FUCK UNIX SIGNALS. */
- signal(SIGCHLD, SIG_DFL);
- switch( (pid = fork()) ) {
- case 0:
- /* Hmm. Work around an apparent bug in stdio. */
- if(closeme)
- close(fileno(closeme));
- execl("/bin/sh", "/bin/sh", "-c", cmd, (char *)NULL);
- /* DOH! */
- sprintf(tfn, "/tmp/startmsg.%d", getpid());
- if(!(f = fopen(tfn, "w")))
- exit(1);
- fprintf(f, "Exec of %s failed. The error was %s.\n", cmd,
- system_errmsg());
- fclose(f);
- exit(1);
- case -1:
- rm->title = "Fork failed";
- rm->msg = "Can't create new process. %s";
- rm->arg = "";
- rm->sysmsg = 1;
- return -1;
- default:
- sprintf(tfn, "/tmp/startmsg.%d", getpid());
-
- if(waitpid(pid, &exstat, 0) == -1) {
- rm->title = "Can't wait for child";
- rm->msg = "Can't wait for process. %s";
- rm->arg = "";
- rm->sysmsg = 1;
- return -1;
- }
- if(exstat) {
- if((fd = open(tfn, O_RDONLY)) < 0) {
- rm->title = "Can't open error file";
- rm->msg = "Can't find error file %s.";
- rm->arg = cmd;
- rm->sysmsg = 1;
- return -1;
- }
- fstat(fd, &fi);
- if((fi.st_size > 0) && (fi.st_size < 8192)) {
- errmsg = (char *) MALLOC(fi.st_size + 1);
- read(fd, errmsg, fi.st_size);
- errmsg[fi.st_size] = '\0';
- close(fd);
- unlink(tfn);
- rm->title = "Command execution failed";
- rm->msg = "The command did not execute. "
- "Here is the output:<p>\n<pre>\n%s\n</pre>\n";
- rm->arg = errmsg;
- rm->sysmsg = 0;
- return -1;
- }
- else {
- close(fd);
- unlink(tfn);
-
- rm->title = "Command execution failed";
- rm->msg = "The command didn't execute, and it did not produce "
- "any output. Run <code>%s</code> from the command "
- "line and examine the output.\n";
- rm->arg = cmd;
- rm->sysmsg = 0;
- return -1;
- }
- }
- unlink(tfn);
- return 0;
- }
-#endif /* WIN32 */
-
-}
-
-
/* This is basically copy_file from the install section, with the error
* reporting changed to match the admin stuff. Since some stuff depends
@@ -654,65 +500,6 @@ SYS_FILE lf;
HANDLE lf;
#endif
-char *get_flock_path(void)
-{
- char *result="";
- char *port=getenv("SERVER_PORT");
-#ifdef XP_UNIX
- result=(char *) MALLOC(strlen("/tmp/lock.%%s.")+strlen(port)+4);
- sprintf(result, "/tmp/lock.%%s.%s", port);
-#endif
- return result;
-}
-
-/* Open a file with locking, close a file with unlocking. */
-FILE *fopen_l(char *path, char *mode)
-{
- FILE *f = fopen(path, mode);
- char *lockpath;
- char *sn="admin-serv";
- char *flp=FILE_LOCK_PATH;
-
- if(f == NULL) return NULL;
- lockpath=(char *) MALLOC(strlen(sn)+strlen(flp)+16);
- sprintf(lockpath, flp, sn);
-#ifdef XP_UNIX
- if( (lf=system_fopenRW(lockpath)) == SYS_ERROR_FD)
- report_error(FILE_ERROR, lockpath, "Could not open file.");
- if(system_flock(lf)==IO_ERROR)
- report_error(FILE_ERROR, lockpath, "Could not lock file.");
-#elif defined(XP_WIN32)
- /* Using mutexes because if the CGI program dies, the mutex will be
- * automatically released by the OS for another process to grab.
- * Semaphores do not have this property; and if the CGI program crashes,
- * the admin server would be effectively crippled.
- */
- if ( (lf = CreateMutex(NULL, 0, lockpath)) == NULL) {
- report_error(FILE_ERROR, lockpath, "Could not create admin mutex.");
- } else {
- if ( WaitForSingleObject(lf, 60*1000) == WAIT_FAILED) {
- report_error(FILE_ERROR, lockpath, "Unable to obtain mutex after 60 seconds.");
- }
- }
-#endif /* XP_UNIX */
- return f;
-}
-
-void fclose_l(FILE *f)
-{
- fclose(f);
-#ifdef XP_UNIX
- if(system_ulock(lf)==IO_ERROR)
- report_error(FILE_ERROR, NULL, "Could not unlock lock file.");
- system_fclose(lf);
-#elif defined(XP_WIN32)
- if (lf) {
- ReleaseMutex(lf);
- CloseHandle(lf);
- }
-#endif /* XP_UNIX */
-}
-
/* Ripped off from the client. (Sorry, Lou.) */
/* */
/* The magic set of 64 chars in the uuencoded data */
@@ -833,58 +620,6 @@ char *alert_word_wrap(char *str, int width, char *linefeed)
return ans;
}
-void remove_directory(char *path)
-{
- struct stat finfo;
- char **dirlisting;
- register int x=0;
- int stat_good = 0;
- char *fullpath = NULL;
-
-#ifdef XP_UNIX
- stat_good = (lstat(path, &finfo) == -1 ? 0 : 1);
-#else /* WIN32 */
- stat_good = (stat(path, &finfo) == -1 ? 0 : 1);
-#endif /* XP_UNIX */
-
- if(!stat_good) return;
-
- if(S_ISDIR(finfo.st_mode)) {
- dirlisting = list_directory(path,1);
- if(!dirlisting) return;
-
- for(x=0; dirlisting[x]; x++) {
- fullpath = (char *) MALLOC(strlen(path) +
- strlen(dirlisting[x]) + 4);
- sprintf(fullpath, "%s%c%s", path, FILE_PATHSEP, dirlisting[x]);
-#ifdef XP_UNIX
- stat_good = (lstat(fullpath, &finfo) == -1 ? 0 : 1);
-#else /* WIN32 */
- stat_good = (stat(fullpath, &finfo) == -1 ? 0 : 1);
-#endif /* XP_UNIX */
- if(!stat_good) continue;
- if(S_ISDIR(finfo.st_mode)) {
- remove_directory(fullpath);
- } else {
- fprintf(stdout, "<i>Removing file</i> "
- "<code>%s</code><br>\n", fullpath);
- unlink(fullpath);
- }
- FREE(fullpath);
- }
- fprintf(stdout, "<i>Removing directory</i> "
- "<code>%s</code><br>\n", path);
-#ifdef XP_UNIX
- rmdir(path);
-#else /* XP_WIN32 */
- RemoveDirectory(path);
-#endif /* XP_WIN32 */
- } else {
- fprintf(stdout, "<i>Removing file</i> <code>%s</code><br>\n", path);
- unlink(path);
- }
- return;
-}
/* do fgets with a filebuffer *, instead of a File *. Can't use util_getline
because it complains if the line is too long.
diff --git a/lib/libdsa/dsalib_confs.c b/lib/libdsa/dsalib_confs.c
index 3c24c98..36d9356 100644
--- a/lib/libdsa/dsalib_confs.c
+++ b/lib/libdsa/dsalib_confs.c
@@ -145,7 +145,7 @@ ds_parm_in_line(char *confline, char *parm)
if ( parm == NULL )
return(0);
parm_size = strlen(parm);
- if ( parm_size == (int)NULL )
+ if ( parm_size == 0 )
return(0);
if ( PL_strncasecmp(confline, parm, parm_size) == 0 )
if ( ((int) strlen(confline)) > parm_size )
diff --git a/lib/libdsa/dsalib_updown.c b/lib/libdsa/dsalib_updown.c
index b9d8f28..0bef3ab 100644
--- a/lib/libdsa/dsalib_updown.c
+++ b/lib/libdsa/dsalib_updown.c
@@ -302,9 +302,11 @@ ds_bring_down_server()
int status;
int cur_size;
char *errorlog;
+#if defined( WITH_SYSTEMD ) || defined( ENABLE_SERVICE )
char stop_cmd[BIG_LINE];
int error;
-
+#endif
+
status = ds_get_updown_status(); /* set server_pid too! */
if ( status != DS_SERVER_UP ) {
ds_send_error("The server is not up.", 0);
diff --git a/lib/libdsa/dsalib_util.c b/lib/libdsa/dsalib_util.c
index a03c827..da875df 100644
--- a/lib/libdsa/dsalib_util.c
+++ b/lib/libdsa/dsalib_util.c
@@ -287,41 +287,6 @@ ds_become_original (char **ds_config)
#endif
}
-/* returns 1 if string "searchstring" found in file "filename" */
-/* if found, returnstring is allocated and filled with the line */
-/* caller should release the memory */
-DS_EXPORT_SYMBOL int
-ds_search_file(char *filename, char *searchstring, char **returnstring)
-{
- struct stat finfo;
- FILE * sf;
- char big_line[BIG_LINE];
-
- if( filename == NULL )
- return 0;
-
- if( stat(filename, &finfo) != 0 ) /* successful */
- return 0;
-
- if( !(sf = fopen(filename, "r")) )
- return 0;
-
- while ( fgets(big_line, BIG_LINE, sf) ) {
- if( strstr( big_line, searchstring ) != NULL ) {
- *returnstring = (char *)malloc(strlen(big_line) + 1);
- if (NULL != *returnstring) {
- strcpy(*returnstring, big_line);
- }
- fclose(sf);
- return 1;
- }
- }
-
- fclose(sf);
-
- return 0;
-}
-
/*
* on linux when running as root, doing something like
* system("date > out.log 2>&1") will fail, because of an
diff --git a/mod_restartd/mod_restartd-2.2.c b/mod_restartd/mod_restartd-2.2.c
index a4e73fb..4da4b84 100644
--- a/mod_restartd/mod_restartd-2.2.c
+++ b/mod_restartd/mod_restartd-2.2.c
@@ -645,12 +645,14 @@ static int cgid_server(void *data)
ap_log_error(APLOG_MARK, APLOG_ERR, errno, main_server,
"Couldn't bind unix domain socket %s",
sockname);
+ close(sd);
return errno;
}
if (listen(sd, DEFAULT_CGID_LISTENBACKLOG) < 0) {
ap_log_error(APLOG_MARK, APLOG_ERR, errno, main_server,
"Couldn't listen on unix domain socket");
+ close(sd);
return errno;
}
@@ -659,6 +661,7 @@ static int cgid_server(void *data)
ap_log_error(APLOG_MARK, APLOG_ERR, errno, main_server,
"Couldn't change owner of unix domain socket %s",
sockname);
+ close(sd);
return errno;
}
}
@@ -836,6 +839,7 @@ static int cgid_server(void *data)
}
}
}
+ close(sd);
return -1;
}
12 years, 3 months
lib/libadmsslutil
by Richard Allen Megginson
lib/libadmsslutil/admsslutil.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
New commits:
commit cae399a681a6808fea9853c63431cf8bfaab3cbb
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Thu Jan 26 14:50:59 2012 -0700
Ticket #161 - Review and address latest Coverity issues
https://fedorahosted.org/389/ticket/161
Resolves: Ticket #161
Bug Description: Review and address latest Coverity issues
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description:
11120 Dereference after null check
don't access info if it is NULL
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
diff --git a/lib/libadmsslutil/admsslutil.c b/lib/libadmsslutil/admsslutil.c
index 7cea464..3233cf0 100644
--- a/lib/libadmsslutil/admsslutil.c
+++ b/lib/libadmsslutil/admsslutil.c
@@ -166,11 +166,13 @@ static int initNSS(const char *securitydir, AdmldapInfo info)
The pin file should contain the pin for the token
We just use adm.conf as the custom file.
*/
- custom_file_copy = admldapGetConfigFileName(info);
- PR_snprintf(custom_file, sizeof(custom_file), custom_file_copy);
- PL_strfree(custom_file_copy);
- /* set password function */
- PK11_SetPasswordFunc(getPassword_cb);
+ if (info) {
+ custom_file_copy = admldapGetConfigFileName(info);
+ PR_snprintf(custom_file, sizeof(custom_file), custom_file_copy);
+ PL_strfree(custom_file_copy);
+ /* set password function */
+ PK11_SetPasswordFunc(getPassword_cb);
+ }
/* enable all default ciphers */
if (SSL_OptionSetDefault(SSL_ENABLE_SSL2, PR_FALSE)) {
12 years, 3 months
2 commits - ldap/servers
by Mark Reynolds
ldap/servers/slapd/back-ldbm/instance.c | 136 ++++--
ldap/servers/slapd/back-ldbm/ldbm_attr.c | 323 +++++++--------
ldap/servers/slapd/back-ldbm/ldbm_config.h | 3
ldap/servers/slapd/back-ldbm/ldbm_index_config.c | 469 +++++++----------------
ldap/servers/slapd/back-ldbm/ldif2ldbm.c | 50 +-
ldap/servers/slapd/back-ldbm/perfctrs.c | 2
ldap/servers/slapd/back-ldbm/proto-back-ldbm.h | 2
7 files changed, 429 insertions(+), 556 deletions(-)
New commits:
commit 2f86ad935e00209a3ea06b9a1463fab575ee89b7
Author: Mark Reynolds <mareynol(a)redhat.com>
Date: Thu Jan 26 14:26:34 2012 -0500
Ticket #140 - incorrect memset parameters
One line change to correct the parameter ordering
diff --git a/ldap/servers/slapd/back-ldbm/perfctrs.c b/ldap/servers/slapd/back-ldbm/perfctrs.c
index 27efb7d..86b3bb1 100644
--- a/ldap/servers/slapd/back-ldbm/perfctrs.c
+++ b/ldap/servers/slapd/back-ldbm/perfctrs.c
@@ -101,7 +101,7 @@ static void init_shared_memory(perfctrs_private *priv)
{
performance_counters *perf = (performance_counters*)priv->memory;
if (NULL != perf) {
- memset(perf,0,sizeof(performance_counters));
+ memset(perf,sizeof(performance_counters),0);
}
}
commit 39870fe59195d54dd9d654b1d46737968683f48f
Author: Mark Reynolds <mareynol(a)redhat.com>
Date: Thu Jan 26 13:56:33 2012 -0500
Ticket #55 - Limit of 1024 characters for nsMatchingRule
Bug Description: If the total length of all the nsMatchingRule attribute values in an index, exceeds
1024 characters, the remaining values will get truncated.
Fix Description: Previously there was static buffer of 1024 chars. The reason for creating the buffer
was to comply with some older code. Where we needed to take slapi attrs, and
convert them into comma separated lists. I changed the code to just use the slapi attrs
instead of comma separated lists. Thus removing all the static buffers in this area of
the code.
I also, removed some unneccessary loops that were checking for muliple cn values. This
was not neccessary. However removing the loop caused a lot of indentation changes,
which makes the diff quite long.
https://fedorahosted.org/389/ticket/55
diff --git a/ldap/servers/slapd/back-ldbm/instance.c b/ldap/servers/slapd/back-ldbm/instance.c
index 0217e96..8cf79a3 100644
--- a/ldap/servers/slapd/back-ldbm/instance.c
+++ b/ldap/servers/slapd/back-ldbm/instance.c
@@ -44,7 +44,7 @@
/* Forward declarations */
static void ldbm_instance_destructor(void **arg);
-
+Slapi_Entry *ldbm_instance_init_config_entry(char *cn_val, char *v1, char *v2, char *v3);
/* Creates and initializes a new ldbm_instance structure.
@@ -148,13 +148,59 @@ done:
return rc;
}
+/*
+ * Take a bunch of strings, and create a index config entry
+ */
+Slapi_Entry *
+ldbm_instance_init_config_entry(char *cn_val, char *type_val1, char *type_val2, char *type_val3){
+ Slapi_Entry *e = slapi_entry_alloc();
+ Slapi_Value *sval;
+ Slapi_Attr *indextype_attr;
+ Slapi_Attr *cn_attr;
+ Slapi_Attr *attrs = slapi_attr_new();;
+
+ cn_attr = slapi_attr_new();
+ slapi_attr_init(cn_attr, "cn");
+ sval = slapi_value_new_string(cn_val);
+ slapi_attr_add_value(cn_attr,sval);
+ attrlist_add(attrs,cn_attr);
+ slapi_value_free(&sval);
+
+ indextype_attr = slapi_attr_new();
+ slapi_attr_init(indextype_attr, "nsIndexType");
+ sval = slapi_value_new_string(type_val1);
+ slapi_attr_add_value(indextype_attr,sval);
+ attrlist_add(&attrs,indextype_attr);
+ slapi_value_free(&sval);
+
+ if(type_val2){
+ indextype_attr = slapi_attr_new();
+ slapi_attr_init(indextype_attr, "nsIndexType");
+ sval = slapi_value_new_string(type_val2);
+ slapi_attr_add_value(indextype_attr,sval);
+ attrlist_add(&attrs,indextype_attr);
+ slapi_value_free(&sval);
+ }
+ if(type_val3){
+ indextype_attr = slapi_attr_new();
+ slapi_attr_init(indextype_attr, "nsIndexType");
+ sval = slapi_value_new_string(type_val3);
+ slapi_attr_add_value(indextype_attr,sval);
+ attrlist_add(&attrs,indextype_attr);
+ slapi_value_free(&sval);
+ }
+
+ slapi_entry_init_ext(e, NULL, attrs);
+ return e;
+}
+
/* create the default indexes separately
* (because when we're creating a new backend while the server is running,
* the DSE needs to be pre-seeded first.)
*/
int ldbm_instance_create_default_indexes(backend *be)
{
- char *argv[ 9 ];
+ Slapi_Entry *e;
ldbm_instance *inst = (ldbm_instance *)be->be_instance_info;
/* write the dse file only on the final index */
int flags = LDBM_INSTANCE_CONFIG_DONT_WRITE;
@@ -166,76 +212,64 @@ int ldbm_instance_create_default_indexes(backend *be)
* ACL routines.
*/
if (entryrdn_get_switch()) { /* subtree-rename: on */
- argv[ 0 ] = LDBM_ENTRYRDN_STR;
- argv[ 1 ] = "subtree";
- argv[ 2 ] = NULL;
- ldbm_instance_config_add_index_entry(inst, 2, argv, flags);
+ e = ldbm_instance_init_config_entry(LDBM_ENTRYDN_STR,"subtree", 0, 0);
+ ldbm_instance_config_add_index_entry(inst, e, flags);
+ slapi_entry_free(e);
} else {
- argv[ 0 ] = LDBM_ENTRYDN_STR;
- argv[ 1 ] = "eq";
- argv[ 2 ] = NULL;
- ldbm_instance_config_add_index_entry(inst, 2, argv, flags);
+ e = ldbm_instance_init_config_entry(LDBM_ENTRYDN_STR,"eq", 0, 0);
+ ldbm_instance_config_add_index_entry(inst, e, flags);
+ slapi_entry_free(e);
}
- argv[ 0 ] = LDBM_PARENTID_STR;
- argv[ 1 ] = "eq";
- argv[ 2 ] = NULL;
- ldbm_instance_config_add_index_entry(inst, 2, argv, flags);
+ e = ldbm_instance_init_config_entry(LDBM_PARENTID_STR,"eq", 0, 0);
+ ldbm_instance_config_add_index_entry(inst, e, flags);
+ slapi_entry_free(e);
- argv[ 0 ] = "objectclass";
- argv[ 1 ] = "eq";
- argv[ 2 ] = NULL;
- ldbm_instance_config_add_index_entry(inst, 2, argv, flags);
+ e = ldbm_instance_init_config_entry("objectclass","eq", 0, 0);
+ ldbm_instance_config_add_index_entry(inst, e, flags);
+ slapi_entry_free(e);
- argv[ 0 ] = "aci";
- argv[ 1 ] = "pres";
- argv[ 2 ] = NULL;
- ldbm_instance_config_add_index_entry(inst, 2, argv, flags);
+ e = ldbm_instance_init_config_entry("aci","pres", 0, 0);
+ ldbm_instance_config_add_index_entry(inst, e, flags);
+ slapi_entry_free(e);
#if 0 /* don't need copiedfrom */
- argv[ 0 ] = "copiedfrom";
- argv[ 1 ] = "pres";
- argv[ 2 ] = NULL;
- ldbm_instance_config_add_index_entry(inst, 2, argv, flags);
+ e = ldbm_instance_init_config_entry("copiedfrom","pres");
+ ldbm_instance_config_add_index_entry(inst, e, flags);
+ slapi_entry_free(e);
#endif
- argv[ 0 ] = LDBM_NUMSUBORDINATES_STR;
- argv[ 1 ] = "pres";
- argv[ 2 ] = NULL;
- ldbm_instance_config_add_index_entry(inst, 2, argv, flags);
+ e = ldbm_instance_init_config_entry(LDBM_NUMSUBORDINATES_STR,"pres", 0, 0);
+ ldbm_instance_config_add_index_entry(inst, e, flags);
+ slapi_entry_free(e);
- argv[ 0 ] = SLAPI_ATTR_UNIQUEID;
- argv[ 1 ] = "eq";
- argv[ 2 ] = NULL;
- ldbm_instance_config_add_index_entry(inst, 2, argv, flags);
+ e = ldbm_instance_init_config_entry(SLAPI_ATTR_UNIQUEID,"eq", 0, 0);
+ ldbm_instance_config_add_index_entry(inst, e, flags);
+ slapi_entry_free(e);
/* For MMR, we need this attribute (to replace use of dncomp in delete). */
- argv[ 0 ] = ATTR_NSDS5_REPLCONFLICT;
- argv[ 1 ] = "eq,pres";
- argv[ 2 ] = NULL;
- ldbm_instance_config_add_index_entry(inst, 2, argv, flags);
+ e = ldbm_instance_init_config_entry(ATTR_NSDS5_REPLCONFLICT,"eq", "pres", 0);
+ ldbm_instance_config_add_index_entry(inst, e, flags);
+ slapi_entry_free(e);
/* write the dse file only on the final index */
- argv[ 0 ] = SLAPI_ATTR_NSCP_ENTRYDN;
- argv[ 1 ] = "eq";
- argv[ 2 ] = NULL;
- ldbm_instance_config_add_index_entry(inst, 2, argv, 0);
-
- argv[ 0 ] = LDBM_PSEUDO_ATTR_DEFAULT;
- argv[ 1 ] = "none";
- argv[ 2 ] = NULL;
+ e = ldbm_instance_init_config_entry(SLAPI_ATTR_NSCP_ENTRYDN,"eq", 0, 0);
+ ldbm_instance_config_add_index_entry(inst, e, flags);
+ slapi_entry_free(e);
+
/* ldbm_instance_config_add_index_entry(inst, 2, argv); */
- attr_index_config( be, "ldbm index init", 0, 2, argv, 1 );
+ e = ldbm_instance_init_config_entry(LDBM_PSEUDO_ATTR_DEFAULT,"none", 0, 0);
+ attr_index_config( be, "ldbm index init", 0, e, 1, 0 );
+ slapi_entry_free(e);
if (!entryrdn_get_noancestorid()) {
/*
* ancestorid is special, there is actually no such attr type
* but we still want to use the attr index file APIs.
*/
- argv[ 0 ] = LDBM_ANCESTORID_STR;
- argv[ 1 ] = "eq";
- argv[ 2 ] = NULL;
- attr_index_config( be, "ldbm index init", 0, 2, argv, 1 );
+ e = ldbm_instance_init_config_entry(LDBM_ANCESTORID_STR,"eq", 0, 0);
+ attr_index_config( be, "ldbm index init", 0, e, 1, 0 );
+ slapi_entry_free(e);
}
return 0;
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_attr.c b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
index d09413f..4890d60 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_attr.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_attr.c
@@ -171,64 +171,65 @@ attr_index_config(
backend *be,
char *fname,
int lineno,
- int argc,
- char **argv,
- int init
+ Slapi_Entry *e,
+ int init,
+ int indextype_none
)
{
ldbm_instance *inst = (ldbm_instance *) be->be_instance_info;
- int i, j;
- char **attrs = NULL;
- char **indexes = NULL;
+ int j = 0;
char **index_rules = NULL;
struct attrinfo *a;
int return_value = -1;
int *substrlens = NULL;
-
- if ((argc == 0) || (argv == NULL)) {
+ int need_compare_fn = 0;
+ int hasIndexType = 0;
+ const char *attrsyntax_oid = NULL;
+ const struct berval *attrValue;
+ Slapi_Value *sval;
+ Slapi_Attr *attr;
+
+ /* Get the cn */
+ if (0 == slapi_entry_attr_find(e, "cn", &attr)) {
+ slapi_attr_first_value(attr, &sval);
+ attrValue = slapi_value_get_berval(sval);
+ } else {
LDAPDebug(LDAP_DEBUG_ANY, "attr_index_config: Missing indexing arguments\n", 0, 0, 0);
- goto done;
- }
-
- attrs = slapi_str2charray( argv[0], "," );
- if ( argc > 1 ) {
- indexes = slapi_str2charray( argv[1], "," );
- if ( argc > 2 ) {
- index_rules = slapi_str2charray( argv[2], "," );
- }
- }
-
- if (!indexes) {
- LDAPDebug(LDAP_DEBUG_ANY, "attr_index_config: Missing index\n", 0, 0, 0);
- goto done;
+ return;
}
- for ( i = 0; attrs[i] != NULL; i++ ) {
- int need_compare_fn = 0;
- const char *attrsyntax_oid = NULL;
- a = attrinfo_new();
- slapi_attr_init(&a->ai_sattr, attrs[i]);
- /* we can't just set a->ai_type to the type from a->ai_sattr
- if the type has attroptions or subtypes, ai_sattr.a_type will
- contain them - but for the purposes of indexing, we don't want
- them */
- a->ai_type = slapi_attr_basetype( attrs[i], NULL, 0 );
- attrsyntax_oid = attr_get_syntax_oid(&a->ai_sattr);
- a->ai_indexmask = 0;
- for ( j = 0; indexes[j] != NULL; j++ ) {
- if ( strncasecmp( indexes[j], "pres", 4 ) == 0 ) {
+ a = attrinfo_new();
+ slapi_attr_init(&a->ai_sattr, attrValue->bv_val);
+ /*
+ * we can't just set a->ai_type to the type from a->ai_sattr
+ * if the type has attroptions or subtypes, ai_sattr.a_type will
+ * contain them - but for the purposes of indexing, we don't want them
+ */
+ a->ai_type = slapi_attr_basetype( attrValue->bv_val, NULL, 0 );
+ attrsyntax_oid = attr_get_syntax_oid(&a->ai_sattr);
+ a->ai_indexmask = 0;
+
+ if(indextype_none){
+ /* This is the same has having none for indexType, but applies to the whole entry */
+ a->ai_indexmask = INDEX_OFFLINE;
+ } else {
+ slapi_entry_attr_find(e, "nsIndexType", &attr);
+ for (j = slapi_attr_first_value(attr, &sval); j != -1;j = slapi_attr_next_value(attr, j, &sval)) {
+ hasIndexType = 1;
+ attrValue = slapi_value_get_berval(sval);
+ if ( strncasecmp( attrValue->bv_val, "pres", 4 ) == 0 ) {
a->ai_indexmask |= INDEX_PRESENCE;
- } else if ( strncasecmp( indexes[j], "eq", 2 ) == 0 ) {
+ } else if ( strncasecmp( attrValue->bv_val, "eq", 2 ) == 0 ) {
a->ai_indexmask |= INDEX_EQUALITY;
- } else if ( strncasecmp( indexes[j], "approx", 6 ) == 0 ) {
+ } else if ( strncasecmp( attrValue->bv_val, "approx", 6 ) == 0 ) {
a->ai_indexmask |= INDEX_APPROX;
- } else if ( strncasecmp( indexes[j], "subtree", 7 ) == 0 ) {
+ } else if ( strncasecmp( attrValue->bv_val, "subtree", 7 ) == 0 ) {
/* subtree should be located before "sub" */
a->ai_indexmask |= INDEX_SUBTREE;
a->ai_dup_cmp_fn = entryrdn_compare_dups;
- } else if ( strncasecmp( indexes[j], "sub", 3 ) == 0 ) {
+ } else if ( strncasecmp( attrValue->bv_val, "sub", 3 ) == 0 ) {
a->ai_indexmask |= INDEX_SUB;
- } else if ( strncasecmp( indexes[j], "none", 4 ) == 0 ) {
+ } else if ( strncasecmp( attrValue->bv_val, "none", 4 ) == 0 ) {
if ( a->ai_indexmask != 0 ) {
LDAPDebug(LDAP_DEBUG_ANY,
"%s: line %d: index type \"none\" cannot be combined with other types\n",
@@ -238,77 +239,81 @@ attr_index_config(
} else {
LDAPDebug(LDAP_DEBUG_ANY,
"%s: line %d: unknown index type \"%s\" (ignored)\n",
- fname, lineno, indexes[j]);
+ fname, lineno, attrValue->bv_val);
LDAPDebug(LDAP_DEBUG_ANY,
"valid index types are \"pres\", \"eq\", \"approx\", or \"sub\"\n",
0, 0, 0);
}
}
+ if(hasIndexType == 0){
+ /* indexType missing, error out */
+ LDAPDebug(LDAP_DEBUG_ANY, "attr_index_config: Missing index type\n", 0, 0, 0);
+ return;
+ }
+ }
- /* compute a->ai_index_rules: */
- /* for index rules there are two uses:
- * 1) a simple way to define an ordered index to support <= and >= searches
- * for those attributes which do not have an ORDERING matching rule defined
- * for them in their schema definition. The index generated is not a :RULE:
- * index, it is a normal = EQUALITY index, with the keys ordered using the
- * comparison function provided by the syntax plugin for the attribute. For
- * example - the uidNumber attribute has INTEGER syntax, but the standard
- * definition of the attribute does not specify an ORDERING matching rule.
- * By default, this means that you cannot perform searches like
- * (uidNumber>=501) - but many users expect to be able to perform this type of
- * search. By specifying that you want an ordered index, using an integer
- * matching rule, you can support indexed seaches of this type.
- * 2) a RULE index - the index key prefix is :NAMEOROID: - this is used
- * to support extensible match searches like (cn:fr-CA.3:=gilles), which would
- * find the index key :fr-CA.3:gilles in the cn index.
- * We check first to see if this is a simple ordered index - user specified an
- * ordering matching rule compatible with the attribute syntax, and there is
- * a compare function. If not, we assume it is a RULE index definition.
- */
- j = 0;
- if (index_rules != NULL) for (; index_rules[j] != NULL; ++j);
- if (j > 0) { /* there are some candidates */
- char** official_rules =
- (char**)slapi_ch_malloc ((j + 1) * sizeof (char*));
- size_t k = 0;
- for (j = 0; index_rules[j] != NULL; ++j) {
- /* Check that index_rules[j] is an official OID */
- char* officialOID = NULL;
- IFP mrINDEX = NULL;
- Slapi_PBlock* pb = NULL;
- int do_continue = 0; /* can we skip the RULE parsing stuff? */
-
- if (strstr(index_rules[j], INDEX_ATTR_SUBSTRBEGIN)) {
- _set_attr_substrlen(INDEX_SUBSTRBEGIN, index_rules[j],
- &substrlens);
- do_continue = 1; /* done with j - next j */
- } else if (strstr(index_rules[j], INDEX_ATTR_SUBSTRMIDDLE)) {
- _set_attr_substrlen(INDEX_SUBSTRMIDDLE, index_rules[j],
- &substrlens);
- do_continue = 1; /* done with j - next j */
- } else if (strstr(index_rules[j], INDEX_ATTR_SUBSTREND)) {
- _set_attr_substrlen(INDEX_SUBSTREND, index_rules[j],
- &substrlens);
- do_continue = 1; /* done with j - next j */
- /* check if this is a simple ordering specification
- for an attribute that has no ordering matching rule */
- } else if (slapi_matchingrule_is_ordering(index_rules[j], attrsyntax_oid) &&
- slapi_matchingrule_can_use_compare_fn(index_rules[j]) &&
- !a->ai_sattr.a_mr_ord_plugin) { /* no ordering for this attribute */
- need_compare_fn = 1; /* get compare func for this attr */
- do_continue = 1; /* done with j - next j */
- }
+ /* compute a->ai_index_rules: */
+ /* for index rules there are two uses:
+ * 1) a simple way to define an ordered index to support <= and >= searches
+ * for those attributes which do not have an ORDERING matching rule defined
+ * for them in their schema definition. The index generated is not a :RULE:
+ * index, it is a normal = EQUALITY index, with the keys ordered using the
+ * comparison function provided by the syntax plugin for the attribute. For
+ * example - the uidNumber attribute has INTEGER syntax, but the standard
+ * definition of the attribute does not specify an ORDERING matching rule.
+ * By default, this means that you cannot perform searches like
+ * (uidNumber>=501) - but many users expect to be able to perform this type of
+ * search. By specifying that you want an ordered index, using an integer
+ * matching rule, you can support indexed seaches of this type.
+ * 2) a RULE index - the index key prefix is :NAMEOROID: - this is used
+ * to support extensible match searches like (cn:fr-CA.3:=gilles), which would
+ * find the index key :fr-CA.3:gilles in the cn index.
+ * We check first to see if this is a simple ordered index - user specified an
+ * ordering matching rule compatible with the attribute syntax, and there is
+ * a compare function. If not, we assume it is a RULE index definition.
+ */
- if (do_continue) {
- continue; /* done with index_rules[j] */
- }
+ if(0 == slapi_entry_attr_find(e, "nsMatchingRule", &attr)){
+ char** official_rules = (char**)slapi_ch_malloc ((j + 1) * sizeof (char*));
+ size_t k = 0;
+ for (j = slapi_attr_first_value(attr, &sval); j != -1;j = slapi_attr_next_value(attr, j, &sval)) {
+ /* Check that index_rules[j] is an official OID */
+ char* officialOID = NULL;
+ IFP mrINDEX = NULL;
+ Slapi_PBlock* pb = NULL;
+ int do_continue = 0; /* can we skip the RULE parsing stuff? */
+ attrValue = slapi_value_get_berval(sval);
+
+ if (strstr(index_rules[j], INDEX_ATTR_SUBSTRBEGIN)) {
+ _set_attr_substrlen(INDEX_SUBSTRBEGIN, attrValue->bv_val, &substrlens);
+ do_continue = 1; /* done with j - next j */
+ } else if (strstr(index_rules[j], INDEX_ATTR_SUBSTRMIDDLE)) {
+ _set_attr_substrlen(INDEX_SUBSTRMIDDLE, attrValue->bv_val, &substrlens);
+ do_continue = 1; /* done with j - next j */
+ } else if (strstr(index_rules[j], INDEX_ATTR_SUBSTREND)) {
+ _set_attr_substrlen(INDEX_SUBSTREND, attrValue->bv_val, &substrlens);
+ do_continue = 1; /* done with j - next j */
+ /* check if this is a simple ordering specification
+ for an attribute that has no ordering matching rule */
+ } else if (slapi_matchingrule_is_ordering(attrValue->bv_val, attrsyntax_oid) &&
+ slapi_matchingrule_can_use_compare_fn(attrValue->bv_val) &&
+ !a->ai_sattr.a_mr_ord_plugin) { /* no ordering for this attribute */
+ need_compare_fn = 1; /* get compare func for this attr */
+ do_continue = 1; /* done with j - next j */
+ }
+
+ if (do_continue) {
+ continue; /* done with index_rules[j] */
+ }
- /* must be a RULE specification */
- pb = slapi_pblock_new();
- /* next check if this is a RULE type index
- try to actually create an indexer and see if the indexer
- actually has a regular INDEX_FN or an INDEX_SV_FN */
- if (!slapi_pblock_set (pb, SLAPI_PLUGIN_MR_OID, index_rules[j]) &&
+ /* must be a RULE specification */
+ pb = slapi_pblock_new();
+ /*
+ * next check if this is a RULE type index
+ * try to actually create an indexer and see if the indexer
+ * actually has a regular INDEX_FN or an INDEX_SV_FN
+ */
+ if (!slapi_pblock_set (pb, SLAPI_PLUGIN_MR_OID, attrValue->bv_val) &&
!slapi_pblock_set (pb, SLAPI_PLUGIN_MR_TYPE, a->ai_type) &&
!slapi_mr_indexer_create (pb) &&
((!slapi_pblock_get (pb, SLAPI_PLUGIN_MR_INDEX_FN, &mrINDEX) &&
@@ -317,76 +322,70 @@ attr_index_config(
mrINDEX != NULL)) &&
!slapi_pblock_get (pb, SLAPI_PLUGIN_MR_OID, &officialOID) &&
officialOID != NULL) {
- if (!strcasecmp (index_rules[j], officialOID)) {
- official_rules[k++] = slapi_ch_strdup (officialOID);
- } else {
- char* preamble = slapi_ch_smprintf("%s: line %d", fname, lineno);
- LDAPDebug (LDAP_DEBUG_ANY, "%s: use \"%s\" instead of \"%s\" (ignored)\n",
- preamble, officialOID, index_rules[j] );
- slapi_ch_free((void**)&preamble);
- }
- } else { /* we don't know what this is */
- LDAPDebug (LDAP_DEBUG_ANY, "%s: line %d: "
- "unknown or invalid matching rule \"%s\" in index configuration (ignored)\n",
- fname, lineno, index_rules[j] );
- }
- {/* It would improve speed to save the indexer, for future use.
- But, for simplicity, we destroy it now: */
- IFP mrDESTROY = NULL;
- if (!slapi_pblock_get (pb, SLAPI_PLUGIN_DESTROY_FN, &mrDESTROY) &&
- mrDESTROY != NULL) {
- mrDESTROY (pb);
- }
+ if (!strcasecmp (index_rules[j], officialOID)) {
+ official_rules[k++] = slapi_ch_strdup (officialOID);
+ } else {
+ char* preamble = slapi_ch_smprintf("%s: line %d", fname, lineno);
+ LDAPDebug (LDAP_DEBUG_ANY, "%s: use \"%s\" instead of \"%s\" (ignored)\n",
+ preamble, officialOID, attrValue->bv_val);
+ slapi_ch_free((void**)&preamble);
}
- slapi_pblock_destroy (pb);
+ } else { /* we don't know what this is */
+ LDAPDebug (LDAP_DEBUG_ANY, "%s: line %d: "
+ "unknown or invalid matching rule \"%s\" in index configuration (ignored)\n",
+ fname, lineno, attrValue->bv_val);
}
- official_rules[k] = NULL;
- a->ai_substr_lens = substrlens;
- if (k > 0) {
- a->ai_index_rules = official_rules;
- a->ai_indexmask |= INDEX_RULES;
- } else {
- slapi_ch_free((void**)&official_rules);
+
+ { /*
+ * It would improve speed to save the indexer, for future use.
+ * But, for simplicity, we destroy it now:
+ */
+ IFP mrDESTROY = NULL;
+ if (!slapi_pblock_get (pb, SLAPI_PLUGIN_DESTROY_FN, &mrDESTROY) &&
+ mrDESTROY != NULL) {
+ mrDESTROY (pb);
+ }
}
+ slapi_pblock_destroy (pb);
}
+ official_rules[k] = NULL;
+ a->ai_substr_lens = substrlens;
+ if (k > 0) {
+ a->ai_index_rules = official_rules;
+ a->ai_indexmask |= INDEX_RULES;
+ } else {
+ slapi_ch_free((void**)&official_rules);
+ }
+ }
- /* initialize the IDL code's private data */
- return_value = idl_init_private(be, a);
- if (0 != return_value) {
- /* fatal error, exit */
- LDAPDebug(LDAP_DEBUG_ANY,"%s: line %d:Fatal Error: Failed to initialize attribute structure\n",
+ /* initialize the IDL code's private data */
+ return_value = idl_init_private(be, a);
+ if (0 != return_value) {
+ /* fatal error, exit */
+ LDAPDebug(LDAP_DEBUG_ANY,"%s: line %d:Fatal Error: Failed to initialize attribute structure\n",
fname, lineno, 0);
- exit( 1 );
- }
+ exit( 1 );
+ }
- /* if user didn't specify an ordering rule in the index config,
- see if the schema def for the attr defines one */
- if (!need_compare_fn && a->ai_sattr.a_mr_ord_plugin) {
- need_compare_fn = 1;
- }
+ /* if user didn't specify an ordering rule in the index config,
+ see if the schema def for the attr defines one */
+ if (!need_compare_fn && a->ai_sattr.a_mr_ord_plugin) {
+ need_compare_fn = 1;
+ }
- if (need_compare_fn) {
- int rc = attr_get_value_cmp_fn( &a->ai_sattr, &a->ai_key_cmp_fn );
- if (rc != LDAP_SUCCESS) {
- LDAPDebug(LDAP_DEBUG_ANY,
+ if (need_compare_fn) {
+ int rc = attr_get_value_cmp_fn( &a->ai_sattr, &a->ai_key_cmp_fn );
+ if (rc != LDAP_SUCCESS) {
+ LDAPDebug(LDAP_DEBUG_ANY,
"The attribute [%s] does not have a valid ORDERING matching rule - error %d:s\n",
a->ai_type, rc, ldap_err2string(rc));
- a->ai_key_cmp_fn = NULL;
- }
- }
-
- if ( avl_insert( &inst->inst_attrs, a, ainfo_cmp, ainfo_dup ) != 0 ) {
- /* duplicate - existing version updated */
- attrinfo_delete(&a);
+ a->ai_key_cmp_fn = NULL;
}
}
-done:
- charray_free( attrs );
- if ( indexes != NULL ) {
- charray_free( indexes );
- }
- if ( index_rules != NULL ) {
- charray_free( index_rules );
+
+ if ( avl_insert( &inst->inst_attrs, a, ainfo_cmp, ainfo_dup ) != 0 ) {
+ /* duplicate - existing version updated */
+ attrinfo_delete(&a);
}
}
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.h b/ldap/servers/slapd/back-ldbm/ldbm_config.h
index e41b623..36b8f60 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.h
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.h
@@ -170,8 +170,7 @@ int ldbm_config_ignored_attr(char *attr_name);
/* Functions in ldbm_instance_config.c used in ldbm_config.c */
int ldbm_instance_config_load_dse_info(ldbm_instance *inst);
-int ldbm_instance_config_add_index_entry(ldbm_instance *inst, int argc,
- char **argv, int flags);
+int ldbm_instance_config_add_index_entry(ldbm_instance *inst, Slapi_Entry *e, int flags);
int
ldbm_instance_index_config_enable_index(ldbm_instance *inst, Slapi_Entry* e);
int ldbm_instance_create_default_user_indexes(ldbm_instance *inst);
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_index_config.c b/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
index aa47584..3786a44 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_index_config.c
@@ -51,7 +51,7 @@
int ldbm_instance_index_config_add_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e, int *returncode, char *returntext, void *arg);
int ldbm_instance_index_config_delete_callback(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e, int *returncode, char *returntext, void *arg);
-
+#define INDEXTYPE_NONE 1
@@ -104,50 +104,28 @@ static char *attrinfo2ConfIndexes (struct attrinfo *pai)
}
-/* attrinfo2ConfMatchingRules: converts attrinfo into matching rule oids, as
- * seen in index entries within dse.ldif
+/*
+ * attrinfo2ConfMatchingRules: returns an array of matching rules
*/
-static char *attrinfo2ConfMatchingRules (struct attrinfo *pai)
+static char **attrinfo2ConfMatchingRules (struct attrinfo *pai)
{
int i;
- char buffer[1024];
-
- buffer[0] = '\0';
+ char **value = NULL;
if (pai->ai_index_rules) {
- strcat (buffer, "\t");
- for (i = 0; pai->ai_index_rules[i]; i++) {
- PL_strcatn (buffer, sizeof(buffer), pai->ai_index_rules[i]);
- if (pai->ai_index_rules[i+1]) {
- PL_strcatn (buffer, sizeof(buffer), ",");
- }
- }
+ for (i = 0; pai->ai_index_rules[i]; i++) {
+ charray_add(&value,slapi_ch_strdup(pai->ai_index_rules[i]));
+ }
}
- return (slapi_ch_strdup (buffer) );
+ return (value);
}
-
-/* used by the two callbacks below, to parse an index entry into something
- * awkward that we can pass to attr_index_config().
- */
-#define MAX_TMPBUF 1024
-#define ZCAT_SAFE(_buf, _x1, _x2) do { \
- if (strlen(_buf) + strlen(_x1) + strlen(_x2) + 2 < MAX_TMPBUF) { \
- strcat(_buf, _x1); \
- strcat(_buf, _x2); \
- } \
-} while (0)
static int ldbm_index_parse_entry(ldbm_instance *inst, Slapi_Entry *e,
- const char *trace_string,
- char **index_name)
+ const char *trace_string, char **index_name)
{
- char *arglist[] = { NULL, NULL, NULL, NULL };
- int argc = 0, i;
- int isFirst;
Slapi_Attr *attr;
const struct berval *attrValue;
Slapi_Value *sval;
- char tmpBuf[MAX_TMPBUF];
/* Get the name of the attribute to index which will be the value
* of the cn attribute. */
@@ -165,121 +143,28 @@ static int ldbm_index_parse_entry(ldbm_instance *inst, Slapi_Entry *e,
slapi_entry_get_dn(e), 0, 0);
return LDAP_OPERATIONS_ERROR;
}
- arglist[argc++] = slapi_ch_strdup(attrValue->bv_val);
- if (index_name != NULL) {
- *index_name = slapi_ch_strdup(attrValue->bv_val);
+
+ if(index_name != NULL){
+ *index_name = slapi_ch_strdup(attrValue->bv_val);
}
- /* Get the list of index types from the entry. */
+ /* check and see if we have the required indexType */
if (0 == slapi_entry_attr_find(e, "nsIndexType", &attr)) {
- tmpBuf[0] = 0;
- isFirst = 1;
- for (i = slapi_attr_first_value(attr, &sval); i != -1;
- i = slapi_attr_next_value(attr, i, &sval)) {
- attrValue = slapi_value_get_berval(sval);
- if (NULL != attrValue->bv_val && strlen(attrValue->bv_val) > 0) {
- if (isFirst) {
- ZCAT_SAFE(tmpBuf, "", attrValue->bv_val);
- isFirst = 0;
- } else {
- ZCAT_SAFE(tmpBuf, ",", attrValue->bv_val);
- }
- }
- }
- if (0 == tmpBuf[0]) {
+ slapi_attr_first_value(attr, &sval);
+ attrValue = slapi_value_get_berval(sval);
+ if (NULL == attrValue->bv_val || strlen(attrValue->bv_val) == 0) {
+ /* missing the index type, error out */
LDAPDebug(LDAP_DEBUG_ANY,
"Warning: malformed index entry %s -- empty nsIndexType\n",
slapi_entry_get_dn(e), 0, 0);
slapi_ch_free_string(index_name);
- for (i = 0; i < argc; i++) {
- slapi_ch_free((void **)&arglist[i]);
- }
return LDAP_OPERATIONS_ERROR;
}
- arglist[argc++] = slapi_ch_strdup(tmpBuf);
- }
-
- tmpBuf[0] = 0;
- /* Get the list of matching rules from the entry. */
- if (0 == slapi_entry_attr_find(e, "nsMatchingRule", &attr)) {
- for (i = slapi_attr_first_value(attr, &sval); i != -1;
- i = slapi_attr_next_value(attr, i, &sval)) {
- attrValue = slapi_value_get_berval(sval);
- if (NULL != attrValue->bv_val && strlen(attrValue->bv_val) > 0) {
- if (0 == tmpBuf[0]) {
- ZCAT_SAFE(tmpBuf, "", attrValue->bv_val);
- } else {
- ZCAT_SAFE(tmpBuf, ",", attrValue->bv_val);
- }
- }
- }
}
- /* Get the substr begin length. note: pick the first value. */
- if (0 == slapi_entry_attr_find(e, INDEX_ATTR_SUBSTRBEGIN, &attr)) {
- i = slapi_attr_first_value(attr, &sval);
- if (-1 != i) {
- attrValue = slapi_value_get_berval(sval);
- if (NULL != attrValue->bv_val && strlen(attrValue->bv_val) > 0) {
- if (0 == tmpBuf[0]) {
- PR_snprintf(tmpBuf, MAX_TMPBUF, "%s=%s",
- INDEX_ATTR_SUBSTRBEGIN, attrValue->bv_val);
- } else {
- int tmpbuflen = strlen(tmpBuf);
- char *p = tmpBuf + tmpbuflen;
- PR_snprintf(p, MAX_TMPBUF - tmpbuflen, ",%s=%s",
- INDEX_ATTR_SUBSTRBEGIN, attrValue->bv_val);
- }
- }
- }
- }
+ /* ok the entry is good to process, pass it to attr_index_config */
+ attr_index_config(inst->inst_be, (char *)trace_string, 0, e, 0, 0);
- /* Get the substr middle length. note: pick the first value. */
- if (0 == slapi_entry_attr_find(e, INDEX_ATTR_SUBSTRMIDDLE, &attr)) {
- i = slapi_attr_first_value(attr, &sval);
- if (-1 != i) {
- attrValue = slapi_value_get_berval(sval);
- if (NULL != attrValue->bv_val && strlen(attrValue->bv_val) > 0) {
- if (0 == tmpBuf[0]) {
- PR_snprintf(tmpBuf, MAX_TMPBUF, "%s=%s",
- INDEX_ATTR_SUBSTRMIDDLE, attrValue->bv_val);
- } else {
- int tmpbuflen = strlen(tmpBuf);
- char *p = tmpBuf + tmpbuflen;
- PR_snprintf(p, MAX_TMPBUF - tmpbuflen, ",%s=%s",
- INDEX_ATTR_SUBSTRMIDDLE, attrValue->bv_val);
- }
- }
- }
- }
-
- /* Get the substr end length. note: pick the first value. */
- if (0 == slapi_entry_attr_find(e, INDEX_ATTR_SUBSTREND, &attr)) {
- i = slapi_attr_first_value(attr, &sval);
- if (-1 != i) {
- attrValue = slapi_value_get_berval(sval);
- if (NULL != attrValue->bv_val && strlen(attrValue->bv_val) > 0) {
- if (0 == tmpBuf[0]) {
- PR_snprintf(tmpBuf, MAX_TMPBUF, "%s=%s",
- INDEX_ATTR_SUBSTREND, attrValue->bv_val);
- } else {
- int tmpbuflen = strlen(tmpBuf);
- char *p = tmpBuf + tmpbuflen;
- PR_snprintf(p, MAX_TMPBUF - tmpbuflen, ",%s=%s",
- INDEX_ATTR_SUBSTREND, attrValue->bv_val);
- }
- }
- }
- }
- if (0 != tmpBuf[0]) {
- arglist[argc++] = slapi_ch_strdup(tmpBuf);
- }
-
- arglist[argc] = NULL;
- attr_index_config(inst->inst_be, (char *)trace_string, 0, argc, arglist, 0);
- for (i = 0; i < argc; i++) {
- slapi_ch_free((void **)&arglist[i]);
- }
return LDAP_SUCCESS;
}
@@ -294,8 +179,7 @@ ldbm_index_init_entry_callback(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* en
ldbm_instance *inst = (ldbm_instance *) arg;
returntext[0] = '\0';
- *returncode = ldbm_index_parse_entry(inst, e, "from ldbm instance init",
- NULL);
+ *returncode = ldbm_index_parse_entry(inst, e, "from ldbm instance init", NULL);
if (*returncode == LDAP_SUCCESS) {
return SLAPI_DSE_CALLBACK_OK;
} else {
@@ -318,16 +202,15 @@ ldbm_instance_index_config_add_callback(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_
*returncode = ldbm_index_parse_entry(inst, e, "from DSE add", &index_name);
if (*returncode == LDAP_SUCCESS) {
struct attrinfo *ai = NULL;
-
/* if the index is a "system" index, we assume it's being added by
* by the server, and it's okay for the index to go online immediately.
* if not, we set the index "offline" so it won't actually be used
* until someone runs db2index on it.
*/
if (! ldbm_attribute_always_indexed(index_name)) {
- ainfo_get(inst->inst_be, index_name, &ai);
- PR_ASSERT(ai != NULL);
- ai->ai_indexmask |= INDEX_OFFLINE;
+ ainfo_get(inst->inst_be, index_name, &ai);
+ PR_ASSERT(ai != NULL);
+ ai->ai_indexmask |= INDEX_OFFLINE;
}
slapi_ch_free((void **)&index_name);
return SLAPI_DSE_CALLBACK_OK;
@@ -343,11 +226,9 @@ int
ldbm_instance_index_config_delete_callback(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter, int *returncode, char *returntext, void *arg)
{
ldbm_instance *inst = (ldbm_instance *) arg;
- char *arglist[4];
Slapi_Attr *attr;
Slapi_Value *sval;
const struct berval *attrValue;
- int argc = 0;
int rc = SLAPI_DSE_CALLBACK_OK;
struct attrinfo *ainfo = NULL;
@@ -358,12 +239,7 @@ ldbm_instance_index_config_delete_callback(Slapi_PBlock *pb, Slapi_Entry* e, Sla
slapi_attr_first_value(attr, &sval);
attrValue = slapi_value_get_berval(sval);
- arglist[argc++] = slapi_ch_strdup(attrValue->bv_val);
- arglist[argc++] = slapi_ch_strdup("none");
- arglist[argc] = NULL;
- attr_index_config(inst->inst_be, "From DSE delete", 0, argc, arglist, 0);
- slapi_ch_free((void **)&arglist[0]);
- slapi_ch_free((void **)&arglist[1]);
+ attr_index_config(inst->inst_be, "From DSE delete", 0, e, 0, INDEXTYPE_NONE);
ainfo_get(inst->inst_be, attrValue->bv_val, &ainfo);
@@ -390,15 +266,18 @@ ldbm_instance_index_config_modify_callback(Slapi_PBlock *pb, Slapi_Entry *e,
Slapi_Entry *entryAfter, int *returncode, char *returntext, void *arg)
{
ldbm_instance *inst = (ldbm_instance *)arg;
+ Slapi_Entry *modEntry;
+ Slapi_Attr *modAttr = NULL;
+ Slapi_Attr *indexTypeAttr;
+ Slapi_Attr *matchingRuleAttr;
Slapi_Attr *attr;
+ Slapi_Value *modValue;
Slapi_Value *sval;
const struct berval *attrValue;
struct attrinfo *ainfo = NULL;
LDAPMod **mods;
- char *arglist[4] = {0};
char *config_attr;
char *origIndexTypes = NULL;
- char *origMatchingRules = NULL;
char **origIndexTypesArray = NULL;
char **origMatchingRulesArray = NULL;
char **addIndexTypesArray = NULL;
@@ -407,7 +286,6 @@ ldbm_instance_index_config_modify_callback(Slapi_PBlock *pb, Slapi_Entry *e,
char **deleteMatchingRulesArray = NULL;
int i, j;
int dodeletes = 0;
- char tmpBuf[MAX_TMPBUF];
int rc = SLAPI_DSE_CALLBACK_OK;
returntext[0] = '\0';
@@ -430,23 +308,13 @@ ldbm_instance_index_config_modify_callback(Slapi_PBlock *pb, Slapi_Entry *e,
goto out;
}
- origMatchingRules = attrinfo2ConfMatchingRules(ainfo);
- if (NULL == origMatchingRules) {
- rc = SLAPI_DSE_CALLBACK_ERROR;
- goto out;
- }
-
origIndexTypesArray = slapi_str2charray(origIndexTypes, ",");
if (NULL == origIndexTypesArray) {
rc = SLAPI_DSE_CALLBACK_ERROR;
goto out;
}
- origMatchingRulesArray = slapi_str2charray(origMatchingRules, ",");
- if (NULL == origMatchingRulesArray) {
- rc = SLAPI_DSE_CALLBACK_ERROR;
- goto out;
- }
+ origMatchingRulesArray = attrinfo2ConfMatchingRules(ainfo);
for (i = 0; mods[i] != NULL; i++) {
config_attr = (char *)mods[i]->mod_type;
@@ -556,48 +424,53 @@ ldbm_instance_index_config_modify_callback(Slapi_PBlock *pb, Slapi_Entry *e,
}
if (dodeletes) {
- i = 0;
- arglist[i++] = slapi_ch_strdup(attrValue->bv_val);
- arglist[i++] = slapi_ch_strdup("none");
- arglist[i] = NULL;
- attr_index_config(inst->inst_be, "from DSE modify", 0, i, arglist, 0);
-
- /* Free args */
- slapi_ch_free((void **)&arglist[0]);
- slapi_ch_free((void **)&arglist[1]);
+ attr_index_config(inst->inst_be, "from DSE modify", 0, e, 0, INDEXTYPE_NONE);
}
- i = 0;
- arglist[i++] = slapi_ch_strdup(attrValue->bv_val);
+ /* create a new entry with the correct attr values */
+ modEntry = slapi_entry_alloc();
+
+ /* index types */
if (origIndexTypesArray && origIndexTypesArray[0]) {
- tmpBuf[0] = 0;
- ZCAT_SAFE(tmpBuf, "", origIndexTypesArray[0]);
- for (j = 1; origIndexTypesArray[j] != NULL; j++) {
- ZCAT_SAFE(tmpBuf, ",", origIndexTypesArray[j]);
- }
- arglist[i++] = slapi_ch_strdup(tmpBuf);
+ indexTypeAttr = slapi_attr_new();
+ slapi_attr_init(indexTypeAttr, "nsIndexType");
+ for (j = 0; origIndexTypesArray[j] != NULL; j++) {
+ /* add attr value */
+ modValue = slapi_value_new_string(origIndexTypesArray[j]);
+ slapi_attr_add_value(indexTypeAttr,modValue);
+ slapi_value_free(&modValue);
+ }
} else {
- arglist[i++] = slapi_ch_strdup("none");
+ indexTypeAttr = slapi_attr_new();
+ slapi_attr_init(indexTypeAttr, "nsIndexType");
+ modValue = slapi_value_new_string("none");
+ slapi_attr_add_value(indexTypeAttr,modValue);
+ slapi_value_free(&modValue);
}
+ /* add indexType attribute values */
+ attrlist_add(&modAttr,indexTypeAttr);
+
+ /* matching rules */
if (origMatchingRulesArray && origMatchingRulesArray[0]) {
- tmpBuf[0] = 0;
- ZCAT_SAFE(tmpBuf, "", origMatchingRulesArray[0]);
- for (j = 1; origMatchingRulesArray[j] != NULL; j++) {
- ZCAT_SAFE(tmpBuf, ",", origMatchingRulesArray[j]);
+ matchingRuleAttr = slapi_attr_new();
+ slapi_attr_init(matchingRuleAttr, "nsMatchingRule");
+ for (j = 0; origMatchingRulesArray[j] != NULL; j++) {
+ /* add attr value */
+ modValue = slapi_value_new_string(origMatchingRulesArray[j]);
+ slapi_attr_add_value(matchingRuleAttr,modValue);
+ slapi_value_free(&modValue);
}
- arglist[i++] = slapi_ch_strdup(tmpBuf);
+
+ /* add the matchingRule attribute values */
+ attrlist_add(&modAttr,matchingRuleAttr);
}
- arglist[i] = NULL;
- attr_index_config(inst->inst_be, "from DSE modify", 0, i, arglist, 0);
+ slapi_entry_init_ext(modEntry, NULL, modAttr);
+ attr_index_config(inst->inst_be, "from DSE modify", 0, modEntry, 0, 0);
+ slapi_entry_free(modEntry);
out:
- /* Free args */
- for (i=0; arglist[i]; i++) {
- slapi_ch_free((void **)&arglist[i]);
- }
-
if(origIndexTypesArray) {
charray_free(origIndexTypesArray);
}
@@ -619,9 +492,6 @@ out:
if (origIndexTypes) {
slapi_ch_free ((void **)&origIndexTypes);
}
- if (origMatchingRules) {
- slapi_ch_free ((void **)&origMatchingRules);
- }
return rc;
}
@@ -629,90 +499,92 @@ out:
/* add index entries to the per-instance DSE (used only from instance.c) */
int ldbm_instance_config_add_index_entry(
ldbm_instance *inst,
- int argc,
- char **argv,
+ Slapi_Entry *e,
int flags
)
{
- char **attrs = NULL;
- char **indexes = NULL;
- char **matchingRules = NULL;
char *eBuf;
- int i = 0;
int j = 0;
char *basetype = NULL;
- char tmpAttrsStr[256];
- char tmpIndexesStr[256];
- char tmpMatchingRulesStr[1024];
struct ldbminfo *li = inst->inst_li;
char *dn = NULL;
+ Slapi_Attr *attr;
+ const struct berval *attrValue;
+ Slapi_Value *sval;
int rc = 0;
- if ((argc < 2) || (NULL == argv) || (NULL == argv[0]) ||
- (NULL == argv[1])) {
- return(-1);
+ /* get the cn value */
+ if (slapi_entry_attr_find(e, "cn", &attr) != 0) {
+ LDAPDebug(LDAP_DEBUG_ANY, "Warning: malformed index entry %s\n",
+ slapi_entry_get_dn(e), 0, 0);
+ return -1;
}
- PL_strncpyz(tmpAttrsStr,argv[0], sizeof(tmpAttrsStr));
- attrs = slapi_str2charray( tmpAttrsStr, "," );
- PL_strncpyz(tmpIndexesStr,argv[1], sizeof(tmpIndexesStr));
- indexes = slapi_str2charray( tmpIndexesStr, ",");
-
- if(argc > 2) {
- PL_strncpyz(tmpMatchingRulesStr,argv[2], sizeof(tmpMatchingRulesStr));
- matchingRules = slapi_str2charray( tmpMatchingRulesStr, ",");
+ slapi_attr_first_value(attr, &sval);
+ attrValue = slapi_value_get_berval(sval);
+ if (NULL == attrValue->bv_val || 0 == strlen(attrValue->bv_val)) {
+ LDAPDebug(LDAP_DEBUG_ANY,
+ "Warning: malformed index entry %s -- empty index name\n",
+ slapi_entry_get_dn(e), 0, 0);
+ return -1;
}
- for(i=0; attrs && attrs[i] !=NULL; i++)
- {
- if('\0' == attrs[i][0]) continue;
- basetype = slapi_attr_basetype(attrs[i], NULL, 0);
- dn = slapi_create_dn_string("cn=%s,cn=index,cn=%s,cn=%s,cn=plugins,cn=config",
+ basetype = slapi_attr_basetype(attrValue->bv_val, NULL, 0);
+ dn = slapi_create_dn_string("cn=%s,cn=index,cn=%s,cn=%s,cn=plugins,cn=config",
basetype, inst->inst_name, li->li_plugin->plg_name);
- if (NULL == dn) {
- LDAPDebug(LDAP_DEBUG_ANY,
- "ldbm_instance_config_add_index_entry: "
- "failed create index dn with type %s for plugin %s, "
- "instance %s\n",
- basetype, inst->inst_li->li_plugin->plg_name,
- inst->inst_name);
- slapi_ch_free((void**)&basetype);
- rc = -1;
- goto done;
- }
- eBuf = PR_smprintf(
- "dn: %s\n"
- "objectclass: top\n"
- "objectclass: nsIndex\n"
- "cn: %s\n"
- "nsSystemIndex: %s\n",
+ if (NULL == dn) {
+ LDAPDebug(LDAP_DEBUG_ANY,
+ "ldbm_instance_config_add_index_entry: "
+ "failed create index dn with type %s for plugin %s, "
+ "instance %s\n",
+ basetype, inst->inst_li->li_plugin->plg_name,
+ inst->inst_name);
+ slapi_ch_free((void**)&basetype);
+ return -1;
+ }
+
+ eBuf = PR_smprintf(
+ "dn: %s\n"
+ "objectclass: top\n"
+ "objectclass: nsIndex\n"
+ "cn: %s\n"
+ "nsSystemIndex: %s\n",
dn, basetype,
(ldbm_attribute_always_indexed(basetype)?"true":"false"));
- slapi_ch_free_string(&dn);
- for(j=0; indexes && indexes[j] != NULL; j++)
- {
- eBuf = PR_sprintf_append(eBuf, "nsIndexType:%s\n", indexes[j]);
- }
- if((argc>2)&&(argv[2]))
- {
- for(j=0; matchingRules && matchingRules[j] != NULL; j++)
- {
- eBuf = PR_sprintf_append(eBuf, "nsMatchingRule:%s\n", matchingRules[j]);
- }
- }
+ slapi_ch_free_string(&dn);
+
+ /* get nsIndexType and its values, and add them */
+ if( 0 == slapi_entry_attr_find(e, "nsIndexType", &attr)){
+ for (j = slapi_attr_first_value(attr, &sval); j != -1;j = slapi_attr_next_value(attr, j, &sval)) {
+ attrValue = slapi_value_get_berval(sval);
+ eBuf = PR_sprintf_append(eBuf, "nsIndexType: %s\n", attrValue->bv_val);
+ }
+ } else {
+ LDAPDebug(LDAP_DEBUG_ANY,
+ "ldbm_instance_config_add_index_entry: "
+ "failed create index dn with type %s for plugin %s, "
+ "instance %s. Missing nsIndexType\n",
+ basetype, inst->inst_li->li_plugin->plg_name,
+ inst->inst_name);
+ slapi_ch_free((void**)&basetype);
+ return -1;
+ }
- ldbm_config_add_dse_entry(li, eBuf, flags);
- if (eBuf) {
- PR_smprintf_free(eBuf);
- }
+ /* get nsMatchingRule and its values, and add them */
+ if(0 == slapi_entry_attr_find(e, "nsMatchingRule", &attr)) {
+ for (j = slapi_attr_first_value(attr, &sval); j != -1;j = slapi_attr_next_value(attr, j, &sval)) {
+ attrValue = slapi_value_get_berval(sval);
+ eBuf = PR_sprintf_append(eBuf, "nsMatchingRule: %s\n", attrValue->bv_val);
+ }
+ }
+
+ ldbm_config_add_dse_entry(li, eBuf, flags);
+ if (eBuf) {
+ PR_smprintf_free(eBuf);
+ }
- slapi_ch_free((void**)&basetype);
- }
+ slapi_ch_free((void**)&basetype);
-done:
- charray_free(attrs);
- charray_free(indexes);
- charray_free(matchingRules);
return rc;
}
@@ -724,10 +596,9 @@ ldbm_instance_index_config_enable_index(ldbm_instance *inst, Slapi_Entry* e)
rc=ldbm_index_parse_entry(inst, e, "from DSE add", &index_name);
if (rc == LDAP_SUCCESS) {
+ /* Assume the caller knows if it is OK to go online immediately */
struct attrinfo *ai = NULL;
- /* Assume the caller knows if it is OK to go online immediatly */
-
ainfo_get(inst->inst_be, index_name, &ai);
PR_ASSERT(ai != NULL);
ai->ai_indexmask &= ~INDEX_OFFLINE;
@@ -736,30 +607,19 @@ ldbm_instance_index_config_enable_index(ldbm_instance *inst, Slapi_Entry* e)
return rc;
}
-
/*
-** create the default user-defined indexes
+** Create the default user-defined indexes
+**
+** Search for user-defined default indexes and add them
+** to the backend instance being created.
*/
int ldbm_instance_create_default_user_indexes(ldbm_instance *inst)
{
-
- /*
- ** Search for user-defined default indexes and add them
- ** to the backend instance beeing created.
- */
-
Slapi_PBlock *aPb;
Slapi_Entry **entries = NULL;
Slapi_Attr *attr;
- Slapi_Value *sval = NULL;
- const struct berval *attrValue;
- char *argv[ 8 ];
- char tmpBuf[MAX_TMPBUF];
- char tmpBuf2[MAX_TMPBUF];
- int argc;
char *basedn = NULL;
-
struct ldbminfo *li;
/* write the dse file only on the final index */
@@ -772,7 +632,6 @@ int ldbm_instance_create_default_user_indexes(ldbm_instance *inst)
}
li = inst->inst_li;
- strcpy(tmpBuf,"");
/* Construct the base dn of the subtree that holds the default user indexes. */
basedn = slapi_create_dn_string("cn=default indexes,cn=config,cn=%s,cn=plugins,cn=config",
@@ -792,69 +651,27 @@ int ldbm_instance_create_default_user_indexes(ldbm_instance *inst)
slapi_search_internal_pb (aPb);
slapi_pblock_get(aPb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &entries);
if (entries!=NULL) {
- int i,j;
+ int i;
for (i=0; entries[i]!=NULL; i++) {
-
- /* Get the name of the attribute to index which will be the value
- * of the cn attribute. */
-
+ /*
+ * Get the name of the attribute to index which will be the value
+ * of the cn attribute.
+ */
if (slapi_entry_attr_find(entries[i], "cn", &attr) != 0) {
LDAPDebug(LDAP_DEBUG_ANY,"Warning: malformed index entry %s. Index ignored.\n",
slapi_entry_get_dn(entries[i]), 0, 0);
continue;
}
- slapi_attr_first_value(attr, &sval);
- attrValue = slapi_value_get_berval(sval);
- argv[0] = attrValue->bv_val;
- argc=1;
-
- /* Get the list of index types from the entry. */
-
- if (0 == slapi_entry_attr_find(entries[i], "nsIndexType", &attr)) {
- for (j = slapi_attr_first_value(attr, &sval); j != -1;
- j = slapi_attr_next_value(attr, j, &sval)) {
- attrValue = slapi_value_get_berval(sval);
- if (0 == j) {
- tmpBuf[0] = 0;
- ZCAT_SAFE(tmpBuf, "", attrValue->bv_val);
- } else {
- ZCAT_SAFE(tmpBuf, ",", attrValue->bv_val);
- }
- }
- argv[argc]=tmpBuf;
- argc++;
- }
-
- /* Get the list of matching rules from the entry. */
-
- if (0 == slapi_entry_attr_find(entries[i], "nsMatchingRule", &attr)) {
- for (j = slapi_attr_first_value(attr, &sval); j != -1;
- j = slapi_attr_next_value(attr, j, &sval)) {
- attrValue = slapi_value_get_berval(sval);
- if (0 == j) {
- tmpBuf2[0] = 0;
- ZCAT_SAFE(tmpBuf2, "", attrValue->bv_val);
- } else {
- ZCAT_SAFE(tmpBuf2, ",", attrValue->bv_val);
- }
- }
- argv[argc]=tmpBuf2;
- argc++;
- }
-
- argv[argc]=NULL;
/* Create the index entry in the backend */
-
if (entries[i+1] == NULL) {
/* write the dse file only on the final index */
flags = 0;
}
- ldbm_instance_config_add_index_entry(inst, argc, argv, flags);
+ ldbm_instance_config_add_index_entry(inst, entries[i], flags);
/* put the index online */
-
ldbm_instance_index_config_enable_index(inst, entries[i]);
}
}
diff --git a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
index b430f9a..2e18c53 100644
--- a/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
+++ b/ldap/servers/slapd/back-ldbm/ldif2ldbm.c
@@ -2474,32 +2474,56 @@ db2index_add_indexed_attr(backend *be, char *attrString)
{
char *iptr = NULL;
char *mptr = NULL;
- char *nsslapd_index_value[4];
- int argc = 0;
- int i;
+ Slapi_Entry *e;
+ Slapi_Value *sval;
+ Slapi_Attr *indextype_attr;
+ Slapi_Attr *cn_attr;
+ Slapi_Attr *mr_attr;
+ Slapi_Attr *attrs;
if (NULL == (iptr = strchr(attrString, ':'))) {
return(0);
}
+ e = slapi_entry_alloc();
+ attrs = slapi_attr_new();
iptr[0] = '\0';
iptr++;
-
- nsslapd_index_value[argc++] = slapi_ch_strdup(attrString+1);
-
+
+ /* set the index name */
+ cn_attr = slapi_attr_new();
+ slapi_attr_init(cn_attr, "cn");
+ sval = slapi_value_new_string(slapi_ch_strdup(attrString+1));
+ slapi_attr_add_value(cn_attr,sval);
+ attrlist_add(&attrs,cn_attr);
+ slapi_value_free(&sval);
+
if (NULL != (mptr = strchr(iptr, ':'))) {
mptr[0] = '\0';
mptr++;
}
- nsslapd_index_value[argc++] = slapi_ch_strdup(iptr);
+
+ /* set the index type */
+ indextype_attr = slapi_attr_new();
+ slapi_attr_init(indextype_attr, "nsIndexType");
+ sval = slapi_value_new_string(slapi_ch_strdup(iptr));
+ slapi_attr_add_value(indextype_attr,sval);
+ attrlist_add(&attrs,indextype_attr);
+ slapi_value_free(&sval);
+
if (NULL != mptr) {
- nsslapd_index_value[argc++] = slapi_ch_strdup(mptr);
+ /* set the matching rule */
+ mr_attr = slapi_attr_new();
+ slapi_attr_init(mr_attr, "nsMatchingRule");
+ sval = slapi_value_new_string(slapi_ch_strdup(mptr));
+ slapi_attr_add_value(mr_attr,sval);
+ attrlist_add(&attrs,mr_attr);
+ slapi_value_free(&sval);
}
- nsslapd_index_value[argc] = NULL;
- attr_index_config(be, "from db2index()", 0, argc, nsslapd_index_value, 0);
- for ( i=0; i<argc; i++ ) {
- slapi_ch_free_string(&nsslapd_index_value[i]);
- }
+ slapi_entry_init_ext(e, NULL, attrs);
+ attr_index_config(be, "from db2index()", 0, e, 0, 0);
+ slapi_entry_free(e);
+
return(0);
}
diff --git a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
index f286377..0734162 100644
--- a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
+++ b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h
@@ -55,7 +55,7 @@ void attr_masks( backend *be, char *type, int *indexmask,
void attr_masks_ex( backend *be, char *type, int *indexmask,
int *syntaxmask, struct attrinfo **at );
void attr_index_config( backend *be, char *fname, int lineno,
- int argc, char **argv, int init );
+ Slapi_Entry *e, int init, int none );
int ldbm_compute_init();
void attrinfo_deletetree(ldbm_instance *inst);
void attr_create_empty(backend *be,char *type,struct attrinfo **ai);
12 years, 3 months
ldap/servers
by Noriko Hosoi
ldap/servers/slapd/dse.c | 45 +++++++++++++++++++++++++++++++++++++--------
1 file changed, 37 insertions(+), 8 deletions(-)
New commits:
commit d66a37b6ee5befeec02e29c4e084f4becdfe7a0c
Author: Noriko Hosoi <nhosoi(a)jiji.usersys.redhat.com>
Date: Wed Jan 25 15:02:50 2012 -0800
Trac Ticket 35 - Log not clear enough on schema errors
https://fedorahosted.org/389/ticket/35
Fix description: Cryptic error message:
dse - parsing dse entry [attributeTypes]
is replaced with:
dse_read_one_file - Parsing entry (lineno: ##) in file
/path/to/schema/<bad_schema> failed.
dse_read_one_file - Invalid section [attributeTypes:
<the rest of the invalid section up to 256 characters> ...]
diff --git a/ldap/servers/slapd/dse.c b/ldap/servers/slapd/dse.c
index c4fa333..244d82d 100644
--- a/ldap/servers/slapd/dse.c
+++ b/ldap/servers/slapd/dse.c
@@ -725,6 +725,8 @@ dse_read_one_file(struct dse *pdse, const char *filename, Slapi_PBlock *pb,
if(!done)
{
+ int lineno = 1;
+ int lines = 0;
int dont_check_dups = 0;
int str2entry_flags = SLAPI_STR2ENTRY_EXPAND_OBJECTCLASSES |
SLAPI_STR2ENTRY_NOT_WELL_FORMED_LDIF ;
@@ -741,16 +743,34 @@ dse_read_one_file(struct dse *pdse, const char *filename, Slapi_PBlock *pb,
rc= 1; /* assume we will succeed */
while (( entrystr = dse_read_next_entry( buf, &lastp )) != NULL )
{
+ char *p, *q;
+ char errbuf[256];
+ size_t estrlen = strlen(entrystr);
+ size_t cpylen =
+ (estrlen<sizeof(errbuf))?estrlen:sizeof(errbuf)-1;
+
+ memcpy(errbuf, entrystr, cpylen);
+ errbuf[cpylen] = '\0';
+
+ lines = 1;
+ p = entrystr;
+ while ((q = strchr(p, '\n'))) {
+ p = q + 1;
+ lines++;
+ }
+
e = slapi_str2entry( entrystr, str2entry_flags );
if ( e != NULL )
{
int returncode = 0;
char returntext[SLAPI_DSE_RETURNTEXT_SIZE]= {0};
- LDAPDebug(SLAPI_DSE_TRACELEVEL, "dse_read_one_file"
- " processing entry \"%s\" in file %s%s\n",
+ slapi_log_error(SLAPI_LOG_TRACE, "dse_read_one_file",
+ " processing entry \"%s\" in file %s%s "
+ "(lineno: %d)\n",
slapi_entry_get_dn_const(e), filename,
- primary_file ? " (primary file)" : "" );
+ primary_file ? " (primary file)" : "",
+ lineno);
/* remove the numsubordinates attr, which may be bogus */
slapi_entry_attr_delete(e, subordinatecount);
@@ -767,20 +787,29 @@ dse_read_one_file(struct dse *pdse, const char *filename, Slapi_PBlock *pb,
}
else /* free entry if not used */
{
- slapi_log_error(SLAPI_LOG_FATAL, "dse",
- "The entry %s in file %s is invalid, error code %d (%s) - %s\n",
+ slapi_log_error(SLAPI_LOG_FATAL,
+ "dse_read_one_file",
+ "The entry %s in file %s "
+ "(lineno: %d) is invalid, "
+ "error code %d (%s) - %s\n",
slapi_entry_get_dn_const(e),
- filename, returncode,
+ filename, lineno, returncode,
ldap_err2string(returncode),
returntext);
slapi_entry_free(e);
rc = 0; /* failure */
}
} else {
- slapi_log_error( SLAPI_LOG_FATAL, "dse",
- "parsing dse entry [%s]\n", entrystr );
+ slapi_log_error( SLAPI_LOG_FATAL, "dse_read_one_file",
+ "Parsing entry (lineno: %d) "
+ "in file %s failed.\n",
+ lineno, filename );
+ slapi_log_error( SLAPI_LOG_FATAL, "dse_read_one_file",
+ "Invalid section [%s%s]\n",
+ errbuf, cpylen==estrlen?"":" ..." );
rc = 0; /* failure */
}
+ lineno += lines + 1 /* 1 is for a blank line. */;
}
}
slapi_ch_free((void **)&buf);
12 years, 3 months
ldap/servers
by Noriko Hosoi
ldap/servers/plugins/acctpolicy/acct_config.c | 2 -
ldap/servers/plugins/acctpolicy/acct_plugin.c | 2 -
ldap/servers/plugins/acl/acleffectiverights.c | 2 -
ldap/servers/plugins/acl/aclinit.c | 2 -
ldap/servers/plugins/automember/automember.c | 6 +--
ldap/servers/plugins/dna/dna.c | 15 +++++----
ldap/servers/plugins/linkedattrs/fixup_task.c | 4 +-
ldap/servers/plugins/linkedattrs/linked_attrs.c | 2 -
ldap/servers/plugins/memberof/memberof.c | 38 +++++++++++------------
ldap/servers/plugins/mep/mep.c | 12 +++----
ldap/servers/plugins/referint/referint.c | 4 +-
ldap/servers/plugins/replication/repl5_replica.c | 2 -
ldap/servers/slapd/config.c | 2 -
ldap/servers/slapd/dn.c | 2 -
ldap/servers/slapd/fedse.c | 14 ++++----
ldap/servers/slapd/main.c | 2 -
ldap/servers/slapd/mapping_tree.c | 6 +--
ldap/servers/slapd/plugin.c | 4 +-
ldap/servers/slapd/plugin_internal_op.c | 4 +-
ldap/servers/slapd/schema.c | 2 -
ldap/servers/slapd/snmp_collator.c | 2 -
21 files changed, 66 insertions(+), 63 deletions(-)
New commits:
commit 04dd39659c9cbc36bddac827fba94e7127534376
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Mon Jan 23 11:30:11 2012 -0800
Trac Ticket 139 - eliminate the use of char *dn in favor of Slapi_DN *dn
https://fedorahosted.org/389/ticket/139
Fix description: The oritinal RFE had been already implemented in
the commit f6397113666f06848412bb12f754f04258cfa5fa:
Reduce the number of DN normalization
In this patch, the Slapi_DN creation (slapi_sdn_{new,set,init}_dn_*)
are replaced with corresponding _normdn_ or _ndn_ APIs which takes
advantage of the knowledge that the DN is already optimized or not.
diff --git a/ldap/servers/plugins/acctpolicy/acct_config.c b/ldap/servers/plugins/acctpolicy/acct_config.c
index 5d462a3..3da338a 100644
--- a/ldap/servers/plugins/acctpolicy/acct_config.c
+++ b/ldap/servers/plugins/acctpolicy/acct_config.c
@@ -42,7 +42,7 @@ acct_policy_load_config_startup( Slapi_PBlock* pb, void* plugin_id ) {
int rc;
/* Retrieve the config entry */
- config_sdn = slapi_sdn_new_dn_byref( PLUGIN_CONFIG_DN );
+ config_sdn = slapi_sdn_new_normdn_byref( PLUGIN_CONFIG_DN );
rc = slapi_search_internal_get_entry( config_sdn, NULL, &config_entry,
plugin_id);
slapi_sdn_free( &config_sdn );
diff --git a/ldap/servers/plugins/acctpolicy/acct_plugin.c b/ldap/servers/plugins/acctpolicy/acct_plugin.c
index 9c74278..975b7c7 100644
--- a/ldap/servers/plugins/acctpolicy/acct_plugin.c
+++ b/ldap/servers/plugins/acctpolicy/acct_plugin.c
@@ -274,7 +274,7 @@ acct_bind_postop( Slapi_PBlock *pb )
/* We're not always tracking logins, so check whether the entry is
covered by an account policy to decide whether we should track */
if( tracklogin == 0 ) {
- sdn = slapi_sdn_new_dn_byref( dn );
+ sdn = slapi_sdn_new_normdn_byref( dn );
ldrc = slapi_search_internal_get_entry_ext( sdn, NULL, &target_entry,
plugin_id, txn );
diff --git a/ldap/servers/plugins/acl/acleffectiverights.c b/ldap/servers/plugins/acl/acleffectiverights.c
index 3d1f754..380dd74 100644
--- a/ldap/servers/plugins/acl/acleffectiverights.c
+++ b/ldap/servers/plugins/acl/acleffectiverights.c
@@ -376,7 +376,7 @@ _ger_new_gerpb (
*/
gerop->o_extension = factory_create_extension ( get_operation_object_type(), (void *)gerop, (void *)conn );
slapi_pblock_set ( *gerpb, SLAPI_OPERATION, gerop );
- slapi_sdn_set_dn_byval ( &gerop->o_sdn, subjectndn );
+ slapi_sdn_set_ndn_byval ( &gerop->o_sdn, subjectndn );
geraclpb = acl_get_ext ( ACL_EXT_OPERATION, (void *)gerop);
acl_init_aclpb ( *gerpb, geraclpb, subjectndn, 0 );
geraclpb->aclpb_res_type |= ACLPB_EFFECTIVE_RIGHTS;
diff --git a/ldap/servers/plugins/acl/aclinit.c b/ldap/servers/plugins/acl/aclinit.c
index e99e57f..9628075 100644
--- a/ldap/servers/plugins/acl/aclinit.c
+++ b/ldap/servers/plugins/acl/aclinit.c
@@ -156,7 +156,7 @@ aclinit_main()
* rootdse entry so we search for acis in there explicitly here.
*/
- sdn = slapi_sdn_new_dn_byval("");
+ sdn = slapi_sdn_new_ndn_byval("");
slapi_log_error ( SLAPI_LOG_ACL, plugin_name,
"Searching for all acis(scope base) at suffix ''\n");
aclinit_search_and_update_aci ( 0, /* thisbeonly */
diff --git a/ldap/servers/plugins/automember/automember.c b/ldap/servers/plugins/automember/automember.c
index c5e5667..92d5ae6 100644
--- a/ldap/servers/plugins/automember/automember.c
+++ b/ldap/servers/plugins/automember/automember.c
@@ -349,7 +349,7 @@ automember_start(Slapi_PBlock * pb)
/* Set the alternate config area if one is defined. */
slapi_pblock_get(pb, SLAPI_PLUGIN_CONFIG_AREA, &config_area);
if (config_area) {
- automember_set_config_area(slapi_sdn_new_dn_byval(config_area));
+ automember_set_config_area(slapi_sdn_new_normdn_byval(config_area));
}
/*
@@ -1025,7 +1025,7 @@ automember_parse_regex_entry(struct configEntry *config, Slapi_Entry *e)
if (rule) {
/* Fill in the target group. */
- rule->target_group_dn = slapi_sdn_new_dn_byval(target_group);
+ rule->target_group_dn = slapi_sdn_new_normdn_byval(target_group);
if (!PR_CLIST_IS_EMPTY((PRCList *)config->inclusive_rules)) {
list = PR_LIST_HEAD((PRCList *)config->inclusive_rules);
@@ -1079,7 +1079,7 @@ automember_parse_regex_entry(struct configEntry *config, Slapi_Entry *e)
if (rule) {
/* Fill in the target group. */
- rule->target_group_dn = slapi_sdn_new_dn_byval(target_group);
+ rule->target_group_dn = slapi_sdn_new_normdn_byval(target_group);
if (!PR_CLIST_IS_EMPTY((PRCList *)config->exclusive_rules)) {
list = PR_LIST_HEAD((PRCList *)config->exclusive_rules);
diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
index 2c7876f..a422055 100644
--- a/ldap/servers/plugins/dna/dna.c
+++ b/ldap/servers/plugins/dna/dna.c
@@ -1236,7 +1236,7 @@ dna_load_host_port()
attrs[2] = "nsslapd-secureport";
attrs[3] = NULL;
- config_dn = slapi_sdn_new_dn_byref("cn=config");
+ config_dn = slapi_sdn_new_ndn_byref("cn=config");
if (config_dn) {
slapi_search_internal_get_entry(config_dn, attrs, &e, getPluginID());
slapi_sdn_free(&config_dn);
@@ -1506,7 +1506,7 @@ dna_get_shared_servers(struct configEntry *config_entry, PRCList **servers, void
Slapi_DN *cfg_sdn = NULL;
int i;
- cfg_sdn = slapi_sdn_new_dn_byref(config_entry->shared_cfg_dn);
+ cfg_sdn = slapi_sdn_new_normdn_byref(config_entry->shared_cfg_dn);
/* We found some entries. Go through them and
* order them based off of remaining values. */
@@ -2206,11 +2206,14 @@ dna_update_shared_config(struct configEntry * config_entry, void *txn)
* already exist, we add it. */
if (ret == LDAP_NO_SUCH_OBJECT) {
Slapi_Entry *e = NULL;
+ Slapi_DN *sdn =
+ slapi_sdn_new_normdn_byref(config_entry->shared_cfg_dn);
/* Set up the new shared config entry */
e = slapi_entry_alloc();
/* the entry now owns the dup'd dn */
- slapi_entry_init(e, slapi_ch_strdup(config_entry->shared_cfg_dn), NULL);
+ slapi_entry_init_ext(e, sdn, NULL); /* sdn is copied into e */
+ slapi_sdn_free(&sdn);
slapi_entry_add_string(e, SLAPI_ATTR_OBJECTCLASS, "extensibleObject");
slapi_entry_add_string(e, DNA_HOSTNAME, hostname);
@@ -2434,7 +2437,7 @@ static int dna_is_replica_bind_dn(char *range_dn, char *bind_dn)
ret = 1;
goto done;
}
- replica_sdn = slapi_sdn_new_dn_passin(replica_dn);
+ replica_sdn = slapi_sdn_new_normdn_passin(replica_dn);
attrs[0] = DNA_REPL_BIND_DN;
attrs[1] = 0;
@@ -2479,7 +2482,7 @@ static int dna_get_replica_bind_creds(char *range_dn, struct dnaServer *server,
int ret = LDAP_OPERATIONS_ERROR;
/* Find the backend suffix where the shared config is stored. */
- range_sdn = slapi_sdn_new_dn_byref(range_dn);
+ range_sdn = slapi_sdn_new_normdn_byref(range_dn);
if ((be = slapi_be_select(range_sdn)) != NULL) {
be_suffix = slapi_sdn_get_dn(slapi_be_getsuffix(be, 0));
}
@@ -3398,7 +3401,7 @@ dna_release_range(char *range_dn, PRUint64 *lower, PRUint64 *upper)
list = PR_LIST_HEAD(dna_global_config);
while ((list != dna_global_config) && match != 1) {
config_entry = (struct configEntry *)list;
- cfg_base_sdn = slapi_sdn_new_dn_byref(config_entry->shared_cfg_base);
+ cfg_base_sdn = slapi_sdn_new_normdn_byref(config_entry->shared_cfg_base);
if (slapi_sdn_compare(cfg_base_sdn, range_sdn) == 0) {
/* We found a match. Set match flag to
diff --git a/ldap/servers/plugins/linkedattrs/fixup_task.c b/ldap/servers/plugins/linkedattrs/fixup_task.c
index a698a6c..b92c6b7 100644
--- a/ldap/servers/plugins/linkedattrs/fixup_task.c
+++ b/ldap/servers/plugins/linkedattrs/fixup_task.c
@@ -369,7 +369,7 @@ linked_attrs_add_backlinks_callback(Slapi_Entry *e, void *callback_data)
for (i = 0; targets && targets[i]; ++i) {
char *targetdn = (char *)targets[i];
int perform_update = 0;
- Slapi_DN *targetsdn = slapi_sdn_new_dn_byref(targetdn);
+ Slapi_DN *targetsdn = slapi_sdn_new_normdn_byref(targetdn);
if (g_get_shutdown()) {
return -1;
@@ -382,7 +382,7 @@ linked_attrs_add_backlinks_callback(Slapi_Entry *e, void *callback_data)
/* Find out the root suffix that the linkdn is in
* and see if the target is in the same backend. */
Slapi_Backend *be = NULL;
- Slapi_DN *linksdn = slapi_sdn_new_dn_byref(linkdn);
+ Slapi_DN *linksdn = slapi_sdn_new_normdn_byref(linkdn);
if ((be = slapi_be_select(linksdn))) {
perform_update = slapi_sdn_issuffix(targetsdn, slapi_be_getsuffix(be, 0));
diff --git a/ldap/servers/plugins/linkedattrs/linked_attrs.c b/ldap/servers/plugins/linkedattrs/linked_attrs.c
index 1a647bc..c00c896 100644
--- a/ldap/servers/plugins/linkedattrs/linked_attrs.c
+++ b/ldap/servers/plugins/linkedattrs/linked_attrs.c
@@ -1472,7 +1472,7 @@ linked_attrs_mod_backpointers(char *linkdn, char *type,
perform_update = slapi_dn_issuffix(targetdn, scope);
} else {
Slapi_Backend *be = NULL;
- Slapi_DN *linksdn = slapi_sdn_new_dn_byref(linkdn);
+ Slapi_DN *linksdn = slapi_sdn_new_normdn_byref(linkdn);
if ((be = slapi_be_select(linksdn))) {
perform_update = slapi_sdn_issuffix(targetsdn, slapi_be_getsuffix(be, 0));
diff --git a/ldap/servers/plugins/memberof/memberof.c b/ldap/servers/plugins/memberof/memberof.c
index 19c3085..5100b1a 100644
--- a/ldap/servers/plugins/memberof/memberof.c
+++ b/ldap/servers/plugins/memberof/memberof.c
@@ -382,7 +382,7 @@ int memberof_postop_del(Slapi_PBlock *pb)
{
int ret = 0;
MemberOfConfig configCopy = {0, 0, 0, 0};
- char *dn;
+ char *normdn;
void *caller_id = NULL;
slapi_log_error( SLAPI_LOG_TRACE, MEMBEROF_PLUGIN_SUBSYSTEM,
@@ -396,7 +396,7 @@ int memberof_postop_del(Slapi_PBlock *pb)
return 0;
}
- if(memberof_oktodo(pb) && (dn = memberof_getdn(pb)))
+ if(memberof_oktodo(pb) && (normdn = memberof_getdn(pb)))
{
struct slapi_entry *e = NULL;
void *txn = NULL;
@@ -418,7 +418,7 @@ int memberof_postop_del(Slapi_PBlock *pb)
/* remove this DN from the
* membership lists of groups
*/
- memberof_del_dn_from_groups(pb, &configCopy, dn, txn);
+ memberof_del_dn_from_groups(pb, &configCopy, normdn, txn);
/* is the entry of interest as a group? */
if(e && configCopy.group_filter && !slapi_filter_test_simple(e, configCopy.group_filter))
@@ -431,7 +431,7 @@ int memberof_postop_del(Slapi_PBlock *pb)
{
if (0 == slapi_entry_attr_find(e, configCopy.groupattrs[i], &attr))
{
- memberof_del_attr_list(pb, &configCopy, dn, attr, txn);
+ memberof_del_attr_list(pb, &configCopy, normdn, attr, txn);
}
}
}
@@ -536,7 +536,7 @@ int memberof_call_foreach_dn(Slapi_PBlock *pb, char *dn,
(we don't support having members and groups in
different backends - issues with offline / read only backends)
*/
- sdn = slapi_sdn_new_dn_byref(dn);
+ sdn = slapi_sdn_new_normdn_byref(dn);
be = slapi_be_select(sdn);
if(be)
{
@@ -789,7 +789,7 @@ int memberof_replace_dn_type_callback(Slapi_Entry *e, void *callback_data)
int memberof_postop_modify(Slapi_PBlock *pb)
{
int ret = 0;
- char *dn = 0;
+ char *normdn = 0;
Slapi_Mods *smods = 0;
Slapi_Mod *smod = 0;
LDAPMod **mods;
@@ -807,8 +807,7 @@ int memberof_postop_modify(Slapi_PBlock *pb)
return 0;
}
- if(memberof_oktodo(pb) &&
- (dn = memberof_getdn(pb)))
+ if(memberof_oktodo(pb) && (normdn = memberof_getdn(pb)))
{
int config_copied = 0;
MemberOfConfig *mainConfig = 0;
@@ -866,7 +865,7 @@ int memberof_postop_modify(Slapi_PBlock *pb)
case LDAP_MOD_ADD:
{
/* add group DN to targets */
- memberof_add_smod_list(pb, &configCopy, dn, smod, txn);
+ memberof_add_smod_list(pb, &configCopy, normdn, smod, txn);
break;
}
@@ -878,12 +877,12 @@ int memberof_postop_modify(Slapi_PBlock *pb)
* entry, which the replace code deals with. */
if (slapi_mod_get_num_values(smod) == 0)
{
- memberof_replace_list(pb, &configCopy, dn, txn);
+ memberof_replace_list(pb, &configCopy, normdn, txn);
}
else
{
/* remove group DN from target values in smod*/
- memberof_del_smod_list(pb, &configCopy, dn, smod, txn);
+ memberof_del_smod_list(pb, &configCopy, normdn, smod, txn);
}
break;
}
@@ -891,7 +890,7 @@ int memberof_postop_modify(Slapi_PBlock *pb)
case LDAP_MOD_REPLACE:
{
/* replace current values */
- memberof_replace_list(pb, &configCopy, dn, txn);
+ memberof_replace_list(pb, &configCopy, normdn, txn);
break;
}
@@ -937,7 +936,7 @@ int memberof_postop_add(Slapi_PBlock *pb)
{
int ret = 0;
int interested = 0;
- char *dn = 0;
+ char *normdn = 0;
void *caller_id = NULL;
slapi_log_error( SLAPI_LOG_TRACE, MEMBEROF_PLUGIN_SUBSYSTEM,
@@ -951,7 +950,7 @@ int memberof_postop_add(Slapi_PBlock *pb)
return 0;
}
- if(memberof_oktodo(pb) && (dn = memberof_getdn(pb)))
+ if(memberof_oktodo(pb) && (normdn = memberof_getdn(pb)))
{
MemberOfConfig *mainConfig = 0;
MemberOfConfig configCopy = {0, 0, 0, 0};
@@ -984,7 +983,7 @@ int memberof_postop_add(Slapi_PBlock *pb)
{
if(0 == slapi_entry_attr_find(e, configCopy.groupattrs[i], &attr))
{
- memberof_add_attr_list(pb, &configCopy, dn, attr, txn);
+ memberof_add_attr_list(pb, &configCopy, normdn, attr, txn);
}
}
@@ -1049,6 +1048,7 @@ bail:
* memberof_getdn()
*
* Get dn of target entry
+ * Note: slapi_sdn_get_dn returns normalized dn.
*
*/
char *memberof_getdn(Slapi_PBlock *pb)
@@ -1057,7 +1057,7 @@ char *memberof_getdn(Slapi_PBlock *pb)
Slapi_DN *sdn = NULL;
slapi_pblock_get(pb, SLAPI_TARGET_SDN, &sdn);
- dn = slapi_sdn_get_dn(sdn);
+ dn = slapi_sdn_get_dn(sdn); /* returns norm dn */
return (char *)dn;
}
@@ -1124,7 +1124,7 @@ int memberof_modop_one_replace_r(Slapi_PBlock *pb, MemberOfConfig *config,
}
/* determine if this is a group op or single entry */
- op_to_sdn = slapi_sdn_new_dn_byref(op_to);
+ op_to_sdn = slapi_sdn_new_normdn_byref(op_to);
slapi_search_internal_get_entry_ext( op_to_sdn, config->groupattrs,
&e, memberof_get_plugin_id(), txn);
if(!e)
@@ -1157,7 +1157,7 @@ int memberof_modop_one_replace_r(Slapi_PBlock *pb, MemberOfConfig *config,
if(base_sdn)
{
filter_str = slapi_ch_smprintf("(%s=%s)",
- config->memberof_attr, op_to);
+ config->memberof_attr, op_to);
}
if(filter_str)
@@ -1748,7 +1748,7 @@ int memberof_is_direct_member(MemberOfConfig *config, Slapi_Value *groupdn,
Slapi_Attr *attr = 0;
int i = 0;
- sdn = slapi_sdn_new_dn_byref(slapi_value_get_string(groupdn));
+ sdn = slapi_sdn_new_normdn_byref(slapi_value_get_string(groupdn));
slapi_search_internal_get_entry_ext(sdn, config->groupattrs,
&group_e, memberof_get_plugin_id(), txn);
diff --git a/ldap/servers/plugins/mep/mep.c b/ldap/servers/plugins/mep/mep.c
index 47a6daf..303d9b3 100644
--- a/ldap/servers/plugins/mep/mep.c
+++ b/ldap/servers/plugins/mep/mep.c
@@ -365,7 +365,7 @@ mep_start(Slapi_PBlock * pb)
/* Set the alternate config area if one is defined. */
slapi_pblock_get(pb, SLAPI_PLUGIN_CONFIG_AREA, &config_area);
if (config_area) {
- mep_set_config_area(slapi_sdn_new_dn_byval(config_area));
+ mep_set_config_area(slapi_sdn_new_normdn_byval(config_area));
}
/*
@@ -2182,7 +2182,7 @@ mep_pre_op(Slapi_PBlock * pb, int modop)
/* Fetch the origin entry so we can locate the config template. */
origin_dn = slapi_entry_attr_get_charptr(e, MEP_MANAGED_BY_TYPE);
if (origin_dn) {
- origin_sdn = slapi_sdn_new_dn_byref(origin_dn);
+ origin_sdn = slapi_sdn_new_normdn_byref(origin_dn);
slapi_search_internal_get_entry_ext(origin_sdn, 0,
&origin_e, mep_get_plugin_id(), txn);
slapi_sdn_free(&origin_sdn);
@@ -2419,8 +2419,8 @@ mep_mod_post_op(Slapi_PBlock *pb)
/* Check if we need to rename the managed entry. */
if (mapped_dn) {
- mapped_sdn = slapi_sdn_new_dn_passin(mapped_dn);
- managed_sdn = slapi_sdn_new_dn_byref(managed_dn);
+ mapped_sdn = slapi_sdn_new_normdn_passin(mapped_dn);
+ managed_sdn = slapi_sdn_new_normdn_byref(managed_dn);
if (slapi_sdn_compare(managed_sdn, mapped_sdn) != 0) {
mep_rename_managed_entry(e, mapped_sdn, managed_sdn, txn);
@@ -2739,14 +2739,14 @@ mep_modrdn_post_op(Slapi_PBlock *pb)
* it has already been renamed by another plug-in. If it
* has already been renamed, we need to use the new DN to
* perform our updates. */
- managed_sdn = slapi_sdn_new_dn_byref(managed_dn);
+ managed_sdn = slapi_sdn_new_normdn_byref(managed_dn);
if (slapi_search_internal_get_entry_ext(managed_sdn, 0,
NULL, mep_get_plugin_id(), txn) == LDAP_NO_SUCH_OBJECT) {
slapi_ch_free_string(&managed_dn);
/* This DN is not a copy, so we don't want to free it later. */
managed_dn = slapi_entry_get_dn(new_managed_entry);
- slapi_sdn_set_dn_byref(managed_sdn, managed_dn);
+ slapi_sdn_set_normdn_byref(managed_sdn, managed_dn);
free_managed_dn = 0;
}
diff --git a/ldap/servers/plugins/referint/referint.c b/ldap/servers/plugins/referint/referint.c
index 9c655ca..195ff2b 100644
--- a/ldap/servers/plugins/referint/referint.c
+++ b/ldap/servers/plugins/referint/referint.c
@@ -971,7 +971,7 @@ referint_thread_func(void *arg)
while( GetNextLine(thisline, MAX_LINE, prfd) ){
ptoken = ldap_utf8strtok_r(thisline, delimiter, &iter);
- sdn = slapi_sdn_new_dn_byref(ptoken);
+ sdn = slapi_sdn_new_normdn_byref(ptoken);
ptoken = ldap_utf8strtok_r (NULL, delimiter, &iter);
if(!strcasecmp(ptoken, "NULL")) {
@@ -984,7 +984,7 @@ referint_thread_func(void *arg)
if (!strcasecmp(ptoken, "NULL")) {
tmpsuperior = NULL;
} else {
- tmpsuperior = slapi_sdn_new_dn_byref(ptoken);
+ tmpsuperior = slapi_sdn_new_normdn_byref(ptoken);
}
update_integrity(plugin_argv, sdn, tmprdn,
diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c
index 08c6509..8c7a2ab 100644
--- a/ldap/servers/plugins/replication/repl5_replica.c
+++ b/ldap/servers/plugins/replication/repl5_replica.c
@@ -3132,7 +3132,7 @@ replica_log_ruv_elements_nolock (const Replica *r)
special target dn */
memset (&op_params, 0, sizeof (op_params));
op_params.operation_type = SLAPI_OPERATION_DELETE;
- op_params.target_address.sdn = slapi_sdn_new_dn_byval(START_ITERATION_ENTRY_DN);
+ op_params.target_address.sdn = slapi_sdn_new_ndn_byval(START_ITERATION_ENTRY_DN);
op_params.target_address.uniqueid = START_ITERATION_ENTRY_UNIQUEID;
op_params.csn = csn;
repl_gen = ruv_get_replica_generation (ruv);
diff --git a/ldap/servers/slapd/config.c b/ldap/servers/slapd/config.c
index c25438d..f1df7ba 100644
--- a/ldap/servers/slapd/config.c
+++ b/ldap/servers/slapd/config.c
@@ -250,7 +250,7 @@ slapd_bootstrap_config(const char *configdir)
dn_validate_strict[0] = '\0';
/* Convert LDIF to entry structures */
- slapi_sdn_init_dn_byref(&plug_dn, PLUGIN_BASE_DN);
+ slapi_sdn_init_ndn_byref(&plug_dn, PLUGIN_BASE_DN);
while ((entrystr = dse_read_next_entry(buf, &lastp)) != NULL)
{
char errorbuf[BUFSIZ];
diff --git a/ldap/servers/slapd/dn.c b/ldap/servers/slapd/dn.c
index f434526..aeb24b3 100644
--- a/ldap/servers/slapd/dn.c
+++ b/ldap/servers/slapd/dn.c
@@ -2307,7 +2307,7 @@ slapi_sdn_get_parent_ext(const Slapi_DN *sdn,
{
const char *parentdn =
slapi_dn_parent_ext(slapi_sdn_get_dn(sdn), is_tombstone);
- slapi_sdn_set_dn_passin(sdn_parent,parentdn);
+ slapi_sdn_set_normdn_passin(sdn_parent,parentdn);
sdn_parent->flag= slapi_setbit_uchar(sdn_parent->flag,FLAG_DN);
PR_INCREMENT_COUNTER(slapi_sdn_counter_dn_created);
PR_INCREMENT_COUNTER(slapi_sdn_counter_dn_exist);
diff --git a/ldap/servers/slapd/fedse.c b/ldap/servers/slapd/fedse.c
index ab94628..dbfba16 100644
--- a/ldap/servers/slapd/fedse.c
+++ b/ldap/servers/slapd/fedse.c
@@ -1770,7 +1770,7 @@ setup_internal_backends(char *configdir)
int rc = init_schema_dse(configdir);
Slapi_DN config;
- slapi_sdn_init_dn_byref(&config,"cn=config");
+ slapi_sdn_init_ndn_byref(&config,"cn=config");
if (rc)
{
@@ -1787,13 +1787,13 @@ setup_internal_backends(char *configdir)
Slapi_DN encryption;
Slapi_DN saslmapping;
- slapi_sdn_init_dn_byref(&monitor,"cn=monitor");
- slapi_sdn_init_dn_byref(&counters,"cn=counters,cn=monitor");
- slapi_sdn_init_dn_byref(&snmp,"cn=snmp,cn=monitor");
- slapi_sdn_init_dn_byref(&root,"");
+ slapi_sdn_init_ndn_byref(&monitor,"cn=monitor");
+ slapi_sdn_init_ndn_byref(&counters,"cn=counters,cn=monitor");
+ slapi_sdn_init_ndn_byref(&snmp,"cn=snmp,cn=monitor");
+ slapi_sdn_init_ndn_byref(&root,"");
- slapi_sdn_init_dn_byref(&encryption,"cn=encryption,cn=config");
- slapi_sdn_init_dn_byref(&saslmapping,"cn=mapping,cn=sasl,cn=config");
+ slapi_sdn_init_ndn_byref(&encryption,"cn=encryption,cn=config");
+ slapi_sdn_init_ndn_byref(&saslmapping,"cn=mapping,cn=sasl,cn=config");
/* Search */
dse_register_callback(pfedse,SLAPI_OPERATION_SEARCH,DSE_FLAG_PREOP,&config,LDAP_SCOPE_BASE,"(objectclass=*)",read_config_dse,NULL);
diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c
index ffcdbab..3455852 100644
--- a/ldap/servers/slapd/main.c
+++ b/ldap/servers/slapd/main.c
@@ -1116,7 +1116,7 @@ main( int argc, char **argv)
/* initialize UniqueID generator - must be done once backends are started
and event queue is initialized but before plugins are started */
/* Note: This DN is no need to be normalized. */
- sdn = slapi_sdn_new_dn_byval ("cn=uniqueid generator,cn=config");
+ sdn = slapi_sdn_new_ndn_byval ("cn=uniqueid generator,cn=config");
rc = uniqueIDGenInit (NULL, sdn, slapd_exemode == SLAPD_EXEMODE_SLAPD);
slapi_sdn_free (&sdn);
if (rc != UID_SUCCESS)
diff --git a/ldap/servers/slapd/mapping_tree.c b/ldap/servers/slapd/mapping_tree.c
index 3aa3bec..b2db9fe 100644
--- a/ldap/servers/slapd/mapping_tree.c
+++ b/ldap/servers/slapd/mapping_tree.c
@@ -387,7 +387,7 @@ get_parent_from_entry(Slapi_Entry * entry)
*ptr = '\0';
}
}
- parent_sdn = slapi_sdn_new_dn_passin(slapi_ch_smprintf("%s", parent));
+ parent_sdn = slapi_sdn_new_dn_byval(parent);
slapi_ch_free_string(&origparent);
}
@@ -433,7 +433,7 @@ get_subtree_from_entry(Slapi_Entry * entry)
*ptr = '\0';
}
}
- subtree = slapi_sdn_new_dn_passin(slapi_ch_smprintf("%s", cn));
+ subtree = slapi_sdn_new_dn_byval(cn);
slapi_ch_free_string(&origcn);
}
@@ -2946,7 +2946,7 @@ slapi_get_mapping_tree_node_configsdn (const Slapi_DN *root)
return NULL;
}
- sdn = slapi_sdn_new_dn_passin(dn);
+ sdn = slapi_sdn_new_normdn_passin(dn);
return sdn;
}
diff --git a/ldap/servers/slapd/plugin.c b/ldap/servers/slapd/plugin.c
index 50df502..4c8e8bd 100644
--- a/ldap/servers/slapd/plugin.c
+++ b/ldap/servers/slapd/plugin.c
@@ -271,7 +271,7 @@ slapi_register_plugin_ext(
int rc = 0;
Slapi_Entry *e = NULL;
char *dn = slapi_ch_smprintf("cn=%s,%s", name, PLUGIN_BASE_DN);
- Slapi_DN *sdn = slapi_sdn_new_dn_passin(dn);
+ Slapi_DN *sdn = slapi_sdn_new_normdn_passin(dn);
e = slapi_entry_alloc();
/* this function consumes dn */
@@ -1947,7 +1947,7 @@ plugin_add_descriptive_attributes( Slapi_Entry *e, struct slapdplugin *plugin )
for ( plugtmp = global_plugin_list[i]; NULL == plugin && plugtmp;
plugtmp = plugtmp->plg_next)
{
- slapi_sdn_init_dn_byref( &pdn, plugtmp->plg_dn );
+ slapi_sdn_init_normdn_byref( &pdn, plugtmp->plg_dn );
if ( 0 == slapi_sdn_compare( &pdn, ednp ))
{
plugin = plugtmp;
diff --git a/ldap/servers/slapd/plugin_internal_op.c b/ldap/servers/slapd/plugin_internal_op.c
index 563bc46..9654780 100644
--- a/ldap/servers/slapd/plugin_internal_op.c
+++ b/ldap/servers/slapd/plugin_internal_op.c
@@ -388,7 +388,7 @@ static int seq_internal_callback_pb (Slapi_PBlock *pb, void *callback_data,
slapi_pblock_get(pb, SLAPI_CONTROLS_ARG, &controls);
if (base == NULL) {
- sdn = slapi_sdn_new_dn_byval("");
+ sdn = slapi_sdn_new_ndn_byval("");
} else {
sdn = slapi_sdn_new_dn_byref(base);
}
@@ -837,7 +837,7 @@ PRBool allow_operation (Slapi_PBlock *pb)
slapi_sdn_init(&sdn);
slapi_pblock_get (pb, SLAPI_TARGET_SDN, &sdnp);
if (NULL == sdnp) {
- slapi_sdn_init_dn_byval(&sdn,"");
+ slapi_sdn_init_ndn_byval(&sdn,"");
sdnp = &sdn;
}
diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c
index 03f8b95..f5bc0c2 100644
--- a/ldap/servers/slapd/schema.c
+++ b/ldap/servers/slapd/schema.c
@@ -4034,7 +4034,7 @@ init_schema_dse_ext(char *schemadir, Slapi_Backend *be,
}
*local_pschemadse = NULL;
- slapi_sdn_init_dn_byref(&schema,"cn=schema");
+ slapi_sdn_init_ndn_byref(&schema,"cn=schema");
/* get schemadir if not given */
if (NULL == schemadir)
diff --git a/ldap/servers/slapd/snmp_collator.c b/ldap/servers/slapd/snmp_collator.c
index 6a059b9..aeac7ae 100644
--- a/ldap/servers/slapd/snmp_collator.c
+++ b/ldap/servers/slapd/snmp_collator.c
@@ -887,7 +887,7 @@ getConfigEntry( Slapi_Entry **e ) {
Slapi_DN sdn;
/* SNMP_CONFIG_DN: no need to be normalized */
- slapi_sdn_init_dn_byref( &sdn, SNMP_CONFIG_DN );
+ slapi_sdn_init_normdn_byref( &sdn, SNMP_CONFIG_DN );
slapi_search_internal_get_entry( &sdn, NULL, e,
plugin_get_default_component_id());
slapi_sdn_done( &sdn );
12 years, 3 months
Changes to 'refs/tags/389-admin-1.1.26'
by Richard Allen Megginson
Changes since 389-admin-1.1.11:
Endi S. Dewata (3):
Bug 573889 - Migration does not remove deprecated schema
Bug 644929 - FDS to 389 DS migration results in both Fedora and 389 entries
Bug 470576 - Migration could do addition checks before commiting actions
Nathan Kinder (42):
Bug 648949 - Merge selinux policy into base OS
Regenerated autoconf files
Bug 638511 - dirsrv-admin crashes at startup with SELinux enabled
Bug 668950 - Add posix group support to Console
Bug 672468 - Don't use empty path elements in LD_LIBRARY_PATH
Bug 618897 - Wrong permissions when creating instance from Console
Bug 493424 - remove unneeded modules for admin server apache config
Bug 614690 - Don't use exec to call genrb
Bug 699815 - (cov#10859) Add missing braces in mod_admserv code
Bug 699815 - (cov#10858) getenv() called twice in viewlog cgi
Bug 699815 - (cov#10849,10851) Remove unused variables
Bug 699907 - (cov#10844) Uninitialized time struct
Bug 699907 - (cov#10843) Use of uninitialized variable in logging code
Bug 699907 - (cov#10840) Use of uninitialized buffer in security cgi
Bug 699907 - (cov#10836) Use of uninitialized var in http conn code
Bug 699907 - (cov#10833) Use of uninitialized vars in SNMP code
Bug 700532 - (cov#10832) Incorrect if condition in dsalib
Bug 700875 - (cov#10778) Cleanup ds_bring_up_server_install() in dsalib
Bug 700890 - (cov#10812) Check return value of open() properly in libadmin
Bug 700948 - (cov#10846) - Use of uninitialized variable in mod_admserv
Bug 700948 - (cov#10845) Use of uninitialized variable in mod_admserv
Bug 700948 - (cov#10839) Use of uninitialized variable in security cgi
Bug 700948 - (cov#10837) Use of uninitialized variable in monreplication
Bug 700948 - (cov#10835) Use of unitialized pointer in config cgi
Bug 700948 - (cov#10813) dynamic overrun possibility in ds_listdb cgi
Bug 700948 - (cov#10842) Use of unintialized variable in statusping
Bug 700948 - (cov#10842) Use of unintialized variable in statusping
Bug 702150 - (cov#10823) File descriptors leaked in help cgi
Bug 702150 - (cov#10822,10821) file descriptor leaks in config cgi
Bug 702150 - (cov#10820,10819) file descriptor leaks in readlog cgi
Bug 702150 - leak of config array in dsalib
Bug 702150 - (cov#10816) file descriptor leak in dsalib
Bug 702150 - (cov#10817) Leak of string in libdsa
Bug 702150 - Resouce leaks in htmladmin.c
Bug 702705 - (cov#10830) NULL pointer dereference in htmladmin
Bug 702705 - NULL pointer dereferences in viewlog cgi
Bug 702705 - (cov#10803) NULL pointer dereference in security cgi
Bug 702705 - (cov#10785) NULL pointer dereference in ds_snmpctrl
Bug 702705 - (cov#10784,10783) NULL pointer dereferences in dsalib
Bug 719056 - migrate-ds-admin.pl needs to update SELinux policy
Bug 724808 - startup CGIs write temp file to /
Bug 730079 - Update SELinux policy during upgrades
Noriko Hosoi (12):
Bug 151705 - Need to update Console Cipher Preferences with new ciphers
start-ds-admin.in -- replaced "return 1" with "exit 1"
Bug 616260 - libds-admin-serv linking fails due to unresolved link-time dependencies
Bug 618858 - move start-ds-admin env file into main admin server
Bug 387981 - plain files can be chosen on the Restore Directory dialog
Bug 604881 - admin server log files have incorrect permissions/ownerships
Bug 604881 - admin server log files have incorrect permissions/ownerships
Bug 245278 - Changing to a password with a single quote does not work
Bug 211296 - Clean up all HTML pages (Admin Express, Repl Monitor, etc)
Bug 158926 - Unable to install CA certificate when using
Bug 476925 - Admin Server: Do not allow 8-bit passwords for the admin user
Bug 476925 - Admin Server: Do not allow 8-bit passwords for
Rich Megginson (46):
bump version to 1.1.12.a1
initial support for openldap
add selinux policy for dsgw
skip LD_PRELOAD if using openldap
add more log information if nss init fails
add even more nss debugging
Bug 618454 - mod_admserv should only clear NSS caches and shutdown if NSS is initialized
bump version to 1.1.12.a2
fix building with mozldap
bump version to 1.1.12.a3
fix autotool build issues with properties files
setup-ds-admin.pl -u exits with ServerAdminID and as_uid related error
Bug 656441 - Missing library path entry causes LD_PRELOAD error
bump version to 1.1.13
bump version to 1.1.14.a1
Bug 664671 - Admin server segfault when full SSL access (http+ldap+console) required
bump version to 1.1.14
bump version to 1.1.15
bump version to 1.1.16
Bug 703990 - Support upgrade from Red Hat Directory Server
bump version to 1.1.17
add support for different skins
skip rebranding current brand
bump version to 1.1.18
look for separate openldap ldif library
bump version to 1.1.19
Bug 710372 - Not able to open the Manage Certificate from DS-console
better NSS error handling - reduce memory leaks
fix typo in NSS_Shutdown warning message
added tests for the security cgi
Bug 713000 - Migration stops if old admin server cannot be stopped
Bug 718079 - Perl errors when running migrate-ds-admin.pl
Bug 718285 - AdminServer should use "service" command instead of start/stop/restart scripts
bump version to 1.1.20
bump version to 1.1.21
handle binary upgrade
add man pages for ds_removal and ds_unregister
bump version to 1.1.22
fix binary paths
bump version to 1.1.23
bump version to 1.1.24
Bug 695741 - Providing native systemd file for upcoming F16 Feature Systemd
Bug 740959 - 389-console put CA certificates into wrong database
bump version to 1.1.25
Bug 767823 - selinux: need to allow admin server to connect to ldap port
bump version to 1.1.26
---
Makefile.am | 104
Makefile.in | 1444
VERSION.sh | 4
aclocal.m4 | 6991 ---
admserv/cfgstuff/httpd-2.2.conf.in | 13
admserv/cfgstuff/httpd.conf.in | 2
admserv/cfgstuff/initconfig.in | 5
admserv/cfgstuff/start-ds-admin.in | 83
admserv/cgi-ds/ds_listdb.c | 26
admserv/cgi-ds/ds_snmpctrl.c | 5
admserv/cgi-src40/ReadLog.c | 18
admserv/cgi-src40/admlib.mk | 119
admserv/cgi-src40/admpw.c | 70
admserv/cgi-src40/cgicommon.h | 1
admserv/cgi-src40/cgicommon.properties | 3
admserv/cgi-src40/config.c | 20
admserv/cgi-src40/dllglue.c | 42
admserv/cgi-src40/ds_create.in | 6
admserv/cgi-src40/dsconfig.c | 9
admserv/cgi-src40/head.html | 1
admserv/cgi-src40/help.c | 15
admserv/cgi-src40/htmladmin.c | 677
admserv/cgi-src40/htmladmin.properties | 42
admserv/cgi-src40/monreplication.c | 6
admserv/cgi-src40/repl-monitor-cgi.pl.in | 37
admserv/cgi-src40/restartsrv.c | 8
admserv/cgi-src40/sec-activate.c | 21
admserv/cgi-src40/security.c | 196
admserv/cgi-src40/statpingserv.c | 15
admserv/cgi-src40/stopsrv.c | 5
admserv/cgi-src40/ugdsconfig.c | 38
admserv/cgi-src40/viewdata.c | 152
admserv/cgi-src40/viewdata.properties | 2
admserv/cgi-src40/viewlog.c | 66
admserv/cgi-src40/viewlog.properties | 6
admserv/genrb_wrapper.sh | 2
admserv/html/admserv.html.in | 11
admserv/html/htmladmin.html.in | 13
admserv/html/monreplication.html | 20
admserv/html/viewdata.html | 6
admserv/html/viewlog.html | 14
admserv/makeUpgradeTar.sh | 30
admserv/newinst/src/25changefedorato389.pl | 250
admserv/newinst/src/25rebrand.pl.in | 413
admserv/newinst/src/30updateglobalpref.pl.in | 9
admserv/newinst/src/AdminMigration.pm.in | 79
admserv/newinst/src/AdminServer.pm.in | 141
admserv/newinst/src/AdminUtil.pm.in | 78
admserv/newinst/src/ConfigDSDialogs.pm | 30
admserv/newinst/src/dirserver.map.in | 1
admserv/newinst/src/setup-ds-admin.res.in | 3
admserv/schema/ldif/02globalpreferences.ldif.tmpl | 49
admserv/schema/ldif/10dsdata.ldif.tmpl | 39
compile | 21
config.guess | 302
config.h.in | 24
config.sub | 232
configure |40598 ++++++++++------------
configure.ac | 106
depcomp | 172
include/libadmin/libadmin.h | 64
include/libdsa/dsalib.h | 13
install-sh | 517
lib/libadmin/dllglue.c | 77
lib/libadmin/httpcon.c | 2
lib/libadmin/referer.c | 4
lib/libadmin/template.c | 29
lib/libadmin/util.c | 738
lib/libdsa/dsalib_conf.c | 37
lib/libdsa/dsalib_confs.c | 77
lib/libdsa/dsalib_location.c | 46
lib/libdsa/dsalib_tailf.c | 1
lib/libdsa/dsalib_updown.c | 74
lib/libdsa/dsalib_util.c | 13
ltmain.sh |13199 +++----
m4/mozldap.m4 | 116
m4/openldap.m4 | 138
m4/selinux.m4 | 3
man/man8/ds_removal.8 | 54
man/man8/ds_unregister.8 | 48
man/man8/restart-ds-admin.8 | 10
man/man8/start-ds-admin.8 | 10
man/man8/stop-ds-admin.8 | 10
missing | 104
mod_admserv/mod_admserv.c | 178
mod_admserv/mod_admserv.h | 15
mod_restartd/mod_restartd-2.2.c | 2
selinux/dirsrv-admin.fc.in | 5
selinux/dirsrv-admin.te | 2
tests/ds_create/testget.1 | 2
tests/htmladmin/testget.2 | 2
tests/htmladmin/testget.3 | 2
tests/htmladmin/testget.4 | 2
tests/htmladmin/testget.5 | 2
tests/htmladmin/testget.6 | 2
tests/htmladmin/testget.7 | 2
tests/htmladmin/testget.8 | 2
tests/security/testpost.1 | 1
tests/security/testpost.10 | 1
tests/security/testpost.11 | 1
tests/security/testpost.12 | 1
tests/security/testpost.13 | 1
tests/security/testpost.14 | 1
tests/security/testpost.15 | 1
tests/security/testpost.16 | 1
tests/security/testpost.17 | 1
tests/security/testpost.18 | 1
tests/security/testpost.19 | 1
tests/security/testpost.2 | 1
tests/security/testpost.20 | 1
tests/security/testpost.21 | 1
tests/security/testpost.3 | 1
tests/security/testpost.4 | 1
tests/security/testpost.5 | 1
tests/security/testpost.6 | 1
tests/security/testpost.7 | 1
tests/security/testpost.8 | 1
tests/security/testpost.9 | 1
tests/setup.sh | 250
tests/ugdsconfig/testget.10 | 2
tests/viewdata/testget.2 | 2
tests/viewdata/testget.3 | 2
tests/viewdata/testget.4 | 2
tests/viewlog/testget.3 | 2
tests/viewlog/testget.4 | 2
wrappers/systemd.service.in | 24
126 files changed, 32931 insertions(+), 35873 deletions(-)
---
12 years, 3 months
VERSION.sh
by Richard Allen Megginson
VERSION.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 8a198a1474e9d843ce318f3a7b4505896e816f70
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Wed Jan 25 08:13:19 2012 -0700
bump version to 1.1.26
diff --git a/VERSION.sh b/VERSION.sh
index 699116d..9c97174 100644
--- a/VERSION.sh
+++ b/VERSION.sh
@@ -11,7 +11,7 @@ vendorurl=http://port389.org
# PACKAGE_VERSION is constructed from these
VERSION_MAJOR=1
VERSION_MINOR=1
-VERSION_MAINT=25
+VERSION_MAINT=26
# if this is a PRERELEASE, set VERSION_PREREL
# otherwise, comment it out
# be sure to include the dot prefix in the prerel
12 years, 3 months
ldap/servers
by Noriko Hosoi
ldap/servers/slapd/daemon.c | 35 +++++++++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
New commits:
commit 9760c1c05179f04702fcb9c97feda200fbc52ac0
Author: Noriko Hosoi <nhosoi(a)jiji.usersys.redhat.com>
Date: Tue Jan 24 11:59:51 2012 -0800
Trac Ticket #52 - FQDN set to nsslapd-listenhost
makes the server start fail if
IPv4-mapped-IPv6 address is given
https://fedorahosted.org/389/ticket/52
Fix description: Added a code to check netaddr is duplicated or
not. When the address is IPv4-mapped-IPv6, cut the IPv4 part
out of the address and use it to compare.
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index a6ed94f..3333e8a 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -2776,18 +2776,49 @@ slapd_listenhost2addr(const char *listenhost, PRNetAddr ***addr)
slapd_pr_strerror(prerr));
rval = -1;
} else {
+ char **strnetaddrs = NULL;
*addr = (PRNetAddr **)slapi_ch_calloc(addrcnt + 1, sizeof (PRNetAddr *));
iter = NULL; /* from the beginning */
memset( netaddr, 0, sizeof( PRNetAddr ));
for ( i = 0; i < addrcnt; i++ ) {
+ char abuf[256];
+ char *abp = abuf;
iter = PR_EnumerateAddrInfo( iter, infop, 0, netaddr );
if ( NULL == iter ) {
break;
}
- (*addr)[i] = netaddr;
- netaddr = (PRNetAddr *)slapi_ch_calloc(1, sizeof(PRNetAddr));
+ /*
+ * Check if the netaddr is duplicated or not.
+ * IPv4 mapped IPv6 could be the identical to IPv4 addr.
+ */
+ netaddr2string(netaddr, abuf, sizeof(abuf));
+ if (PR_IsNetAddrType(netaddr, PR_IpAddrV4Mapped)) {
+ /* IPv4 mapped IPv6; redundant to IPv4;
+ * cut the "::ffff:" part. */
+ abp = strrchr(abuf, ':');
+ if (abp) {
+ abp++;
+ } else {
+ abp = abuf;
+ }
+ }
+ if (charray_inlist(strnetaddrs, abp)) {
+ LDAPDebug2Args(LDAP_DEBUG_ANY,
+ "slapd_listenhost2addr: "
+ "detected duplicated address %s "
+ "[%s]\n", abuf, abp);
+ } else {
+ LDAPDebug1Arg(LDAP_DEBUG_TRACE,
+ "slapd_listenhost2addr: "
+ "registering address %s\n", abp);
+ slapi_ch_array_add(&strnetaddrs, slapi_ch_strdup(abp));
+ (*addr)[i] = netaddr;
+ netaddr =
+ (PRNetAddr *)slapi_ch_calloc(1, sizeof(PRNetAddr));
+ }
}
slapi_ch_free((void **)&netaddr); /* not used */
+ slapi_ch_array_free(strnetaddrs);
}
PR_FreeAddrInfo( infop );
} else {
12 years, 3 months
VERSION.sh
by Richard Allen Megginson
VERSION.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 8d39bb6fc588a00dc5c687e1dc7cb2a95ab0c48f
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Tue Jan 24 14:04:56 2012 -0700
bump version to 1.2.10.rc1
diff --git a/VERSION.sh b/VERSION.sh
index a7e0680..9d058c3 100644
--- a/VERSION.sh
+++ b/VERSION.sh
@@ -14,7 +14,7 @@ VERSION_MAINT=10
# if this is a PRERELEASE, set VERSION_PREREL
# otherwise, comment it out
# be sure to include the dot prefix in the prerel
-VERSION_PREREL=.a8
+VERSION_PREREL=.rc1
# NOTES on VERSION_PREREL
# use aN for an alpha release e.g. a1, a2, etc.
# use rcN for a release candidate e.g. rc1, rc2, etc.
12 years, 3 months