]> andersk Git - openssh.git/blobdiff - ssh-add.c
- (tim) [configure.ac] Add AC_REVISION. Add sys/time.h to lastlog.h test
[openssh.git] / ssh-add.c
index 06a52464e034e9e797ff379a77512c099e62d79b..2b01e6f13c91edd145d6ab7c1aba8bcb1b542c4b 100644 (file)
--- a/ssh-add.c
+++ b/ssh-add.c
@@ -35,7 +35,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: ssh-add.c,v 1.70 2004/05/08 00:21:31 djm Exp $");
+RCSID("$OpenBSD: ssh-add.c,v 1.74 2005/11/12 18:37:59 deraadt Exp $");
 
 #include <openssl/evp.h>
 
@@ -145,7 +145,7 @@ add_file(AuthenticationConnection *ac, const char *filename)
                /* clear passphrase since it did not work */
                clear_pass();
                snprintf(msg, sizeof msg, "Enter passphrase for %.200s: ",
-                  comment);
+                   comment);
                for (;;) {
                        pass = read_passphrase(msg, RP_ALLOW_STDIN);
                        if (strcmp(pass, "") == 0) {
@@ -312,6 +312,9 @@ main(int argc, char **argv)
        char *sc_reader_id = NULL;
        int i, ch, deleting = 0, ret = 0;
 
+       /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
+       sanitise_stdfd();
+
        __progname = ssh_get_progname(argv[0]);
        init_rng();
        seed_rng();
@@ -321,7 +324,8 @@ main(int argc, char **argv)
        /* At first, get a connection to the authentication agent. */
        ac = ssh_get_authentication_connection();
        if (ac == NULL) {
-               fprintf(stderr, "Could not open a connection to your authentication agent.\n");
+               fprintf(stderr,
+                   "Could not open a connection to your authentication agent.\n");
                exit(2);
        }
        while ((ch = getopt(argc, argv, "lLcdDxXe:s:t:")) != -1) {
@@ -389,7 +393,7 @@ main(int argc, char **argv)
                        goto done;
                }
 
-               for(i = 0; default_files[i]; i++) {
+               for (i = 0; default_files[i]; i++) {
                        snprintf(buf, sizeof(buf), "%s/%s", pw->pw_dir,
                            default_files[i]);
                        if (stat(buf, &st) < 0)
@@ -402,7 +406,7 @@ main(int argc, char **argv)
                if (count == 0)
                        ret = 1;
        } else {
-               for(i = 0; i < argc; i++) {
+               for (i = 0; i < argc; i++) {
                        if (do_file(ac, deleting, argv[i]) == -1)
                                ret = 1;
                }
This page took 0.129495 seconds and 4 git commands to generate.