97 |
This variable is local to each buffer.") |
This variable is local to each buffer.") |
98 |
(make-variable-buffer-local 'tramp-smb-share-cache) |
(make-variable-buffer-local 'tramp-smb-share-cache) |
99 |
|
|
100 |
|
(defvar tramp-smb-process-running nil |
101 |
|
"Flag whether a corresponding process is still running. |
102 |
|
Will be changed by corresponding `process-sentinel'. |
103 |
|
This variable is local to each buffer.") |
104 |
|
(make-variable-buffer-local 'tramp-smb-process-running) |
105 |
|
|
106 |
;; New handlers should be added here. |
;; New handlers should be added here. |
107 |
(defconst tramp-smb-file-name-handler-alist |
(defconst tramp-smb-file-name-handler-alist |
108 |
'( |
'( |
940 |
(tramp-message 9 "Started process %s" (process-command p)) |
(tramp-message 9 "Started process %s" (process-command p)) |
941 |
(process-kill-without-query p) |
(process-kill-without-query p) |
942 |
(set-buffer buffer) |
(set-buffer buffer) |
943 |
(setq tramp-smb-share share) |
(set-process-sentinel |
944 |
|
p (lambda (proc str) (setq tramp-smb-process-running nil))) |
945 |
|
; If no share is given, the process will terminate |
946 |
|
(setq tramp-smb-process-running share |
947 |
|
tramp-smb-share share) |
948 |
|
|
949 |
; send password |
; send password |
950 |
(when real-user |
(when real-user |
956 |
(error "Cannot open connection //%s@%s/%s" |
(error "Cannot open connection //%s@%s/%s" |
957 |
user host (or share ""))))))) |
user host (or share ""))))))) |
958 |
|
|
959 |
;; We don't use timeouts. If needed, the caller shall warap around. |
;; We don't use timeouts. If needed, the caller shall wrap around. |
960 |
(defun tramp-smb-wait-for-output (user host) |
(defun tramp-smb-wait-for-output (user host) |
961 |
"Wait for output from smbclient command. |
"Wait for output from smbclient command. |
962 |
Sets position to begin of buffer. |
Sets position to begin of buffer. |
963 |
Returns nil if no error message has appeared." |
Returns nil if no error message has appeared." |
964 |
(save-excursion |
(save-excursion |
965 |
(let ((proc (get-buffer-process (current-buffer))) |
(let ((proc (get-buffer-process (current-buffer))) |
966 |
found err) |
(found (progn (goto-char (point-max)) |
967 |
|
(beginning-of-line) |
968 |
|
(looking-at tramp-smb-prompt))) |
969 |
|
err) |
970 |
(save-match-data |
(save-match-data |
971 |
;; Algorithm: get waiting output. See if last line contains |
;; Algorithm: get waiting output. See if last line contains |
972 |
;; tramp-smb-prompt sentinel, or process has exited. |
;; tramp-smb-prompt sentinel, or process has exited. |
973 |
;; If not, wait a bit and again get waiting output. |
;; If not, wait a bit and again get waiting output. |
974 |
(while (and (not found) |
(while (and (not found) tramp-smb-process-running) |
975 |
proc (processp proc) |
(accept-process-output proc) |
|
(memq (process-status proc) '(run open))) |
|
|
(accept-process-output proc 10) |
|
976 |
(goto-char (point-max)) |
(goto-char (point-max)) |
977 |
(beginning-of-line) |
(beginning-of-line) |
978 |
(setq found (looking-at tramp-smb-prompt))) |
(setq found (looking-at tramp-smb-prompt))) |
980 |
;; There might be pending output. If tramp-smb-prompt sentinel |
;; There might be pending output. If tramp-smb-prompt sentinel |
981 |
;; hasn't been found, the process has died already. We should |
;; hasn't been found, the process has died already. We should |
982 |
;; give it a chance. |
;; give it a chance. |
983 |
(when (not found) |
(when (not found) (accept-process-output nil 1)) |
|
(if (and proc (processp proc)) |
|
|
(accept-process-output proc 1) |
|
|
(accept-process-output nil 1))) |
|
984 |
|
|
985 |
;; Search for errors. |
;; Search for errors. |
986 |
(goto-char (point-min)) |
(goto-char (point-min)) |
1080 |
;; * Provide a local smb.conf. The default one might not be readable. |
;; * Provide a local smb.conf. The default one might not be readable. |
1081 |
;; * Error handling in case password is wrong. |
;; * Error handling in case password is wrong. |
1082 |
;; * Read password from "~/.netrc". |
;; * Read password from "~/.netrc". |
|
;; * `tramp-smb-wait-for-output' has problems with Emacs 20.7 (when process |
|
|
;; has died). To be investigated further. |
|
1083 |
;; * Use different buffers for different shares. By this, the password |
;; * Use different buffers for different shares. By this, the password |
1084 |
;; won't be requested again when changing shares on the same host. |
;; won't be requested again when changing shares on the same host. |
1085 |
;; * Return more comprehensive file permission string. Think whether it is |
;; * Return more comprehensive file permission string. Think whether it is |
1086 |
;; possible to implement `set-file-modes'. |
;; possible to implement `set-file-modes'. |
1087 |
;; * Handle WILDCARD and FULL-DIRECTORY-P in |
;; * Handle WILDCARD and FULL-DIRECTORY-P in |
1088 |
;; `tramp-smb-handle-insert-directory'. Remove workaround returning "". |
;; `tramp-smb-handle-insert-directory'. |
1089 |
|
;; * Handle links (FILENAME.LNK). |
1090 |
;; * Maybe local tmp files should have the same extension like the original |
;; * Maybe local tmp files should have the same extension like the original |
1091 |
;; files. Strange behaviour with jka-compr otherwise? |
;; files. Strange behaviour with jka-compr otherwise? |
1092 |
;; * Copy files in dired from SMB to another method doesn't work. |
;; * Copy files in dired from SMB to another method doesn't work. |
1093 |
;; * Try to remove the inclusion of dummy "" directory. Seems to be at |
;; * Try to remove the inclusion of dummy "" directory. Seems to be at |
1094 |
;; several places, now. |
;; several places, especially in `tramp-smb-handle-insert-directory'. |
1095 |
;; * Provide variables for debug. |
;; * Provide variables for debug. |
1096 |
;; * (RMS) Use unwind-protect to clean up the state so as to make the state |
;; * (RMS) Use unwind-protect to clean up the state so as to make the state |
1097 |
;; regular again. |
;; regular again. |