rpms/Maelstrom/devel Maelstrom-3.0.5-setgid.patch, NONE, 1.1 Maelstrom-3.0.6-gcc34.patch, NONE, 1.1 Maelstrom.spec, NONE, 1.1 maelstrom.png, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Bill Nottingham (notting) fedora-extras-commits at redhat.com
Mon May 23 20:45:14 UTC 2005


Author: notting

Update of /cvs/extras/rpms/Maelstrom/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv17637/devel

Modified Files:
	.cvsignore sources 
Added Files:
	Maelstrom-3.0.5-setgid.patch Maelstrom-3.0.6-gcc34.patch 
	Maelstrom.spec maelstrom.png 
Log Message:
auto-import Maelstrom-3.0.6-6 on branch devel from Maelstrom-3.0.6-6.src.rpm

Maelstrom-3.0.5-setgid.patch:

--- NEW FILE Maelstrom-3.0.5-setgid.patch ---
--- Maelstrom-3.0.5/scores.cpp.setgid	2000-09-24 13:55:39.000000000 -0400
+++ Maelstrom-3.0.5/scores.cpp	2002-08-23 00:12:01.000000000 -0400
@@ -6,6 +6,7 @@
 #ifdef unix
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <unistd.h>
 #endif
 #include <stdio.h>
 
@@ -19,7 +20,7 @@
 #define NUM_SCORES		10		// Do not change this!
 
 /* Everyone can write to scores file if defined to 0 */
-#define SCORES_PERMMASK		0
+#define SCORES_PERMMASK		646
 
 #define CLR_DIALOG_WIDTH	281
 #define CLR_DIALOG_HEIGHT	111
@@ -32,6 +33,7 @@
 	LibPath path;
 	SDL_RWops *scores_src;
 	int i;
+	gid_t priv_gid, user_gid;
 
 	/* Try to load network scores, if we can */
 	if ( gNetScores ) {
@@ -44,6 +46,14 @@
 	}
 	memset(&hScores, 0, sizeof(hScores));
 
+	priv_gid = sgid;
+	user_gid = getgid();
+
+	if (setregid(user_gid, priv_gid)) {
+	    error(
+	"Unable to set group ID to the effective group id. -- Exiting.\n");
+	    exit(1);
+	}
 	scores_src = SDL_RWFromFile(path.Path(MAELSTROM_SCORES), "rb");
 	if ( scores_src != NULL ) {
 		for ( i=0; i<NUM_SCORES; ++i ) {
@@ -54,6 +64,11 @@
 		}
 		SDL_RWclose(scores_src);
 	}
+	if (setegid(getgid())) {
+	    error(
+	"Unable to set group ID to that of the user. -- Exiting.\n");
+	    exit(1);
+	}
 }
 
 void SaveScores(void)
@@ -64,6 +79,7 @@
 #ifdef unix
 	int omask;
 #endif
+	gid_t user_gid, priv_gid;
 
 	/* Don't save network scores */
 	if ( gNetScores )
@@ -72,6 +88,15 @@
 #ifdef unix
 	omask=umask(SCORES_PERMMASK);
 #endif
+
+	priv_gid = sgid;
+	user_gid = getgid();
+
+	if (setregid(user_gid, priv_gid)) {
+	    error(
+	"Unable to set group ID to the effective group id. -- Exiting.\n");
+	    exit(1);
+	}
 	scores_src = SDL_RWFromFile(path.Path(MAELSTROM_SCORES), "wb");
 	if ( scores_src != NULL ) {
 		for ( i=0; i<NUM_SCORES; ++i ) {
@@ -85,6 +110,11 @@
 		error("Warning: Couldn't save scores to %s\n",
 						path.Path(MAELSTROM_SCORES));
 	}
+	if (setegid(getgid())) {
+	    error(
+	"Unable to set group ID to that of the user. -- Exiting.\n");
+	    exit(1);
+	}
 #ifdef unix
 	umask(omask);
 #endif
--- Maelstrom-3.0.5/main.cpp.setgid	2000-09-24 13:55:56.000000000 -0400
+++ Maelstrom-3.0.5/main.cpp	2002-08-22 23:56:05.000000000 -0400
@@ -11,6 +11,8 @@
 /* ------------------------------------------------------------- */
 
 #include "Maelstrom_Globals.h"
+#include <sys/types.h>
+#include <unistd.h>
 #include "buttonlist.h"
 #include "load.h"
 #include "fastrand.h"
@@ -28,6 +30,7 @@
 Bool	gUpdateBuffer;
 Bool	gRunning;
 int	gNoDelay;
+gid_t   sgid;
 
 // Local variables in this file...
 static ButtonList buttons;
@@ -176,6 +179,15 @@
 	SDL_Event event;
 	LibPath::SetExePath(argv[0]);
 
+	/* drop all group permissions and run as normal user.  We are SETGID
+	   for safe access to the high score file later. */
+	sgid = getegid();
+	if (setegid(getgid())) {
+	    error(
+	"Unable to set effective group ID to the group id. -- Exiting.\n");
+	    exit(1);
+	}
+
 #ifndef __WIN95__
 	/* The first thing we do is calculate our checksum */
 	(void) checksum();
--- Maelstrom-3.0.5/Maelstrom_Globals.h.setgid	2002-08-23 00:14:58.000000000 -0400
+++ Maelstrom-3.0.5/Maelstrom_Globals.h	2002-08-22 23:59:00.000000000 -0400
@@ -47,6 +47,7 @@
 extern Bool	gUpdateBuffer;
 extern Bool	gRunning;
 extern int	gNoDelay;
+extern gid_t    sgid;
 
 // in init.cc : 
 extern Sint32	gLastHigh;

Maelstrom-3.0.6-gcc34.patch:

--- NEW FILE Maelstrom-3.0.6-gcc34.patch ---
--- Maelstrom-3.0.6/buttonlist.h.sopwith	2004-06-18 15:33:49.000000000 -0400
+++ Maelstrom-3.0.6/buttonlist.h	2004-06-18 15:47:39.000000000 -0400
@@ -7,6 +7,13 @@
 class ButtonList {
 
 public:
+	typedef struct _button {
+		/* Sensitive area */
+		Uint16 x1, y1;
+		Uint16 x2, y2;
+		void (*callback)(void);
+		struct _button *next;
+	} button;
 	ButtonList() {
 		button_list.next = NULL;
 	}
@@ -16,7 +23,7 @@
 
 	void Add_Button(Uint16 x, Uint16 y, Uint16 width, Uint16 height, 
 						void (*callback)(void)) {
-		struct button *belem;
+		button *belem;
 		
 		for ( belem=&button_list; belem->next; belem=belem->next );
 		belem->next = new button;
@@ -30,7 +37,7 @@
 	}
 
 	void Activate_Button(Uint16 x, Uint16 y) {
-		struct button *belem;
+		button *belem;
 
 		for ( belem=button_list.next; belem; belem=belem->next ) {
 			if ( (x >= belem->x1) && (x <= belem->x2) &&
@@ -42,7 +49,7 @@
 	}
 
 	void Delete_Buttons(void) {
-		struct button *belem, *btemp;
+		button *belem, *btemp;
 
 		for ( belem=button_list.next; belem; ) {
 			btemp = belem;
@@ -53,12 +60,5 @@
 	}
 	
 private:
-	typedef struct button {
-		/* Sensitive area */
-		Uint16 x1, y1;
-		Uint16 x2, y2;
-		void (*callback)(void);
-		struct button *next;
-	} button;
 	button button_list;
 };


--- NEW FILE Maelstrom.spec ---
Summary: A space combat game.
Name: Maelstrom
Version: 3.0.6
Release: 6
License: LGPL
Group: Amusements/Games
Source0:   Maelstrom-%{version}.tar.gz
Source1:   maelstrom.png
Patch0: Maelstrom-3.0.5-setgid.patch
Patch1: Maelstrom-3.0.6-gcc34.patch
URL:       http://www.devolution.com/~slouken/Maelstrom/
BuildRoot: %{_tmppath}/Maelstrom-%{PACKAGE_VERSION}-root
BuildPrereq: SDL-devel, SDL_net-devel

%description
Maelstrom is a space combat game, originally ported from the Macintosh
platform. Brave pilots get to dodge asteroids and fight off other
ships at the same time.

%prep

%setup -q
%patch0 -p1 -b .setgid
%patch1 -p1 -b .gcc34

%build
touch Makefile.in
%configure

make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT
%makeinstall

mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications

cat > $RPM_BUILD_ROOT%{_datadir}/applications/net-Maelstrom.desktop << EOF
[Desktop Entry]
Name=Maelstrom
Comment=Space combat game
Exec=%{_bindir}/Maelstrom
Icon=maelstrom.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Application;Game;ArcadeGame;X-Red-Hat-Base;
EOF

# remove unpackaged files from the buildroot
rm -f $RPM_BUILD_ROOT%{_bindir}/{Maelstrom-netd,macres,playwave,snd2wav}

mkdir -p -m 755 $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/48x48/apps

install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/48x48/apps

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-, root, games)
%doc COPYING CREDITS README* Changelog Docs
%attr(2755,root,games) %{_bindir}/Maelstrom
%attr(0575,root,games) %dir %{_prefix}/games/Maelstrom
%config %attr(0060,root,games) %{_prefix}/games/Maelstrom/Maelstrom-Scores
%{_prefix}/games/Maelstrom/icon*
%{_prefix}/games/Maelstrom/Images
%{_prefix}/games/Maelstrom/Maelstrom_Fonts
%{_prefix}/games/Maelstrom/Maelstrom_Sounds
%{_prefix}/games/Maelstrom/Maelstrom_Sprites
%defattr(-, root, root)
%{_datadir}/applications/net-Maelstrom.desktop
%{_datadir}/icons

%changelog
* Tue Jun 15 2004 Elliot Lee <sopwith at redhat.com>
- rebuilt
- Add gcc34.patch

* Sun May 23 2004 Florian La Roche <Florian.LaRoche at redhat.de>
- make some files again owned by root

* Tue Mar 23 2004 Bill Nottingham <notting at redhat.com> 3.0.6-3
- make score file %config (#108386)
- move icon (#111583)

* Fri Feb 13 2004 Elliot Lee <sopwith at redhat.com>
- rebuilt

* Tue Sep 30 2003 Bill Nottingham <notting at redhat.com> 3.0.6-1
- tweak desktop file (#79668, #105792 <ville.skytta at iki.fi>)
- update to 3.0.6

* Wed Jun 04 2003 Elliot Lee <sopwith at redhat.com>
- rebuilt

* Tue Feb 18 2003 Bill Nottingham <notting at redhat.com> 3.0.5-8
- fix desktop (#81096)

* Wed Jan 22 2003 Tim Powers <timp at redhat.com>
- rebuilt

* Thu Dec 12 2002 Tim Powers <timp at redhat.com> 3.0.5-6
- remove unpackaged files from the buildroot

* Fri Aug 23 2002 Tim Powers <timp at redhat.com>
- bump release number and rebuild

* Thu Aug 22 2002 Preston Brown <pbrown at redhat.com>
- set maelstrom to setgid and access high score file safely (#70768)
- BuildReq on SDL_net-devel (#69105)

* Sat Aug 10 2002 Elliot Lee <sopwith at redhat.com>
- rebuilt with gcc-3.2 (we hope)

* Tue Jul 23 2002 Tim Powers <timp at redhat.com> 3.0.5-2
- build using gcc-3.2-0.1

* Mon Jun 24 2002 Bill Nottingham <notting at redhat.com> 3.0.5-1
- update to 3.0.5

* Fri Jun 21 2002 Tim Powers <timp at redhat.com>
- automated rebuild

* Thu May 23 2002 Tim Powers <timp at redhat.com>
- automated rebuild

* Fri Jan 25 2002 Bill Nottingham <notting at redhat.com>
- rebuild

* Wed Sep 12 2001 Tim Powers <timp at redhat.com>
- rebuild with new gcc and binutils

* Tue Jul 10 2001 Elliot Lee <sopwith at redhat.com>
- Rebuild to remove libXv/libXxf86dga deps

* Mon Jun 25 2001 Bill Nottingham <notting at redhat.com>
- add buildprereq (#44884)

* Tue Jun 12 2001 Nalin Dahyabhai <nalin at redhat.com>
- rebuild in new environment

* Mon May  7 2001 Bill Nottingham <notting at redhat.com>
- fix some prototypes in the network daemon
- rebuild against fixed SDL (#24119)

* Mon Apr 30 2001 Bill Nottingham <notting at redhat.com>
- use official tarball, fixes a minor /tmp issue (#38393)

* Fri Apr 27 2001 Bill Nottingham <notting at redhat.com>
- rebuild for C++ exception handling on ia64

* Mon Mar 12 2001 Bill Nottingham <notting at redhat.com>
- move desktop file to /etc/X11/applnk (#31492)

* Tue Feb 27 2001 Bill Nottingham <notting at redhat.com>
- fix Packager: tag

* Fri Dec  1 2000 Bill Nottingham <notting at redhat.com>
- Maelstrom is cool. Let's put it in the base distro.

* Mon Jul 24 2000 Prospector <prospector at redhat.com>
- rebuilt

* Mon Jul 10 2000 Tim Powers <timp at redhat.com>
- rebuilt

* Wed Jul 05 2000 Tim Powers <timp at redhat.com>
- cleaned up spec file, shoudln't try to install files in the post or preun
  sections
- use %%configure and %%makeinstall
- use predefined RPM macros whenever possible
- don't use redundant defines at top of spec
- patched to buld with gcc-2.96

* Mon Apr 24 2000 Tim Powers <timp at redhat.com>
- rebuilt for 7.0

* Tue Feb 08 2000 Tim Powers <timp at redhat.com>
- strip binaries

* Fri Jan 28 2000 Tim Powers <timp at redhat.com>
- changed to valid group

* Wed Dec  8 1999 Bill Nottingham <notting at redhat.com>
- don't echo in %pre/%post, don't add desktop entries to $HOME

* Tue Sep 21 1999 Sam Lantinga <slouken at devolution.com>

- first attempt at a spec file



Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/Maelstrom/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	23 May 2005 20:41:22 -0000	1.1
+++ .cvsignore	23 May 2005 20:45:11 -0000	1.2
@@ -0,0 +1 @@
+Maelstrom-3.0.6.tar.gz


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/Maelstrom/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	23 May 2005 20:41:22 -0000	1.1
+++ sources	23 May 2005 20:45:11 -0000	1.2
@@ -0,0 +1 @@
+8aab0e75ca52808fd6777535ebb1f1c4  Maelstrom-3.0.6.tar.gz




More information about the fedora-extras-commits mailing list