X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=apps%2Fpasswd.c;h=9ca25dd1da811fe44934e5e7cce3d4208973cadf;hb=7ecd974f5f1bb38de6c47c188c8709b86b809245;hp=bb395c35a197907e228b62340230e4907800615f;hpb=20d2186c87dabec56c6da48961a779843724a019;p=oweals%2Fopenssl.git diff --git a/apps/passwd.c b/apps/passwd.c index bb395c35a1..9ca25dd1da 100644 --- a/apps/passwd.c +++ b/apps/passwd.c @@ -19,7 +19,6 @@ # include #endif #ifndef NO_MD5CRYPT_1 -# include # include #endif @@ -79,6 +78,9 @@ int MAIN(int argc, char **argv) if (bio_err == NULL) if ((bio_err=BIO_new(BIO_s_file())) != NULL) BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT); + + if (!load_config(bio_err, NULL)) + goto err; out = BIO_new(BIO_s_file()); if (out == NULL) goto err; @@ -290,7 +292,7 @@ err: if (out) BIO_free_all(out); apps_shutdown(); - EXIT(ret); + OPENSSL_EXIT(ret); } @@ -310,7 +312,8 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt) static char out_buf[6 + 9 + 24 + 2]; /* "$apr1$..salt..$.......md5hash..........\0" */ unsigned char buf[MD5_DIGEST_LENGTH]; char *salt_out; - int n, i; + int n; + unsigned int i; EVP_MD_CTX md,md2; size_t passwd_len, salt_len; @@ -356,13 +359,13 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt) for (i = 0; i < 1000; i++) { EVP_DigestInit_ex(&md2,EVP_md5(), NULL); - EVP_DigestUpdate(&md2, (i & 1) ? (unsigned char *) passwd : buf, + EVP_DigestUpdate(&md2, (i & 1) ? (unsigned const char *) passwd : buf, (i & 1) ? passwd_len : sizeof buf); if (i % 3) EVP_DigestUpdate(&md2, salt_out, salt_len); if (i % 7) EVP_DigestUpdate(&md2, passwd, passwd_len); - EVP_DigestUpdate(&md2, (i & 1) ? buf : (unsigned char *) passwd, + EVP_DigestUpdate(&md2, (i & 1) ? buf : (unsigned const char *) passwd, (i & 1) ? sizeof buf : passwd_len); EVP_DigestFinal_ex(&md2, buf, NULL); } @@ -471,7 +474,8 @@ static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p, if ((strlen(passwd) > pw_maxlen)) { if (!quiet) - BIO_printf(bio_err, "Warning: truncating password to %u characters\n", pw_maxlen); + /* XXX: really we should know how to print a size_t, not cast it */ + BIO_printf(bio_err, "Warning: truncating password to %u characters\n", (unsigned)pw_maxlen); passwd[pw_maxlen] = 0; } assert(strlen(passwd) <= pw_maxlen); @@ -479,7 +483,7 @@ static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p, /* now compute password hash */ #ifndef OPENSSL_NO_DES if (usecrypt) - hash = des_crypt(passwd, *salt_p); + hash = DES_crypt(passwd, *salt_p); #endif #ifndef NO_MD5CRYPT_1 if (use1 || useapr1) @@ -503,6 +507,6 @@ err: int MAIN(int argc, char **argv) { fputs("Program not available.\n", stderr) - EXIT(1); + OPENSSL_EXIT(1); } #endif