[Tux4kids-commits] r394 - in tuxmath/trunk: doc src

tholy-guest at alioth.debian.org tholy-guest at alioth.debian.org
Wed Dec 26 19:31:55 UTC 2007


Author: tholy-guest
Date: 2007-12-26 19:31:55 +0000 (Wed, 26 Dec 2007)
New Revision: 394

Modified:
   tuxmath/trunk/doc/changelog
   tuxmath/trunk/src/fileops.c
Log:
More bugfixes in multiuser login: properly support homedir in global
configuration file (don't let a re-read stomp on previous settings),
and use unrestrictive permissions on saved files in a multiuser login
configuration.


Modified: tuxmath/trunk/doc/changelog
===================================================================
--- tuxmath/trunk/doc/changelog	2007-12-25 16:17:17 UTC (rev 393)
+++ tuxmath/trunk/doc/changelog	2007-12-26 19:31:55 UTC (rev 394)
@@ -1,3 +1,14 @@
+2007.Dec.26 (svn.debian.org/tux4kids - revision 394)
+    Code:
+      * More bugfixing in the new login system: now the system seems to
+	work if the homedir is specified in the global configuration file,
+	and in a multiuser setup file permissions are set to be
+	unrestrictive (so that a user can modify his/her own files no
+	matter how he/she is logged in).
+	
+    Tim Holy <holy at wustl.edu>
+
+
 2007.Dec.24 (svn.debian.org/tux4kids - revision 382-392)
     Code:
       * Fix bugs that came with the new login system, including: fix

Modified: tuxmath/trunk/src/fileops.c
===================================================================
--- tuxmath/trunk/src/fileops.c	2007-12-25 16:17:17 UTC (rev 393)
+++ tuxmath/trunk/src/fileops.c	2007-12-26 19:31:55 UTC (rev 394)
@@ -166,6 +166,7 @@
 #include <dirent.h>  /* for opendir() */
 #include <sys/stat.h>/* for mkdir() */
 #include <unistd.h>  /* for getcwd() */
+#include <sys/types.h> /* for umask() */
 
 /* Standard C includes: */
 #include <stdio.h>
@@ -984,8 +985,10 @@
     fp = NULL;
     return 1;
   }
-  else
+  else {
+    fprintf(stderr, "\nUnable to write goldstars file.\n");
     return 0;
+  }
 }
 
 
@@ -1231,8 +1234,12 @@
     printf("User data directory cannot be opened, there is a configuration error\n");
     printf("Continuing anyway without saving or loading individual settings.\n");
   }
-  else
+  else {
     closedir(dir);
+    // If we have multi-user logins, don't create restrictive
+    // permissions on new or rewritten files
+    umask(0x0);
+  }
 }
 
 
@@ -1381,7 +1388,7 @@
     else if(0 == strcasecmp(parameter, "homedir"))
     {
       /* Only let administrator change this setting */
-      if (file_type == GLOBAL_CONFIG_FILE)
+      if (file_type == GLOBAL_CONFIG_FILE && user_data_dir == NULL)
       {
 	/* Check to see whether the specified homedir exists */
 	if (opendir(value) == NULL)




More information about the Tux4kids-commits mailing list