summaryrefslogtreecommitdiff
path: root/lisp/net/tramp-smb.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2022-09-06 12:33:19 +0200
committerMichael Albinus <michael.albinus@gmx.de>2022-09-06 12:33:19 +0200
commit106456d01bd9b9ffe82c00c4b09a9094a603438e (patch)
treed22b880bfe42d350784bccd593e4e8a502435f08 /lisp/net/tramp-smb.el
parenteaca6378d2c4b94bc70a7979642502a80bfacd11 (diff)
downloademacs-106456d01bd9b9ffe82c00c4b09a9094a603438e.tar.gz
Use secondary groups when checking permissions in Tramp (Bug#57044)
* lisp/net/tramp.el (tramp-check-cached-permissions): Check also for secondary groups. (Bug#57044) (tramp-get-remote-groups): * lisp/net/tramp-adb.el (tramp-adb-handle-get-remote-groups): * lisp/net/tramp-sh.el (tramp-sh-handle-get-remote-groups): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-get-remote-groups): New defuns. * lisp/net/tramp.el (tramp-file-name-for-operation): * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): * lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist): * lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist): * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist): * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist): * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist): * lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist): Add `tramp-get-remote-groups'. * lisp/net/tramp.el: * lisp/net/tramp-adb.el: * lisp/net/tramp-cache.el: * lisp/net/tramp-crypt.el: * lisp/net/tramp-fuse.el: * lisp/net/tramp-gvfs.el: * lisp/net/tramp-integration.el: * lisp/net/tramp-rclone.el: * lisp/net/tramp-sh.el: * lisp/net/tramp-smb.el: * lisp/net/tramp-sudoedit.el: Use `blank' in `rx' forms. * test/lisp/net/tramp-archive-tests.el: * test/lisp/net/tramp-tests.el: Use `blank' in `rx' forms.
Diffstat (limited to 'lisp/net/tramp-smb.el')
-rw-r--r--lisp/net/tramp-smb.el49
1 files changed, 25 insertions, 24 deletions
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 3d65520282b..930f4f707bb 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -98,9 +98,9 @@ this variable \"client min protocol=NT1\"."
"Regexp of SMB server identification.")
(defconst tramp-smb-prompt
- (rx bol (| (: (| "smb:" "PS") space (+ nonl) "> ")
- (: (+ space) "Server"
- (+ space) "Comment" eol)))
+ (rx bol (| (: (| "smb:" "PS") blank (+ nonl) "> ")
+ (: (+ blank) "Server"
+ (+ blank) "Comment" eol)))
"Regexp used as prompt in smbclient or powershell.")
(defconst tramp-smb-wrong-passwd-regexp
@@ -110,10 +110,10 @@ this variable \"client min protocol=NT1\"."
(defconst tramp-smb-errors
(rx (| ;; Connection error / timeout / unknown command.
- (: "Connection" (? " to " (+ (not space))) " failed")
+ (: "Connection" (? " to " (+ (not blank))) " failed")
"Read from server failed, maybe it closed the connection"
"Call timed out: server did not respond"
- (: (+ (not space)) ": command not found")
+ (: (+ (not blank)) ": command not found")
"Server doesn't support UNIX CIFS calls"
(| ;; Samba.
"ERRDOS"
@@ -298,6 +298,7 @@ See `tramp-actions-before-shell' for more info.")
(temporary-file-directory . tramp-handle-temporary-file-directory)
(tramp-get-home-directory . tramp-smb-handle-get-home-directory)
(tramp-get-remote-gid . ignore)
+ (tramp-get-remote-groups . ignore)
(tramp-get-remote-uid . ignore)
(tramp-set-file-uid-gid . ignore)
(unhandled-file-name-directory . ignore)
@@ -884,28 +885,28 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
(while (not (eobp))
(cond
((looking-at
- (rx "Size:" (+ space) (group (+ digit)) (+ space)
- "Blocks:" (+ space) (+ digit) (+ space) (group (+ wordchar))))
+ (rx "Size:" (+ blank) (group (+ digit)) (+ blank)
+ "Blocks:" (+ blank) (+ digit) (+ blank) (group (+ wordchar))))
(setq size (string-to-number (match-string 1))
id (if (string-equal "directory" (match-string 2)) t
(if (string-equal "symbolic" (match-string 2)) ""))))
((looking-at
- (rx "Inode:" (+ space) (group (+ digit)) (+ space)
- "Links:" (+ space) (group (+ digit))))
+ (rx "Inode:" (+ blank) (group (+ digit)) (+ blank)
+ "Links:" (+ blank) (group (+ digit))))
(setq inode (string-to-number (match-string 1))
link (string-to-number (match-string 2))))
((looking-at
- (rx "Access:" (+ space)
- "(" (+ digit) "/" (group (+ (not space))) ")" (+ space)
- "Uid:" (+ space) (group (+ digit)) (+ whitespace)
- "Gid:" (+ space) (group (+ digit))))
+ (rx "Access:" (+ blank)
+ "(" (+ digit) "/" (group (+ (not blank))) ")" (+ blank)
+ "Uid:" (+ blank) (group (+ digit)) (+ blank)
+ "Gid:" (+ blank) (group (+ digit))))
(setq mode (match-string 1)
uid (match-string 2)
gid (match-string 3)))
((looking-at
- (rx "Access:" (+ space)
+ (rx "Access:" (+ blank)
(group (+ digit)) "-" (group (+ digit)) "-"
- (group (+ digit)) (+ space)
+ (group (+ digit)) (+ blank)
(group (+ digit)) ":" (group (+ digit)) ":"
(group (+ digit))))
(setq atime
@@ -917,9 +918,9 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
(string-to-number (match-string 2)) ;; month
(string-to-number (match-string 1))))) ;; year
((looking-at
- (rx "Modify:" (+ space)
+ (rx "Modify:" (+ blank)
(group (+ digit)) "-" (group (+ digit)) "-"
- (group (+ digit)) (+ space)
+ (group (+ digit)) (+ blank)
(group (+ digit)) ":" (group (+ digit)) ":"
(group (+ digit))))
(setq mtime
@@ -931,9 +932,9 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
(string-to-number (match-string 2)) ;; month
(string-to-number (match-string 1))))) ;; year
((looking-at
- (rx "Change:" (+ space)
+ (rx "Change:" (+ blank)
(group (+ digit)) "-" (group (+ digit)) "-"
- (group (+ digit)) (+ space)
+ (group (+ digit)) (+ blank)
(group (+ digit)) ":" (group (+ digit)) ":"
(group (+ digit))))
(setq ctime
@@ -1008,7 +1009,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
(goto-char (point-min))
(forward-line)
(when (looking-at
- (rx (* space) (group (+ digit))
+ (rx (* blank) (group (+ digit))
" blocks of size " (group (+ digit))
". " (group (+ digit)) " blocks available"))
(setq blocksize (string-to-number (match-string 2))
@@ -1660,7 +1661,7 @@ If VEC has no cifs capabilities, exchange \"/\" by \"\\\\\"."
(setq localname (replace-match "$" nil nil localname 1)))
;; A trailing space is not supported.
- (when (string-match-p (rx space eol) localname)
+ (when (string-match-p (rx blank eol) localname)
(tramp-error
vec 'file-error
"Invalid file name %s" (tramp-make-tramp-file-name vec localname)))
@@ -1853,9 +1854,9 @@ are listed. Result is the list (LOCALNAME MODE SIZE MTIME)."
;; localname.
(if (string-match
- (rx bol (+ space)
- (group (not space) (? (* nonl) (not space)))
- (* space) eol)
+ (rx bol (+ blank)
+ (group (not blank) (? (* nonl) (not blank)))
+ (* blank) eol)
line)
(setq localname (match-string 1 line))
(cl-return))))