Przeglądaj źródła

Resolves: bug 253047
Bug Description: Does not build on Fedora 8
Fix Description: If using the O_CREAT flag with open(), the file mode must also be given. Also, the bdb calls to use ->open() must use parentheses around the function pointer access e.g. (DB->open)(args...) instead of just DB->open(args).
Platforms tested: RHEL4, Fedora 8
Flag Day: no
Doc impact: no

Rich Megginson 18 lat temu
rodzic
commit
750fa2c4c2

+ 4 - 4
ldap/servers/slapd/back-ldbm/dbhelp.c

@@ -74,7 +74,7 @@ static int dblayer_copy_file_keybykey(DB_ENV *env, char *source_file_name, char
 		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_keybykey, Create error %d: %s\n", retval, db_strerror(retval), 0);
 		goto error;
 	}
-	retval = source_file->open(source_file, NULL, source_file_name, NULL, DB_UNKNOWN, DB_RDONLY, 0);
+	retval = (source_file->open)(source_file, NULL, source_file_name, NULL, DB_UNKNOWN, DB_RDONLY, 0);
 	if (retval) {
 		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_keybykey, Open error %d: %s\n", retval, db_strerror(retval), 0);
 		goto error;
@@ -113,7 +113,7 @@ static int dblayer_copy_file_keybykey(DB_ENV *env, char *source_file_name, char
 		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_keybykey, set_pagesize error %d: %s\n", retval, db_strerror(retval), 0);
 		goto error;
 	}
-	retval = destination_file->open(destination_file, NULL, destination_file_name, NULL, dbtype, DB_CREATE | DB_EXCL, mode);
+	retval = (destination_file->open)(destination_file, NULL, destination_file_name, NULL, dbtype, DB_CREATE | DB_EXCL, mode);
 	if (retval) {
 		LDAPDebug(LDAP_DEBUG_ANY, "dblayer_copy_file_keybykey, Open error %d: %s\n", retval, db_strerror(retval), 0);
 		goto error;
@@ -260,7 +260,7 @@ int dblayer_make_private_recovery_env(char *db_home_dir, dblayer_private *priv,
 	}
 	dblayer_set_env_debugging(ret_env, priv);
 
-	retval = ret_env->open(ret_env,db_home_dir, DB_INIT_TXN | DB_RECOVER_FATAL | DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE,0);
+	retval = (ret_env->open)(ret_env,db_home_dir, DB_INIT_TXN | DB_RECOVER_FATAL | DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE,0);
 	if (0 == retval) {
 		*env = ret_env;
 	} else {
@@ -292,7 +292,7 @@ int dblayer_make_private_simple_env(char *db_home_dir, DB_ENV **env)
 		goto error;
 	}
 
-	retval = ret_env->open(ret_env,db_home_dir,DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE,0);
+	retval = (ret_env->open)(ret_env,db_home_dir,DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE,0);
 	if (0 == retval) {
 		*env = ret_env;
 	} else {

+ 6 - 6
ldap/servers/slapd/back-ldbm/dblayer.c

@@ -102,11 +102,11 @@
 {                                                                              \
     if (((oflags) & DB_INIT_TXN) && ((oflags) & DB_INIT_LOG))                  \
     {                                                                          \
-        (rval) = (db)->open((db), (txnid), (file), (database), (type), (flags)|DB_AUTO_COMMIT, (mode)); \
+        (rval) = ((db)->open)((db), (txnid), (file), (database), (type), (flags)|DB_AUTO_COMMIT, (mode)); \
     }                                                                          \
     else                                                                       \
     {                                                                          \
-        (rval) = (db)->open((db), (txnid), (file), (database), (type), (flags), (mode)); \
+        (rval) = ((db)->open)((db), (txnid), (file), (database), (type), (flags), (mode)); \
     }                                                                          \
 }
 /* 608145: db4.1 and newer does not require exclusive lock for checkpointing 
@@ -1556,7 +1556,7 @@ int dblayer_start(struct ldbminfo *li, int dbmode)
             }
         }
 
-        return_value = pEnv->dblayer_DB_ENV->open(
+        return_value = (pEnv->dblayer_DB_ENV->open)(
                         pEnv->dblayer_DB_ENV,
                         region_dir,
                         recover_flags,
@@ -1612,7 +1612,7 @@ int dblayer_start(struct ldbminfo *li, int dbmode)
     if (!((DBLAYER_IMPORT_MODE|DBLAYER_INDEX_MODE) & dbmode))
     {
         pEnv->dblayer_openflags = open_flags;
-        return_value = pEnv->dblayer_DB_ENV->open(
+        return_value = (pEnv->dblayer_DB_ENV->open)(
             pEnv->dblayer_DB_ENV,
             region_dir,
             open_flags,
@@ -1940,7 +1940,7 @@ int dblayer_instance_start(backend *be, int mode)
             mypEnv->dblayer_openflags = oflags;
             data_directories[0] = inst->inst_parent_dir_name;
             dblayer_set_data_dir(priv, mypEnv, data_directories);
-            return_value = mypEnv->dblayer_DB_ENV->open(mypEnv->dblayer_DB_ENV,
+            return_value = (mypEnv->dblayer_DB_ENV->open)(mypEnv->dblayer_DB_ENV,
                                                        inst_dirp,
                                                        oflags,
                                                        priv->dblayer_file_mode);
@@ -2220,7 +2220,7 @@ int dblayer_get_aux_id2entry(backend *be, DB **ppDB, DB_ENV **ppEnv)
     mypEnv->dblayer_openflags = envflags;
     data_directories[0] = inst->inst_parent_dir_name;
     dblayer_set_data_dir(priv, mypEnv, data_directories);
-    rval = mypEnv->dblayer_DB_ENV->open(mypEnv->dblayer_DB_ENV,
+    rval = (mypEnv->dblayer_DB_ENV->open)(mypEnv->dblayer_DB_ENV,
             priv->dblayer_home_directory, envflags, priv->dblayer_file_mode);
     if (rval != 0)
     {

+ 1 - 1
ldap/servers/slapd/protect_db.c

@@ -116,7 +116,7 @@ grab_lockfile()
     t.tv_sec = 0;
     t.tv_usec = WAIT_TIME * 1000;
         for(x = 0; x < NUM_TRIES; x++) {
-            if ((fd = open(lockfile, O_RDWR | O_CREAT | O_EXCL)) != -1) {
+            if ((fd = open(lockfile, O_RDWR | O_CREAT | O_EXCL, 0664)) != -1) {
                 /* Got the lock */
                 write(fd, (void *) &pid, sizeof(pid_t));
         close(fd);