[sword-cvs] sword/src/mgr filemgr.cpp,1.28,1.29 installmgr.cpp,1.13,1.14

sword@www.crosswire.org sword@www.crosswire.org
Thu, 7 Aug 2003 15:51:24 -0700


Update of /usr/local/cvsroot/sword/src/mgr
In directory www:/tmp/cvs-serv7710/src/mgr

Modified Files:
	filemgr.cpp installmgr.cpp 
Log Message:
Fixed permissions on installmgr


Index: filemgr.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/mgr/filemgr.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- filemgr.cpp	7 Jul 2003 23:32:33 -0000	1.28
+++ filemgr.cpp	7 Aug 2003 22:51:21 -0000	1.29
@@ -93,7 +93,7 @@
 
 
 FileDesc *FileMgr::open(const char *path, int mode, bool tryDowngrade) {
-	return open(path, mode, S_IREAD | S_IWRITE, tryDowngrade);
+	return open(path, mode, S_IREAD | S_IWRITE|S_IRGRP|S_IROTH, tryDowngrade);
 }
 
 FileDesc *FileMgr::open(const char *path, int mode, int perms, bool tryDowngrade) {
@@ -150,7 +150,7 @@
 		if (i == 9999)
 			return -2;
 
-		int fd = ::open(buf, O_CREAT|O_RDWR, S_IREAD|S_IWRITE);
+		int fd = ::open(buf, O_CREAT|O_RDWR, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
 		if (fd < 0)
 			return -3;
 	
@@ -162,7 +162,7 @@
 		}
 		// zero out the file
 		::close(file->fd);
-		file->fd = ::open(file->path, O_TRUNC, S_IREAD|S_IWRITE);
+		file->fd = ::open(file->path, O_TRUNC, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
 		::close(file->fd);
 		file->fd = -77;	// force file open by filemgr
 		// copy tmp file back (dumb, but must preserve file permissions)
@@ -309,10 +309,10 @@
 int FileMgr::createPathAndFile(const char *fName) {
 	int fd;
 	
-	fd = ::open(fName, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+	fd = ::open(fName, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
 	if (fd < 1) {
 		createParent(fName);
-		fd = ::open(fName, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
+		fd = ::open(fName, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
 	}
 	return fd;
 }

Index: installmgr.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/mgr/installmgr.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- installmgr.cpp	16 Jul 2003 12:26:09 -0000	1.13
+++ installmgr.cpp	7 Aug 2003 22:51:21 -0000	1.14
@@ -538,23 +538,23 @@
 						modFile += ent->d_name;
 						SWConfig *config = new SWConfig(modFile.c_str());
 						if (config->Sections.find(modName) != config->Sections.end()) {
-							delete config;
 							SWBuf targetFile = destMgr->configPath; //"./mods.d/";
 							targetFile += "/";
 							targetFile += ent->d_name;
 							FileMgr::copyFile(modFile.c_str(), targetFile.c_str());
 							if (cipher) {
-/*									
-								CipherForm->modName = modName;
-								CipherForm->confFile = targetFile;
-								if (CipherForm->ShowModal() == mrCancel) {
-									removeModule(modName);
+								if (getCipherCode(modName, config)) {
+									SWMgr newDest(destMgr->prefixPath);
+									removeModule(&newDest, modName);
 									aborted = true;
 								}
-*/											
+								else {
+									config->Save();
+									FileMgr::copyFile(modFile.c_str(), targetFile.c_str());
+								}
 							}
 						}
-						else	delete config;
+						delete config;
 					}
 				}
 				closedir(dir);
@@ -565,6 +565,11 @@
 	return 1;
 }
 
+
+// return aborted
+bool InstallMgr::getCipherCode(const char *modName, SWConfig *config) {
+	return false;
+}
 
 int InstallMgr::copyFileToSWORDInstall(SWMgr *manager, const char *sourceDir, const char *fName) {
 	SWBuf sourcePath = sourceDir;