Add missing '#ifndef NO_DSA'.
[oweals/openssl.git] / apps / passwd.c
index 7ade6e54dec861314b19c02887d50c204622b6e7..ea2b089e24a73762fd027f997f5a34b5ef9e9487 100644 (file)
@@ -44,7 +44,7 @@ static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p,
        char *passwd, BIO *out, int quiet, int table, int reverse,
        size_t pw_maxlen, int usecrypt, int use1, int useapr1);
 
-/* -crypt        - standard Unix password algorithm (default, only choice)
+/* -crypt        - standard Unix password algorithm (default)
  * -1            - MD5-based password algorithm
  * -apr1         - MD5-based password algorithm, Apache variant
  * -salt string  - salt
@@ -81,6 +81,12 @@ int MAIN(int argc, char **argv)
        if (out == NULL)
                goto err;
        BIO_set_fp(out, stdout, BIO_NOCLOSE | BIO_FP_TEXT);
+#ifdef VMS
+       {
+       BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+       out = BIO_push(tmpbio, out);
+       }
+#endif
 
        badopt = 0, opt_done = 0;
        i = 0;
@@ -266,6 +272,7 @@ int MAIN(int argc, char **argv)
                        }
                while (!done);
                }
+       ret = 0;
 
 err:
        ERR_print_errors(bio_err);
@@ -276,7 +283,7 @@ err:
        if (in)
                BIO_free(in);
        if (out)
-               BIO_free(out);
+               BIO_free_all(out);
        EXIT(ret);
        }
 
@@ -309,7 +316,7 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt)
        strncat(out_buf, "$", 1);
        strncat(out_buf, salt, 8);
        assert(strlen(out_buf) <= 6 + 8); /* "$apr1$..salt.." */
-       salt_out = out_buf + 6;
+       salt_out = out_buf + 2 + strlen(magic);
        salt_len = strlen(salt_out);
        assert(salt_len <= 8);