aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorPaul Eggert2017-03-12 12:04:10 -0700
committerPaul Eggert2017-03-12 12:04:10 -0700
commit995be66f0f0d26d1a96cbb8dfb429c3941157771 (patch)
treebdfcd011288f3ee5ca2ae228c5830f8d11b9f41f /lisp
parentf7040f5b1615162845c84f41125f008a5eb604f3 (diff)
downloademacs-995be66f0f0d26d1a96cbb8dfb429c3941157771.tar.gz
emacs-995be66f0f0d26d1a96cbb8dfb429c3941157771.zip
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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/play/gamegrid.el29
1 files changed, 10 insertions, 19 deletions
diff --git a/lisp/play/gamegrid.el b/lisp/play/gamegrid.el
index b0ccbd3b63d..0386a89b3a4 100644
--- a/lisp/play/gamegrid.el
+++ b/lisp/play/gamegrid.el
@@ -475,17 +475,19 @@ FILE is created there."
475;; update FILE. This is for the case that a user has installed 475;; update FILE. This is for the case that a user has installed
476;; a game on her own. 476;; a game on her own.
477;; 477;;
478;; 4. "update-game-score" is not setgid/setuid. Use it to 478;; 4. "update-game-score" does not exist or is not setgid/setuid.
479;; create/update FILE in the user's home directory. There is 479;; Create/update FILE in the user's home directory, without
480;; presumably no shared game directory. 480;; using "update-game-score". There is presumably no shared
481;; game directory.
481 482
482(defvar gamegrid-shared-game-dir) 483(defvar gamegrid-shared-game-dir)
483 484
484(defun gamegrid-add-score-with-update-game-score (file score) 485(defun gamegrid-add-score-with-update-game-score (file score)
485 (let ((gamegrid-shared-game-dir 486 (let ((gamegrid-shared-game-dir
486 (not (zerop (logand (file-modes 487 (not (zerop (logand (or (file-modes
487 (expand-file-name "update-game-score" 488 (expand-file-name "update-game-score"
488 exec-directory)) 489 exec-directory))
490 0)
489 #o6000))))) 491 #o6000)))))
490 (cond ((file-name-absolute-p file) 492 (cond ((file-name-absolute-p file)
491 (gamegrid-add-score-insecure file score)) 493 (gamegrid-add-score-insecure file score))
@@ -497,23 +499,12 @@ FILE is created there."
497 (expand-file-name file shared-game-score-directory) score)) 499 (expand-file-name file shared-game-score-directory) score))
498 ;; Else: Add the score to a score file in the user's home 500 ;; Else: Add the score to a score file in the user's home
499 ;; directory. 501 ;; directory.
500 (gamegrid-shared-game-dir
501 ;; If `gamegrid-shared-game-dir' is non-nil, then
502 ;; "update-gamescore" program is setuid, so don't use it.
503 (unless (file-exists-p
504 (directory-file-name gamegrid-user-score-file-directory))
505 (make-directory gamegrid-user-score-file-directory t))
506 (gamegrid-add-score-insecure file score
507 gamegrid-user-score-file-directory))
508 (t 502 (t
509 (unless (file-exists-p 503 (unless (file-exists-p
510 (directory-file-name gamegrid-user-score-file-directory)) 504 (directory-file-name gamegrid-user-score-file-directory))
511 (make-directory gamegrid-user-score-file-directory t)) 505 (make-directory gamegrid-user-score-file-directory t))
512 (let ((f (expand-file-name file 506 (gamegrid-add-score-insecure file score
513 gamegrid-user-score-file-directory))) 507 gamegrid-user-score-file-directory)))))
514 (unless (file-exists-p f)
515 (write-region "" nil f nil 'silent nil 'excl))
516 (gamegrid-add-score-with-update-game-score-1 file f score))))))
517 508
518(defun gamegrid-add-score-with-update-game-score-1 (file target score) 509(defun gamegrid-add-score-with-update-game-score-1 (file target score)
519 (let ((default-directory "/") 510 (let ((default-directory "/")