/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to dracut-module/password-agent.c

  • Committer: Teddy Hogeborn
  • Date: 2022-04-23 23:58:39 UTC
  • Revision ID: teddy@recompile.se-20220423235839-cnt9aq1kjveqaydc
Bug fix in mandos-ctl: handle backslashes in password

* mandos-ctl (mode=password): When sending the password to gpg, use
  "printf" instead of "echo -n".  This avoids the behavior of the
  "echo" builtin in "dash", which always interprets backslash escape
  codes.

Reported-By: Jesse Norell <jesse@kci.net>

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- coding: utf-8; lexical-binding: t -*- */
 
1
/* -*- mode: c; coding: utf-8; after-save-hook: (lambda () (let* ((find-build-directory (lambda (try-directory &optional base-directory) (let ((base-directory (or base-directory try-directory))) (cond ((equal try-directory "/") base-directory) ((file-readable-p (concat (file-name-as-directory try-directory) "Makefile")) try-directory) ((funcall find-build-directory (directory-file-name (file-name-directory try-directory)) base-directory)))))) (build-directory (funcall find-build-directory (buffer-file-name))) (local-build-directory (if (fboundp 'file-local-name) (file-local-name build-directory) (or (file-remote-p build-directory 'localname) build-directory))) (command (file-relative-name (file-name-sans-extension (buffer-file-name)) build-directory))) (pcase (progn (if (get-buffer "*Test*") (kill-buffer "*Test*")) (process-file-shell-command (let ((qbdir (shell-quote-argument local-build-directory)) (qcmd (shell-quote-argument command))) (format "cd %s && CFLAGS=-Werror make --silent %s && %s --test --verbose" qbdir qcmd qcmd)) nil "*Test*")) (0 (let ((w (get-buffer-window "*Test*"))) (if w (delete-window w)))) (_ (with-current-buffer "*Test*" (compilation-mode) (cd-absolute build-directory)) (display-buffer "*Test*" '(display-buffer-in-side-window)))))); -*- */
2
2
/*
3
3
 * Mandos password agent - Simple password agent to run Mandos client
4
4
 *
5
 
 * Copyright © 2019-2022 Teddy Hogeborn
6
 
 * Copyright © 2019-2022 Björn Påhlsson
 
5
 * Copyright © 2019-2021 Teddy Hogeborn
 
6
 * Copyright © 2019-2021 Björn Påhlsson
7
7
 * 
8
8
 * This file is part of Mandos.
9
9
 * 
8195
8195
  g_option_context_free(context);
8196
8196
  return should_run_tests != FALSE;
8197
8197
}
8198
 
 
8199
 
/*
8200
 
Local Variables:
8201
 
run-tests:
8202
 
(lambda ()
8203
 
  (if (not (funcall run-tests-in-test-buffer default-directory))
8204
 
      (funcall show-test-buffer-in-test-window)
8205
 
    (funcall remove-test-window)))
8206
 
run-tests-in-test-buffer:
8207
 
(lambda (dir)
8208
 
  (with-current-buffer (get-buffer-create "*Test*")
8209
 
    (setq buffer-read-only nil
8210
 
          default-directory dir)
8211
 
    (erase-buffer)
8212
 
    (compilation-mode))
8213
 
  (let ((process-result
8214
 
         (let ((inhibit-read-only t))
8215
 
           (process-file-shell-command
8216
 
            (funcall get-command-line) nil "*Test*"))))
8217
 
    (and (numberp process-result)
8218
 
         (= process-result 0))))
8219
 
get-command-line:
8220
 
(lambda ()
8221
 
  (let*
8222
 
      ((build-directory
8223
 
        (funcall find-build-directory (buffer-file-name)))
8224
 
       (local-build-directory
8225
 
        (if (fboundp 'file-local-name)
8226
 
            (file-local-name build-directory)
8227
 
          (or (file-remote-p build-directory 'localname)
8228
 
              build-directory)))
8229
 
       (command
8230
 
        (file-relative-name (file-name-sans-extension
8231
 
                             (buffer-file-name)) build-directory))
8232
 
       (qbdir (shell-quote-argument local-build-directory))
8233
 
       (qcmd (shell-quote-argument command)))
8234
 
    (format (concat "cd %s && CFLAGS=-Werror make --silent %s"
8235
 
             " && %s --test --verbose") qbdir qcmd qcmd)))
8236
 
find-build-directory:
8237
 
(lambda (try-directory &optional base-directory)
8238
 
  (let ((base-directory (or base-directory try-directory)))
8239
 
    (cond ((equal try-directory "/") base-directory)
8240
 
          ((file-readable-p
8241
 
            (concat (file-name-as-directory try-directory)
8242
 
                    "Makefile")) try-directory)
8243
 
          ((funcall find-build-directory
8244
 
                    (directory-file-name (file-name-directory
8245
 
                                          try-directory))
8246
 
                    base-directory)))))
8247
 
show-test-buffer-in-test-window:
8248
 
(lambda ()
8249
 
  (when (not (get-buffer-window-list "*Test*"))
8250
 
    (setq next-error-last-buffer (get-buffer "*Test*"))
8251
 
    (let* ((side (if (>= (window-width) 146) 'right 'bottom))
8252
 
           (display-buffer-overriding-action
8253
 
            `((display-buffer-in-side-window) (side . ,side)
8254
 
              (window-height . fit-window-to-buffer)
8255
 
              (window-width . fit-window-to-buffer))))
8256
 
      (display-buffer "*Test*"))))
8257
 
remove-test-window:
8258
 
(lambda ()
8259
 
  (let ((test-window (get-buffer-window "*Test*")))
8260
 
    (if test-window (delete-window test-window))))
8261
 
eval: (add-hook 'after-save-hook run-tests 90 t)
8262
 
End:
8263
 
*/