1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Install update-game-score only on request

Most distributions do not install update-game-score properly
due to setuid/setgid complications, so install it only when
the installer specifies a user or group (Bug#25895).
* .gitattributes: Remove lib-src/update-game-score.exe.manifest.
* Makefile.in (gameuser, gamegroup, use_gamedir, PATH_GAME):
New vars.
(epaths-force): Use PATH_GAME.
(uninstall): Remove snake-scores and tetris-scores only if shared.
* configure.ac: Default --with-gameuser to 'no'.
(UPDATE_MANIFEST): Remove.
* etc/NEWS: Mention this.
* lib-src/Makefile.in (UPDATE_MANIFEST): Remove.
(use_gamedir): New macro.
(UTILITIES): Remove update-game-score unless use_gamedir.
(SCRIPTS): Remove $(UPDATE_MANIFEST).
($(DESTDIR)${archlibdir}): Install game directory program and data
only if use_gamedir.
* lib-src/update-game-score.exe.manifest: Remove, as
update-game-score is no longer installed on MS-Windows.
* lisp/play/gamegrid.el (gamegrid-add-score-with-update-game-score):
Use auxiliary program only if setuid or setgid.
* make-dist: Do not distribute update-game-score.exe.manifest.
* src/callproc.c (init_callproc):
Set Vshared_game_score_directory based on PATH_GAME, not DOS_NT.
(syms_of_callproc): Remove unnecessary initialization of
Vshared_game_score_directory.
This commit is contained in:
Paul Eggert 2017-03-12 12:04:10 -07:00
parent f7040f5b16
commit 995be66f0f
9 changed files with 63 additions and 81 deletions

View file

@ -475,17 +475,19 @@ FILE is created there."
;; update FILE. This is for the case that a user has installed
;; a game on her own.
;;
;; 4. "update-game-score" is not setgid/setuid. Use it to
;; create/update FILE in the user's home directory. There is
;; presumably no shared game directory.
;; 4. "update-game-score" does not exist or is not setgid/setuid.
;; Create/update FILE in the user's home directory, without
;; using "update-game-score". There is presumably no shared
;; game directory.
(defvar gamegrid-shared-game-dir)
(defun gamegrid-add-score-with-update-game-score (file score)
(let ((gamegrid-shared-game-dir
(not (zerop (logand (file-modes
(expand-file-name "update-game-score"
exec-directory))
(not (zerop (logand (or (file-modes
(expand-file-name "update-game-score"
exec-directory))
0)
#o6000)))))
(cond ((file-name-absolute-p file)
(gamegrid-add-score-insecure file score))
@ -497,23 +499,12 @@ FILE is created there."
(expand-file-name file shared-game-score-directory) score))
;; Else: Add the score to a score file in the user's home
;; directory.
(gamegrid-shared-game-dir
;; If `gamegrid-shared-game-dir' is non-nil, then
;; "update-gamescore" program is setuid, so don't use it.
(unless (file-exists-p
(directory-file-name gamegrid-user-score-file-directory))
(make-directory gamegrid-user-score-file-directory t))
(gamegrid-add-score-insecure file score
gamegrid-user-score-file-directory))
(t
(unless (file-exists-p
(directory-file-name gamegrid-user-score-file-directory))
(make-directory gamegrid-user-score-file-directory t))
(let ((f (expand-file-name file
gamegrid-user-score-file-directory)))
(unless (file-exists-p f)
(write-region "" nil f nil 'silent nil 'excl))
(gamegrid-add-score-with-update-game-score-1 file f score))))))
(gamegrid-add-score-insecure file score
gamegrid-user-score-file-directory)))))
(defun gamegrid-add-score-with-update-game-score-1 (file target score)
(let ((default-directory "/")