[GRASS-SVN] r54264 - grass/trunk/lib/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Dec 11 05:29:20 PST 2012
Author: glynn
Date: 2012-12-11 05:29:19 -0800 (Tue, 11 Dec 2012)
New Revision: 54264
Modified:
grass/trunk/lib/gis/mapset_msc.c
Log:
Allow mapset ownership test to be skipped
Modified: grass/trunk/lib/gis/mapset_msc.c
===================================================================
--- grass/trunk/lib/gis/mapset_msc.c 2012-12-10 10:32:07 UTC (rev 54263)
+++ grass/trunk/lib/gis/mapset_msc.c 2012-12-11 13:29:19 UTC (rev 54264)
@@ -88,6 +88,22 @@
return G__make_mapset_element(buf);
}
+static int check_owner(const STRUCT_STAT *info)
+{
+#if defined(__MINGW32__) || defined(SKIP_MAPSET_OWN_CHK)
+ return 1;
+#else
+ const char *check = getenv("GRASS_SKIP_MAPSET_OWNER_CHECK");
+ if (check && *check)
+ return 1;
+ if (info->st_uid != getuid())
+ return 0;
+ if (info->st_uid != geteuid())
+ return 0;
+ return 1;
+#endif
+}
+
/*!
\brief Check for user mapset permission
@@ -109,12 +125,8 @@
if (!S_ISDIR(info.st_mode))
return -1;
-#ifndef __MINGW32__
- if (info.st_uid != getuid())
+ if (!check_owner(&info))
return 0;
- if (info.st_uid != geteuid())
- return 0;
-#endif
return 1;
}
@@ -143,16 +155,8 @@
if (!S_ISDIR(info.st_mode))
return -1;
-#ifndef SKIP_MAPSET_OWN_CHK
-
-#ifndef __MINGW32__
- if (info.st_uid != getuid())
+ if (!check_owner(&info))
return 0;
- if (info.st_uid != geteuid())
- return 0;
-#endif
-#endif
-
return 1;
}
More information about the grass-commit
mailing list